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,656 | public Map<String,Object> flattenAsMap(){
if (flattenedMap != null) return flattenedMap;
flattenedMap=newJsonifyLinkedHashMap();
reduce(source);
while (!elementIters.isEmpty()) {
IndexedPeekIterator<?> deepestIter=elementIters.getLast();
if (!deepestIter.hasNext()) {
elementIters.removeLast();
}
else if (deepestIter.peek() instanceof Member) {
Member mem=(Member)deepestIter.next();
reduce(mem.getValue());
}
else {
JsonValue val=(JsonValue)deepestIter.next();
reduce(val);
}
}
return flattenedMap;
}
| [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"flattenAsMap",
"(",
")",
"{",
"if",
"(",
"flattenedMap",
"!=",
"null",
")",
"return",
"flattenedMap",
";",
"flattenedMap",
"=",
"newJsonifyLinkedHashMap",
"(",
")",
";",
"reduce",
"(",
"source",
")",
";",
"while",
"(",
"!",
"elementIters",
".",
"isEmpty",
"(",
")",
")",
"{",
"IndexedPeekIterator",
"<",
"?",
">",
"deepestIter",
"=",
"elementIters",
".",
"getLast",
"(",
")",
";",
"if",
"(",
"!",
"deepestIter",
".",
"hasNext",
"(",
")",
")",
"{",
"elementIters",
".",
"removeLast",
"(",
")",
";",
"}",
"else",
"if",
"(",
"deepestIter",
".",
"peek",
"(",
")",
"instanceof",
"Member",
")",
"{",
"Member",
"mem",
"=",
"(",
"Member",
")",
"deepestIter",
".",
"next",
"(",
")",
";",
"reduce",
"(",
"mem",
".",
"getValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"JsonValue",
"val",
"=",
"(",
"JsonValue",
")",
"deepestIter",
".",
"next",
"(",
")",
";",
"reduce",
"(",
"val",
")",
";",
"}",
"}",
"return",
"flattenedMap",
";",
"}"
] | returns a flattened json as map .
| train | true |
69,658 | public Object readObject() throws IOException {
int tag=read();
switch (tag) {
case 'N':
return null;
case 'T':
return Boolean.valueOf(true);
case 'F':
return Boolean.valueOf(false);
case 'I':
return Integer.valueOf(parseInt());
case 'L':
return Long.valueOf(parseLong());
case 'D':
return Double.valueOf(parseDouble());
case 'd':
return new Date(parseLong());
case 'x':
case 'X':
{
_isLastChunk=tag == 'X';
_chunkLength=(read() << 8) + read();
return parseXML();
}
case 's':
case 'S':
{
_isLastChunk=tag == 'S';
_chunkLength=(read() << 8) + read();
int data;
_sbuf.setLength(0);
while ((data=parseChar()) >= 0) _sbuf.append((char)data);
return _sbuf.toString();
}
case 'b':
case 'B':
{
_isLastChunk=tag == 'B';
_chunkLength=(read() << 8) + read();
int data;
ByteArrayOutputStream bos=new ByteArrayOutputStream();
while ((data=parseByte()) >= 0) bos.write(data);
return bos.toByteArray();
}
case 'V':
{
String type=readType();
int length=readLength();
return _serializerFactory.readList(this,length,type);
}
case 'M':
{
String type=readType();
return _serializerFactory.readMap(this,type);
}
case 'R':
{
int ref=parseInt();
return _refs.get(ref);
}
case 'r':
{
String type=readType();
String url=readString();
return resolveRemote(type,url);
}
default :
throw error("unknown code for readObject at " + codeName(tag));
}
}
| [
"public",
"Object",
"readObject",
"(",
")",
"throws",
"IOException",
"{",
"int",
"tag",
"=",
"read",
"(",
")",
";",
"switch",
"(",
"tag",
")",
"{",
"case",
"'N'",
":",
"return",
"null",
";",
"case",
"'T'",
":",
"return",
"Boolean",
".",
"valueOf",
"(",
"true",
")",
";",
"case",
"'F'",
":",
"return",
"Boolean",
".",
"valueOf",
"(",
"false",
")",
";",
"case",
"'I'",
":",
"return",
"Integer",
".",
"valueOf",
"(",
"parseInt",
"(",
")",
")",
";",
"case",
"'L'",
":",
"return",
"Long",
".",
"valueOf",
"(",
"parseLong",
"(",
")",
")",
";",
"case",
"'D'",
":",
"return",
"Double",
".",
"valueOf",
"(",
"parseDouble",
"(",
")",
")",
";",
"case",
"'d'",
":",
"return",
"new",
"Date",
"(",
"parseLong",
"(",
")",
")",
";",
"case",
"'x'",
":",
"case",
"'X'",
":",
"{",
"_isLastChunk",
"=",
"tag",
"==",
"'X'",
";",
"_chunkLength",
"=",
"(",
"read",
"(",
")",
"<<",
"8",
")",
"+",
"read",
"(",
")",
";",
"return",
"parseXML",
"(",
")",
";",
"}",
"case",
"'s'",
":",
"case",
"'S'",
":",
"{",
"_isLastChunk",
"=",
"tag",
"==",
"'S'",
";",
"_chunkLength",
"=",
"(",
"read",
"(",
")",
"<<",
"8",
")",
"+",
"read",
"(",
")",
";",
"int",
"data",
";",
"_sbuf",
".",
"setLength",
"(",
"0",
")",
";",
"while",
"(",
"(",
"data",
"=",
"parseChar",
"(",
")",
")",
">=",
"0",
")",
"_sbuf",
".",
"append",
"(",
"(",
"char",
")",
"data",
")",
";",
"return",
"_sbuf",
".",
"toString",
"(",
")",
";",
"}",
"case",
"'b'",
":",
"case",
"'B'",
":",
"{",
"_isLastChunk",
"=",
"tag",
"==",
"'B'",
";",
"_chunkLength",
"=",
"(",
"read",
"(",
")",
"<<",
"8",
")",
"+",
"read",
"(",
")",
";",
"int",
"data",
";",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"while",
"(",
"(",
"data",
"=",
"parseByte",
"(",
")",
")",
">=",
"0",
")",
"bos",
".",
"write",
"(",
"data",
")",
";",
"return",
"bos",
".",
"toByteArray",
"(",
")",
";",
"}",
"case",
"'V'",
":",
"{",
"String",
"type",
"=",
"readType",
"(",
")",
";",
"int",
"length",
"=",
"readLength",
"(",
")",
";",
"return",
"_serializerFactory",
".",
"readList",
"(",
"this",
",",
"length",
",",
"type",
")",
";",
"}",
"case",
"'M'",
":",
"{",
"String",
"type",
"=",
"readType",
"(",
")",
";",
"return",
"_serializerFactory",
".",
"readMap",
"(",
"this",
",",
"type",
")",
";",
"}",
"case",
"'R'",
":",
"{",
"int",
"ref",
"=",
"parseInt",
"(",
")",
";",
"return",
"_refs",
".",
"get",
"(",
"ref",
")",
";",
"}",
"case",
"'r'",
":",
"{",
"String",
"type",
"=",
"readType",
"(",
")",
";",
"String",
"url",
"=",
"readString",
"(",
")",
";",
"return",
"resolveRemote",
"(",
"type",
",",
"url",
")",
";",
"}",
"default",
":",
"throw",
"error",
"(",
"\"unknown code for readObject at \"",
"+",
"codeName",
"(",
"tag",
")",
")",
";",
"}",
"}"
] | reads an arbitrary object from the input stream when the type is unknown .
| train | true |
69,661 | @Override public String toString(){
return "Dirichlet(" + Arrays.asList(alphas) + ")";
}
| [
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"Dirichlet(\"",
"+",
"Arrays",
".",
"asList",
"(",
"alphas",
")",
"+",
"\")\"",
";",
"}"
] | returns the name and hyper - parameters of the distribution
| train | false |
69,664 | public Epoch createEpoch(ServerViewController recManager){
epochsLock.lock();
Set<Integer> keys=epochs.keySet();
int max=-1;
for ( int k : keys) {
if (k > max) max=k;
}
max++;
Epoch epoch=new Epoch(recManager,this,max);
epochs.put(max,epoch);
epochsLock.unlock();
return epoch;
}
| [
"public",
"Epoch",
"createEpoch",
"(",
"ServerViewController",
"recManager",
")",
"{",
"epochsLock",
".",
"lock",
"(",
")",
";",
"Set",
"<",
"Integer",
">",
"keys",
"=",
"epochs",
".",
"keySet",
"(",
")",
";",
"int",
"max",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"k",
":",
"keys",
")",
"{",
"if",
"(",
"k",
">",
"max",
")",
"max",
"=",
"k",
";",
"}",
"max",
"++",
";",
"Epoch",
"epoch",
"=",
"new",
"Epoch",
"(",
"recManager",
",",
"this",
",",
"max",
")",
";",
"epochs",
".",
"put",
"(",
"max",
",",
"epoch",
")",
";",
"epochsLock",
".",
"unlock",
"(",
")",
";",
"return",
"epoch",
";",
"}"
] | creates a epoch associated with this consensus , supposedly the next
| train | false |
69,666 | public static String fileBuilderUrl(String baseUri,String seed,byte[] signatureSecret,long fileId,long fileAccessHash){
byte[] seedBytes=decodeHex(seed.toCharArray());
byte[] fileIdBytes=getBytes(fileId);
byte[] accessHashBytes=getBytes(fileAccessHash);
byte[] bytesToSign=ArrayUtils.addAll(ArrayUtils.addAll(seedBytes,fileIdBytes),accessHashBytes);
String signPart=HmacUtils.hmacSha256Hex(signatureSecret,bytesToSign);
String signature=seed + "_" + signPart;
return baseUri + "/" + fileId+ "?signature="+ signature;
}
| [
"public",
"static",
"String",
"fileBuilderUrl",
"(",
"String",
"baseUri",
",",
"String",
"seed",
",",
"byte",
"[",
"]",
"signatureSecret",
",",
"long",
"fileId",
",",
"long",
"fileAccessHash",
")",
"{",
"byte",
"[",
"]",
"seedBytes",
"=",
"decodeHex",
"(",
"seed",
".",
"toCharArray",
"(",
")",
")",
";",
"byte",
"[",
"]",
"fileIdBytes",
"=",
"getBytes",
"(",
"fileId",
")",
";",
"byte",
"[",
"]",
"accessHashBytes",
"=",
"getBytes",
"(",
"fileAccessHash",
")",
";",
"byte",
"[",
"]",
"bytesToSign",
"=",
"ArrayUtils",
".",
"addAll",
"(",
"ArrayUtils",
".",
"addAll",
"(",
"seedBytes",
",",
"fileIdBytes",
")",
",",
"accessHashBytes",
")",
";",
"String",
"signPart",
"=",
"HmacUtils",
".",
"hmacSha256Hex",
"(",
"signatureSecret",
",",
"bytesToSign",
")",
";",
"String",
"signature",
"=",
"seed",
"+",
"\"_\"",
"+",
"signPart",
";",
"return",
"baseUri",
"+",
"\"/\"",
"+",
"fileId",
"+",
"\"?signature=\"",
"+",
"signature",
";",
"}"
] | returns url with calculated signature for specific file with specific file builder parameters
| train | false |
69,668 | protected void addNonMatch(StringBuilder sb,String text){
sb.append(text);
}
| [
"protected",
"void",
"addNonMatch",
"(",
"StringBuilder",
"sb",
",",
"String",
"text",
")",
"{",
"sb",
".",
"append",
"(",
"text",
")",
";",
"}"
] | called while highlighting a single result , to append a non - matching chunk of text from the suggestion to the provided fragments list .
| train | false |
69,669 | public CertificateToken(X509Certificate x509Certificate){
if (x509Certificate == null) {
throw new NullPointerException("X509 certificate is missing");
}
this.x509Certificate=x509Certificate;
this.issuerX500Principal=x509Certificate.getIssuerX500Principal();
this.signatureAlgorithm=SignatureAlgorithm.forOID(x509Certificate.getSigAlgOID());
this.digestAlgorithm=signatureAlgorithm.getDigestAlgorithm();
this.encryptionAlgorithm=signatureAlgorithm.getEncryptionAlgorithm();
super.extraInfo=this.extraInfo=new CertificateTokenValidationExtraInfo();
}
| [
"public",
"CertificateToken",
"(",
"X509Certificate",
"x509Certificate",
")",
"{",
"if",
"(",
"x509Certificate",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"X509 certificate is missing\"",
")",
";",
"}",
"this",
".",
"x509Certificate",
"=",
"x509Certificate",
";",
"this",
".",
"issuerX500Principal",
"=",
"x509Certificate",
".",
"getIssuerX500Principal",
"(",
")",
";",
"this",
".",
"signatureAlgorithm",
"=",
"SignatureAlgorithm",
".",
"forOID",
"(",
"x509Certificate",
".",
"getSigAlgOID",
"(",
")",
")",
";",
"this",
".",
"digestAlgorithm",
"=",
"signatureAlgorithm",
".",
"getDigestAlgorithm",
"(",
")",
";",
"this",
".",
"encryptionAlgorithm",
"=",
"signatureAlgorithm",
".",
"getEncryptionAlgorithm",
"(",
")",
";",
"super",
".",
"extraInfo",
"=",
"this",
".",
"extraInfo",
"=",
"new",
"CertificateTokenValidationExtraInfo",
"(",
")",
";",
"}"
] | creates a certificatetoken wrapping the provided x509certificate .
| train | false |
69,670 | private PlatformTarget createPlatformCache(IgniteCacheProxy cache){
return new PlatformCache(platformCtx,cache,false,cacheExts);
}
| [
"private",
"PlatformTarget",
"createPlatformCache",
"(",
"IgniteCacheProxy",
"cache",
")",
"{",
"return",
"new",
"PlatformCache",
"(",
"platformCtx",
",",
"cache",
",",
"false",
",",
"cacheExts",
")",
";",
"}"
] | creates new platform cache .
| train | false |
69,671 | public List<Class<?>> findAvailableImplementations(Class<?> interfase) throws IOException {
_resourcesNotLoaded.clear();
List<Class<?>> implementations=new ArrayList<>();
List<String> strings=findAvailableStrings(interfase.getName());
for ( String className : strings) {
try {
Class<?> impl=_classLoader.loadClass(className);
if (interfase.isAssignableFrom(impl)) {
implementations.add(impl);
}
else {
_resourcesNotLoaded.add(className);
}
}
catch ( Exception notAvailable) {
_resourcesNotLoaded.add(className);
}
}
return implementations;
}
| [
"public",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"findAvailableImplementations",
"(",
"Class",
"<",
"?",
">",
"interfase",
")",
"throws",
"IOException",
"{",
"_resourcesNotLoaded",
".",
"clear",
"(",
")",
";",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"implementations",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"List",
"<",
"String",
">",
"strings",
"=",
"findAvailableStrings",
"(",
"interfase",
".",
"getName",
"(",
")",
")",
";",
"for",
"(",
"String",
"className",
":",
"strings",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"impl",
"=",
"_classLoader",
".",
"loadClass",
"(",
"className",
")",
";",
"if",
"(",
"interfase",
".",
"isAssignableFrom",
"(",
"impl",
")",
")",
"{",
"implementations",
".",
"add",
"(",
"impl",
")",
";",
"}",
"else",
"{",
"_resourcesNotLoaded",
".",
"add",
"(",
"className",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"notAvailable",
")",
"{",
"_resourcesNotLoaded",
".",
"add",
"(",
"className",
")",
";",
"}",
"}",
"return",
"implementations",
";",
"}"
] | assumes the class specified points to a file in the classpath that contains the name of a class that implements or is a subclass of the specfied class . < p / > any class that cannot be loaded or are not assignable to the specified class will be skipped and placed in the ' resourcesnotloaded ' collection . < p / > example classpath : < p / > meta - inf / java . io . inputstream # contains the classname org . acme . acmeinputstream meta - inf / java . io . inputstream # contains the classname org . widget . neatoinputstream meta - inf / java . io . inputstream # contains the classname com . foo . barinputstream < p / > resourcefinder finder = new resourcefinder ( " meta - inf / " ) ; list classes = finder . findallimplementations ( java . io . inputstream . class ) ; classes . contains ( " org . acme . acmeinputstream " ) ; / / true classes . contains ( " org . widget . neatoinputstream " ) ; / / true classes . contains ( " com . foo . barinputstream " ) ; / / true
| train | true |
69,673 | public static void isCIDR(String network) throws IllegalArgumentException {
String[] hostMask=network.split("/");
if (hostMask.length != 2) {
throw new IllegalArgumentException("subnetAddress is not a CIDR");
}
isValidInetAddress(hostMask[0]);
if (Integer.parseUnsignedInt(hostMask[1]) > 32) {
throw new IllegalArgumentException("CIDR mask may not be larger than 32");
}
}
| [
"public",
"static",
"void",
"isCIDR",
"(",
"String",
"network",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"[",
"]",
"hostMask",
"=",
"network",
".",
"split",
"(",
"\"/\"",
")",
";",
"if",
"(",
"hostMask",
".",
"length",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"subnetAddress is not a CIDR\"",
")",
";",
"}",
"isValidInetAddress",
"(",
"hostMask",
"[",
"0",
"]",
")",
";",
"if",
"(",
"Integer",
".",
"parseUnsignedInt",
"(",
"hostMask",
"[",
"1",
"]",
")",
">",
"32",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"CIDR mask may not be larger than 32\"",
")",
";",
"}",
"}"
] | verify if cidr string is a valid cidr address .
| train | false |
69,674 | private void synchronize(){
s_logger.log(Level.INFO,"");
s_logger.log(Level.INFO,"migrateSynchronize");
if (isUpgrade()) {
dropDBObjects(DBObject_Check.class);
dropDBObjects(DBObject_Unique.class);
dropDBObjects(DBObject_ForeignKey.class);
dropDBObjects(DBObject_View.class);
dropDBObjects(DBObject_Operator.class);
dropDBObjects(DBObject_Trigger.class);
dropDBObjects(DBObject_Function.class);
truncateTemporaryTables();
ArrayList<String> truncatedTables=new ArrayList<String>();
for (Iterator<String> it=m_trackingList.iterator(); it.hasNext(); ) {
truncatedTables.add(it.next());
}
dropSystemClients();
createTemporaryTargetIndexes();
purgeSystemRecords(truncatedTables);
dropDBObjects(DBObject_PrimaryKey.class);
dropDBObjects(DBObject_Index.class);
dropTemporaryIndexes();
}
synchronizeDBSequencesFromSource();
synchronizeTables();
synchronizeDBSequencesDropUnused();
if (isCopy()) convertTriggersToFunctions();
recreateDBObjects(DBObject_Function.class,true);
recreateDBObjects(DBObject_Trigger.class,false);
recreateDBObjects(DBObject_Operator.class,false);
recreateDBObjects(DBObject_View.class,true);
if (isUpgrade()) {
createTemporaryPrimaryKeys();
synchronizePrimaryKeys();
}
synchronizeData();
if (isUpgrade()) dropTemporaryIndexes();
recreateDBObjects(DBObject_Index.class,false);
recreateDBObjects(DBObject_PrimaryKey.class,false);
if (isUpgrade()) {
populateNewParents();
createTemporaryIndexes();
preserveParentLinks();
purgeOrphans();
dropTemporaryIndexes();
enforceCheckConstraints();
cleanupCustomizations();
cleanupADSequences();
cleanupTranslations();
cleanupTerminology();
cleanupTreeNodes();
cleanupSecurity();
bumpVersionInfo();
}
recreateDBObjects(DBObject_ForeignKey.class,false);
recreateDBObjects(DBObject_Check.class,false);
recreateDBObjects(DBObject_Unique.class,false);
m_target.setDoNotInterrupt(false);
}
| [
"private",
"void",
"synchronize",
"(",
")",
"{",
"s_logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"\"",
")",
";",
"s_logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"migrateSynchronize\"",
")",
";",
"if",
"(",
"isUpgrade",
"(",
")",
")",
"{",
"dropDBObjects",
"(",
"DBObject_Check",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_Unique",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_ForeignKey",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_View",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_Operator",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_Trigger",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_Function",
".",
"class",
")",
";",
"truncateTemporaryTables",
"(",
")",
";",
"ArrayList",
"<",
"String",
">",
"truncatedTables",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Iterator",
"<",
"String",
">",
"it",
"=",
"m_trackingList",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"truncatedTables",
".",
"add",
"(",
"it",
".",
"next",
"(",
")",
")",
";",
"}",
"dropSystemClients",
"(",
")",
";",
"createTemporaryTargetIndexes",
"(",
")",
";",
"purgeSystemRecords",
"(",
"truncatedTables",
")",
";",
"dropDBObjects",
"(",
"DBObject_PrimaryKey",
".",
"class",
")",
";",
"dropDBObjects",
"(",
"DBObject_Index",
".",
"class",
")",
";",
"dropTemporaryIndexes",
"(",
")",
";",
"}",
"synchronizeDBSequencesFromSource",
"(",
")",
";",
"synchronizeTables",
"(",
")",
";",
"synchronizeDBSequencesDropUnused",
"(",
")",
";",
"if",
"(",
"isCopy",
"(",
")",
")",
"convertTriggersToFunctions",
"(",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Function",
".",
"class",
",",
"true",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Trigger",
".",
"class",
",",
"false",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Operator",
".",
"class",
",",
"false",
")",
";",
"recreateDBObjects",
"(",
"DBObject_View",
".",
"class",
",",
"true",
")",
";",
"if",
"(",
"isUpgrade",
"(",
")",
")",
"{",
"createTemporaryPrimaryKeys",
"(",
")",
";",
"synchronizePrimaryKeys",
"(",
")",
";",
"}",
"synchronizeData",
"(",
")",
";",
"if",
"(",
"isUpgrade",
"(",
")",
")",
"dropTemporaryIndexes",
"(",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Index",
".",
"class",
",",
"false",
")",
";",
"recreateDBObjects",
"(",
"DBObject_PrimaryKey",
".",
"class",
",",
"false",
")",
";",
"if",
"(",
"isUpgrade",
"(",
")",
")",
"{",
"populateNewParents",
"(",
")",
";",
"createTemporaryIndexes",
"(",
")",
";",
"preserveParentLinks",
"(",
")",
";",
"purgeOrphans",
"(",
")",
";",
"dropTemporaryIndexes",
"(",
")",
";",
"enforceCheckConstraints",
"(",
")",
";",
"cleanupCustomizations",
"(",
")",
";",
"cleanupADSequences",
"(",
")",
";",
"cleanupTranslations",
"(",
")",
";",
"cleanupTerminology",
"(",
")",
";",
"cleanupTreeNodes",
"(",
")",
";",
"cleanupSecurity",
"(",
")",
";",
"bumpVersionInfo",
"(",
")",
";",
"}",
"recreateDBObjects",
"(",
"DBObject_ForeignKey",
".",
"class",
",",
"false",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Check",
".",
"class",
",",
"false",
")",
";",
"recreateDBObjects",
"(",
"DBObject_Unique",
".",
"class",
",",
"false",
")",
";",
"m_target",
".",
"setDoNotInterrupt",
"(",
"false",
")",
";",
"}"
] | synchronize target from source
| train | false |
69,676 | public static long[] shiftRightI(long[] v,int off){
if (off == 0) {
return v;
}
if (off < 0) {
return shiftLeftI(v,-off);
}
final int shiftWords=off >>> LONG_LOG2_SIZE;
final int shiftBits=off & LONG_LOG2_MASK;
if (shiftWords >= v.length) {
return zeroI(v);
}
if (shiftBits == 0) {
System.arraycopy(v,shiftWords,v,0,v.length - shiftWords);
Arrays.fill(v,v.length - shiftWords,v.length,0);
return v;
}
final int unshiftBits=Long.SIZE - shiftBits;
for (int i=0; i < v.length - shiftWords - 1; i++) {
final int src=i + shiftWords;
v[i]=(v[src + 1] << unshiftBits) | (v[src] >>> shiftBits);
}
v[v.length - shiftWords - 1]=v[v.length - 1] >>> shiftBits;
Arrays.fill(v,v.length - shiftWords,v.length,0);
return v;
}
| [
"public",
"static",
"long",
"[",
"]",
"shiftRightI",
"(",
"long",
"[",
"]",
"v",
",",
"int",
"off",
")",
"{",
"if",
"(",
"off",
"==",
"0",
")",
"{",
"return",
"v",
";",
"}",
"if",
"(",
"off",
"<",
"0",
")",
"{",
"return",
"shiftLeftI",
"(",
"v",
",",
"-",
"off",
")",
";",
"}",
"final",
"int",
"shiftWords",
"=",
"off",
">",
">",
">",
"LONG_LOG2_SIZE",
";",
"final",
"int",
"shiftBits",
"=",
"off",
"&",
"LONG_LOG2_MASK",
";",
"if",
"(",
"shiftWords",
">=",
"v",
".",
"length",
")",
"{",
"return",
"zeroI",
"(",
"v",
")",
";",
"}",
"if",
"(",
"shiftBits",
"==",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"v",
",",
"shiftWords",
",",
"v",
",",
"0",
",",
"v",
".",
"length",
"-",
"shiftWords",
")",
";",
"Arrays",
".",
"fill",
"(",
"v",
",",
"v",
".",
"length",
"-",
"shiftWords",
",",
"v",
".",
"length",
",",
"0",
")",
";",
"return",
"v",
";",
"}",
"final",
"int",
"unshiftBits",
"=",
"Long",
".",
"SIZE",
"-",
"shiftBits",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"v",
".",
"length",
"-",
"shiftWords",
"-",
"1",
";",
"i",
"++",
")",
"{",
"final",
"int",
"src",
"=",
"i",
"+",
"shiftWords",
";",
"v",
"[",
"i",
"]",
"=",
"(",
"v",
"[",
"src",
"+",
"1",
"]",
"<<",
"unshiftBits",
")",
"|",
"(",
"v",
"[",
"src",
"]",
">",
">",
">",
"shiftBits",
")",
";",
"}",
"v",
"[",
"v",
".",
"length",
"-",
"shiftWords",
"-",
"1",
"]",
"=",
"v",
"[",
"v",
".",
"length",
"-",
"1",
"]",
">",
">",
">",
"shiftBits",
";",
"Arrays",
".",
"fill",
"(",
"v",
",",
"v",
".",
"length",
"-",
"shiftWords",
",",
"v",
".",
"length",
",",
"0",
")",
";",
"return",
"v",
";",
"}"
] | shift a long [ ] bitset inplace . low - endian layout for the array .
| train | true |
69,679 | @Override public Grammar loadGrammar(XMLInputSource source) throws IOException, XNIException {
reset(fLoaderConfig);
fSettingsChanged=false;
XSDDescription desc=new XSDDescription();
desc.fContextType=XSDDescription.CONTEXT_PREPARSE;
desc.setBaseSystemId(source.getBaseSystemId());
desc.setLiteralSystemId(source.getSystemId());
Hashtable locationPairs=new Hashtable();
processExternalHints(fExternalSchemas,fExternalNoNSSchema,locationPairs,fErrorReporter);
SchemaGrammar grammar=loadSchema(desc,source,locationPairs);
if (grammar != null && fGrammarPool != null) {
fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA,fGrammarBucket.getGrammars());
if (fIsCheckedFully && fJAXPCache.get(grammar) != grammar) {
XSConstraints.fullSchemaChecking(fGrammarBucket,fSubGroupHandler,fCMBuilder,fErrorReporter);
}
}
return grammar;
}
| [
"@",
"Override",
"public",
"Grammar",
"loadGrammar",
"(",
"XMLInputSource",
"source",
")",
"throws",
"IOException",
",",
"XNIException",
"{",
"reset",
"(",
"fLoaderConfig",
")",
";",
"fSettingsChanged",
"=",
"false",
";",
"XSDDescription",
"desc",
"=",
"new",
"XSDDescription",
"(",
")",
";",
"desc",
".",
"fContextType",
"=",
"XSDDescription",
".",
"CONTEXT_PREPARSE",
";",
"desc",
".",
"setBaseSystemId",
"(",
"source",
".",
"getBaseSystemId",
"(",
")",
")",
";",
"desc",
".",
"setLiteralSystemId",
"(",
"source",
".",
"getSystemId",
"(",
")",
")",
";",
"Hashtable",
"locationPairs",
"=",
"new",
"Hashtable",
"(",
")",
";",
"processExternalHints",
"(",
"fExternalSchemas",
",",
"fExternalNoNSSchema",
",",
"locationPairs",
",",
"fErrorReporter",
")",
";",
"SchemaGrammar",
"grammar",
"=",
"loadSchema",
"(",
"desc",
",",
"source",
",",
"locationPairs",
")",
";",
"if",
"(",
"grammar",
"!=",
"null",
"&&",
"fGrammarPool",
"!=",
"null",
")",
"{",
"fGrammarPool",
".",
"cacheGrammars",
"(",
"XMLGrammarDescription",
".",
"XML_SCHEMA",
",",
"fGrammarBucket",
".",
"getGrammars",
"(",
")",
")",
";",
"if",
"(",
"fIsCheckedFully",
"&&",
"fJAXPCache",
".",
"get",
"(",
"grammar",
")",
"!=",
"grammar",
")",
"{",
"XSConstraints",
".",
"fullSchemaChecking",
"(",
"fGrammarBucket",
",",
"fSubGroupHandler",
",",
"fCMBuilder",
",",
"fErrorReporter",
")",
";",
"}",
"}",
"return",
"grammar",
";",
"}"
] | returns a grammar object by parsing the contents of the entity pointed to by source .
| train | false |
69,680 | public void interrupt(){
if (m_pstmt != null) {
try {
m_pstmt.cancel();
close();
}
catch ( SQLException e) {
log.log(Level.SEVERE,"Cannot cancel SQL statement",e);
}
}
super.interrupt();
}
| [
"public",
"void",
"interrupt",
"(",
")",
"{",
"if",
"(",
"m_pstmt",
"!=",
"null",
")",
"{",
"try",
"{",
"m_pstmt",
".",
"cancel",
"(",
")",
";",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"log",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Cannot cancel SQL statement\"",
",",
"e",
")",
";",
"}",
"}",
"super",
".",
"interrupt",
"(",
")",
";",
"}"
] | interrupt this thread - cancel the query if still in execution carlos ruiz - globalqss - [ 2826660 ] - info product performance big problem
| train | false |
69,681 | private boolean hasNextPostponed(){
return !postponedRoutes.isEmpty();
}
| [
"private",
"boolean",
"hasNextPostponed",
"(",
")",
"{",
"return",
"!",
"postponedRoutes",
".",
"isEmpty",
"(",
")",
";",
"}"
] | returns true if there is another postponed route to try .
| train | false |
69,683 | protected void cleanupSuspendState(DLockRequestMessage request){
postReleaseLock(request.getRemoteThread(),request.getObjectName());
}
| [
"protected",
"void",
"cleanupSuspendState",
"(",
"DLockRequestMessage",
"request",
")",
"{",
"postReleaseLock",
"(",
"request",
".",
"getRemoteThread",
"(",
")",
",",
"request",
".",
"getObjectName",
"(",
")",
")",
";",
"}"
] | departure or other codepath not specific to unlock requires that we cleanup suspend state that was already permitted to request . this needs to be invoked for both regular and suspend locks . < p > synchronizes on suspendlock .
| train | false |
69,684 | public void initDiskCache(){
synchronized (mDiskCacheLock) {
if (mDiskLruCache == null || mDiskLruCache.isClosed()) {
File diskCacheDir=mCacheParams.diskCacheDir;
if (mCacheParams.diskCacheEnabled && diskCacheDir != null) {
if (!diskCacheDir.exists()) {
diskCacheDir.mkdirs();
}
if (Utils.getUsableSpace(diskCacheDir) > mCacheParams.diskCacheSize) {
try {
mDiskLruCache=DiskLruCache.open(diskCacheDir,APP_VERSION,VALUE_COUNT,mCacheParams.diskCacheSize);
if (BuildConfig.DEBUG) {
VolleyLog.d("Disk cache initialized");
}
}
catch ( final IOException e) {
mCacheParams.diskCacheDir=null;
VolleyLog.e("initDiskCache - " + e);
}
}
}
}
mDiskCacheStarting=false;
mDiskCacheLock.notifyAll();
}
}
| [
"public",
"void",
"initDiskCache",
"(",
")",
"{",
"synchronized",
"(",
"mDiskCacheLock",
")",
"{",
"if",
"(",
"mDiskLruCache",
"==",
"null",
"||",
"mDiskLruCache",
".",
"isClosed",
"(",
")",
")",
"{",
"File",
"diskCacheDir",
"=",
"mCacheParams",
".",
"diskCacheDir",
";",
"if",
"(",
"mCacheParams",
".",
"diskCacheEnabled",
"&&",
"diskCacheDir",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"diskCacheDir",
".",
"exists",
"(",
")",
")",
"{",
"diskCacheDir",
".",
"mkdirs",
"(",
")",
";",
"}",
"if",
"(",
"Utils",
".",
"getUsableSpace",
"(",
"diskCacheDir",
")",
">",
"mCacheParams",
".",
"diskCacheSize",
")",
"{",
"try",
"{",
"mDiskLruCache",
"=",
"DiskLruCache",
".",
"open",
"(",
"diskCacheDir",
",",
"APP_VERSION",
",",
"VALUE_COUNT",
",",
"mCacheParams",
".",
"diskCacheSize",
")",
";",
"if",
"(",
"BuildConfig",
".",
"DEBUG",
")",
"{",
"VolleyLog",
".",
"d",
"(",
"\"Disk cache initialized\"",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"mCacheParams",
".",
"diskCacheDir",
"=",
"null",
";",
"VolleyLog",
".",
"e",
"(",
"\"initDiskCache - \"",
"+",
"e",
")",
";",
"}",
"}",
"}",
"}",
"mDiskCacheStarting",
"=",
"false",
";",
"mDiskCacheLock",
".",
"notifyAll",
"(",
")",
";",
"}",
"}"
] | initializes the disk cache . note that this includes disk access so this should not be executed on the main / ui thread . by default an imagecache does not initialize the disk cache when it is created , instead you should call initdiskcache ( ) to initialize it on a background thread .
| train | false |
69,685 | public static void cassandraSetupComplete(){
lock.countDown();
}
| [
"public",
"static",
"void",
"cassandraSetupComplete",
"(",
")",
"{",
"lock",
".",
"countDown",
"(",
")",
";",
"}"
] | this method is supposed to be called from within the cassandradaemon advice to signal that cassandra setup process is completed .
| train | false |
69,686 | public int compareTo(Object other){
@SuppressWarnings("unchecked") Ranking<V> otherRanking=(Ranking<V>)other;
return Double.compare(otherRanking.rankScore,rankScore);
}
| [
"public",
"int",
"compareTo",
"(",
"Object",
"other",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Ranking",
"<",
"V",
">",
"otherRanking",
"=",
"(",
"Ranking",
"<",
"V",
">",
")",
"other",
";",
"return",
"Double",
".",
"compare",
"(",
"otherRanking",
".",
"rankScore",
",",
"rankScore",
")",
";",
"}"
] | compares two ranking based on the rank score .
| train | false |
69,687 | public MecanumDrive(Motor leftFront,Motor leftRear,Motor rightFront,Motor rightRear,AngleSensor gyro){
this(leftFront,leftRear,rightFront,rightRear,gyro,null);
}
| [
"public",
"MecanumDrive",
"(",
"Motor",
"leftFront",
",",
"Motor",
"leftRear",
",",
"Motor",
"rightFront",
",",
"Motor",
"rightRear",
",",
"AngleSensor",
"gyro",
")",
"{",
"this",
"(",
"leftFront",
",",
"leftRear",
",",
"rightFront",
",",
"rightRear",
",",
"gyro",
",",
"null",
")",
";",
"}"
] | creates a new drivesystem subsystem that uses the supplied drive train and no shifter . the voltage send to the drive train is limited to [ - 1 . 0 , 1 . 0 ] .
| train | false |
69,688 | public ExampleSourceConfigurationWizard(ConfigurationListener listener){
super("Example Source Wizard",listener);
dataViewPane.setVisible(false);
addTitleStep();
addDataLoadingStep();
addColumnSeparatorStep();
addNameDefinitionStep();
addValueTypeDefinitionStep();
addAttributeTypeDefinitionStep();
addResultFileDefinitionStep();
addBottomComponent(dataViewPane);
}
| [
"public",
"ExampleSourceConfigurationWizard",
"(",
"ConfigurationListener",
"listener",
")",
"{",
"super",
"(",
"\"Example Source Wizard\"",
",",
"listener",
")",
";",
"dataViewPane",
".",
"setVisible",
"(",
"false",
")",
";",
"addTitleStep",
"(",
")",
";",
"addDataLoadingStep",
"(",
")",
";",
"addColumnSeparatorStep",
"(",
")",
";",
"addNameDefinitionStep",
"(",
")",
";",
"addValueTypeDefinitionStep",
"(",
")",
";",
"addAttributeTypeDefinitionStep",
"(",
")",
";",
"addResultFileDefinitionStep",
"(",
")",
";",
"addBottomComponent",
"(",
"dataViewPane",
")",
";",
"}"
] | creates a new wizard .
| train | false |
69,689 | int curveProgressToScreenY(float p){
if (p < 0 || p > 1) return mStackVisibleRect.top + (int)(p * mStackVisibleRect.height());
float pIndex=p * PrecisionSteps;
int pFloorIndex=(int)Math.floor(pIndex);
int pCeilIndex=(int)Math.ceil(pIndex);
float xFraction=0;
if (pFloorIndex < PrecisionSteps && (pCeilIndex != pFloorIndex)) {
float pFraction=(pIndex - pFloorIndex) / (pCeilIndex - pFloorIndex);
xFraction=(xp[pCeilIndex] - xp[pFloorIndex]) * pFraction;
}
float x=xp[pFloorIndex] + xFraction;
return mStackVisibleRect.top + (int)(x * mStackVisibleRect.height());
}
| [
"int",
"curveProgressToScreenY",
"(",
"float",
"p",
")",
"{",
"if",
"(",
"p",
"<",
"0",
"||",
"p",
">",
"1",
")",
"return",
"mStackVisibleRect",
".",
"top",
"+",
"(",
"int",
")",
"(",
"p",
"*",
"mStackVisibleRect",
".",
"height",
"(",
")",
")",
";",
"float",
"pIndex",
"=",
"p",
"*",
"PrecisionSteps",
";",
"int",
"pFloorIndex",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"pIndex",
")",
";",
"int",
"pCeilIndex",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"pIndex",
")",
";",
"float",
"xFraction",
"=",
"0",
";",
"if",
"(",
"pFloorIndex",
"<",
"PrecisionSteps",
"&&",
"(",
"pCeilIndex",
"!=",
"pFloorIndex",
")",
")",
"{",
"float",
"pFraction",
"=",
"(",
"pIndex",
"-",
"pFloorIndex",
")",
"/",
"(",
"pCeilIndex",
"-",
"pFloorIndex",
")",
";",
"xFraction",
"=",
"(",
"xp",
"[",
"pCeilIndex",
"]",
"-",
"xp",
"[",
"pFloorIndex",
"]",
")",
"*",
"pFraction",
";",
"}",
"float",
"x",
"=",
"xp",
"[",
"pFloorIndex",
"]",
"+",
"xFraction",
";",
"return",
"mStackVisibleRect",
".",
"top",
"+",
"(",
"int",
")",
"(",
"x",
"*",
"mStackVisibleRect",
".",
"height",
"(",
")",
")",
";",
"}"
] | converts from the progress along the curve to a screen coordinate .
| train | false |
69,690 | static Profile decode(final String info){
String[] params;
Profile profile;
String s;
params=info.split("\n");
profile=new Profile();
if (params.length > 0) {
s=params[0];
for ( final String host : OLD_SERVER_HOSTS) {
if (s.equals(host)) {
s=NEW_SERVER_HOST;
break;
}
}
if (s.length() != 0) {
profile.setHost(s);
}
}
if (params.length > 1) {
s=params[1];
if (s.length() != 0) {
profile.setUser(s);
}
}
if (params.length > 2) {
s=params[2];
if (s.length() != 0) {
profile.setPassword(s);
}
}
if (params.length > 3) {
s=params[3];
if (s.length() != 0) {
try {
profile.setPort(Integer.parseInt(s));
}
catch ( final NumberFormatException ex) {
}
}
}
return profile;
}
| [
"static",
"Profile",
"decode",
"(",
"final",
"String",
"info",
")",
"{",
"String",
"[",
"]",
"params",
";",
"Profile",
"profile",
";",
"String",
"s",
";",
"params",
"=",
"info",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"profile",
"=",
"new",
"Profile",
"(",
")",
";",
"if",
"(",
"params",
".",
"length",
">",
"0",
")",
"{",
"s",
"=",
"params",
"[",
"0",
"]",
";",
"for",
"(",
"final",
"String",
"host",
":",
"OLD_SERVER_HOSTS",
")",
"{",
"if",
"(",
"s",
".",
"equals",
"(",
"host",
")",
")",
"{",
"s",
"=",
"NEW_SERVER_HOST",
";",
"break",
";",
"}",
"}",
"if",
"(",
"s",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"profile",
".",
"setHost",
"(",
"s",
")",
";",
"}",
"}",
"if",
"(",
"params",
".",
"length",
">",
"1",
")",
"{",
"s",
"=",
"params",
"[",
"1",
"]",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"profile",
".",
"setUser",
"(",
"s",
")",
";",
"}",
"}",
"if",
"(",
"params",
".",
"length",
">",
"2",
")",
"{",
"s",
"=",
"params",
"[",
"2",
"]",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"profile",
".",
"setPassword",
"(",
"s",
")",
";",
"}",
"}",
"if",
"(",
"params",
".",
"length",
">",
"3",
")",
"{",
"s",
"=",
"params",
"[",
"3",
"]",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"try",
"{",
"profile",
".",
"setPort",
"(",
"Integer",
".",
"parseInt",
"(",
"s",
")",
")",
";",
"}",
"catch",
"(",
"final",
"NumberFormatException",
"ex",
")",
"{",
"}",
"}",
"}",
"return",
"profile",
";",
"}"
] | decode a login profile from a string .
| train | false |
69,691 | public static Map<String,Object> testSOAPService(DispatchContext dctx,Map<String,?> context){
Delegator delegator=dctx.getDelegator();
Map<String,Object> response=ServiceUtil.returnSuccess();
List<GenericValue> testingNodes=new LinkedList<GenericValue>();
for (int i=0; i < 3; i++) {
GenericValue testingNode=delegator.makeValue("TestingNode");
testingNode.put("testingNodeId","TESTING_NODE" + i);
testingNode.put("description","Testing Node " + i);
testingNode.put("createdStamp",UtilDateTime.nowTimestamp());
testingNodes.add(testingNode);
}
response.put("testingNodes",testingNodes);
return response;
}
| [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"testSOAPService",
"(",
"DispatchContext",
"dctx",
",",
"Map",
"<",
"String",
",",
"?",
">",
"context",
")",
"{",
"Delegator",
"delegator",
"=",
"dctx",
".",
"getDelegator",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"response",
"=",
"ServiceUtil",
".",
"returnSuccess",
"(",
")",
";",
"List",
"<",
"GenericValue",
">",
"testingNodes",
"=",
"new",
"LinkedList",
"<",
"GenericValue",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"GenericValue",
"testingNode",
"=",
"delegator",
".",
"makeValue",
"(",
"\"TestingNode\"",
")",
";",
"testingNode",
".",
"put",
"(",
"\"testingNodeId\"",
",",
"\"TESTING_NODE\"",
"+",
"i",
")",
";",
"testingNode",
".",
"put",
"(",
"\"description\"",
",",
"\"Testing Node \"",
"+",
"i",
")",
";",
"testingNode",
".",
"put",
"(",
"\"createdStamp\"",
",",
"UtilDateTime",
".",
"nowTimestamp",
"(",
")",
")",
";",
"testingNodes",
".",
"add",
"(",
"testingNode",
")",
";",
"}",
"response",
".",
"put",
"(",
"\"testingNodes\"",
",",
"testingNodes",
")",
";",
"return",
"response",
";",
"}"
] | generic test soap service
| train | false |
69,692 | public void writeAll(ResultSet rs,boolean includeColumnNames) throws SQLException, IOException {
if (includeColumnNames) {
writeColumnNames(rs);
}
while (rs.next()) {
writeNext(resultService.getColumnValues(rs));
}
}
| [
"public",
"void",
"writeAll",
"(",
"ResultSet",
"rs",
",",
"boolean",
"includeColumnNames",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"if",
"(",
"includeColumnNames",
")",
"{",
"writeColumnNames",
"(",
"rs",
")",
";",
"}",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"writeNext",
"(",
"resultService",
".",
"getColumnValues",
"(",
"rs",
")",
")",
";",
"}",
"}"
] | writes the entire resultset to a csv file . the caller is responsible for closing the resultset .
| train | true |
69,693 | public static void disableConnectionReuseIfNecessary(){
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.FROYO) {
System.setProperty("http.keepAlive","false");
}
}
| [
"public",
"static",
"void",
"disableConnectionReuseIfNecessary",
"(",
")",
"{",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
"<",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"{",
"System",
".",
"setProperty",
"(",
"\"http.keepAlive\"",
",",
"\"false\"",
")",
";",
"}",
"}"
] | workaround for bug pre - froyo , see here for more info : http : / / android - developers . blogspot . com / 2011 / 09 / androids - http - clients . html
| train | false |
69,694 | private void updateRatingChoice(){
int current=m_chRating.getSelectedIndex();
m_chRating.removeAllItems();
FactionRecord fRec=(FactionRecord)m_chSubfaction.getSelectedItem();
if (fRec == null) {
fRec=(FactionRecord)m_chFaction.getSelectedItem();
}
ArrayList<String> ratingLevels=fRec.getRatingLevels();
if (ratingLevels.isEmpty()) {
ratingLevels=fRec.getRatingLevelSystem();
}
if (ratingLevels.size() > 1) {
for (int i=ratingLevels.size() - 1; i >= 0; i--) {
m_chRating.addItem(ratingLevels.get(i));
}
}
if (current < 0 && m_chRating.getItemCount() > 0) {
m_chRating.setSelectedIndex(0);
}
else {
m_chRating.setSelectedIndex(Math.min(current,m_chRating.getItemCount() - 1));
}
}
| [
"private",
"void",
"updateRatingChoice",
"(",
")",
"{",
"int",
"current",
"=",
"m_chRating",
".",
"getSelectedIndex",
"(",
")",
";",
"m_chRating",
".",
"removeAllItems",
"(",
")",
";",
"FactionRecord",
"fRec",
"=",
"(",
"FactionRecord",
")",
"m_chSubfaction",
".",
"getSelectedItem",
"(",
")",
";",
"if",
"(",
"fRec",
"==",
"null",
")",
"{",
"fRec",
"=",
"(",
"FactionRecord",
")",
"m_chFaction",
".",
"getSelectedItem",
"(",
")",
";",
"}",
"ArrayList",
"<",
"String",
">",
"ratingLevels",
"=",
"fRec",
".",
"getRatingLevels",
"(",
")",
";",
"if",
"(",
"ratingLevels",
".",
"isEmpty",
"(",
")",
")",
"{",
"ratingLevels",
"=",
"fRec",
".",
"getRatingLevelSystem",
"(",
")",
";",
"}",
"if",
"(",
"ratingLevels",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"ratingLevels",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"m_chRating",
".",
"addItem",
"(",
"ratingLevels",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"}",
"if",
"(",
"current",
"<",
"0",
"&&",
"m_chRating",
".",
"getItemCount",
"(",
")",
">",
"0",
")",
"{",
"m_chRating",
".",
"setSelectedIndex",
"(",
"0",
")",
";",
"}",
"else",
"{",
"m_chRating",
".",
"setSelectedIndex",
"(",
"Math",
".",
"min",
"(",
"current",
",",
"m_chRating",
".",
"getItemCount",
"(",
")",
"-",
"1",
")",
")",
";",
"}",
"}"
] | when faction or subfaction is changed , refresh ratings combo box with appropriate values for selected faction .
| train | false |