id_within_dataset
int64 0
69.7k
| snippet
stringlengths 10
23k
| tokens
sequencelengths 5
4.23k
| nl
stringlengths 15
2.45k
| split_within_dataset
stringclasses 1
value | is_duplicated
bool 2
classes |
---|---|---|---|---|---|
69,390 | public static int[] convert2rgba(IImageLineArray line,PngChunkPLTE pal,PngChunkTRNS trns,int[] buf){
ImageInfo imi=line.getImageInfo();
int nsamples=imi.cols * 4;
if (buf == null || buf.length < nsamples) buf=new int[nsamples];
int maxval=imi.bitDepth == 16 ? (1 << 16) - 1 : 255;
Arrays.fill(buf,maxval);
if (imi.indexed) {
int tlen=trns != null ? trns.getPalletteAlpha().length : 0;
for (int s=0; s < imi.cols; s++) {
int index=line.getElem(s);
pal.getEntryRgb(index,buf,s * 4);
if (index < tlen) {
buf[s * 4 + 3]=trns.getPalletteAlpha()[index];
}
}
}
else if (imi.greyscale) {
int[] unpack=null;
if (imi.bitDepth < 8) unpack=ImageLineHelper.DEPTH_UNPACK[imi.bitDepth];
for (int s=0, i=0, p=0; p < imi.cols; p++) {
buf[s++]=unpack != null ? unpack[line.getElem(i++)] : line.getElem(i++);
buf[s]=buf[s - 1];
s++;
buf[s]=buf[s - 1];
s++;
if (imi.channels == 2) buf[s++]=unpack != null ? unpack[line.getElem(i++)] : line.getElem(i++);
else buf[s++]=maxval;
}
}
else {
for (int s=0, i=0, p=0; p < imi.cols; p++) {
buf[s++]=line.getElem(i++);
buf[s++]=line.getElem(i++);
buf[s++]=line.getElem(i++);
buf[s++]=imi.alpha ? line.getElem(i++) : maxval;
}
}
return buf;
}
| [
"public",
"static",
"int",
"[",
"]",
"convert2rgba",
"(",
"IImageLineArray",
"line",
",",
"PngChunkPLTE",
"pal",
",",
"PngChunkTRNS",
"trns",
",",
"int",
"[",
"]",
"buf",
")",
"{",
"ImageInfo",
"imi",
"=",
"line",
".",
"getImageInfo",
"(",
")",
";",
"int",
"nsamples",
"=",
"imi",
".",
"cols",
"*",
"4",
";",
"if",
"(",
"buf",
"==",
"null",
"||",
"buf",
".",
"length",
"<",
"nsamples",
")",
"buf",
"=",
"new",
"int",
"[",
"nsamples",
"]",
";",
"int",
"maxval",
"=",
"imi",
".",
"bitDepth",
"==",
"16",
"?",
"(",
"1",
"<<",
"16",
")",
"-",
"1",
":",
"255",
";",
"Arrays",
".",
"fill",
"(",
"buf",
",",
"maxval",
")",
";",
"if",
"(",
"imi",
".",
"indexed",
")",
"{",
"int",
"tlen",
"=",
"trns",
"!=",
"null",
"?",
"trns",
".",
"getPalletteAlpha",
"(",
")",
".",
"length",
":",
"0",
";",
"for",
"(",
"int",
"s",
"=",
"0",
";",
"s",
"<",
"imi",
".",
"cols",
";",
"s",
"++",
")",
"{",
"int",
"index",
"=",
"line",
".",
"getElem",
"(",
"s",
")",
";",
"pal",
".",
"getEntryRgb",
"(",
"index",
",",
"buf",
",",
"s",
"*",
"4",
")",
";",
"if",
"(",
"index",
"<",
"tlen",
")",
"{",
"buf",
"[",
"s",
"*",
"4",
"+",
"3",
"]",
"=",
"trns",
".",
"getPalletteAlpha",
"(",
")",
"[",
"index",
"]",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"imi",
".",
"greyscale",
")",
"{",
"int",
"[",
"]",
"unpack",
"=",
"null",
";",
"if",
"(",
"imi",
".",
"bitDepth",
"<",
"8",
")",
"unpack",
"=",
"ImageLineHelper",
".",
"DEPTH_UNPACK",
"[",
"imi",
".",
"bitDepth",
"]",
";",
"for",
"(",
"int",
"s",
"=",
"0",
",",
"i",
"=",
"0",
",",
"p",
"=",
"0",
";",
"p",
"<",
"imi",
".",
"cols",
";",
"p",
"++",
")",
"{",
"buf",
"[",
"s",
"++",
"]",
"=",
"unpack",
"!=",
"null",
"?",
"unpack",
"[",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
"]",
":",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
";",
"buf",
"[",
"s",
"]",
"=",
"buf",
"[",
"s",
"-",
"1",
"]",
";",
"s",
"++",
";",
"buf",
"[",
"s",
"]",
"=",
"buf",
"[",
"s",
"-",
"1",
"]",
";",
"s",
"++",
";",
"if",
"(",
"imi",
".",
"channels",
"==",
"2",
")",
"buf",
"[",
"s",
"++",
"]",
"=",
"unpack",
"!=",
"null",
"?",
"unpack",
"[",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
"]",
":",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
";",
"else",
"buf",
"[",
"s",
"++",
"]",
"=",
"maxval",
";",
"}",
"}",
"else",
"{",
"for",
"(",
"int",
"s",
"=",
"0",
",",
"i",
"=",
"0",
",",
"p",
"=",
"0",
";",
"p",
"<",
"imi",
".",
"cols",
";",
"p",
"++",
")",
"{",
"buf",
"[",
"s",
"++",
"]",
"=",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
";",
"buf",
"[",
"s",
"++",
"]",
"=",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
";",
"buf",
"[",
"s",
"++",
"]",
"=",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
";",
"buf",
"[",
"s",
"++",
"]",
"=",
"imi",
".",
"alpha",
"?",
"line",
".",
"getElem",
"(",
"i",
"++",
")",
":",
"maxval",
";",
"}",
"}",
"return",
"buf",
";",
"}"
] | this is not very efficient , only for tests and troubleshooting
| train | false |
69,391 | protected StringPropertyMatcher(String propertyName,Mode mode,Boolean ignoreCase,String expectedPattern,Function<Issue,String> getActualValue){
super(propertyName);
this.mode=mode;
this.ignoreCase=Objects.requireNonNull(ignoreCase);
this.expectedPattern=safeGetValue(expectedPattern);
this.getActualValue=Objects.requireNonNull(getActualValue);
}
| [
"protected",
"StringPropertyMatcher",
"(",
"String",
"propertyName",
",",
"Mode",
"mode",
",",
"Boolean",
"ignoreCase",
",",
"String",
"expectedPattern",
",",
"Function",
"<",
"Issue",
",",
"String",
">",
"getActualValue",
")",
"{",
"super",
"(",
"propertyName",
")",
";",
"this",
".",
"mode",
"=",
"mode",
";",
"this",
".",
"ignoreCase",
"=",
"Objects",
".",
"requireNonNull",
"(",
"ignoreCase",
")",
";",
"this",
".",
"expectedPattern",
"=",
"safeGetValue",
"(",
"expectedPattern",
")",
";",
"this",
".",
"getActualValue",
"=",
"Objects",
".",
"requireNonNull",
"(",
"getActualValue",
")",
";",
"}"
] | creates a new string property matcher .
| train | false |
69,393 | protected final void afterConsume(Message message){
if (message != null) {
pendingCredit.release();
}
}
| [
"protected",
"final",
"void",
"afterConsume",
"(",
"Message",
"message",
")",
"{",
"if",
"(",
"message",
"!=",
"null",
")",
"{",
"pendingCredit",
".",
"release",
"(",
")",
";",
"}",
"}"
] | to be called after a message is consumed so the flow control of the test kicks in .
| train | false |
69,394 | @Override public boolean eIsSet(int featureID){
switch (featureID) {
case SGenPackage.STRING_LITERAL__VALUE:
return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
}
return super.eIsSet(featureID);
}
| [
"@",
"Override",
"public",
"boolean",
"eIsSet",
"(",
"int",
"featureID",
")",
"{",
"switch",
"(",
"featureID",
")",
"{",
"case",
"SGenPackage",
".",
"STRING_LITERAL__VALUE",
":",
"return",
"VALUE_EDEFAULT",
"==",
"null",
"?",
"value",
"!=",
"null",
":",
"!",
"VALUE_EDEFAULT",
".",
"equals",
"(",
"value",
")",
";",
"}",
"return",
"super",
".",
"eIsSet",
"(",
"featureID",
")",
";",
"}"
] | < ! - - begin - user - doc - - > < ! - - end - user - doc - - >
| train | false |
69,395 | public void state(PrintStream out,String agentContainerId){
JSONObject stateInfo;
if (StringUtils.isEmpty(agentContainerId)) {
stateInfo=getClusterStateInfo();
}
else {
stateInfo=getAgentStateInfo(agentContainerId);
}
if (stateInfo != null) {
out.println(stateInfo.toString(2));
}
else {
throw new MinimesosException("Did not find the cluster or requested container");
}
}
| [
"public",
"void",
"state",
"(",
"PrintStream",
"out",
",",
"String",
"agentContainerId",
")",
"{",
"JSONObject",
"stateInfo",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"agentContainerId",
")",
")",
"{",
"stateInfo",
"=",
"getClusterStateInfo",
"(",
")",
";",
"}",
"else",
"{",
"stateInfo",
"=",
"getAgentStateInfo",
"(",
"agentContainerId",
")",
";",
"}",
"if",
"(",
"stateInfo",
"!=",
"null",
")",
"{",
"out",
".",
"println",
"(",
"stateInfo",
".",
"toString",
"(",
"2",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"MinimesosException",
"(",
"\"Did not find the cluster or requested container\"",
")",
";",
"}",
"}"
] | prints the state of the mesos master or agent
| train | false |
69,396 | @VisibleForTesting protected void addOMADownloadToSharedPrefs(String omaInfo){
Set<String> omaDownloads=getStoredDownloadInfo(PENDING_OMA_DOWNLOADS);
omaDownloads.add(omaInfo);
storeDownloadInfo(PENDING_OMA_DOWNLOADS,omaDownloads);
}
| [
"@",
"VisibleForTesting",
"protected",
"void",
"addOMADownloadToSharedPrefs",
"(",
"String",
"omaInfo",
")",
"{",
"Set",
"<",
"String",
">",
"omaDownloads",
"=",
"getStoredDownloadInfo",
"(",
"PENDING_OMA_DOWNLOADS",
")",
";",
"omaDownloads",
".",
"add",
"(",
"omaInfo",
")",
";",
"storeDownloadInfo",
"(",
"PENDING_OMA_DOWNLOADS",
",",
"omaDownloads",
")",
";",
"}"
] | add oma download info to sharedprefs .
| train | false |
69,397 | void merge(int min,int max){
for (int i=0; i < num; i++) {
if (min >= minRange[i] && max <= maxRange[i]) {
return;
}
else if (min <= minRange[i] && max >= maxRange[i]) {
delete(i);
merge(min,max);
return;
}
else if (min >= minRange[i] && min <= maxRange[i]) {
min=minRange[i];
delete(i);
merge(min,max);
return;
}
else if (max >= minRange[i] && max <= maxRange[i]) {
max=maxRange[i];
delete(i);
merge(min,max);
return;
}
}
if (num >= size) {
size*=2;
int[] newMin=new int[size];
int[] newMax=new int[size];
System.arraycopy(minRange,0,newMin,0,num);
System.arraycopy(maxRange,0,newMax,0,num);
minRange=newMin;
maxRange=newMax;
}
minRange[num]=min;
maxRange[num]=max;
num++;
}
| [
"void",
"merge",
"(",
"int",
"min",
",",
"int",
"max",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"num",
";",
"i",
"++",
")",
"{",
"if",
"(",
"min",
">=",
"minRange",
"[",
"i",
"]",
"&&",
"max",
"<=",
"maxRange",
"[",
"i",
"]",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"min",
"<=",
"minRange",
"[",
"i",
"]",
"&&",
"max",
">=",
"maxRange",
"[",
"i",
"]",
")",
"{",
"delete",
"(",
"i",
")",
";",
"merge",
"(",
"min",
",",
"max",
")",
";",
"return",
";",
"}",
"else",
"if",
"(",
"min",
">=",
"minRange",
"[",
"i",
"]",
"&&",
"min",
"<=",
"maxRange",
"[",
"i",
"]",
")",
"{",
"min",
"=",
"minRange",
"[",
"i",
"]",
";",
"delete",
"(",
"i",
")",
";",
"merge",
"(",
"min",
",",
"max",
")",
";",
"return",
";",
"}",
"else",
"if",
"(",
"max",
">=",
"minRange",
"[",
"i",
"]",
"&&",
"max",
"<=",
"maxRange",
"[",
"i",
"]",
")",
"{",
"max",
"=",
"maxRange",
"[",
"i",
"]",
";",
"delete",
"(",
"i",
")",
";",
"merge",
"(",
"min",
",",
"max",
")",
";",
"return",
";",
"}",
"}",
"if",
"(",
"num",
">=",
"size",
")",
"{",
"size",
"*=",
"2",
";",
"int",
"[",
"]",
"newMin",
"=",
"new",
"int",
"[",
"size",
"]",
";",
"int",
"[",
"]",
"newMax",
"=",
"new",
"int",
"[",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"minRange",
",",
"0",
",",
"newMin",
",",
"0",
",",
"num",
")",
";",
"System",
".",
"arraycopy",
"(",
"maxRange",
",",
"0",
",",
"newMax",
",",
"0",
",",
"num",
")",
";",
"minRange",
"=",
"newMin",
";",
"maxRange",
"=",
"newMax",
";",
"}",
"minRange",
"[",
"num",
"]",
"=",
"min",
";",
"maxRange",
"[",
"num",
"]",
"=",
"max",
";",
"num",
"++",
";",
"}"
] | merges a range into the range list , coalescing ranges if possible .
| train | false |
69,398 | public ParallelAnimator add(Combinable combinable){
combinableList.add(combinable);
return this;
}
| [
"public",
"ParallelAnimator",
"add",
"(",
"Combinable",
"combinable",
")",
"{",
"combinableList",
".",
"add",
"(",
"combinable",
")",
";",
"return",
"this",
";",
"}"
] | this method adds this combinable object to an arraylist .
| train | false |
69,399 | private void printNumber(StringBuffer out,int number,int nDigits){
String s=String.valueOf(number);
for (int i=s.length(); i < nDigits; i++) {
out.append('0');
}
out.append(s);
}
| [
"private",
"void",
"printNumber",
"(",
"StringBuffer",
"out",
",",
"int",
"number",
",",
"int",
"nDigits",
")",
"{",
"String",
"s",
"=",
"String",
".",
"valueOf",
"(",
"number",
")",
";",
"for",
"(",
"int",
"i",
"=",
"s",
".",
"length",
"(",
")",
";",
"i",
"<",
"nDigits",
";",
"i",
"++",
")",
"{",
"out",
".",
"append",
"(",
"'0'",
")",
";",
"}",
"out",
".",
"append",
"(",
"s",
")",
";",
"}"
] | prints an integer as a string .
| train | false |
69,400 | private NamedList rQuery(int expectedDocCount,String query,SolrClient client) throws Exception {
int timeSlept=0;
NamedList res=query(query,client);
while (expectedDocCount != numFound(res) && timeSlept < 30000) {
log.info("Waiting for " + expectedDocCount + " docs");
timeSlept+=100;
Thread.sleep(100);
res=query(query,client);
}
log.info("Waited for {}ms and found {} docs",timeSlept,numFound(res));
return res;
}
| [
"private",
"NamedList",
"rQuery",
"(",
"int",
"expectedDocCount",
",",
"String",
"query",
",",
"SolrClient",
"client",
")",
"throws",
"Exception",
"{",
"int",
"timeSlept",
"=",
"0",
";",
"NamedList",
"res",
"=",
"query",
"(",
"query",
",",
"client",
")",
";",
"while",
"(",
"expectedDocCount",
"!=",
"numFound",
"(",
"res",
")",
"&&",
"timeSlept",
"<",
"30000",
")",
"{",
"log",
".",
"info",
"(",
"\"Waiting for \"",
"+",
"expectedDocCount",
"+",
"\" docs\"",
")",
";",
"timeSlept",
"+=",
"100",
";",
"Thread",
".",
"sleep",
"(",
"100",
")",
";",
"res",
"=",
"query",
"(",
"query",
",",
"client",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Waited for {}ms and found {} docs\"",
",",
"timeSlept",
",",
"numFound",
"(",
"res",
")",
")",
";",
"return",
"res",
";",
"}"
] | will sleep up to 30 seconds , looking for expecteddoccount
| train | false |
69,401 | protected double dist_of_scale(int s){
return Math.pow(m_Base,s);
}
| [
"protected",
"double",
"dist_of_scale",
"(",
"int",
"s",
")",
"{",
"return",
"Math",
".",
"pow",
"(",
"m_Base",
",",
"s",
")",
";",
"}"
] | returns the distance / value of a given scale / level . i . e . the value of base ^ i ( e . g . 2 ^ i ) .
| train | false |
69,402 | boolean addPrinEntry(PolicyEntry pe,PolicyParser.PrincipalEntry newPrin,int index){
PolicyParser.GrantEntry grantEntry=pe.getGrantEntry();
if (grantEntry.contains(newPrin) == true) return false;
LinkedList<PolicyParser.PrincipalEntry> prinList=grantEntry.principals;
if (index != -1) prinList.set(index,newPrin);
else prinList.add(newPrin);
modified=true;
return true;
}
| [
"boolean",
"addPrinEntry",
"(",
"PolicyEntry",
"pe",
",",
"PolicyParser",
".",
"PrincipalEntry",
"newPrin",
",",
"int",
"index",
")",
"{",
"PolicyParser",
".",
"GrantEntry",
"grantEntry",
"=",
"pe",
".",
"getGrantEntry",
"(",
")",
";",
"if",
"(",
"grantEntry",
".",
"contains",
"(",
"newPrin",
")",
"==",
"true",
")",
"return",
"false",
";",
"LinkedList",
"<",
"PolicyParser",
".",
"PrincipalEntry",
">",
"prinList",
"=",
"grantEntry",
".",
"principals",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"prinList",
".",
"set",
"(",
"index",
",",
"newPrin",
")",
";",
"else",
"prinList",
".",
"add",
"(",
"newPrin",
")",
";",
"modified",
"=",
"true",
";",
"return",
"true",
";",
"}"
] | add a principal entry to an existing policyentry at the specified index . a principal entry consists of a class , and name . if the principal already exists , it is not added again .
| train | false |
69,404 | public static int multiplyOpacities256(int opacity1,int opacity2){
double op1=opacity1 / 255.0;
double op2=opacity2 / 255.0;
double resultOpacity=op1 * op2;
return (int)Math.round(resultOpacity * 255.0);
}
| [
"public",
"static",
"int",
"multiplyOpacities256",
"(",
"int",
"opacity1",
",",
"int",
"opacity2",
")",
"{",
"double",
"op1",
"=",
"opacity1",
"/",
"255.0",
";",
"double",
"op2",
"=",
"opacity2",
"/",
"255.0",
";",
"double",
"resultOpacity",
"=",
"op1",
"*",
"op2",
";",
"return",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"resultOpacity",
"*",
"255.0",
")",
";",
"}"
] | multiplies two opacities with range [ 0 , 255 ] . first maps both values to [ 0 , 1 ] , then calculates the product and maps the result back to [ 0 , 255 ] .
| train | false |
69,405 | public static String normalize(CharSequence src,java.text.Normalizer.Form form,int option){
return NormalizerBase.normalize(src.toString(),form,option);
}
| [
"public",
"static",
"String",
"normalize",
"(",
"CharSequence",
"src",
",",
"java",
".",
"text",
".",
"Normalizer",
".",
"Form",
"form",
",",
"int",
"option",
")",
"{",
"return",
"NormalizerBase",
".",
"normalize",
"(",
"src",
".",
"toString",
"(",
")",
",",
"form",
",",
"option",
")",
";",
"}"
] | normalize a sequence of char values . the sequence will be normalized according to the specified normalization from .
| train | false |
69,407 | public static RunStats delegateGetBucketForLong(int buckets) throws Exception {
Long startTime=System.currentTimeMillis();
PrimaryIndexBucketGeneratorImpl ibg=new PrimaryIndexBucketGeneratorImpl(FieldDataType.LONG,buckets);
PrimaryIndexBucketLocatorImpl locator=new PrimaryIndexBucketLocatorImpl(null,null,null,null,null,null,null,ibg.generateBuckets(),null);
logger.debug("test to getBucket for the bucket distribution on Long values");
HashMap<Long,List<Object>> hm=new HashMap<>();
SummaryStatistics stats=new SummaryStatistics();
Random r=new Random();
for (int i=-200000; i < 200000; i++) {
Long randomLong=Long.MIN_VALUE + r.nextLong() * Long.MAX_VALUE;
Long bucketId=locator.getBucket(randomLong,FieldDataType.LONG);
TestUtils.calculate(hm,stats,bucketId,randomLong);
}
Long runTime=System.currentTimeMillis() - startTime;
RunStats runStats=new RunStats("BucketForLong",FieldDataType.LONG,runTime,stats,hm);
logger.debug(runStats.toString());
return runStats;
}
| [
"public",
"static",
"RunStats",
"delegateGetBucketForLong",
"(",
"int",
"buckets",
")",
"throws",
"Exception",
"{",
"Long",
"startTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"PrimaryIndexBucketGeneratorImpl",
"ibg",
"=",
"new",
"PrimaryIndexBucketGeneratorImpl",
"(",
"FieldDataType",
".",
"LONG",
",",
"buckets",
")",
";",
"PrimaryIndexBucketLocatorImpl",
"locator",
"=",
"new",
"PrimaryIndexBucketLocatorImpl",
"(",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
",",
"ibg",
".",
"generateBuckets",
"(",
")",
",",
"null",
")",
";",
"logger",
".",
"debug",
"(",
"\"test to getBucket for the bucket distribution on Long values\"",
")",
";",
"HashMap",
"<",
"Long",
",",
"List",
"<",
"Object",
">",
">",
"hm",
"=",
"new",
"HashMap",
"<",
">",
"(",
")",
";",
"SummaryStatistics",
"stats",
"=",
"new",
"SummaryStatistics",
"(",
")",
";",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"-",
"200000",
";",
"i",
"<",
"200000",
";",
"i",
"++",
")",
"{",
"Long",
"randomLong",
"=",
"Long",
".",
"MIN_VALUE",
"+",
"r",
".",
"nextLong",
"(",
")",
"*",
"Long",
".",
"MAX_VALUE",
";",
"Long",
"bucketId",
"=",
"locator",
".",
"getBucket",
"(",
"randomLong",
",",
"FieldDataType",
".",
"LONG",
")",
";",
"TestUtils",
".",
"calculate",
"(",
"hm",
",",
"stats",
",",
"bucketId",
",",
"randomLong",
")",
";",
"}",
"Long",
"runTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"startTime",
";",
"RunStats",
"runStats",
"=",
"new",
"RunStats",
"(",
"\"BucketForLong\"",
",",
"FieldDataType",
".",
"LONG",
",",
"runTime",
",",
"stats",
",",
"hm",
")",
";",
"logger",
".",
"debug",
"(",
"runStats",
".",
"toString",
"(",
")",
")",
";",
"return",
"runStats",
";",
"}"
] | test to check the bucket distribution for the long values
| train | false |
69,409 | @Override public void dragEnter(DragSourceDragEvent dsde){
}
| [
"@",
"Override",
"public",
"void",
"dragEnter",
"(",
"DragSourceDragEvent",
"dsde",
")",
"{",
"}"
] | as the hotspot enters a platform dependent drop site
| train | false |
69,410 | public static Date add(final Date inputDate,final int addType,final int addAmount){
final Calendar calendar=Calendar.getInstance();
calendar.setTime(inputDate);
calendar.add(addType,addAmount);
return calendar.getTime();
}
| [
"public",
"static",
"Date",
"add",
"(",
"final",
"Date",
"inputDate",
",",
"final",
"int",
"addType",
",",
"final",
"int",
"addAmount",
")",
"{",
"final",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"setTime",
"(",
"inputDate",
")",
";",
"calendar",
".",
"add",
"(",
"addType",
",",
"addAmount",
")",
";",
"return",
"calendar",
".",
"getTime",
"(",
")",
";",
"}"
] | adds given number of days / months / years to given date and returns the resulting date .
| train | false |
69,411 | public long length() throws IOException {
LOG.trace("enter length()");
if (lengthOfData() < 0) {
return -1;
}
final ByteArrayOutputStream overhead=new ByteArrayOutputStream();
sendStart(overhead);
sendDispositionHeader(overhead);
sendContentTypeHeader(overhead);
sendTransferEncodingHeader(overhead);
sendEndOfHeader(overhead);
sendEnd(overhead);
return overhead.size() + lengthOfData();
}
| [
"public",
"long",
"length",
"(",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"trace",
"(",
"\"enter length()\"",
")",
";",
"if",
"(",
"lengthOfData",
"(",
")",
"<",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"final",
"ByteArrayOutputStream",
"overhead",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"sendStart",
"(",
"overhead",
")",
";",
"sendDispositionHeader",
"(",
"overhead",
")",
";",
"sendContentTypeHeader",
"(",
"overhead",
")",
";",
"sendTransferEncodingHeader",
"(",
"overhead",
")",
";",
"sendEndOfHeader",
"(",
"overhead",
")",
";",
"sendEnd",
"(",
"overhead",
")",
";",
"return",
"overhead",
".",
"size",
"(",
")",
"+",
"lengthOfData",
"(",
")",
";",
"}"
] | return the full length of all the data . if you override this method make sure to override # send ( outputstream ) as well
| train | false |
69,412 | public static String replace(String original,String oldSubstring,String newSubstring,boolean all){
StringBuffer b=new StringBuffer(original);
replace(b,oldSubstring,newSubstring,all);
return b.toString();
}
| [
"public",
"static",
"String",
"replace",
"(",
"String",
"original",
",",
"String",
"oldSubstring",
",",
"String",
"newSubstring",
",",
"boolean",
"all",
")",
"{",
"StringBuffer",
"b",
"=",
"new",
"StringBuffer",
"(",
"original",
")",
";",
"replace",
"(",
"b",
",",
"oldSubstring",
",",
"newSubstring",
",",
"all",
")",
";",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}"
] | returns original with occurrences of oldsubstring replaced by newsubstring . set all to true to replace all occurrences , or false to replace the first occurrence only .
| train | false |
69,413 | @Override public boolean equals(final Object o){
if (o == this) {
return true;
}
if (o == null || o.getClass() != getClass()) {
return false;
}
final MethodKey other=(MethodKey)o;
final Class<?>[] otherArgs=other._argumentTypes;
final int argCount=_argumentTypes.length;
if (otherArgs.length != argCount) {
return false;
}
for (int i=0; i < argCount; ++i) {
if (otherArgs[i] != _argumentTypes[i]) {
return false;
}
}
return _name.equals(other._name);
}
| [
"@",
"Override",
"public",
"boolean",
"equals",
"(",
"final",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"==",
"this",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"o",
"==",
"null",
"||",
"o",
".",
"getClass",
"(",
")",
"!=",
"getClass",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"MethodKey",
"other",
"=",
"(",
"MethodKey",
")",
"o",
";",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"otherArgs",
"=",
"other",
".",
"_argumentTypes",
";",
"final",
"int",
"argCount",
"=",
"_argumentTypes",
".",
"length",
";",
"if",
"(",
"otherArgs",
".",
"length",
"!=",
"argCount",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"argCount",
";",
"++",
"i",
")",
"{",
"if",
"(",
"otherArgs",
"[",
"i",
"]",
"!=",
"_argumentTypes",
"[",
"i",
"]",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"_name",
".",
"equals",
"(",
"other",
".",
"_name",
")",
";",
"}"
] | equality means name is the same and argument type erasures as well .
| train | false |
69,415 | @Override public DPState computeFinal(HGNode tailNode,int i,int j,SourcePath sourcePath,Sentence sentence,Accumulator acc){
return new KenLMState();
}
| [
"@",
"Override",
"public",
"DPState",
"computeFinal",
"(",
"HGNode",
"tailNode",
",",
"int",
"i",
",",
"int",
"j",
",",
"SourcePath",
"sourcePath",
",",
"Sentence",
"sentence",
",",
"Accumulator",
"acc",
")",
"{",
"return",
"new",
"KenLMState",
"(",
")",
";",
"}"
] | this function differs from regular transitions because we incorporate the cost of incomplete left - hand ngrams , as well as including the start - and end - of - sentence markers ( if they were requested when the object was created ) . kenlm already includes the prefix probabilities ( of shorter n - grams on the left - hand side ) , so there ' s nothing that needs to be done .
| train | false |
69,416 | public static boolean isGerund(final String word){
if ((word.length() > 4) && word.endsWith("ing")) {
for (int i=word.length() - 3; --i >= 0; ) {
if (isVowel(word.charAt(i))) {
return true;
}
}
}
return false;
}
| [
"public",
"static",
"boolean",
"isGerund",
"(",
"final",
"String",
"word",
")",
"{",
"if",
"(",
"(",
"word",
".",
"length",
"(",
")",
">",
"4",
")",
"&&",
"word",
".",
"endsWith",
"(",
"\"ing\"",
")",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"word",
".",
"length",
"(",
")",
"-",
"3",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"if",
"(",
"isVowel",
"(",
"word",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] | check the given verb for gerund form , e . g . " doing " .
| train | false |
69,417 | public void print(String text){
String[] lines=text.split("\n");
for ( String line : lines) {
view.print(line.isEmpty() ? " " : line);
}
view.scrollBottom();
for ( ActionDelegate actionDelegate : actionDelegates) {
actionDelegate.onConsoleOutput(this);
}
}
| [
"public",
"void",
"print",
"(",
"String",
"text",
")",
"{",
"String",
"[",
"]",
"lines",
"=",
"text",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"for",
"(",
"String",
"line",
":",
"lines",
")",
"{",
"view",
".",
"print",
"(",
"line",
".",
"isEmpty",
"(",
")",
"?",
"\" \"",
":",
"line",
")",
";",
"}",
"view",
".",
"scrollBottom",
"(",
")",
";",
"for",
"(",
"ActionDelegate",
"actionDelegate",
":",
"actionDelegates",
")",
"{",
"actionDelegate",
".",
"onConsoleOutput",
"(",
"this",
")",
";",
"}",
"}"
] | print text on console .
| train | false |
69,419 | protected void preprocessType(Type t){
typePreprocessor.visit(t);
}
| [
"protected",
"void",
"preprocessType",
"(",
"Type",
"t",
")",
"{",
"typePreprocessor",
".",
"visit",
"(",
"t",
")",
";",
"}"
] | preprocess a given type looking for ( i ) additional info ( where clauses ) to be added to the main diagnostic ( ii ) names to be compacted .
| train | false |
69,420 | public void buildLegs(ArrayList<GeoPoint> waypoints){
mLegs=new ArrayList<RoadLeg>();
int firstNodeIndex=0;
int w=waypoints.size();
int n=mNodes.size();
for (int i=1; i < w - 1; i++) {
GeoPoint waypoint=waypoints.get(i);
double distanceMin=-1.0;
int nodeIndexMin=-1;
for (int j=firstNodeIndex; j < n; j++) {
GeoPoint roadPoint=mNodes.get(j).mLocation;
double dSquared=distanceLLSquared(roadPoint,waypoint);
if (nodeIndexMin == -1 || dSquared < distanceMin) {
distanceMin=dSquared;
nodeIndexMin=j;
}
}
RoadLeg leg=new RoadLeg(firstNodeIndex,nodeIndexMin,mNodes);
mLegs.add(leg);
firstNodeIndex=nodeIndexMin + 1;
}
RoadLeg lastLeg=new RoadLeg(firstNodeIndex,n - 1,mNodes);
mLegs.add(lastLeg);
}
| [
"public",
"void",
"buildLegs",
"(",
"ArrayList",
"<",
"GeoPoint",
">",
"waypoints",
")",
"{",
"mLegs",
"=",
"new",
"ArrayList",
"<",
"RoadLeg",
">",
"(",
")",
";",
"int",
"firstNodeIndex",
"=",
"0",
";",
"int",
"w",
"=",
"waypoints",
".",
"size",
"(",
")",
";",
"int",
"n",
"=",
"mNodes",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"w",
"-",
"1",
";",
"i",
"++",
")",
"{",
"GeoPoint",
"waypoint",
"=",
"waypoints",
".",
"get",
"(",
"i",
")",
";",
"double",
"distanceMin",
"=",
"-",
"1.0",
";",
"int",
"nodeIndexMin",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"j",
"=",
"firstNodeIndex",
";",
"j",
"<",
"n",
";",
"j",
"++",
")",
"{",
"GeoPoint",
"roadPoint",
"=",
"mNodes",
".",
"get",
"(",
"j",
")",
".",
"mLocation",
";",
"double",
"dSquared",
"=",
"distanceLLSquared",
"(",
"roadPoint",
",",
"waypoint",
")",
";",
"if",
"(",
"nodeIndexMin",
"==",
"-",
"1",
"||",
"dSquared",
"<",
"distanceMin",
")",
"{",
"distanceMin",
"=",
"dSquared",
";",
"nodeIndexMin",
"=",
"j",
";",
"}",
"}",
"RoadLeg",
"leg",
"=",
"new",
"RoadLeg",
"(",
"firstNodeIndex",
",",
"nodeIndexMin",
",",
"mNodes",
")",
";",
"mLegs",
".",
"add",
"(",
"leg",
")",
";",
"firstNodeIndex",
"=",
"nodeIndexMin",
"+",
"1",
";",
"}",
"RoadLeg",
"lastLeg",
"=",
"new",
"RoadLeg",
"(",
"firstNodeIndex",
",",
"n",
"-",
"1",
",",
"mNodes",
")",
";",
"mLegs",
".",
"add",
"(",
"lastLeg",
")",
";",
"}"
] | as mapquest and osrm doesn ' t provide legs information , we have to rebuild it , using the waypoints and the road nodes . < br > note that mapquest legs fit well with waypoints , as there is a " dedicated " node for each waypoint . but osrm legs are not precise , as there is no node " dedicated " to waypoints .
| train | false |
69,421 | public static final GCodeFlavor tasteFlavor(Resources res,int resId) throws IOException, NotFoundException {
BufferedInputStream buffer=new BufferedInputStream(res.openRawResource(resId));
GCodeFlavor ret=tasteFlavor(buffer);
buffer.close();
return ret;
}
| [
"public",
"static",
"final",
"GCodeFlavor",
"tasteFlavor",
"(",
"Resources",
"res",
",",
"int",
"resId",
")",
"throws",
"IOException",
",",
"NotFoundException",
"{",
"BufferedInputStream",
"buffer",
"=",
"new",
"BufferedInputStream",
"(",
"res",
".",
"openRawResource",
"(",
"resId",
")",
")",
";",
"GCodeFlavor",
"ret",
"=",
"tasteFlavor",
"(",
"buffer",
")",
";",
"buffer",
".",
"close",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | determine the content generator ( i . e . slic3r , skeinforge ) for the given resource .
| train | false |
69,422 | protected void openProposalPopup(){
openProposalPopup(false);
}
| [
"protected",
"void",
"openProposalPopup",
"(",
")",
"{",
"openProposalPopup",
"(",
"false",
")",
";",
"}"
] | open the proposal popup and display the proposals provided by the proposal provider . this method returns immediately . that is , it does not wait for a proposal to be selected . this method is used by subclasses to explicitly invoke the opening of the popup . if there are no proposals to show , the popup will not open and a beep will be sounded .
| train | false |
69,424 | static void pauseThread(long duration){
try {
Thread.sleep(duration);
}
catch ( Exception e) {
_log.warn("Exception while trying to sleep",e);
}
}
| [
"static",
"void",
"pauseThread",
"(",
"long",
"duration",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"duration",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"_log",
".",
"warn",
"(",
"\"Exception while trying to sleep\"",
",",
"e",
")",
";",
"}",
"}"
] | simple puts the thread to sleep for the passed duration .
| train | false |
69,425 | protected static List<ContentType> createMatchingXmlList(ContentType... types){
ArrayList<ContentType> matchingTypes=new ArrayList<ContentType>(types.length + XML_CONTENT_TYPES.size());
for ( ContentType contentType : types) {
matchingTypes.add(contentType);
}
matchingTypes.addAll(XML_CONTENT_TYPES);
return Collections.unmodifiableList(matchingTypes);
}
| [
"protected",
"static",
"List",
"<",
"ContentType",
">",
"createMatchingXmlList",
"(",
"ContentType",
"...",
"types",
")",
"{",
"ArrayList",
"<",
"ContentType",
">",
"matchingTypes",
"=",
"new",
"ArrayList",
"<",
"ContentType",
">",
"(",
"types",
".",
"length",
"+",
"XML_CONTENT_TYPES",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"ContentType",
"contentType",
":",
"types",
")",
"{",
"matchingTypes",
".",
"add",
"(",
"contentType",
")",
";",
"}",
"matchingTypes",
".",
"addAll",
"(",
"XML_CONTENT_TYPES",
")",
";",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"matchingTypes",
")",
";",
"}"
] | creates a new matching contenttype set that contains all of the basic xml types plus an additional list of types .
| train | false |
69,426 | protected void writeShape(SWFShape shape) throws IOException {
for (Iterator it=elements.iterator(); it.hasNext(); ) {
Object el=it.next();
if (el instanceof Shape.ColorFill) {
Shape.ColorFill fill=(Shape.ColorFill)el;
shape.defineFillStyle(fill.getColor());
}
else if (el instanceof Shape.ImageFill) {
Shape.ImageFill fill=(Shape.ImageFill)el;
Symbol image=fill.getImage();
int imgId=(image != null) ? image.getId() : 65535;
shape.defineFillStyle(imgId,fill.getTransform(),fill.isClipped());
}
else if (el instanceof Shape.GradientFill) {
Shape.GradientFill fill=(Shape.GradientFill)el;
shape.defineFillStyle(fill.getTransform(),fill.getRatios(),fill.getColors(),fill.isRadial());
}
else if (el instanceof Shape.LineStyle) {
Shape.LineStyle style=(Shape.LineStyle)el;
shape.defineLineStyle((int)(style.getWidth() * SWFConstants.TWIPS),style.getColor());
}
else if (el instanceof Shape.SetLeftFillStyle) {
Shape.SetLeftFillStyle style=(Shape.SetLeftFillStyle)el;
shape.setFillStyle0(style.getStyleIndex());
}
else if (el instanceof Shape.SetRightFillStyle) {
Shape.SetRightFillStyle style=(Shape.SetRightFillStyle)el;
shape.setFillStyle1(style.getStyleIndex());
}
else if (el instanceof Shape.SetLineStyle) {
Shape.SetLineStyle style=(Shape.SetLineStyle)el;
shape.setLineStyle(style.getStyleIndex());
}
else {
writeVector(shape,el);
}
}
shape.done();
}
| [
"protected",
"void",
"writeShape",
"(",
"SWFShape",
"shape",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"elements",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Object",
"el",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"ColorFill",
")",
"{",
"Shape",
".",
"ColorFill",
"fill",
"=",
"(",
"Shape",
".",
"ColorFill",
")",
"el",
";",
"shape",
".",
"defineFillStyle",
"(",
"fill",
".",
"getColor",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"ImageFill",
")",
"{",
"Shape",
".",
"ImageFill",
"fill",
"=",
"(",
"Shape",
".",
"ImageFill",
")",
"el",
";",
"Symbol",
"image",
"=",
"fill",
".",
"getImage",
"(",
")",
";",
"int",
"imgId",
"=",
"(",
"image",
"!=",
"null",
")",
"?",
"image",
".",
"getId",
"(",
")",
":",
"65535",
";",
"shape",
".",
"defineFillStyle",
"(",
"imgId",
",",
"fill",
".",
"getTransform",
"(",
")",
",",
"fill",
".",
"isClipped",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"GradientFill",
")",
"{",
"Shape",
".",
"GradientFill",
"fill",
"=",
"(",
"Shape",
".",
"GradientFill",
")",
"el",
";",
"shape",
".",
"defineFillStyle",
"(",
"fill",
".",
"getTransform",
"(",
")",
",",
"fill",
".",
"getRatios",
"(",
")",
",",
"fill",
".",
"getColors",
"(",
")",
",",
"fill",
".",
"isRadial",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"LineStyle",
")",
"{",
"Shape",
".",
"LineStyle",
"style",
"=",
"(",
"Shape",
".",
"LineStyle",
")",
"el",
";",
"shape",
".",
"defineLineStyle",
"(",
"(",
"int",
")",
"(",
"style",
".",
"getWidth",
"(",
")",
"*",
"SWFConstants",
".",
"TWIPS",
")",
",",
"style",
".",
"getColor",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"SetLeftFillStyle",
")",
"{",
"Shape",
".",
"SetLeftFillStyle",
"style",
"=",
"(",
"Shape",
".",
"SetLeftFillStyle",
")",
"el",
";",
"shape",
".",
"setFillStyle0",
"(",
"style",
".",
"getStyleIndex",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"SetRightFillStyle",
")",
"{",
"Shape",
".",
"SetRightFillStyle",
"style",
"=",
"(",
"Shape",
".",
"SetRightFillStyle",
")",
"el",
";",
"shape",
".",
"setFillStyle1",
"(",
"style",
".",
"getStyleIndex",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"el",
"instanceof",
"Shape",
".",
"SetLineStyle",
")",
"{",
"Shape",
".",
"SetLineStyle",
"style",
"=",
"(",
"Shape",
".",
"SetLineStyle",
")",
"el",
";",
"shape",
".",
"setLineStyle",
"(",
"style",
".",
"getStyleIndex",
"(",
")",
")",
";",
"}",
"else",
"{",
"writeVector",
"(",
"shape",
",",
"el",
")",
";",
"}",
"}",
"shape",
".",
"done",
"(",
")",
";",
"}"
] | description of the method
| train | false |
69,427 | public DataSet(List<T> yVals,String label){
this.mLabel=label;
this.mYVals=yVals;
if (mYVals == null) mYVals=new ArrayList<T>();
mColors=new ArrayList<Integer>();
mColors.add(Color.rgb(140,234,255));
calcMinMax(mLastStart,mLastEnd);
calcYValueSum();
}
| [
"public",
"DataSet",
"(",
"List",
"<",
"T",
">",
"yVals",
",",
"String",
"label",
")",
"{",
"this",
".",
"mLabel",
"=",
"label",
";",
"this",
".",
"mYVals",
"=",
"yVals",
";",
"if",
"(",
"mYVals",
"==",
"null",
")",
"mYVals",
"=",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
";",
"mColors",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"mColors",
".",
"add",
"(",
"Color",
".",
"rgb",
"(",
"140",
",",
"234",
",",
"255",
")",
")",
";",
"calcMinMax",
"(",
"mLastStart",
",",
"mLastEnd",
")",
";",
"calcYValueSum",
"(",
")",
";",
"}"
] | creates a new dataset object with the given values it represents . also , a label that describes the dataset can be specified . the label can also be used to retrieve the dataset from a chartdata object .
| train | false |
69,428 | protected List<? extends Itemset> frequentItemsets(List<? extends Itemset> candidates,Relation<BitVector> relation,int needed,DBIDs ids,ArrayModifiableDBIDs survivors,int length){
if (candidates.isEmpty()) {
return Collections.emptyList();
}
Itemset first=candidates.get(0);
if (candidates.size() > length * length * length* 100 && first instanceof SparseItemset) {
@SuppressWarnings("unchecked") List<SparseItemset> sparsecand=(List<SparseItemset>)candidates;
return frequentItemsetsSparse(sparsecand,relation,needed,ids,survivors,length);
}
for (DBIDIter iditer=ids.iter(); iditer.valid(); iditer.advance()) {
BitVector bv=relation.get(iditer);
int lives=0;
for ( Itemset candidate : candidates) {
if (candidate.containedIn(bv)) {
candidate.increaseSupport();
++lives;
}
}
if (lives > length) {
survivors.add(iditer);
}
}
List<Itemset> frequent=new ArrayList<>(candidates.size());
for (Iterator<? extends Itemset> iter=candidates.iterator(); iter.hasNext(); ) {
final Itemset candidate=iter.next();
if (candidate.getSupport() >= needed) {
frequent.add(candidate);
}
}
return frequent;
}
| [
"protected",
"List",
"<",
"?",
"extends",
"Itemset",
">",
"frequentItemsets",
"(",
"List",
"<",
"?",
"extends",
"Itemset",
">",
"candidates",
",",
"Relation",
"<",
"BitVector",
">",
"relation",
",",
"int",
"needed",
",",
"DBIDs",
"ids",
",",
"ArrayModifiableDBIDs",
"survivors",
",",
"int",
"length",
")",
"{",
"if",
"(",
"candidates",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"Itemset",
"first",
"=",
"candidates",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"candidates",
".",
"size",
"(",
")",
">",
"length",
"*",
"length",
"*",
"length",
"*",
"100",
"&&",
"first",
"instanceof",
"SparseItemset",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"List",
"<",
"SparseItemset",
">",
"sparsecand",
"=",
"(",
"List",
"<",
"SparseItemset",
">",
")",
"candidates",
";",
"return",
"frequentItemsetsSparse",
"(",
"sparsecand",
",",
"relation",
",",
"needed",
",",
"ids",
",",
"survivors",
",",
"length",
")",
";",
"}",
"for",
"(",
"DBIDIter",
"iditer",
"=",
"ids",
".",
"iter",
"(",
")",
";",
"iditer",
".",
"valid",
"(",
")",
";",
"iditer",
".",
"advance",
"(",
")",
")",
"{",
"BitVector",
"bv",
"=",
"relation",
".",
"get",
"(",
"iditer",
")",
";",
"int",
"lives",
"=",
"0",
";",
"for",
"(",
"Itemset",
"candidate",
":",
"candidates",
")",
"{",
"if",
"(",
"candidate",
".",
"containedIn",
"(",
"bv",
")",
")",
"{",
"candidate",
".",
"increaseSupport",
"(",
")",
";",
"++",
"lives",
";",
"}",
"}",
"if",
"(",
"lives",
">",
"length",
")",
"{",
"survivors",
".",
"add",
"(",
"iditer",
")",
";",
"}",
"}",
"List",
"<",
"Itemset",
">",
"frequent",
"=",
"new",
"ArrayList",
"<",
">",
"(",
"candidates",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Iterator",
"<",
"?",
"extends",
"Itemset",
">",
"iter",
"=",
"candidates",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"final",
"Itemset",
"candidate",
"=",
"iter",
".",
"next",
"(",
")",
";",
"if",
"(",
"candidate",
".",
"getSupport",
"(",
")",
">=",
"needed",
")",
"{",
"frequent",
".",
"add",
"(",
"candidate",
")",
";",
"}",
"}",
"return",
"frequent",
";",
"}"
] | returns the frequent bitsets out of the given bitsets with respect to the given database .
| train | true |
69,429 | void closeConnection() throws SQLException {
conn.close();
stat=null;
conn=null;
}
| [
"void",
"closeConnection",
"(",
")",
"throws",
"SQLException",
"{",
"conn",
".",
"close",
"(",
")",
";",
"stat",
"=",
"null",
";",
"conn",
"=",
"null",
";",
"}"
] | close the database connection .
| train | false |
69,430 | public static boolean isMimeTypeVideo(String mimeType){
if (mimeType.equals(Const.ContentTypes.VIDEO_MP4)) {
return true;
}
return false;
}
| [
"public",
"static",
"boolean",
"isMimeTypeVideo",
"(",
"String",
"mimeType",
")",
"{",
"if",
"(",
"mimeType",
".",
"equals",
"(",
"Const",
".",
"ContentTypes",
".",
"VIDEO_MP4",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | return if mime type is video
| train | false |
69,431 | public void add(DimensionalNode dn){
if (inProgress) {
throw new ConcurrentModificationException("Can't add point while iterator in progress");
}
nodes.add(dn);
}
| [
"public",
"void",
"add",
"(",
"DimensionalNode",
"dn",
")",
"{",
"if",
"(",
"inProgress",
")",
"{",
"throw",
"new",
"ConcurrentModificationException",
"(",
"\"Can't add point while iterator in progress\"",
")",
";",
"}",
"nodes",
".",
"add",
"(",
"dn",
")",
";",
"}"
] | add subtree rooted at given node to the result set .
| train | false |
69,433 | public Status createStatus(){
Status s=new Status();
statuses.add(s);
return s;
}
| [
"public",
"Status",
"createStatus",
"(",
")",
"{",
"Status",
"s",
"=",
"new",
"Status",
"(",
")",
";",
"statuses",
".",
"add",
"(",
"s",
")",
";",
"return",
"s",
";",
"}"
] | creates a new status .
| train | false |
69,434 | private void emitPrimCast(Wrapper from,Wrapper to){
if (from == to) {
return;
}
if (from.isSubwordOrInt()) {
emitI2X(to);
}
else {
if (to.isSubwordOrInt()) {
emitX2I(from);
if (to.bitWidth() < 32) {
emitI2X(to);
}
}
else {
boolean error=false;
switch (from) {
case LONG:
switch (to) {
case FLOAT:
mv.visitInsn(Opcodes.L2F);
break;
case DOUBLE:
mv.visitInsn(Opcodes.L2D);
break;
default :
error=true;
break;
}
break;
case FLOAT:
switch (to) {
case LONG:
mv.visitInsn(Opcodes.F2L);
break;
case DOUBLE:
mv.visitInsn(Opcodes.F2D);
break;
default :
error=true;
break;
}
break;
case DOUBLE:
switch (to) {
case LONG:
mv.visitInsn(Opcodes.D2L);
break;
case FLOAT:
mv.visitInsn(Opcodes.D2F);
break;
default :
error=true;
break;
}
break;
default :
error=true;
break;
}
if (error) {
throw new IllegalStateException("unhandled prim cast: " + from + "2"+ to);
}
}
}
}
| [
"private",
"void",
"emitPrimCast",
"(",
"Wrapper",
"from",
",",
"Wrapper",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"to",
")",
"{",
"return",
";",
"}",
"if",
"(",
"from",
".",
"isSubwordOrInt",
"(",
")",
")",
"{",
"emitI2X",
"(",
"to",
")",
";",
"}",
"else",
"{",
"if",
"(",
"to",
".",
"isSubwordOrInt",
"(",
")",
")",
"{",
"emitX2I",
"(",
"from",
")",
";",
"if",
"(",
"to",
".",
"bitWidth",
"(",
")",
"<",
"32",
")",
"{",
"emitI2X",
"(",
"to",
")",
";",
"}",
"}",
"else",
"{",
"boolean",
"error",
"=",
"false",
";",
"switch",
"(",
"from",
")",
"{",
"case",
"LONG",
":",
"switch",
"(",
"to",
")",
"{",
"case",
"FLOAT",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"L2F",
")",
";",
"break",
";",
"case",
"DOUBLE",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"L2D",
")",
";",
"break",
";",
"default",
":",
"error",
"=",
"true",
";",
"break",
";",
"}",
"break",
";",
"case",
"FLOAT",
":",
"switch",
"(",
"to",
")",
"{",
"case",
"LONG",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"F2L",
")",
";",
"break",
";",
"case",
"DOUBLE",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"F2D",
")",
";",
"break",
";",
"default",
":",
"error",
"=",
"true",
";",
"break",
";",
"}",
"break",
";",
"case",
"DOUBLE",
":",
"switch",
"(",
"to",
")",
"{",
"case",
"LONG",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"D2L",
")",
";",
"break",
";",
"case",
"FLOAT",
":",
"mv",
".",
"visitInsn",
"(",
"Opcodes",
".",
"D2F",
")",
";",
"break",
";",
"default",
":",
"error",
"=",
"true",
";",
"break",
";",
"}",
"break",
";",
"default",
":",
"error",
"=",
"true",
";",
"break",
";",
"}",
"if",
"(",
"error",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"unhandled prim cast: \"",
"+",
"from",
"+",
"\"2\"",
"+",
"to",
")",
";",
"}",
"}",
"}",
"}"
] | emit a type conversion bytecode casting from " from " to " to " .
| train | false |
69,435 | @Override public void onIncomingChatRequest(IncomingChatRequestEvent event) throws Exception {
ReceiveChat chat=event.accept();
String line;
while ((line=chat.readLine()) != null) if (line.equalsIgnoreCase("done")) {
chat.close();
break;
}
else {
int lineLength=line.length();
chat.sendLine("Line '" + line + "' contains "+ lineLength+ " characters");
}
}
| [
"@",
"Override",
"public",
"void",
"onIncomingChatRequest",
"(",
"IncomingChatRequestEvent",
"event",
")",
"throws",
"Exception",
"{",
"ReceiveChat",
"chat",
"=",
"event",
".",
"accept",
"(",
")",
";",
"String",
"line",
";",
"while",
"(",
"(",
"line",
"=",
"chat",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"if",
"(",
"line",
".",
"equalsIgnoreCase",
"(",
"\"done\"",
")",
")",
"{",
"chat",
".",
"close",
"(",
")",
";",
"break",
";",
"}",
"else",
"{",
"int",
"lineLength",
"=",
"line",
".",
"length",
"(",
")",
";",
"chat",
".",
"sendLine",
"(",
"\"Line '\"",
"+",
"line",
"+",
"\"' contains \"",
"+",
"lineLength",
"+",
"\" characters\"",
")",
";",
"}",
"}"
] | this basic example shows how to handle incoming dcc chat requests . it basically repeats what the user said and says how many characters are in their message
| train | false |
69,436 | private boolean checkForTrustedIdentity(final Certificate cert){
return false;
}
| [
"private",
"boolean",
"checkForTrustedIdentity",
"(",
"final",
"Certificate",
"cert",
")",
"{",
"return",
"false",
";",
"}"
] | checks public key . if it is marked as trusted in the identity database , add it to the policy with the allpermission .
| train | false |
69,437 | @Nullable protected static List<RaveError> mergeErrors(@Nullable List<RaveError> e1,@Nullable List<RaveError> e2){
if (e1 == null || e1.isEmpty()) {
return e2;
}
if (e2 == null || e2.isEmpty()) {
return e1;
}
e1.addAll(e2);
return e1;
}
| [
"@",
"Nullable",
"protected",
"static",
"List",
"<",
"RaveError",
">",
"mergeErrors",
"(",
"@",
"Nullable",
"List",
"<",
"RaveError",
">",
"e1",
",",
"@",
"Nullable",
"List",
"<",
"RaveError",
">",
"e2",
")",
"{",
"if",
"(",
"e1",
"==",
"null",
"||",
"e1",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"e2",
";",
"}",
"if",
"(",
"e2",
"==",
"null",
"||",
"e2",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"e1",
";",
"}",
"e1",
".",
"addAll",
"(",
"e2",
")",
";",
"return",
"e1",
";",
"}"
] | takes two raveerror lists and merges them into one .
| train | false |
69,439 | @VisibleForTesting protected HttpURLConnection createConnection() throws RequestFailureException {
try {
URL url=new URL(mGenerator.getServerUrl());
HttpURLConnection connection=(HttpURLConnection)url.openConnection();
connection.setConnectTimeout(MS_CONNECTION_TIMEOUT);
connection.setReadTimeout(MS_CONNECTION_TIMEOUT);
return connection;
}
catch ( MalformedURLException e) {
throw new RequestFailureException("Caught a malformed URL exception.",e);
}
catch ( IOException e) {
throw new RequestFailureException("Failed to open connection to URL",e);
}
}
| [
"@",
"VisibleForTesting",
"protected",
"HttpURLConnection",
"createConnection",
"(",
")",
"throws",
"RequestFailureException",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"mGenerator",
".",
"getServerUrl",
"(",
")",
")",
";",
"HttpURLConnection",
"connection",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"connection",
".",
"setConnectTimeout",
"(",
"MS_CONNECTION_TIMEOUT",
")",
";",
"connection",
".",
"setReadTimeout",
"(",
"MS_CONNECTION_TIMEOUT",
")",
";",
"return",
"connection",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"throw",
"new",
"RequestFailureException",
"(",
"\"Caught a malformed URL exception.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RequestFailureException",
"(",
"\"Failed to open connection to URL\"",
",",
"e",
")",
";",
"}",
"}"
] | returns a httpurlconnection to the server .
| train | false |
69,440 | public static Object[][] formObjectArray(double[][] data){
Object[][] object=new Double[data.length][data[0].length];
for (int i=0; i < object.length; i++) {
for (int j=0; j < object[i].length; j++) {
object[i][j]=new Double(data[i][j]);
}
}
return object;
}
| [
"public",
"static",
"Object",
"[",
"]",
"[",
"]",
"formObjectArray",
"(",
"double",
"[",
"]",
"[",
"]",
"data",
")",
"{",
"Object",
"[",
"]",
"[",
"]",
"object",
"=",
"new",
"Double",
"[",
"data",
".",
"length",
"]",
"[",
"data",
"[",
"0",
"]",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"object",
".",
"length",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"object",
"[",
"i",
"]",
".",
"length",
";",
"j",
"++",
")",
"{",
"object",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"new",
"Double",
"(",
"data",
"[",
"i",
"]",
"[",
"j",
"]",
")",
";",
"}",
"}",
"return",
"object",
";",
"}"
] | creates an object array from an array of doubles .
| train | false |
69,441 | public Request(String... permissions){
this(false,permissions);
}
| [
"public",
"Request",
"(",
"String",
"...",
"permissions",
")",
"{",
"this",
"(",
"false",
",",
"permissions",
")",
";",
"}"
] | constructs a new request .
| train | false |
69,444 | public static List<String> bytesToStringList(byte[] bytes){
List<String> lines=new ArrayList<String>();
if (bytes == null) {
return lines;
}
BufferedReader r=null;
try {
r=new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes),"UTF-8"));
}
catch ( UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
try {
try {
for (String line=r.readLine(); line != null; line=r.readLine()) {
lines.add(line);
}
}
finally {
r.close();
}
}
catch ( IOException e) {
throw new RuntimeException(e);
}
return lines;
}
| [
"public",
"static",
"List",
"<",
"String",
">",
"bytesToStringList",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"List",
"<",
"String",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"return",
"lines",
";",
"}",
"BufferedReader",
"r",
"=",
"null",
";",
"try",
"{",
"r",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"ByteArrayInputStream",
"(",
"bytes",
")",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"try",
"{",
"try",
"{",
"for",
"(",
"String",
"line",
"=",
"r",
".",
"readLine",
"(",
")",
";",
"line",
"!=",
"null",
";",
"line",
"=",
"r",
".",
"readLine",
"(",
")",
")",
"{",
"lines",
".",
"add",
"(",
"line",
")",
";",
"}",
"}",
"finally",
"{",
"r",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"return",
"lines",
";",
"}"
] | convert an array of bytes into a list of strings using utf - 8 . a line is considered to be terminated by any one of a line feed ( ' \ n ' ) , a carriage return ( ' \ r ' ) , or a carriage return followed immediately by a linefeed . < p / > can be used to parse the output of
| train | false |
69,445 | public void disconnect(){
if (protocol == PROTOCOL_HTTP) return;
try {
if (socket != null) {
if (!socket.isClosed()) {
socket.close();
}
}
}
catch ( IOException e) {
LogUtils.LOGE(TAG,"Error while closing socket",e);
}
finally {
socket=null;
}
}
| [
"public",
"void",
"disconnect",
"(",
")",
"{",
"if",
"(",
"protocol",
"==",
"PROTOCOL_HTTP",
")",
"return",
";",
"try",
"{",
"if",
"(",
"socket",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"socket",
".",
"isClosed",
"(",
")",
")",
"{",
"socket",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LogUtils",
".",
"LOGE",
"(",
"TAG",
",",
"\"Error while closing socket\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"socket",
"=",
"null",
";",
"}",
"}"
] | cleans up used resources . this method should always be called if the protocol used is tcp , so we can shutdown gracefully
| train | false |
69,446 | public Object readMessage() throws IOException, FormatErrorException {
while (true) {
fillBuffer(HDRLEN);
long pos=position();
int s1=buffer.get() & 0xFF;
int s2=buffer.get() & 0xFF;
int msgSize=s1 + (256 * s2);
int msgType=buffer.get() & 0xFF;
try {
fillBuffer(msgSize);
}
catch ( EOFException e) {
errors.add(new FormatErrorException(pos,"Unexpected end of file"));
throw e;
}
Object msg;
switch (msgType) {
case MESSAGE_TYPE_DATA:
s1=buffer.get() & 0xFF;
s2=buffer.get() & 0xFF;
int msgID=s1 + (256 * s2);
Subscription subscription=null;
if (msgID < messageSubscriptions.size()) subscription=messageSubscriptions.get(msgID);
if (subscription == null) {
position(pos);
errors.add(new FormatErrorException(pos,"Unknown DATA subscription ID: " + msgID));
buffer.position(buffer.position() + msgSize - 1);
continue;
}
msg=new MessageData(subscription.format,buffer,subscription.multiID);
break;
case MESSAGE_TYPE_INFO:
msg=new MessageInfo(buffer);
break;
case MESSAGE_TYPE_PARAMETER:
msg=new MessageParameter(buffer);
break;
case MESSAGE_TYPE_FORMAT:
msg=new MessageFormat(buffer,msgSize);
break;
case MESSAGE_TYPE_ADD_LOGGED_MSG:
msg=new MessageAddLogged(buffer,msgSize);
break;
case MESSAGE_TYPE_DROPOUT:
msg=new MessageDropout(buffer);
break;
case MESSAGE_TYPE_LOG:
msg=new MessageLog(buffer,msgSize);
break;
case MESSAGE_TYPE_REMOVE_LOGGED_MSG:
case MESSAGE_TYPE_SYNC:
buffer.position(buffer.position() + msgSize);
continue;
default :
buffer.position(buffer.position() + msgSize);
errors.add(new FormatErrorException(pos,"Unknown message type: " + msgType));
continue;
}
int sizeParsed=(int)(position() - pos - HDRLEN);
if (sizeParsed != msgSize) {
errors.add(new FormatErrorException(pos,"Message size mismatch, parsed: " + sizeParsed + ", msg size: "+ msgSize));
buffer.position(buffer.position() + msgSize - sizeParsed);
}
return msg;
}
}
| [
"public",
"Object",
"readMessage",
"(",
")",
"throws",
"IOException",
",",
"FormatErrorException",
"{",
"while",
"(",
"true",
")",
"{",
"fillBuffer",
"(",
"HDRLEN",
")",
";",
"long",
"pos",
"=",
"position",
"(",
")",
";",
"int",
"s1",
"=",
"buffer",
".",
"get",
"(",
")",
"&",
"0xFF",
";",
"int",
"s2",
"=",
"buffer",
".",
"get",
"(",
")",
"&",
"0xFF",
";",
"int",
"msgSize",
"=",
"s1",
"+",
"(",
"256",
"*",
"s2",
")",
";",
"int",
"msgType",
"=",
"buffer",
".",
"get",
"(",
")",
"&",
"0xFF",
";",
"try",
"{",
"fillBuffer",
"(",
"msgSize",
")",
";",
"}",
"catch",
"(",
"EOFException",
"e",
")",
"{",
"errors",
".",
"add",
"(",
"new",
"FormatErrorException",
"(",
"pos",
",",
"\"Unexpected end of file\"",
")",
")",
";",
"throw",
"e",
";",
"}",
"Object",
"msg",
";",
"switch",
"(",
"msgType",
")",
"{",
"case",
"MESSAGE_TYPE_DATA",
":",
"s1",
"=",
"buffer",
".",
"get",
"(",
")",
"&",
"0xFF",
";",
"s2",
"=",
"buffer",
".",
"get",
"(",
")",
"&",
"0xFF",
";",
"int",
"msgID",
"=",
"s1",
"+",
"(",
"256",
"*",
"s2",
")",
";",
"Subscription",
"subscription",
"=",
"null",
";",
"if",
"(",
"msgID",
"<",
"messageSubscriptions",
".",
"size",
"(",
")",
")",
"subscription",
"=",
"messageSubscriptions",
".",
"get",
"(",
"msgID",
")",
";",
"if",
"(",
"subscription",
"==",
"null",
")",
"{",
"position",
"(",
"pos",
")",
";",
"errors",
".",
"add",
"(",
"new",
"FormatErrorException",
"(",
"pos",
",",
"\"Unknown DATA subscription ID: \"",
"+",
"msgID",
")",
")",
";",
"buffer",
".",
"position",
"(",
"buffer",
".",
"position",
"(",
")",
"+",
"msgSize",
"-",
"1",
")",
";",
"continue",
";",
"}",
"msg",
"=",
"new",
"MessageData",
"(",
"subscription",
".",
"format",
",",
"buffer",
",",
"subscription",
".",
"multiID",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_INFO",
":",
"msg",
"=",
"new",
"MessageInfo",
"(",
"buffer",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_PARAMETER",
":",
"msg",
"=",
"new",
"MessageParameter",
"(",
"buffer",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_FORMAT",
":",
"msg",
"=",
"new",
"MessageFormat",
"(",
"buffer",
",",
"msgSize",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_ADD_LOGGED_MSG",
":",
"msg",
"=",
"new",
"MessageAddLogged",
"(",
"buffer",
",",
"msgSize",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_DROPOUT",
":",
"msg",
"=",
"new",
"MessageDropout",
"(",
"buffer",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_LOG",
":",
"msg",
"=",
"new",
"MessageLog",
"(",
"buffer",
",",
"msgSize",
")",
";",
"break",
";",
"case",
"MESSAGE_TYPE_REMOVE_LOGGED_MSG",
":",
"case",
"MESSAGE_TYPE_SYNC",
":",
"buffer",
".",
"position",
"(",
"buffer",
".",
"position",
"(",
")",
"+",
"msgSize",
")",
";",
"continue",
";",
"default",
":",
"buffer",
".",
"position",
"(",
"buffer",
".",
"position",
"(",
")",
"+",
"msgSize",
")",
";",
"errors",
".",
"add",
"(",
"new",
"FormatErrorException",
"(",
"pos",
",",
"\"Unknown message type: \"",
"+",
"msgType",
")",
")",
";",
"continue",
";",
"}",
"int",
"sizeParsed",
"=",
"(",
"int",
")",
"(",
"position",
"(",
")",
"-",
"pos",
"-",
"HDRLEN",
")",
";",
"if",
"(",
"sizeParsed",
"!=",
"msgSize",
")",
"{",
"errors",
".",
"add",
"(",
"new",
"FormatErrorException",
"(",
"pos",
",",
"\"Message size mismatch, parsed: \"",
"+",
"sizeParsed",
"+",
"\", msg size: \"",
"+",
"msgSize",
")",
")",
";",
"buffer",
".",
"position",
"(",
"buffer",
".",
"position",
"(",
")",
"+",
"msgSize",
"-",
"sizeParsed",
")",
";",
"}",
"return",
"msg",
";",
"}",
"}"
] | read next message from log
| train | false |
69,447 | public boolean isFinal(){
return Modifier.isFinal(flags);
}
| [
"public",
"boolean",
"isFinal",
"(",
")",
"{",
"return",
"Modifier",
".",
"isFinal",
"(",
"flags",
")",
";",
"}"
] | utility method to query the modifier flags of this member .
| train | false |
69,450 | private void releaseWaitLatch(){
waitLatch.countDown();
}
| [
"private",
"void",
"releaseWaitLatch",
"(",
")",
"{",
"waitLatch",
".",
"countDown",
"(",
")",
";",
"}"
] | count down wait latch .
| train | false |
69,451 | protected Probe(String name){
this.name=name;
start=System.nanoTime();
log("Probe created at " + new Date());
}
| [
"protected",
"Probe",
"(",
"String",
"name",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"start",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"log",
"(",
"\"Probe created at \"",
"+",
"new",
"Date",
"(",
")",
")",
";",
"}"
] | create a new probe and log that it started .
| train | false |
69,452 | public static boolean isValidObjectName(@Nullable String name){
if (name == null || name.isEmpty()) {
return false;
}
boolean validName=false;
for (int i=0; i < name.length(); i++) {
if (Character.isLetterOrDigit(name.charAt(i))) {
validName=true;
break;
}
}
return validName;
}
| [
"public",
"static",
"boolean",
"isValidObjectName",
"(",
"@",
"Nullable",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"boolean",
"validName",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"name",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isLetterOrDigit",
"(",
"name",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"validName",
"=",
"true",
";",
"break",
";",
"}",
"}",
"return",
"validName",
";",
"}"
] | checks that object has valid object name . some db objects have dummy names ( like " " or " . " ) - we won ' t use them for certain purposes .
| train | false |
69,454 | public AlignerTrainer(){
this(false,false);
}
| [
"public",
"AlignerTrainer",
"(",
")",
"{",
"this",
"(",
"false",
",",
"false",
")",
";",
"}"
] | new alignertrainer for pairs of different symbol sets with no optional info .
| train | false |
69,455 | private static TargetProcessThread parseThreadInformation(final Node node) throws MessageParserException {
final long id=Long.valueOf(getAttribute(node,"threadId"));
final ThreadState state=convertThreadState(Integer.valueOf(getAttribute(node,"threadState")));
return new TargetProcessThread(id,state);
}
| [
"private",
"static",
"TargetProcessThread",
"parseThreadInformation",
"(",
"final",
"Node",
"node",
")",
"throws",
"MessageParserException",
"{",
"final",
"long",
"id",
"=",
"Long",
".",
"valueOf",
"(",
"getAttribute",
"(",
"node",
",",
"\"threadId\"",
")",
")",
";",
"final",
"ThreadState",
"state",
"=",
"convertThreadState",
"(",
"Integer",
".",
"valueOf",
"(",
"getAttribute",
"(",
"node",
",",
"\"threadState\"",
")",
")",
")",
";",
"return",
"new",
"TargetProcessThread",
"(",
"id",
",",
"state",
")",
";",
"}"
] | parses the thread xml node .
| train | false |
69,456 | protected void loadMembers(LinearLayout membersVerticalLayout,final ArrayList<RelationMemberDescription> members){
membersVerticalLayout.removeAllViews();
if (members != null && members.size() > 0) {
for (int i=0; i < members.size(); i++) {
RelationMemberDescription current=members.get(i);
insertNewMember(membersVerticalLayout,i + "",current,-1,Connected.NOT,false);
}
}
}
| [
"protected",
"void",
"loadMembers",
"(",
"LinearLayout",
"membersVerticalLayout",
",",
"final",
"ArrayList",
"<",
"RelationMemberDescription",
">",
"members",
")",
"{",
"membersVerticalLayout",
".",
"removeAllViews",
"(",
")",
";",
"if",
"(",
"members",
"!=",
"null",
"&&",
"members",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"members",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"RelationMemberDescription",
"current",
"=",
"members",
".",
"get",
"(",
"i",
")",
";",
"insertNewMember",
"(",
"membersVerticalLayout",
",",
"i",
"+",
"\"\"",
",",
"current",
",",
"-",
"1",
",",
"Connected",
".",
"NOT",
",",
"false",
")",
";",
"}",
"}",
"}"
] | creates edits from a sortedmap containing tags ( as sequential key - value pairs )
| train | false |
69,457 | private static void deleteHours(ContentResolver cr,String restaurantId){
String sel=OpenHours.RESTAURANT_ID + " = ?";
String[] args={restaurantId};
cr.delete(OpenHours.CONTENT_URI,sel,args);
cr.delete(OpenDays.CONTENT_URI,sel,args);
}
| [
"private",
"static",
"void",
"deleteHours",
"(",
"ContentResolver",
"cr",
",",
"String",
"restaurantId",
")",
"{",
"String",
"sel",
"=",
"OpenHours",
".",
"RESTAURANT_ID",
"+",
"\" = ?\"",
";",
"String",
"[",
"]",
"args",
"=",
"{",
"restaurantId",
"}",
";",
"cr",
".",
"delete",
"(",
"OpenHours",
".",
"CONTENT_URI",
",",
"sel",
",",
"args",
")",
";",
"cr",
".",
"delete",
"(",
"OpenDays",
".",
"CONTENT_URI",
",",
"sel",
",",
"args",
")",
";",
"}"
] | delete the restaurant ' s open hours and open days .
| train | false |
69,460 | public void overrideButton(String button,boolean override){
LOG.i("App","WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!");
if (button.equals("volumeup")) {
webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_UP,override);
}
else if (button.equals("volumedown")) {
webView.setButtonPlumbedToJs(KeyEvent.KEYCODE_VOLUME_DOWN,override);
}
}
| [
"public",
"void",
"overrideButton",
"(",
"String",
"button",
",",
"boolean",
"override",
")",
"{",
"LOG",
".",
"i",
"(",
"\"App\"",
",",
"\"WARNING: Volume Button Default Behavior will be overridden. The volume event will be fired!\"",
")",
";",
"if",
"(",
"button",
".",
"equals",
"(",
"\"volumeup\"",
")",
")",
"{",
"webView",
".",
"setButtonPlumbedToJs",
"(",
"KeyEvent",
".",
"KEYCODE_VOLUME_UP",
",",
"override",
")",
";",
"}",
"else",
"if",
"(",
"button",
".",
"equals",
"(",
"\"volumedown\"",
")",
")",
"{",
"webView",
".",
"setButtonPlumbedToJs",
"(",
"KeyEvent",
".",
"KEYCODE_VOLUME_DOWN",
",",
"override",
")",
";",
"}",
"}"
] | override the default behavior of the android volume buttons . if overridden , when the volume button is pressed , the " volume [ up | down ] button " javascript event will be fired .
| train | false |
69,461 | public void addAll(Collection<Mention> collection){
mentions.addAll(collection);
collection.forEach(null);
}
| [
"public",
"void",
"addAll",
"(",
"Collection",
"<",
"Mention",
">",
"collection",
")",
"{",
"mentions",
".",
"addAll",
"(",
"collection",
")",
";",
"collection",
".",
"forEach",
"(",
"null",
")",
";",
"}"
] | adds all mentions in collection to this cluster
| train | false |
69,462 | @Override public void onAction(final Player player,final RPAction action){
rewriteCommandLine(action);
String actionStr=action.get("action");
if (actionStr == null) {
logger.warn("missing action attribute in RPAction " + action);
return;
}
if (actionStr.equals("offer_trade")) {
Entity entity=EntityHelper.entityFromTargetName(action.get("target"),player);
if ((entity == null) || (!(entity instanceof Player))) {
return;
}
player.offerTrade((Player)entity);
}
else if (actionStr.equals("lock")) {
player.lockTrade();
}
else if (actionStr.equals("unlock")) {
player.unlockTradeItemOffer();
}
else if (actionStr.equals("deal")) {
player.dealTrade();
}
else if (actionStr.equals("cancel")) {
player.cancelTrade();
}
}
| [
"@",
"Override",
"public",
"void",
"onAction",
"(",
"final",
"Player",
"player",
",",
"final",
"RPAction",
"action",
")",
"{",
"rewriteCommandLine",
"(",
"action",
")",
";",
"String",
"actionStr",
"=",
"action",
".",
"get",
"(",
"\"action\"",
")",
";",
"if",
"(",
"actionStr",
"==",
"null",
")",
"{",
"logger",
".",
"warn",
"(",
"\"missing action attribute in RPAction \"",
"+",
"action",
")",
";",
"return",
";",
"}",
"if",
"(",
"actionStr",
".",
"equals",
"(",
"\"offer_trade\"",
")",
")",
"{",
"Entity",
"entity",
"=",
"EntityHelper",
".",
"entityFromTargetName",
"(",
"action",
".",
"get",
"(",
"\"target\"",
")",
",",
"player",
")",
";",
"if",
"(",
"(",
"entity",
"==",
"null",
")",
"||",
"(",
"!",
"(",
"entity",
"instanceof",
"Player",
")",
")",
")",
"{",
"return",
";",
"}",
"player",
".",
"offerTrade",
"(",
"(",
"Player",
")",
"entity",
")",
";",
"}",
"else",
"if",
"(",
"actionStr",
".",
"equals",
"(",
"\"lock\"",
")",
")",
"{",
"player",
".",
"lockTrade",
"(",
")",
";",
"}",
"else",
"if",
"(",
"actionStr",
".",
"equals",
"(",
"\"unlock\"",
")",
")",
"{",
"player",
".",
"unlockTradeItemOffer",
"(",
")",
";",
"}",
"else",
"if",
"(",
"actionStr",
".",
"equals",
"(",
"\"deal\"",
")",
")",
"{",
"player",
".",
"dealTrade",
"(",
")",
";",
"}",
"else",
"if",
"(",
"actionStr",
".",
"equals",
"(",
"\"cancel\"",
")",
")",
"{",
"player",
".",
"cancelTrade",
"(",
")",
";",
"}",
"}"
] | processes the requested action .
| train | false |
69,463 | protected int fill(byte[] buffer,int offset,int count) throws IOException {
if (inputStream == null) return -1;
try {
return inputStream.read(buffer,offset,count);
}
catch ( IOException ex) {
throw new IOException(ex);
}
}
| [
"protected",
"int",
"fill",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"count",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inputStream",
"==",
"null",
")",
"return",
"-",
"1",
";",
"try",
"{",
"return",
"inputStream",
".",
"read",
"(",
"buffer",
",",
"offset",
",",
"count",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"ex",
")",
";",
"}",
"}"
] | fills the buffer with more bytes . can be overridden to fill the bytes from a source other than the inputstream .
| train | true |
69,465 | public static Double evaluateToDouble(String expression,Map<String,Object> vars){
Object result=evaluate(expression,vars);
if (result == null) {
throw new IllegalStateException("Result must be not null");
}
if (!isNumeric(String.valueOf(result))) {
throw new IllegalStateException("Result must be numeric: " + result + ", "+ result.getClass());
}
return Double.valueOf(String.valueOf(result));
}
| [
"public",
"static",
"Double",
"evaluateToDouble",
"(",
"String",
"expression",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"vars",
")",
"{",
"Object",
"result",
"=",
"evaluate",
"(",
"expression",
",",
"vars",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Result must be not null\"",
")",
";",
"}",
"if",
"(",
"!",
"isNumeric",
"(",
"String",
".",
"valueOf",
"(",
"result",
")",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Result must be numeric: \"",
"+",
"result",
"+",
"\", \"",
"+",
"result",
".",
"getClass",
"(",
")",
")",
";",
"}",
"return",
"Double",
".",
"valueOf",
"(",
"String",
".",
"valueOf",
"(",
"result",
")",
")",
";",
"}"
] | evaluates the given expression . the given variables will be substituted in the expression . converts the result of the evaluation to a double . throws an illegalstateexception if the result could not be converted to a double
| train | false |
69,467 | public void error(SourceLocator srcLctr,String msg,Object args[],Exception e) throws TransformerException {
String formattedMsg=XSLMessages.createMessage(msg,args);
ErrorListener errHandler=m_transformer.getErrorListener();
if (null != errHandler) errHandler.fatalError(new TransformerException(formattedMsg,srcLctr));
else throw new TransformerException(formattedMsg,srcLctr);
}
| [
"public",
"void",
"error",
"(",
"SourceLocator",
"srcLctr",
",",
"String",
"msg",
",",
"Object",
"args",
"[",
"]",
",",
"Exception",
"e",
")",
"throws",
"TransformerException",
"{",
"String",
"formattedMsg",
"=",
"XSLMessages",
".",
"createMessage",
"(",
"msg",
",",
"args",
")",
";",
"ErrorListener",
"errHandler",
"=",
"m_transformer",
".",
"getErrorListener",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"errHandler",
")",
"errHandler",
".",
"fatalError",
"(",
"new",
"TransformerException",
"(",
"formattedMsg",
",",
"srcLctr",
")",
")",
";",
"else",
"throw",
"new",
"TransformerException",
"(",
"formattedMsg",
",",
"srcLctr",
")",
";",
"}"
] | tell the user of an error , and probably throw an exception .
| train | true |
69,468 | public static void generateReturnCode(String returnType,CodeVisitor cv){
if (returnType.equals("V")) {
cv.visitInsn(POP);
cv.visitInsn(RETURN);
}
else if (isPrimitive(returnType)) {
int opcode=IRETURN;
String type;
String meth;
if (returnType.equals("B")) {
type="java/lang/Byte";
meth="byteValue";
}
else if (returnType.equals("I")) {
type="java/lang/Integer";
meth="intValue";
}
else if (returnType.equals("Z")) {
type="java/lang/Boolean";
meth="booleanValue";
}
else if (returnType.equals("D")) {
opcode=DRETURN;
type="java/lang/Double";
meth="doubleValue";
}
else if (returnType.equals("F")) {
opcode=FRETURN;
type="java/lang/Float";
meth="floatValue";
}
else if (returnType.equals("J")) {
opcode=LRETURN;
type="java/lang/Long";
meth="longValue";
}
else if (returnType.equals("C")) {
type="java/lang/Character";
meth="charValue";
}
else {
type="java/lang/Short";
meth="shortValue";
}
String desc=returnType;
cv.visitTypeInsn(CHECKCAST,type);
cv.visitMethodInsn(INVOKEVIRTUAL,type,meth,"()" + desc);
cv.visitInsn(opcode);
}
else {
cv.visitTypeInsn(CHECKCAST,descriptorToClassName(returnType));
cv.visitInsn(ARETURN);
}
}
| [
"public",
"static",
"void",
"generateReturnCode",
"(",
"String",
"returnType",
",",
"CodeVisitor",
"cv",
")",
"{",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"V\"",
")",
")",
"{",
"cv",
".",
"visitInsn",
"(",
"POP",
")",
";",
"cv",
".",
"visitInsn",
"(",
"RETURN",
")",
";",
"}",
"else",
"if",
"(",
"isPrimitive",
"(",
"returnType",
")",
")",
"{",
"int",
"opcode",
"=",
"IRETURN",
";",
"String",
"type",
";",
"String",
"meth",
";",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"B\"",
")",
")",
"{",
"type",
"=",
"\"java/lang/Byte\"",
";",
"meth",
"=",
"\"byteValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"I\"",
")",
")",
"{",
"type",
"=",
"\"java/lang/Integer\"",
";",
"meth",
"=",
"\"intValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"Z\"",
")",
")",
"{",
"type",
"=",
"\"java/lang/Boolean\"",
";",
"meth",
"=",
"\"booleanValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"D\"",
")",
")",
"{",
"opcode",
"=",
"DRETURN",
";",
"type",
"=",
"\"java/lang/Double\"",
";",
"meth",
"=",
"\"doubleValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"F\"",
")",
")",
"{",
"opcode",
"=",
"FRETURN",
";",
"type",
"=",
"\"java/lang/Float\"",
";",
"meth",
"=",
"\"floatValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"J\"",
")",
")",
"{",
"opcode",
"=",
"LRETURN",
";",
"type",
"=",
"\"java/lang/Long\"",
";",
"meth",
"=",
"\"longValue\"",
";",
"}",
"else",
"if",
"(",
"returnType",
".",
"equals",
"(",
"\"C\"",
")",
")",
"{",
"type",
"=",
"\"java/lang/Character\"",
";",
"meth",
"=",
"\"charValue\"",
";",
"}",
"else",
"{",
"type",
"=",
"\"java/lang/Short\"",
";",
"meth",
"=",
"\"shortValue\"",
";",
"}",
"String",
"desc",
"=",
"returnType",
";",
"cv",
".",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"type",
")",
";",
"cv",
".",
"visitMethodInsn",
"(",
"INVOKEVIRTUAL",
",",
"type",
",",
"meth",
",",
"\"()\"",
"+",
"desc",
")",
";",
"cv",
".",
"visitInsn",
"(",
"opcode",
")",
";",
"}",
"else",
"{",
"cv",
".",
"visitTypeInsn",
"(",
"CHECKCAST",
",",
"descriptorToClassName",
"(",
"returnType",
")",
")",
";",
"cv",
".",
"visitInsn",
"(",
"ARETURN",
")",
";",
"}",
"}"
] | generates the code to unreify the result of the given method . for a method " int m ( int i , string s ) " , this code is the bytecode corresponding to the " ( ( integer ) . . . ) . intvalue ( ) " expression .
| train | false |
69,473 | public final boolean exit(){
if (!inQueue) return false;
inQueue=false;
return cancelScheduledTimeout(this);
}
| [
"public",
"final",
"boolean",
"exit",
"(",
")",
"{",
"if",
"(",
"!",
"inQueue",
")",
"return",
"false",
";",
"inQueue",
"=",
"false",
";",
"return",
"cancelScheduledTimeout",
"(",
"this",
")",
";",
"}"
] | returns true if the timeout occurred .
| train | false |
69,474 | public void deserialize(Column<CompositeColumnName> column,Object obj){
if (_encrypt && _parentType.getEncryptionProvider() != null) {
deserializeEncryptedColumn(column,obj,_parentType.getEncryptionProvider());
}
else {
ColumnValue.setField(column,_property,obj);
}
}
| [
"public",
"void",
"deserialize",
"(",
"Column",
"<",
"CompositeColumnName",
">",
"column",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"_encrypt",
"&&",
"_parentType",
".",
"getEncryptionProvider",
"(",
")",
"!=",
"null",
")",
"{",
"deserializeEncryptedColumn",
"(",
"column",
",",
"obj",
",",
"_parentType",
".",
"getEncryptionProvider",
"(",
")",
")",
";",
"}",
"else",
"{",
"ColumnValue",
".",
"setField",
"(",
"column",
",",
"_property",
",",
"obj",
")",
";",
"}",
"}"
] | deserializes column into object field
| train | false |
69,475 | private void heapifyDown(Comparable<Object> cur){
final int stop=size >>> 1;
int twopos=0;
while (twopos < stop) {
int bestchild=(twopos << 1) + 1;
Comparable<Object> best=twoheap[bestchild];
final int right=bestchild + 1;
if (right < size && best.compareTo(twoheap[right]) < 0) {
bestchild=right;
best=twoheap[right];
}
if (cur.compareTo(best) >= 0) {
break;
}
twoheap[twopos]=best;
twopos=bestchild;
}
twoheap[twopos]=cur;
}
| [
"private",
"void",
"heapifyDown",
"(",
"Comparable",
"<",
"Object",
">",
"cur",
")",
"{",
"final",
"int",
"stop",
"=",
"size",
">",
">",
">",
"1",
";",
"int",
"twopos",
"=",
"0",
";",
"while",
"(",
"twopos",
"<",
"stop",
")",
"{",
"int",
"bestchild",
"=",
"(",
"twopos",
"<<",
"1",
")",
"+",
"1",
";",
"Comparable",
"<",
"Object",
">",
"best",
"=",
"twoheap",
"[",
"bestchild",
"]",
";",
"final",
"int",
"right",
"=",
"bestchild",
"+",
"1",
";",
"if",
"(",
"right",
"<",
"size",
"&&",
"best",
".",
"compareTo",
"(",
"twoheap",
"[",
"right",
"]",
")",
"<",
"0",
")",
"{",
"bestchild",
"=",
"right",
";",
"best",
"=",
"twoheap",
"[",
"right",
"]",
";",
"}",
"if",
"(",
"cur",
".",
"compareTo",
"(",
"best",
")",
">=",
"0",
")",
"{",
"break",
";",
"}",
"twoheap",
"[",
"twopos",
"]",
"=",
"best",
";",
"twopos",
"=",
"bestchild",
";",
"}",
"twoheap",
"[",
"twopos",
"]",
"=",
"cur",
";",
"}"
] | invoke heapify - down for the root object .
| train | false |
69,476 | @KnownFailure("not supported") public void testUpdate4() throws SQLException {
DatabaseCreator.fillFKStrictTable(conn);
try {
statement.executeUpdate("UPDATE " + DatabaseCreator.FKSTRICT_TABLE + " SET name_id = 6 WHERE name_id = 2");
fail("expecting SQLException");
}
catch ( SQLException ex) {
}
}
| [
"@",
"KnownFailure",
"(",
"\"not supported\"",
")",
"public",
"void",
"testUpdate4",
"(",
")",
"throws",
"SQLException",
"{",
"DatabaseCreator",
".",
"fillFKStrictTable",
"(",
"conn",
")",
";",
"try",
"{",
"statement",
".",
"executeUpdate",
"(",
"\"UPDATE \"",
"+",
"DatabaseCreator",
".",
"FKSTRICT_TABLE",
"+",
"\" SET name_id = 6 WHERE name_id = 2\"",
")",
";",
"fail",
"(",
"\"expecting SQLException\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"}",
"}"
] | updatefunctionalitytest2 # testupdate4 ( ) . attempts to set incorrect foreign key value - expecting sqlexception todo foreign key functionality is not supported
| train | false |
69,478 | public static int checkActions(Map<String,Object> entry){
boolean ip6=false;
boolean ip4=false;
String actions=null;
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS) || entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS) || entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
if (entry.containsKey(StaticFlowEntryPusher.COLUMN_ACTIONS)) {
actions=(String)entry.get(StaticFlowEntryPusher.COLUMN_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS)) {
actions=(String)entry.get(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS);
}
else if (entry.containsKey(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS)) {
actions=(String)entry.get(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS);
}
if (actions.contains(MatchUtils.STR_ICMPV6_CODE) || actions.contains(MatchUtils.STR_ICMPV6_TYPE) || actions.contains(MatchUtils.STR_IPV6_DST)|| actions.contains(MatchUtils.STR_IPV6_SRC)|| actions.contains(MatchUtils.STR_IPV6_FLOW_LABEL)|| actions.contains(MatchUtils.STR_IPV6_ND_SSL)|| actions.contains(MatchUtils.STR_IPV6_ND_TARGET)|| actions.contains(MatchUtils.STR_IPV6_ND_TTL)) {
ip6=true;
}
if (actions.contains(MatchUtils.STR_NW_SRC) || actions.contains(MatchUtils.STR_NW_DST) || actions.contains(MatchUtils.STR_ARP_OPCODE)|| actions.contains(MatchUtils.STR_ARP_SHA)|| actions.contains(MatchUtils.STR_ARP_DHA)|| actions.contains(MatchUtils.STR_ARP_SPA)|| actions.contains(MatchUtils.STR_ARP_DPA)|| actions.contains(MatchUtils.STR_ICMP_CODE)|| actions.contains(MatchUtils.STR_ICMP_TYPE)) {
ip4=true;
}
}
if (ip6 == false && ip4 == false) {
return 0;
}
else if (ip6 == false && ip4 == true) {
return 1;
}
else if (ip6 == true && ip4 == false) {
return 2;
}
else {
return -1;
}
}
| [
"public",
"static",
"int",
"checkActions",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"entry",
")",
"{",
"boolean",
"ip6",
"=",
"false",
";",
"boolean",
"ip4",
"=",
"false",
";",
"String",
"actions",
"=",
"null",
";",
"if",
"(",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_ACTIONS",
")",
"||",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_APPLY_ACTIONS",
")",
"||",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_WRITE_ACTIONS",
")",
")",
"{",
"if",
"(",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_ACTIONS",
")",
")",
"{",
"actions",
"=",
"(",
"String",
")",
"entry",
".",
"get",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_ACTIONS",
")",
";",
"}",
"else",
"if",
"(",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_APPLY_ACTIONS",
")",
")",
"{",
"actions",
"=",
"(",
"String",
")",
"entry",
".",
"get",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_APPLY_ACTIONS",
")",
";",
"}",
"else",
"if",
"(",
"entry",
".",
"containsKey",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_WRITE_ACTIONS",
")",
")",
"{",
"actions",
"=",
"(",
"String",
")",
"entry",
".",
"get",
"(",
"StaticFlowEntryPusher",
".",
"COLUMN_INSTR_WRITE_ACTIONS",
")",
";",
"}",
"if",
"(",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ICMPV6_CODE",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ICMPV6_TYPE",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_DST",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_SRC",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_FLOW_LABEL",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_ND_SSL",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_ND_TARGET",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_IPV6_ND_TTL",
")",
")",
"{",
"ip6",
"=",
"true",
";",
"}",
"if",
"(",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_NW_SRC",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_NW_DST",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ARP_OPCODE",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ARP_SHA",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ARP_DHA",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ARP_SPA",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ARP_DPA",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ICMP_CODE",
")",
"||",
"actions",
".",
"contains",
"(",
"MatchUtils",
".",
"STR_ICMP_TYPE",
")",
")",
"{",
"ip4",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"ip6",
"==",
"false",
"&&",
"ip4",
"==",
"false",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"ip6",
"==",
"false",
"&&",
"ip4",
"==",
"true",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"ip6",
"==",
"true",
"&&",
"ip4",
"==",
"false",
")",
"{",
"return",
"2",
";",
"}",
"else",
"{",
"return",
"-",
"1",
";",
"}",
"}"
] | validates actions / instructions - 1 - - > ipv4 / ipv6 conflict 0 - - > no ipv4 or ipv6 actions 1 - - > ipv4 only actions 2 - - > ipv6 only actions
| train | false |
69,479 | public IDFFModelImpl(HttpServletRequest req,Map map){
super(req,map);
}
| [
"public",
"IDFFModelImpl",
"(",
"HttpServletRequest",
"req",
",",
"Map",
"map",
")",
"{",
"super",
"(",
"req",
",",
"map",
")",
";",
"}"
] | creates a simple model using default resource bundle .
| train | false |
69,480 | public void startInjectorIfNeeded(String inputFile){
ExamplePubsubTopicOptions pubsubTopicOptions=options.as(ExamplePubsubTopicOptions.class);
if (pubsubTopicOptions.isStreaming() && !Strings.isNullOrEmpty(inputFile) && !Strings.isNullOrEmpty(pubsubTopicOptions.getPubsubTopic())) {
runInjectorPipeline(inputFile,pubsubTopicOptions.getPubsubTopic());
}
}
| [
"public",
"void",
"startInjectorIfNeeded",
"(",
"String",
"inputFile",
")",
"{",
"ExamplePubsubTopicOptions",
"pubsubTopicOptions",
"=",
"options",
".",
"as",
"(",
"ExamplePubsubTopicOptions",
".",
"class",
")",
";",
"if",
"(",
"pubsubTopicOptions",
".",
"isStreaming",
"(",
")",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"inputFile",
")",
"&&",
"!",
"Strings",
".",
"isNullOrEmpty",
"(",
"pubsubTopicOptions",
".",
"getPubsubTopic",
"(",
")",
")",
")",
"{",
"runInjectorPipeline",
"(",
"inputFile",
",",
"pubsubTopicOptions",
".",
"getPubsubTopic",
"(",
")",
")",
";",
"}",
"}"
] | if this is an unbounded ( streaming ) pipeline , and both inputfile and pubsub topic are defined , start an ' injector ' pipeline that publishes the contents of the file to the given topic , first creating the topic if necessary .
| train | false |
69,482 | public static <T>SyncSupplier<T> from(Collection<T> collection,boolean fair){
return new SyncSupplier(new ReentrantLock(fair),new ArrayList<>(collection),collection.size());
}
| [
"public",
"static",
"<",
"T",
">",
"SyncSupplier",
"<",
"T",
">",
"from",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"boolean",
"fair",
")",
"{",
"return",
"new",
"SyncSupplier",
"(",
"new",
"ReentrantLock",
"(",
"fair",
")",
",",
"new",
"ArrayList",
"<",
">",
"(",
"collection",
")",
",",
"collection",
".",
"size",
"(",
")",
")",
";",
"}"
] | creates and returns a new instance .
| train | false |
69,483 | public static TLCVariableValue parseValue(String input){
Assert.isNotNull(input,"The value must be not null");
input.trim();
TLCVariableValue result;
try {
InputPair pair=new InputPair(input,0);
result=innerParse(pair);
if (pair.offset != input.length()) {
throw new VariableValueParseException();
}
}
catch ( VariableValueParseException e) {
result=new TLCSimpleVariableValue(input);
}
return result;
}
| [
"public",
"static",
"TLCVariableValue",
"parseValue",
"(",
"String",
"input",
")",
"{",
"Assert",
".",
"isNotNull",
"(",
"input",
",",
"\"The value must be not null\"",
")",
";",
"input",
".",
"trim",
"(",
")",
";",
"TLCVariableValue",
"result",
";",
"try",
"{",
"InputPair",
"pair",
"=",
"new",
"InputPair",
"(",
"input",
",",
"0",
")",
";",
"result",
"=",
"innerParse",
"(",
"pair",
")",
";",
"if",
"(",
"pair",
".",
"offset",
"!=",
"input",
".",
"length",
"(",
")",
")",
"{",
"throw",
"new",
"VariableValueParseException",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"VariableValueParseException",
"e",
")",
"{",
"result",
"=",
"new",
"TLCSimpleVariableValue",
"(",
"input",
")",
";",
"}",
"return",
"result",
";",
"}"
] | factory method to deliver simple values
| train | false |
69,484 | @SuppressWarnings("unchecked") public static Map createMap(Object... args){
Map result=new LinkedHashMap();
if (args == null || args.length == 0) return result;
for (int i=0; i < args.length - 1; i+=2) result.put(args[i],args[i + 1]);
return result;
}
| [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"createMap",
"(",
"Object",
"...",
"args",
")",
"{",
"Map",
"result",
"=",
"new",
"LinkedHashMap",
"(",
")",
";",
"if",
"(",
"args",
"==",
"null",
"||",
"args",
".",
"length",
"==",
"0",
")",
"return",
"result",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
"-",
"1",
";",
"i",
"+=",
"2",
")",
"result",
".",
"put",
"(",
"args",
"[",
"i",
"]",
",",
"args",
"[",
"i",
"+",
"1",
"]",
")",
";",
"return",
"result",
";",
"}"
] | strings at even index are keys , odd - index strings are values in the returned map
| train | false |
69,485 | @Override public InstantiatedType apply(Substitution<ReferenceType> substitution){
List<TypeArgument> argumentList=new ArrayList<>();
for ( TypeVariable variable : parameters) {
ReferenceType referenceType=substitution.get(variable);
if (referenceType == null) {
referenceType=variable;
}
argumentList.add(new ReferenceArgument(referenceType));
}
return (InstantiatedType)apply(substitution,new InstantiatedType(new GenericClassType(rawType),argumentList));
}
| [
"@",
"Override",
"public",
"InstantiatedType",
"apply",
"(",
"Substitution",
"<",
"ReferenceType",
">",
"substitution",
")",
"{",
"List",
"<",
"TypeArgument",
">",
"argumentList",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"TypeVariable",
"variable",
":",
"parameters",
")",
"{",
"ReferenceType",
"referenceType",
"=",
"substitution",
".",
"get",
"(",
"variable",
")",
";",
"if",
"(",
"referenceType",
"==",
"null",
")",
"{",
"referenceType",
"=",
"variable",
";",
"}",
"argumentList",
".",
"add",
"(",
"new",
"ReferenceArgument",
"(",
"referenceType",
")",
")",
";",
"}",
"return",
"(",
"InstantiatedType",
")",
"apply",
"(",
"substitution",
",",
"new",
"InstantiatedType",
"(",
"new",
"GenericClassType",
"(",
"rawType",
")",
",",
"argumentList",
")",
")",
";",
"}"
] | instantiates this generic class using the substitution to replace the type parameters .
| train | false |
69,486 | private void onClick(){
onIdentityserverUrlUpdate();
onHomeserverUrlUpdate();
InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mHomeServerText.getWindowToken(),0);
}
| [
"private",
"void",
"onClick",
"(",
")",
"{",
"onIdentityserverUrlUpdate",
"(",
")",
";",
"onHomeserverUrlUpdate",
"(",
")",
";",
"InputMethodManager",
"imm",
"=",
"(",
"InputMethodManager",
")",
"getSystemService",
"(",
"Context",
".",
"INPUT_METHOD_SERVICE",
")",
";",
"imm",
".",
"hideSoftInputFromWindow",
"(",
"mHomeServerText",
".",
"getWindowToken",
"(",
")",
",",
"0",
")",
";",
"}"
] | dismiss the keyboard and save the updated values
| train | false |
69,487 | public static String mapFullWidthLetterToHalfWidth(String text){
}
| [
"public",
"static",
"String",
"mapFullWidthLetterToHalfWidth",
"(",
"String",
"text",
")",
"{",
"}"
] | convert full - width letters in chinese fonts to normal half - width letters in ansi charset . numbers are not touched .
| train | false |
69,489 | private void checkFenced() throws ManagedLedgerException {
if (state.get() == State.Fenced) {
log.error("[{}] Attempted to use a fenced managed ledger",name);
throw new ManagedLedgerFencedException();
}
}
| [
"private",
"void",
"checkFenced",
"(",
")",
"throws",
"ManagedLedgerException",
"{",
"if",
"(",
"state",
".",
"get",
"(",
")",
"==",
"State",
".",
"Fenced",
")",
"{",
"log",
".",
"error",
"(",
"\"[{}] Attempted to use a fenced managed ledger\"",
",",
"name",
")",
";",
"throw",
"new",
"ManagedLedgerFencedException",
"(",
")",
";",
"}",
"}"
] | throws an exception if the managed ledger has been previously fenced
| train | false |
69,491 | private long hash(final float[] a,final int l,final int k){
final int[] w=weight[k];
long h=init[k];
int i=l;
while (i-- != 0) h^=(h << 5) + Float.floatToRawIntBits(a[i]) * w[i % NUMBER_OF_WEIGHTS] + (h >>> 2);
return (h & 0x7FFFFFFFFFFFFFFFL) % m;
}
| [
"private",
"long",
"hash",
"(",
"final",
"float",
"[",
"]",
"a",
",",
"final",
"int",
"l",
",",
"final",
"int",
"k",
")",
"{",
"final",
"int",
"[",
"]",
"w",
"=",
"weight",
"[",
"k",
"]",
";",
"long",
"h",
"=",
"init",
"[",
"k",
"]",
";",
"int",
"i",
"=",
"l",
";",
"while",
"(",
"i",
"--",
"!=",
"0",
")",
"h",
"^=",
"(",
"h",
"<<",
"5",
")",
"+",
"Float",
".",
"floatToRawIntBits",
"(",
"a",
"[",
"i",
"]",
")",
"*",
"w",
"[",
"i",
"%",
"NUMBER_OF_WEIGHTS",
"]",
"+",
"(",
"h",
">",
">",
">",
"2",
")",
";",
"return",
"(",
"h",
"&",
"0x7FFFFFFFFFFFFFFFL",
")",
"%",
"m",
";",
"}"
] | hashes the given float array with the given hash function .
| train | false |
69,492 | public SignatureEvaluator(int suggestedBufferSize,boolean humanReadable){
this(suggestedBufferSize,humanReadable,new SignatureRules());
}
| [
"public",
"SignatureEvaluator",
"(",
"int",
"suggestedBufferSize",
",",
"boolean",
"humanReadable",
")",
"{",
"this",
"(",
"suggestedBufferSize",
",",
"humanReadable",
",",
"new",
"SignatureRules",
"(",
")",
")",
";",
"}"
] | save the stringbuilder some work and guess how big your signature might be . uses the default signaturerules ( rules for determining what to include in a signature ) .
| train | false |
69,494 | public boolean isIndependent(Node x,Node y,List<Node> z){
int n=sampleSize();
double r=partialCorrelation(x,y,z);
double fisherZ=Math.sqrt(n - 3 - z.size()) * 0.5 * (Math.log(1.0 + r) - Math.log(1.0 - r));
this.fisherZ=fisherZ;
boolean independent=Math.abs(fisherZ) < cutoff;
return independent;
}
| [
"public",
"boolean",
"isIndependent",
"(",
"Node",
"x",
",",
"Node",
"y",
",",
"List",
"<",
"Node",
">",
"z",
")",
"{",
"int",
"n",
"=",
"sampleSize",
"(",
")",
";",
"double",
"r",
"=",
"partialCorrelation",
"(",
"x",
",",
"y",
",",
"z",
")",
";",
"double",
"fisherZ",
"=",
"Math",
".",
"sqrt",
"(",
"n",
"-",
"3",
"-",
"z",
".",
"size",
"(",
")",
")",
"*",
"0.5",
"*",
"(",
"Math",
".",
"log",
"(",
"1.0",
"+",
"r",
")",
"-",
"Math",
".",
"log",
"(",
"1.0",
"-",
"r",
")",
")",
";",
"this",
".",
"fisherZ",
"=",
"fisherZ",
";",
"boolean",
"independent",
"=",
"Math",
".",
"abs",
"(",
"fisherZ",
")",
"<",
"cutoff",
";",
"return",
"independent",
";",
"}"
] | determines whether variable x is independent of variable y given a list of conditioning variables z .
| train | false |
69,496 | public static String[] fileToArray(File file,String label){
LinkedList<String> words=new LinkedList<>();
words.add(label);
BufferedReader in=openReader(file);
for (String line=readLine(in,file); line != null; line=readLine(in,file)) {
String[] lineWords=line.split("\\s+");
for ( String lineWord : lineWords) if (!lineWord.matches("^\\s*$")) words.add(lineWord);
}
closeReader(in,file);
return words.toArray(new String[words.size()]);
}
| [
"public",
"static",
"String",
"[",
"]",
"fileToArray",
"(",
"File",
"file",
",",
"String",
"label",
")",
"{",
"LinkedList",
"<",
"String",
">",
"words",
"=",
"new",
"LinkedList",
"<",
">",
"(",
")",
";",
"words",
".",
"add",
"(",
"label",
")",
";",
"BufferedReader",
"in",
"=",
"openReader",
"(",
"file",
")",
";",
"for",
"(",
"String",
"line",
"=",
"readLine",
"(",
"in",
",",
"file",
")",
";",
"line",
"!=",
"null",
";",
"line",
"=",
"readLine",
"(",
"in",
",",
"file",
")",
")",
"{",
"String",
"[",
"]",
"lineWords",
"=",
"line",
".",
"split",
"(",
"\"\\\\s+\"",
")",
";",
"for",
"(",
"String",
"lineWord",
":",
"lineWords",
")",
"if",
"(",
"!",
"lineWord",
".",
"matches",
"(",
"\"^\\\\s*$\"",
")",
")",
"words",
".",
"add",
"(",
"lineWord",
")",
";",
"}",
"closeReader",
"(",
"in",
",",
"file",
")",
";",
"return",
"words",
".",
"toArray",
"(",
"new",
"String",
"[",
"words",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] | reads in the specified file , splits it on whitespace , and adds all resulting words to an array which it returns . the specified label string appears in the returned array first , before any of the file ' s words .
| train | false |
69,497 | public void updateDuration(){
if (!Double.isNaN(getXmin()) && !Double.isNaN(getXmax())) {
setDuration(getXmax() - getXmin());
}
}
| [
"public",
"void",
"updateDuration",
"(",
")",
"{",
"if",
"(",
"!",
"Double",
".",
"isNaN",
"(",
"getXmin",
"(",
")",
")",
"&&",
"!",
"Double",
".",
"isNaN",
"(",
"getXmax",
"(",
")",
")",
")",
"{",
"setDuration",
"(",
"getXmax",
"(",
")",
"-",
"getXmin",
"(",
")",
")",
";",
"}",
"}"
] | recalculate and set duration based on current start and end times
| train | false |
69,498 | public static byte[] copyWithLength(byte[] orig,int length){
byte[] result=new byte[length];
int howMuchToCopy=length < orig.length ? length : orig.length;
System.arraycopy(orig,0,result,0,howMuchToCopy);
return result;
}
| [
"public",
"static",
"byte",
"[",
"]",
"copyWithLength",
"(",
"byte",
"[",
"]",
"orig",
",",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"int",
"howMuchToCopy",
"=",
"length",
"<",
"orig",
".",
"length",
"?",
"length",
":",
"orig",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"orig",
",",
"0",
",",
"result",
",",
"0",
",",
"howMuchToCopy",
")",
";",
"return",
"result",
";",
"}"
] | copies the original byte array content to a new byte array . the resulting byte array is always " length " size . if length is smaller than the original byte array , the resulting byte array is truncated . if length is bigger than the original byte array , the resulting byte array is filled with zero bytes .
| train | true |
69,499 | protected void shuffleTestAndTrainingSetTogether(){
ArrayList lOverall=new ArrayList(TestFiles.size() + TrainingFiles.size());
lOverall.addAll(TrainingFiles);
lOverall.addAll(TestFiles);
utils.shuffleList(lOverall);
TestFiles.clear();
TrainingFiles.clear();
TestFiles.addAll(lOverall.subList(0,TestFiles.size()));
TrainingFiles.addAll(lOverall.subList(TestFiles.size(),lOverall.size()));
}
| [
"protected",
"void",
"shuffleTestAndTrainingSetTogether",
"(",
")",
"{",
"ArrayList",
"lOverall",
"=",
"new",
"ArrayList",
"(",
"TestFiles",
".",
"size",
"(",
")",
"+",
"TrainingFiles",
".",
"size",
"(",
")",
")",
";",
"lOverall",
".",
"addAll",
"(",
"TrainingFiles",
")",
";",
"lOverall",
".",
"addAll",
"(",
"TestFiles",
")",
";",
"utils",
".",
"shuffleList",
"(",
"lOverall",
")",
";",
"TestFiles",
".",
"clear",
"(",
")",
";",
"TrainingFiles",
".",
"clear",
"(",
")",
";",
"TestFiles",
".",
"addAll",
"(",
"lOverall",
".",
"subList",
"(",
"0",
",",
"TestFiles",
".",
"size",
"(",
")",
")",
")",
";",
"TrainingFiles",
".",
"addAll",
"(",
"lOverall",
".",
"subList",
"(",
"TestFiles",
".",
"size",
"(",
")",
",",
"lOverall",
".",
"size",
"(",
")",
")",
")",
";",
"}"
] | creates a list containing shuffled test and training instances and then recreates the training and test sets based on this list .
| train | false |
69,500 | public void removed(java.awt.Container cont){
if (autoTimer) {
timer.stop();
updateTimerButton();
}
}
| [
"public",
"void",
"removed",
"(",
"java",
".",
"awt",
".",
"Container",
"cont",
")",
"{",
"if",
"(",
"autoTimer",
")",
"{",
"timer",
".",
"stop",
"(",
")",
";",
"updateTimerButton",
"(",
")",
";",
"}",
"}"
] | this method is called after the layer is removed from the mapbean and when the projection changes . if the autotimer is set , the timer is stopped .
| train | false |
69,501 | public void create_ratsnest(){
ratsnest=new RatsNest(r_board,stat);
Integer incomplete_count=ratsnest.incomplete_count();
Integer length_violation_count=ratsnest.length_violation_count();
String curr_message;
if (length_violation_count == 0) {
curr_message=incomplete_count.toString() + " " + resources.getString("incomplete_connections_to_route");
}
else {
curr_message=incomplete_count.toString() + " " + resources.getString("incompletes")+ " "+ length_violation_count.toString()+ " "+ resources.getString("length_violations");
}
screen_messages.set_status_message(curr_message);
}
| [
"public",
"void",
"create_ratsnest",
"(",
")",
"{",
"ratsnest",
"=",
"new",
"RatsNest",
"(",
"r_board",
",",
"stat",
")",
";",
"Integer",
"incomplete_count",
"=",
"ratsnest",
".",
"incomplete_count",
"(",
")",
";",
"Integer",
"length_violation_count",
"=",
"ratsnest",
".",
"length_violation_count",
"(",
")",
";",
"String",
"curr_message",
";",
"if",
"(",
"length_violation_count",
"==",
"0",
")",
"{",
"curr_message",
"=",
"incomplete_count",
".",
"toString",
"(",
")",
"+",
"\" \"",
"+",
"resources",
".",
"getString",
"(",
"\"incomplete_connections_to_route\"",
")",
";",
"}",
"else",
"{",
"curr_message",
"=",
"incomplete_count",
".",
"toString",
"(",
")",
"+",
"\" \"",
"+",
"resources",
".",
"getString",
"(",
"\"incompletes\"",
")",
"+",
"\" \"",
"+",
"length_violation_count",
".",
"toString",
"(",
")",
"+",
"\" \"",
"+",
"resources",
".",
"getString",
"(",
"\"length_violations\"",
")",
";",
"}",
"screen_messages",
".",
"set_status_message",
"(",
"curr_message",
")",
";",
"}"
] | displays all incomplete connections .
| train | false |
69,502 | private boolean isNotSymbol(String text,int index,char c){
if (index >= 0 && index < text.length()) {
return text.charAt(index) != c;
}
return true;
}
| [
"private",
"boolean",
"isNotSymbol",
"(",
"String",
"text",
",",
"int",
"index",
",",
"char",
"c",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"text",
".",
"length",
"(",
")",
")",
"{",
"return",
"text",
".",
"charAt",
"(",
"index",
")",
"!=",
"c",
";",
"}",
"return",
"true",
";",
"}"
] | checking if symbol is not eq to c
| train | true |
69,504 | public static String toHTML(final String markdownText){
if (Strings.isEmptyOrNull(markdownText)) {
return "";
}
final StringWriter writer=new StringWriter();
final Markdown markdown=new Markdown();
try {
markdown.transform(new StringReader(markdownText),writer);
}
catch ( final ParseException e) {
return markdownText;
}
return writer.toString();
}
| [
"public",
"static",
"String",
"toHTML",
"(",
"final",
"String",
"markdownText",
")",
"{",
"if",
"(",
"Strings",
".",
"isEmptyOrNull",
"(",
"markdownText",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"final",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"final",
"Markdown",
"markdown",
"=",
"new",
"Markdown",
"(",
")",
";",
"try",
"{",
"markdown",
".",
"transform",
"(",
"new",
"StringReader",
"(",
"markdownText",
")",
",",
"writer",
")",
";",
"}",
"catch",
"(",
"final",
"ParseException",
"e",
")",
"{",
"return",
"markdownText",
";",
"}",
"return",
"writer",
".",
"toString",
"(",
")",
";",
"}"
] | converts the specified markdown text to html .
| train | false |
69,506 | protected RTextAreaUI createRTextAreaUI(){
return new RTextAreaUI(this);
}
| [
"protected",
"RTextAreaUI",
"createRTextAreaUI",
"(",
")",
"{",
"return",
"new",
"RTextAreaUI",
"(",
"this",
")",
";",
"}"
] | returns the a real ui to install on this text area .
| train | false |
69,507 | public int deleteRows(String tableName) throws NamingException, SQLException {
Context ctx=cache.getJNDIContext();
DataSource da=(DataSource)ctx.lookup("java:/SimpleDataSource");
Connection conn=da.getConnection();
Statement stmt=conn.createStatement();
int rowsDeleted=0;
String sql="";
sql="select * from " + tableName;
ResultSet rs=stmt.executeQuery(sql);
if (rs.next()) {
sql="delete from " + tableName;
rowsDeleted=stmt.executeUpdate(sql);
}
rs.close();
stmt.close();
conn.close();
return rowsDeleted;
}
| [
"public",
"int",
"deleteRows",
"(",
"String",
"tableName",
")",
"throws",
"NamingException",
",",
"SQLException",
"{",
"Context",
"ctx",
"=",
"cache",
".",
"getJNDIContext",
"(",
")",
";",
"DataSource",
"da",
"=",
"(",
"DataSource",
")",
"ctx",
".",
"lookup",
"(",
"\"java:/SimpleDataSource\"",
")",
";",
"Connection",
"conn",
"=",
"da",
".",
"getConnection",
"(",
")",
";",
"Statement",
"stmt",
"=",
"conn",
".",
"createStatement",
"(",
")",
";",
"int",
"rowsDeleted",
"=",
"0",
";",
"String",
"sql",
"=",
"\"\"",
";",
"sql",
"=",
"\"select * from \"",
"+",
"tableName",
";",
"ResultSet",
"rs",
"=",
"stmt",
".",
"executeQuery",
"(",
"sql",
")",
";",
"if",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"sql",
"=",
"\"delete from \"",
"+",
"tableName",
";",
"rowsDeleted",
"=",
"stmt",
".",
"executeUpdate",
"(",
"sql",
")",
";",
"}",
"rs",
".",
"close",
"(",
")",
";",
"stmt",
".",
"close",
"(",
")",
";",
"conn",
".",
"close",
"(",
")",
";",
"return",
"rowsDeleted",
";",
"}"
] | this method is used to delete all rows from the timestamped table created by createtable ( ) in cacheutils class .
| train | false |
69,508 | protected String quoteStringLiteral(String value){
StringWriter sw=new StringWriter();
try (JsonWriter writer=new JsonWriter(sw)){
writer.setLenient(true);
writer.value(value);
writer.flush();
}
catch ( IOException ex) {
throw new RuntimeException("Unexpected I/O failure: " + ex.getLocalizedMessage(),ex);
}
return sw.toString();
}
| [
"protected",
"String",
"quoteStringLiteral",
"(",
"String",
"value",
")",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"(",
"JsonWriter",
"writer",
"=",
"new",
"JsonWriter",
"(",
"sw",
")",
")",
"{",
"writer",
".",
"setLenient",
"(",
"true",
")",
";",
"writer",
".",
"value",
"(",
"value",
")",
";",
"writer",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected I/O failure: \"",
"+",
"ex",
".",
"getLocalizedMessage",
"(",
")",
",",
"ex",
")",
";",
"}",
"return",
"sw",
".",
"toString",
"(",
")",
";",
"}"
] | create a textual representation of a string literal that evaluates to the given value .
| train | false |
69,510 | private void processReport(int id,long seqno,long time,D datum){
ThreadPosition tp=array.get(id);
if (tp == null) {
tp=new ThreadPosition();
tp.id=id;
tp.seqno=seqno;
tp.time=time;
tp.reportTime=System.currentTimeMillis();
tp.datum=datum;
array.put(id,tp);
if (head == null) {
head=tp;
tail=tp;
}
else {
ThreadPosition nextTp=head;
while (nextTp != null) {
if (nextTp.seqno > tp.seqno) {
if (nextTp.before != null) nextTp.before.after=tp;
tp.before=nextTp.before;
tp.after=nextTp;
nextTp.before=tp;
break;
}
nextTp=nextTp.after;
}
if (nextTp == null) {
tail.after=tp;
tp.before=tail;
tail=tp;
}
if (tp.before == null) head=tp;
}
}
else {
if (tp.seqno > seqno) bug("Thread reporting position moved backwards: task=" + id + " previous seqno="+ tp.seqno+ " new seqno="+ seqno);
tp.seqno=seqno;
tp.time=time;
tp.reportTime=System.currentTimeMillis();
tp.datum=datum;
ThreadPosition nextTp=tp.after;
while (nextTp != null && tp.seqno > tp.after.seqno) {
if (tp.before != null) tp.before.after=nextTp;
if (nextTp.after != null) nextTp.after.before=tp;
nextTp.before=tp.before;
tp.after=nextTp.after;
nextTp.after=tp;
tp.before=nextTp;
if (head == tp) head=nextTp;
nextTp=tp.after;
}
if (tp.after == null) tail=tp;
}
}
| [
"private",
"void",
"processReport",
"(",
"int",
"id",
",",
"long",
"seqno",
",",
"long",
"time",
",",
"D",
"datum",
")",
"{",
"ThreadPosition",
"tp",
"=",
"array",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"tp",
"==",
"null",
")",
"{",
"tp",
"=",
"new",
"ThreadPosition",
"(",
")",
";",
"tp",
".",
"id",
"=",
"id",
";",
"tp",
".",
"seqno",
"=",
"seqno",
";",
"tp",
".",
"time",
"=",
"time",
";",
"tp",
".",
"reportTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"tp",
".",
"datum",
"=",
"datum",
";",
"array",
".",
"put",
"(",
"id",
",",
"tp",
")",
";",
"if",
"(",
"head",
"==",
"null",
")",
"{",
"head",
"=",
"tp",
";",
"tail",
"=",
"tp",
";",
"}",
"else",
"{",
"ThreadPosition",
"nextTp",
"=",
"head",
";",
"while",
"(",
"nextTp",
"!=",
"null",
")",
"{",
"if",
"(",
"nextTp",
".",
"seqno",
">",
"tp",
".",
"seqno",
")",
"{",
"if",
"(",
"nextTp",
".",
"before",
"!=",
"null",
")",
"nextTp",
".",
"before",
".",
"after",
"=",
"tp",
";",
"tp",
".",
"before",
"=",
"nextTp",
".",
"before",
";",
"tp",
".",
"after",
"=",
"nextTp",
";",
"nextTp",
".",
"before",
"=",
"tp",
";",
"break",
";",
"}",
"nextTp",
"=",
"nextTp",
".",
"after",
";",
"}",
"if",
"(",
"nextTp",
"==",
"null",
")",
"{",
"tail",
".",
"after",
"=",
"tp",
";",
"tp",
".",
"before",
"=",
"tail",
";",
"tail",
"=",
"tp",
";",
"}",
"if",
"(",
"tp",
".",
"before",
"==",
"null",
")",
"head",
"=",
"tp",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"tp",
".",
"seqno",
">",
"seqno",
")",
"bug",
"(",
"\"Thread reporting position moved backwards: task=\"",
"+",
"id",
"+",
"\" previous seqno=\"",
"+",
"tp",
".",
"seqno",
"+",
"\" new seqno=\"",
"+",
"seqno",
")",
";",
"tp",
".",
"seqno",
"=",
"seqno",
";",
"tp",
".",
"time",
"=",
"time",
";",
"tp",
".",
"reportTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"tp",
".",
"datum",
"=",
"datum",
";",
"ThreadPosition",
"nextTp",
"=",
"tp",
".",
"after",
";",
"while",
"(",
"nextTp",
"!=",
"null",
"&&",
"tp",
".",
"seqno",
">",
"tp",
".",
"after",
".",
"seqno",
")",
"{",
"if",
"(",
"tp",
".",
"before",
"!=",
"null",
")",
"tp",
".",
"before",
".",
"after",
"=",
"nextTp",
";",
"if",
"(",
"nextTp",
".",
"after",
"!=",
"null",
")",
"nextTp",
".",
"after",
".",
"before",
"=",
"tp",
";",
"nextTp",
".",
"before",
"=",
"tp",
".",
"before",
";",
"tp",
".",
"after",
"=",
"nextTp",
".",
"after",
";",
"nextTp",
".",
"after",
"=",
"tp",
";",
"tp",
".",
"before",
"=",
"nextTp",
";",
"if",
"(",
"head",
"==",
"tp",
")",
"head",
"=",
"nextTp",
";",
"nextTp",
"=",
"tp",
".",
"after",
";",
"}",
"if",
"(",
"tp",
".",
"after",
"==",
"null",
")",
"tail",
"=",
"tp",
";",
"}",
"}"
] | insert the reported position into the array using the seqno for ordering .
| train | false |
69,511 | public void initialize(UISearchResult sr){
super.initialize(sr);
RESULT=sr;
_mediaType=NamedMediaType.getFromExtension(getExtension());
addedOn=sr.getCreationTime() > 0 ? new Date(sr.getCreationTime()) : null;
actionsHolder=new SearchResultActionsHolder(sr);
name=new SearchResultNameHolder(sr);
seeds=RESULT.getSeeds() <= 0 || !(RESULT instanceof TorrentUISearchResult) ? "" : String.valueOf(RESULT.getSeeds());
icon=getIcon();
size=new SizeHolder(getSize());
source=new SourceHolder(RESULT);
}
| [
"public",
"void",
"initialize",
"(",
"UISearchResult",
"sr",
")",
"{",
"super",
".",
"initialize",
"(",
"sr",
")",
";",
"RESULT",
"=",
"sr",
";",
"_mediaType",
"=",
"NamedMediaType",
".",
"getFromExtension",
"(",
"getExtension",
"(",
")",
")",
";",
"addedOn",
"=",
"sr",
".",
"getCreationTime",
"(",
")",
">",
"0",
"?",
"new",
"Date",
"(",
"sr",
".",
"getCreationTime",
"(",
")",
")",
":",
"null",
";",
"actionsHolder",
"=",
"new",
"SearchResultActionsHolder",
"(",
"sr",
")",
";",
"name",
"=",
"new",
"SearchResultNameHolder",
"(",
"sr",
")",
";",
"seeds",
"=",
"RESULT",
".",
"getSeeds",
"(",
")",
"<=",
"0",
"||",
"!",
"(",
"RESULT",
"instanceof",
"TorrentUISearchResult",
")",
"?",
"\"\"",
":",
"String",
".",
"valueOf",
"(",
"RESULT",
".",
"getSeeds",
"(",
")",
")",
";",
"icon",
"=",
"getIcon",
"(",
")",
";",
"size",
"=",
"new",
"SizeHolder",
"(",
"getSize",
"(",
")",
")",
";",
"source",
"=",
"new",
"SourceHolder",
"(",
"RESULT",
")",
";",
"}"
] | initializes this line with the specified search result .
| train | false |
69,512 | public void printDocComment(JCTree tree) throws IOException {
if (docComments != null) {
String dc=docComments.getCommentText(tree);
if (dc != null) {
print("/**");
println();
int pos=0;
int endpos=lineEndPos(dc,pos);
while (pos < dc.length()) {
align();
print(" *");
if (pos < dc.length() && dc.charAt(pos) > ' ') print(" ");
print(dc.substring(pos,endpos));
println();
pos=endpos + 1;
endpos=lineEndPos(dc,pos);
}
align();
print(" */");
println();
align();
}
}
}
| [
"public",
"void",
"printDocComment",
"(",
"JCTree",
"tree",
")",
"throws",
"IOException",
"{",
"if",
"(",
"docComments",
"!=",
"null",
")",
"{",
"String",
"dc",
"=",
"docComments",
".",
"getCommentText",
"(",
"tree",
")",
";",
"if",
"(",
"dc",
"!=",
"null",
")",
"{",
"print",
"(",
"\"/**\"",
")",
";",
"println",
"(",
")",
";",
"int",
"pos",
"=",
"0",
";",
"int",
"endpos",
"=",
"lineEndPos",
"(",
"dc",
",",
"pos",
")",
";",
"while",
"(",
"pos",
"<",
"dc",
".",
"length",
"(",
")",
")",
"{",
"align",
"(",
")",
";",
"print",
"(",
"\" *\"",
")",
";",
"if",
"(",
"pos",
"<",
"dc",
".",
"length",
"(",
")",
"&&",
"dc",
".",
"charAt",
"(",
"pos",
")",
">",
"' '",
")",
"print",
"(",
"\" \"",
")",
";",
"print",
"(",
"dc",
".",
"substring",
"(",
"pos",
",",
"endpos",
")",
")",
";",
"println",
"(",
")",
";",
"pos",
"=",
"endpos",
"+",
"1",
";",
"endpos",
"=",
"lineEndPos",
"(",
"dc",
",",
"pos",
")",
";",
"}",
"align",
"(",
")",
";",
"print",
"(",
"\" */\"",
")",
";",
"println",
"(",
")",
";",
"align",
"(",
")",
";",
"}",
"}",
"}"
] | print documentation comment , if it exists
| train | false |
69,513 | public void check(){
Response<Set<String>> serversResp=clusterService.listOnlineServers();
if (!serversResp.isSuccess()) {
Logs.error("failed to get all online servers, cause: {}",serversResp.getErr());
return;
}
try {
Set<String> allServers=serversResp.getData();
final Set<String> failedServers=Sets.newHashSet();
doCheck(allServers,failedServers);
removeFailedServers(failedServers);
}
catch ( InterruptedException e) {
Logs.error("failed to check online servers: {}",Throwables.getStackTraceAsString(e));
}
}
| [
"public",
"void",
"check",
"(",
")",
"{",
"Response",
"<",
"Set",
"<",
"String",
">",
">",
"serversResp",
"=",
"clusterService",
".",
"listOnlineServers",
"(",
")",
";",
"if",
"(",
"!",
"serversResp",
".",
"isSuccess",
"(",
")",
")",
"{",
"Logs",
".",
"error",
"(",
"\"failed to get all online servers, cause: {}\"",
",",
"serversResp",
".",
"getErr",
"(",
")",
")",
";",
"return",
";",
"}",
"try",
"{",
"Set",
"<",
"String",
">",
"allServers",
"=",
"serversResp",
".",
"getData",
"(",
")",
";",
"final",
"Set",
"<",
"String",
">",
"failedServers",
"=",
"Sets",
".",
"newHashSet",
"(",
")",
";",
"doCheck",
"(",
"allServers",
",",
"failedServers",
")",
";",
"removeFailedServers",
"(",
"failedServers",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Logs",
".",
"error",
"(",
"\"failed to check online servers: {}\"",
",",
"Throwables",
".",
"getStackTraceAsString",
"(",
"e",
")",
")",
";",
"}",
"}"
] | check all online servers are health & remove dead online servers
| train | false |
69,515 | public boolean saveAsKML(File file){
try {
Log.d(BonusPackHelper.LOG_TAG,"Saving " + file.getAbsolutePath());
OutputStreamWriter out=new OutputStreamWriter(new FileOutputStream(file),"UTF-8");
BufferedWriter writer=new BufferedWriter(out,8192);
boolean result=saveAsKML(writer);
writer.close();
Log.d(BonusPackHelper.LOG_TAG,"Saved.");
return result;
}
catch ( IOException e) {
e.printStackTrace();
return false;
}
}
| [
"public",
"boolean",
"saveAsKML",
"(",
"File",
"file",
")",
"{",
"try",
"{",
"Log",
".",
"d",
"(",
"BonusPackHelper",
".",
"LOG_TAG",
",",
"\"Saving \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"OutputStreamWriter",
"out",
"=",
"new",
"OutputStreamWriter",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
",",
"\"UTF-8\"",
")",
";",
"BufferedWriter",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"out",
",",
"8192",
")",
";",
"boolean",
"result",
"=",
"saveAsKML",
"(",
"writer",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"Log",
".",
"d",
"(",
"BonusPackHelper",
".",
"LOG_TAG",
",",
"\"Saved.\"",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"false",
";",
"}",
"}"
] | save the document as a kml file
| train | false |
69,516 | public void testSealedObject1() throws Exception {
String secret="secret string";
try {
new SealedObject(secret,null);
fail("NullPointerException should be thrown in the case " + "of null cipher.");
}
catch ( NullPointerException e) {
}
KeyGenerator kg=KeyGenerator.getInstance("DES");
Key key=kg.generateKey();
IvParameterSpec ips=new IvParameterSpec(new byte[]{1,2,3,4,5,6,7,8});
Cipher cipher=Cipher.getInstance("DES/CBC/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE,key,ips);
SealedObject so=new SealedObject(secret,cipher);
cipher=Cipher.getInstance("DES/CBC/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE,key,ips);
try {
new SealedObject(secret,cipher);
fail("IllegalBlockSizeException expected");
}
catch ( IllegalBlockSizeException e) {
}
}
| [
"public",
"void",
"testSealedObject1",
"(",
")",
"throws",
"Exception",
"{",
"String",
"secret",
"=",
"\"secret string\"",
";",
"try",
"{",
"new",
"SealedObject",
"(",
"secret",
",",
"null",
")",
";",
"fail",
"(",
"\"NullPointerException should be thrown in the case \"",
"+",
"\"of null cipher.\"",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"}",
"KeyGenerator",
"kg",
"=",
"KeyGenerator",
".",
"getInstance",
"(",
"\"DES\"",
")",
";",
"Key",
"key",
"=",
"kg",
".",
"generateKey",
"(",
")",
";",
"IvParameterSpec",
"ips",
"=",
"new",
"IvParameterSpec",
"(",
"new",
"byte",
"[",
"]",
"{",
"1",
",",
"2",
",",
"3",
",",
"4",
",",
"5",
",",
"6",
",",
"7",
",",
"8",
"}",
")",
";",
"Cipher",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"\"DES/CBC/PKCS5Padding\"",
")",
";",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
",",
"key",
",",
"ips",
")",
";",
"SealedObject",
"so",
"=",
"new",
"SealedObject",
"(",
"secret",
",",
"cipher",
")",
";",
"cipher",
"=",
"Cipher",
".",
"getInstance",
"(",
"\"DES/CBC/NoPadding\"",
")",
";",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
",",
"key",
",",
"ips",
")",
";",
"try",
"{",
"new",
"SealedObject",
"(",
"secret",
",",
"cipher",
")",
";",
"fail",
"(",
"\"IllegalBlockSizeException expected\"",
")",
";",
"}",
"catch",
"(",
"IllegalBlockSizeException",
"e",
")",
"{",
"}",
"}"
] | sealedobject ( serializable object , cipher c ) method testing . tests if the nullpointerexception is thrown in the case of null cipher .
| train | false |
69,517 | private void interrogateStdOutFiles(List<LogDestination> appenders){
for ( String fileName : stdoutFiles) {
FileLogAccessor fla=resolveStdoutLogDestination(fileName);
if (fla != null) {
appenders.add(fla);
}
}
}
| [
"private",
"void",
"interrogateStdOutFiles",
"(",
"List",
"<",
"LogDestination",
">",
"appenders",
")",
"{",
"for",
"(",
"String",
"fileName",
":",
"stdoutFiles",
")",
"{",
"FileLogAccessor",
"fla",
"=",
"resolveStdoutLogDestination",
"(",
"fileName",
")",
";",
"if",
"(",
"fla",
"!=",
"null",
")",
"{",
"appenders",
".",
"add",
"(",
"fla",
")",
";",
"}",
"}",
"}"
] | interrogate std out files .
| train | false |
69,519 | public E remove(int index){
rangeCheck(index);
modCount++;
E oldValue=elementData(index);
int numMoved=size - index - 1;
if (numMoved > 0) System.arraycopy(elementData,index + 1,elementData,index,numMoved);
elementData[--size]=null;
return oldValue;
}
| [
"public",
"E",
"remove",
"(",
"int",
"index",
")",
"{",
"rangeCheck",
"(",
"index",
")",
";",
"modCount",
"++",
";",
"E",
"oldValue",
"=",
"elementData",
"(",
"index",
")",
";",
"int",
"numMoved",
"=",
"size",
"-",
"index",
"-",
"1",
";",
"if",
"(",
"numMoved",
">",
"0",
")",
"System",
".",
"arraycopy",
"(",
"elementData",
",",
"index",
"+",
"1",
",",
"elementData",
",",
"index",
",",
"numMoved",
")",
";",
"elementData",
"[",
"--",
"size",
"]",
"=",
"null",
";",
"return",
"oldValue",
";",
"}"
] | removes the element at the specified position in this list . shifts any subsequent elements to the left ( subtracts one from their indices ) .
| train | true |
69,520 | private static Collection<SearchDirectory> classpathDirectories() throws IOException {
HadoopLocations loc=locations();
Collection<SearchDirectory> res=new ArrayList<>();
res.add(new SearchDirectory(new File(loc.common(),"lib"),AcceptAllDirectoryFilter.INSTANCE));
res.add(new SearchDirectory(new File(loc.hdfs(),"lib"),AcceptAllDirectoryFilter.INSTANCE));
res.add(new SearchDirectory(new File(loc.mapred(),"lib"),AcceptAllDirectoryFilter.INSTANCE));
res.add(new SearchDirectory(new File(loc.common()),new PrefixDirectoryFilter("hadoop-common-")));
res.add(new SearchDirectory(new File(loc.common()),new PrefixDirectoryFilter("hadoop-auth-")));
res.add(new SearchDirectory(new File(loc.hdfs()),new PrefixDirectoryFilter("hadoop-hdfs-")));
res.add(new SearchDirectory(new File(loc.mapred()),new PrefixDirectoryFilter("hadoop-mapreduce-client-common")));
res.add(new SearchDirectory(new File(loc.mapred()),new PrefixDirectoryFilter("hadoop-mapreduce-client-core")));
res.addAll(parseUserLibs());
return res;
}
| [
"private",
"static",
"Collection",
"<",
"SearchDirectory",
">",
"classpathDirectories",
"(",
")",
"throws",
"IOException",
"{",
"HadoopLocations",
"loc",
"=",
"locations",
"(",
")",
";",
"Collection",
"<",
"SearchDirectory",
">",
"res",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"common",
"(",
")",
",",
"\"lib\"",
")",
",",
"AcceptAllDirectoryFilter",
".",
"INSTANCE",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"hdfs",
"(",
")",
",",
"\"lib\"",
")",
",",
"AcceptAllDirectoryFilter",
".",
"INSTANCE",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"mapred",
"(",
")",
",",
"\"lib\"",
")",
",",
"AcceptAllDirectoryFilter",
".",
"INSTANCE",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"common",
"(",
")",
")",
",",
"new",
"PrefixDirectoryFilter",
"(",
"\"hadoop-common-\"",
")",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"common",
"(",
")",
")",
",",
"new",
"PrefixDirectoryFilter",
"(",
"\"hadoop-auth-\"",
")",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"hdfs",
"(",
")",
")",
",",
"new",
"PrefixDirectoryFilter",
"(",
"\"hadoop-hdfs-\"",
")",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"mapred",
"(",
")",
")",
",",
"new",
"PrefixDirectoryFilter",
"(",
"\"hadoop-mapreduce-client-common\"",
")",
")",
")",
";",
"res",
".",
"add",
"(",
"new",
"SearchDirectory",
"(",
"new",
"File",
"(",
"loc",
".",
"mapred",
"(",
")",
")",
",",
"new",
"PrefixDirectoryFilter",
"(",
"\"hadoop-mapreduce-client-core\"",
")",
")",
")",
";",
"res",
".",
"addAll",
"(",
"parseUserLibs",
"(",
")",
")",
";",
"return",
"res",
";",
"}"
] | gets base directories to discover classpath elements in .
| train | false |
69,521 | public void testClearParameters() throws SQLException {
PreparedStatement ps=null;
try {
String query="select * from zoo where id = ? and family=?";
ps=conn.prepareStatement(query);
ps.clearParameters();
try {
ps.execute();
fail("SQLException is not thrown during execute method after calling clearParameters()");
}
catch ( SQLException sql) {
}
ps.setInt(1,2);
ps.setString(2,"dog");
ps.clearParameters();
try {
ps.execute();
fail("SQLException is not thrown during execute method after calling clearParameters()");
}
catch ( SQLException sqle) {
}
ps.setInt(1,2);
ps.clearParameters();
try {
ps.execute();
fail("SQLException is not thrown during execute method after calling clearParameters()");
}
catch ( SQLException sqle) {
}
ps.setInt(1,2);
ps.setString(2,"cat");
try {
ps.execute();
}
catch ( SQLException sqle) {
fail("SQLException is thrown during execute method after calling clearParameters() twice");
}
}
finally {
try {
ps.close();
}
catch ( SQLException ee) {
}
}
}
| [
"public",
"void",
"testClearParameters",
"(",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"ps",
"=",
"null",
";",
"try",
"{",
"String",
"query",
"=",
"\"select * from zoo where id = ? and family=?\"",
";",
"ps",
"=",
"conn",
".",
"prepareStatement",
"(",
"query",
")",
";",
"ps",
".",
"clearParameters",
"(",
")",
";",
"try",
"{",
"ps",
".",
"execute",
"(",
")",
";",
"fail",
"(",
"\"SQLException is not thrown during execute method after calling clearParameters()\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sql",
")",
"{",
"}",
"ps",
".",
"setInt",
"(",
"1",
",",
"2",
")",
";",
"ps",
".",
"setString",
"(",
"2",
",",
"\"dog\"",
")",
";",
"ps",
".",
"clearParameters",
"(",
")",
";",
"try",
"{",
"ps",
".",
"execute",
"(",
")",
";",
"fail",
"(",
"\"SQLException is not thrown during execute method after calling clearParameters()\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqle",
")",
"{",
"}",
"ps",
".",
"setInt",
"(",
"1",
",",
"2",
")",
";",
"ps",
".",
"clearParameters",
"(",
")",
";",
"try",
"{",
"ps",
".",
"execute",
"(",
")",
";",
"fail",
"(",
"\"SQLException is not thrown during execute method after calling clearParameters()\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqle",
")",
"{",
"}",
"ps",
".",
"setInt",
"(",
"1",
",",
"2",
")",
";",
"ps",
".",
"setString",
"(",
"2",
",",
"\"cat\"",
")",
";",
"try",
"{",
"ps",
".",
"execute",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqle",
")",
"{",
"fail",
"(",
"\"SQLException is thrown during execute method after calling clearParameters() twice\"",
")",
";",
"}",
"}",
"finally",
"{",
"try",
"{",
"ps",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"ee",
")",
"{",
"}",
"}",
"}"
] | test fails : clearparameters should be implemented with stmt . reset ( )
| train | false |
69,524 | public static Object demuxArray(Object src,int[] dims,Class<?> componentType){
Object dst=null;
if (componentType != byte.class) {
dst=Array.newInstance(componentType,dims);
}
else {
int[] dimsTemp=new int[dims.length + 1];
System.arraycopy(dims,0,dimsTemp,0,dims.length);
dimsTemp[dims.length]=1;
dst=Array.newInstance(componentType,dimsTemp);
}
_fillDemux(0,dims,src,0,dst);
return dst;
}
| [
"public",
"static",
"Object",
"demuxArray",
"(",
"Object",
"src",
",",
"int",
"[",
"]",
"dims",
",",
"Class",
"<",
"?",
">",
"componentType",
")",
"{",
"Object",
"dst",
"=",
"null",
";",
"if",
"(",
"componentType",
"!=",
"byte",
".",
"class",
")",
"{",
"dst",
"=",
"Array",
".",
"newInstance",
"(",
"componentType",
",",
"dims",
")",
";",
"}",
"else",
"{",
"int",
"[",
"]",
"dimsTemp",
"=",
"new",
"int",
"[",
"dims",
".",
"length",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"dims",
",",
"0",
",",
"dimsTemp",
",",
"0",
",",
"dims",
".",
"length",
")",
";",
"dimsTemp",
"[",
"dims",
".",
"length",
"]",
"=",
"1",
";",
"dst",
"=",
"Array",
".",
"newInstance",
"(",
"componentType",
",",
"dimsTemp",
")",
";",
"}",
"_fillDemux",
"(",
"0",
",",
"dims",
",",
"src",
",",
"0",
",",
"dst",
")",
";",
"return",
"dst",
";",
"}"
] | demux single - dimension array ( x [ ] ) to a multi - dimension array ( x [ ] [ ] [ ] )
| train | false |