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 |
---|---|---|---|---|---|
398 | public static <M extends Message>String writeJsonStream(ImmutableList<M> messages){
ByteArrayOutputStream resultStream=new ByteArrayOutputStream();
MessageWriter<M> writer=MessageWriter.create(Output.forStream(new PrintStream(resultStream)));
writer.writeAll(messages);
return resultStream.toString();
}
| [
"public",
"static",
"<",
"M",
"extends",
"Message",
">",
"String",
"writeJsonStream",
"(",
"ImmutableList",
"<",
"M",
">",
"messages",
")",
"{",
"ByteArrayOutputStream",
"resultStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"MessageWriter",
"<",
"M",
">",
"writer",
"=",
"MessageWriter",
".",
"create",
"(",
"Output",
".",
"forStream",
"(",
"new",
"PrintStream",
"(",
"resultStream",
")",
")",
")",
";",
"writer",
".",
"writeAll",
"(",
"messages",
")",
";",
"return",
"resultStream",
".",
"toString",
"(",
")",
";",
"}"
] | returns the string representation of the stream of supplied messages . each individual message is represented as valid json , but not that the whole result is , itself , * not * valid json .
| train | false |
399 | public org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType buildContentMaturityRatingType(String agency,String rating,org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType.Audience audience) throws URISyntaxException {
org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType contentMaturityRatingType=new org.smpte_ra.schemas.st2067_2_2016.ContentMaturityRatingType();
if (!agency.matches("^[a-zA-Z0-9._-]+") == true) {
throw new URISyntaxException("Invalid URI","The ContentMaturityRating agency %s does not follow the syntax of a valid URI (a-z, A-Z, 0-9, ., _, -)");
}
contentMaturityRatingType.setAgency(agency);
contentMaturityRatingType.setRating(rating);
contentMaturityRatingType.setAudience(audience);
return contentMaturityRatingType;
}
| [
"public",
"org",
".",
"smpte_ra",
".",
"schemas",
".",
"st2067_2_2016",
".",
"ContentMaturityRatingType",
"buildContentMaturityRatingType",
"(",
"String",
"agency",
",",
"String",
"rating",
",",
"org",
".",
"smpte_ra",
".",
"schemas",
".",
"st2067_2_2016",
".",
"ContentMaturityRatingType",
".",
"Audience",
"audience",
")",
"throws",
"URISyntaxException",
"{",
"org",
".",
"smpte_ra",
".",
"schemas",
".",
"st2067_2_2016",
".",
"ContentMaturityRatingType",
"contentMaturityRatingType",
"=",
"new",
"org",
".",
"smpte_ra",
".",
"schemas",
".",
"st2067_2_2016",
".",
"ContentMaturityRatingType",
"(",
")",
";",
"if",
"(",
"!",
"agency",
".",
"matches",
"(",
"\"^[a-zA-Z0-9._-]+\"",
")",
"==",
"true",
")",
"{",
"throw",
"new",
"URISyntaxException",
"(",
"\"Invalid URI\"",
",",
"\"The ContentMaturityRating agency %s does not follow the syntax of a valid URI (a-z, A-Z, 0-9, ., _, -)\"",
")",
";",
"}",
"contentMaturityRatingType",
".",
"setAgency",
"(",
"agency",
")",
";",
"contentMaturityRatingType",
".",
"setRating",
"(",
"rating",
")",
";",
"contentMaturityRatingType",
".",
"setAudience",
"(",
"audience",
")",
";",
"return",
"contentMaturityRatingType",
";",
"}"
] | a method to construct a contentmaturityratingtype conforming to the 2016 schema
| train | false |
401 | private final double readDatum(final DataInput in,final ColumnType columnType) throws IOException {
switch (columnType) {
case DOUBLE:
return in.readDouble();
case INTEGER:
int iValue=in.readInt();
if (iValue == Integer.MIN_VALUE + 1) {
boolean isMissing=in.readBoolean();
if (isMissing) {
return Double.NaN;
}
else {
return iValue;
}
}
else {
return iValue;
}
case NOMINAL_BYTE:
byte bValue=in.readByte();
if (bValue == -1) {
return Double.NaN;
}
else {
return bValue;
}
case NOMINAL_INTEGER:
iValue=in.readInt();
if (iValue == -1) {
return Double.NaN;
}
else {
return iValue;
}
case NOMINAL_SHORT:
short sValue=in.readShort();
if (sValue == -1) {
return Double.NaN;
}
else {
return sValue;
}
default :
throw new RuntimeException("Illegal type: " + columnType);
}
}
| [
"private",
"final",
"double",
"readDatum",
"(",
"final",
"DataInput",
"in",
",",
"final",
"ColumnType",
"columnType",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"columnType",
")",
"{",
"case",
"DOUBLE",
":",
"return",
"in",
".",
"readDouble",
"(",
")",
";",
"case",
"INTEGER",
":",
"int",
"iValue",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"if",
"(",
"iValue",
"==",
"Integer",
".",
"MIN_VALUE",
"+",
"1",
")",
"{",
"boolean",
"isMissing",
"=",
"in",
".",
"readBoolean",
"(",
")",
";",
"if",
"(",
"isMissing",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"else",
"{",
"return",
"iValue",
";",
"}",
"}",
"else",
"{",
"return",
"iValue",
";",
"}",
"case",
"NOMINAL_BYTE",
":",
"byte",
"bValue",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"bValue",
"==",
"-",
"1",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"else",
"{",
"return",
"bValue",
";",
"}",
"case",
"NOMINAL_INTEGER",
":",
"iValue",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"if",
"(",
"iValue",
"==",
"-",
"1",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"else",
"{",
"return",
"iValue",
";",
"}",
"case",
"NOMINAL_SHORT",
":",
"short",
"sValue",
"=",
"in",
".",
"readShort",
"(",
")",
";",
"if",
"(",
"sValue",
"==",
"-",
"1",
")",
"{",
"return",
"Double",
".",
"NaN",
";",
"}",
"else",
"{",
"return",
"sValue",
";",
"}",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Illegal type: \"",
"+",
"columnType",
")",
";",
"}",
"}"
] | reads a single datum in non - sparse representation of the given type and returns it as a double .
| train | false |
403 | public double op(final double x){
final double sn=Math.sin(this.asr * (-x + 1) * 0.5);
return Math.exp((sn * hk - hs) / (1.0 - sn * sn));
}
| [
"public",
"double",
"op",
"(",
"final",
"double",
"x",
")",
"{",
"final",
"double",
"sn",
"=",
"Math",
".",
"sin",
"(",
"this",
".",
"asr",
"*",
"(",
"-",
"x",
"+",
"1",
")",
"*",
"0.5",
")",
";",
"return",
"Math",
".",
"exp",
"(",
"(",
"sn",
"*",
"hk",
"-",
"hs",
")",
"/",
"(",
"1.0",
"-",
"sn",
"*",
"sn",
")",
")",
";",
"}"
] | computes equation 3 , see references
| train | false |
404 | public void listen(StanzaListener stanzaListener,StanzaFilter stanzaFilter){
connection.addAsyncStanzaListener(stanzaListener,stanzaFilter);
logger.info("Listening for incoming XMPP Stanzas...");
}
| [
"public",
"void",
"listen",
"(",
"StanzaListener",
"stanzaListener",
",",
"StanzaFilter",
"stanzaFilter",
")",
"{",
"connection",
".",
"addAsyncStanzaListener",
"(",
"stanzaListener",
",",
"stanzaFilter",
")",
";",
"logger",
".",
"info",
"(",
"\"Listening for incoming XMPP Stanzas...\"",
")",
";",
"}"
] | begin listening for incoming messages .
| train | false |
405 | public static void addInputMode(String name,Hashtable values,boolean firstUpcase){
initInputModes();
inputModes.put(name,values);
if (firstUpcase) {
firstUppercaseInputMode.addElement(name);
}
}
| [
"public",
"static",
"void",
"addInputMode",
"(",
"String",
"name",
",",
"Hashtable",
"values",
",",
"boolean",
"firstUpcase",
")",
"{",
"initInputModes",
"(",
")",
";",
"inputModes",
".",
"put",
"(",
"name",
",",
"values",
")",
";",
"if",
"(",
"firstUpcase",
")",
"{",
"firstUppercaseInputMode",
".",
"addElement",
"(",
"name",
")",
";",
"}",
"}"
] | adds a new inputmode hashtable with the given name and set of values
| train | false |
407 | @Override public void addEnvVarUpdatedListener(EnvVarUpdateInterface listener){
if (!listenerList.contains(listener)) {
listenerList.add(listener);
}
}
| [
"@",
"Override",
"public",
"void",
"addEnvVarUpdatedListener",
"(",
"EnvVarUpdateInterface",
"listener",
")",
"{",
"if",
"(",
"!",
"listenerList",
".",
"contains",
"(",
"listener",
")",
")",
"{",
"listenerList",
".",
"add",
"(",
"listener",
")",
";",
"}",
"}"
] | adds the env var updated listener .
| train | false |
408 | private void init(Configuration exp) throws IOException {
isInitialized=true;
}
| [
"private",
"void",
"init",
"(",
"Configuration",
"exp",
")",
"throws",
"IOException",
"{",
"isInitialized",
"=",
"true",
";",
"}"
] | private initializer method that sets up the generic resources .
| train | false |
409 | public List<LocalVariable> visibleVariables() throws AbsentInformationException {
validateStackFrame();
createVisibleVariables();
List<LocalVariable> mapAsList=new ArrayList<LocalVariable>(visibleVariables.values());
Collections.sort(mapAsList);
return mapAsList;
}
| [
"public",
"List",
"<",
"LocalVariable",
">",
"visibleVariables",
"(",
")",
"throws",
"AbsentInformationException",
"{",
"validateStackFrame",
"(",
")",
";",
"createVisibleVariables",
"(",
")",
";",
"List",
"<",
"LocalVariable",
">",
"mapAsList",
"=",
"new",
"ArrayList",
"<",
"LocalVariable",
">",
"(",
"visibleVariables",
".",
"values",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"mapAsList",
")",
";",
"return",
"mapAsList",
";",
"}"
] | return the list of visible variable in the frame . need not be synchronized since it cannot be provably stale .
| train | false |
411 | public static void startServices(ServiceHost host,Class... services) throws InstantiationException, IllegalAccessException {
checkArgument(services != null,"services cannot be null");
for ( Class service : services) {
startService(host,service);
}
}
| [
"public",
"static",
"void",
"startServices",
"(",
"ServiceHost",
"host",
",",
"Class",
"...",
"services",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"checkArgument",
"(",
"services",
"!=",
"null",
",",
"\"services cannot be null\"",
")",
";",
"for",
"(",
"Class",
"service",
":",
"services",
")",
"{",
"startService",
"(",
"host",
",",
"service",
")",
";",
"}",
"}"
] | starts the list of services on the host .
| train | false |
412 | private AppliedMigration createAppliedMigration(int version,String description){
return new AppliedMigration(version,version,MigrationVersion.fromVersion(Integer.toString(version)),description,MigrationType.CQL,"x",null,new Date(),"sa",123,true);
}
| [
"private",
"AppliedMigration",
"createAppliedMigration",
"(",
"int",
"version",
",",
"String",
"description",
")",
"{",
"return",
"new",
"AppliedMigration",
"(",
"version",
",",
"version",
",",
"MigrationVersion",
".",
"fromVersion",
"(",
"Integer",
".",
"toString",
"(",
"version",
")",
")",
",",
"description",
",",
"MigrationType",
".",
"CQL",
",",
"\"x\"",
",",
"null",
",",
"new",
"Date",
"(",
")",
",",
"\"sa\"",
",",
"123",
",",
"true",
")",
";",
"}"
] | creates a new applied migration with this version .
| train | false |
413 | TemplateEntry nextEntry(){
if (!hasNext()) {
throw new NoSuchElementException();
}
final TemplateEntry entry=nextEntry;
nextEntry=null;
return entry;
}
| [
"TemplateEntry",
"nextEntry",
"(",
")",
"{",
"if",
"(",
"!",
"hasNext",
"(",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"final",
"TemplateEntry",
"entry",
"=",
"nextEntry",
";",
"nextEntry",
"=",
"null",
";",
"return",
"entry",
";",
"}"
] | returns the next generated entry .
| train | false |
415 | public static double correlation(double[] x,double[] y){
if (x.length == y.length) {
double mx=MathUtils.mean(x);
double my=MathUtils.mean(y);
double sx=Math.sqrt(MathUtils.variance(x));
double sy=Math.sqrt(MathUtils.variance(y));
int n=x.length;
double nval=0.0;
for (int i=0; i < n; i++) {
nval+=(x[i] - mx) * (y[i] - my);
}
double r=nval / ((n - 1) * sx * sy);
return r;
}
else throw new IllegalArgumentException("vectors of different size");
}
| [
"public",
"static",
"double",
"correlation",
"(",
"double",
"[",
"]",
"x",
",",
"double",
"[",
"]",
"y",
")",
"{",
"if",
"(",
"x",
".",
"length",
"==",
"y",
".",
"length",
")",
"{",
"double",
"mx",
"=",
"MathUtils",
".",
"mean",
"(",
"x",
")",
";",
"double",
"my",
"=",
"MathUtils",
".",
"mean",
"(",
"y",
")",
";",
"double",
"sx",
"=",
"Math",
".",
"sqrt",
"(",
"MathUtils",
".",
"variance",
"(",
"x",
")",
")",
";",
"double",
"sy",
"=",
"Math",
".",
"sqrt",
"(",
"MathUtils",
".",
"variance",
"(",
"y",
")",
")",
";",
"int",
"n",
"=",
"x",
".",
"length",
";",
"double",
"nval",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"nval",
"+=",
"(",
"x",
"[",
"i",
"]",
"-",
"mx",
")",
"*",
"(",
"y",
"[",
"i",
"]",
"-",
"my",
")",
";",
"}",
"double",
"r",
"=",
"nval",
"/",
"(",
"(",
"n",
"-",
"1",
")",
"*",
"sx",
"*",
"sy",
")",
";",
"return",
"r",
";",
"}",
"else",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"vectors of different size\"",
")",
";",
"}"
] | sample correlation coefficient ref : http : / / en . wikipedia . org / wiki / correlation_and_dependence
| train | false |
416 | public static int writeMessageFully(Message msg,OutputStream out,ByteBuffer buf,MessageWriter writer) throws IOException {
assert msg != null;
assert out != null;
assert buf != null;
assert buf.hasArray();
if (writer != null) writer.setCurrentWriteClass(msg.getClass());
boolean finished=false;
int cnt=0;
while (!finished) {
finished=msg.writeTo(buf,writer);
out.write(buf.array(),0,buf.position());
cnt+=buf.position();
buf.clear();
}
return cnt;
}
| [
"public",
"static",
"int",
"writeMessageFully",
"(",
"Message",
"msg",
",",
"OutputStream",
"out",
",",
"ByteBuffer",
"buf",
",",
"MessageWriter",
"writer",
")",
"throws",
"IOException",
"{",
"assert",
"msg",
"!=",
"null",
";",
"assert",
"out",
"!=",
"null",
";",
"assert",
"buf",
"!=",
"null",
";",
"assert",
"buf",
".",
"hasArray",
"(",
")",
";",
"if",
"(",
"writer",
"!=",
"null",
")",
"writer",
".",
"setCurrentWriteClass",
"(",
"msg",
".",
"getClass",
"(",
")",
")",
";",
"boolean",
"finished",
"=",
"false",
";",
"int",
"cnt",
"=",
"0",
";",
"while",
"(",
"!",
"finished",
")",
"{",
"finished",
"=",
"msg",
".",
"writeTo",
"(",
"buf",
",",
"writer",
")",
";",
"out",
".",
"write",
"(",
"buf",
".",
"array",
"(",
")",
",",
"0",
",",
"buf",
".",
"position",
"(",
")",
")",
";",
"cnt",
"+=",
"buf",
".",
"position",
"(",
")",
";",
"buf",
".",
"clear",
"(",
")",
";",
"}",
"return",
"cnt",
";",
"}"
] | fully writes communication message to provided stream .
| train | false |
418 | protected final void dragExit(final int x,final int y){
DragSourceEvent event=new DragSourceEvent(getDragSourceContext(),x,y);
EventDispatcher dispatcher=new EventDispatcher(DISPATCH_EXIT,event);
SunToolkit.invokeLaterOnAppContext(SunToolkit.targetToAppContext(getComponent()),dispatcher);
startSecondaryEventLoop();
}
| [
"protected",
"final",
"void",
"dragExit",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
")",
"{",
"DragSourceEvent",
"event",
"=",
"new",
"DragSourceEvent",
"(",
"getDragSourceContext",
"(",
")",
",",
"x",
",",
"y",
")",
";",
"EventDispatcher",
"dispatcher",
"=",
"new",
"EventDispatcher",
"(",
"DISPATCH_EXIT",
",",
"event",
")",
";",
"SunToolkit",
".",
"invokeLaterOnAppContext",
"(",
"SunToolkit",
".",
"targetToAppContext",
"(",
"getComponent",
"(",
")",
")",
",",
"dispatcher",
")",
";",
"startSecondaryEventLoop",
"(",
")",
";",
"}"
] | upcall from native code
| train | false |
419 | public static String generateRandomString(int count){
Random random=new Random();
StringBuffer buffer=new StringBuffer();
while (count-- != 0) {
char ch=(char)(random.nextInt(96) + 32);
buffer.append(ch);
}
return buffer.toString();
}
| [
"public",
"static",
"String",
"generateRandomString",
"(",
"int",
"count",
")",
"{",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"while",
"(",
"count",
"--",
"!=",
"0",
")",
"{",
"char",
"ch",
"=",
"(",
"char",
")",
"(",
"random",
".",
"nextInt",
"(",
"96",
")",
"+",
"32",
")",
";",
"buffer",
".",
"append",
"(",
"ch",
")",
";",
"}",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}"
] | generate a random string . this is used for password encryption .
| train | false |
420 | public void decrement(){
int counterVal=counter.decrementAndGet();
if (counterVal == 0) {
if (null != resourceCallback) {
resourceCallback.onTransitionToIdle();
}
becameIdleAt=SystemClock.uptimeMillis();
}
if (debugCounting) {
if (counterVal == 0) {
Log.i(TAG,"Resource: " + resourceName + " went idle! (Time spent not idle: "+ (becameIdleAt - becameBusyAt)+ ")");
}
else {
Log.i(TAG,"Resource: " + resourceName + " in-use-count decremented to: "+ counterVal);
}
}
if (counterVal < 0) {
throw new IllegalArgumentException("Counter has been corrupted!");
}
}
| [
"public",
"void",
"decrement",
"(",
")",
"{",
"int",
"counterVal",
"=",
"counter",
".",
"decrementAndGet",
"(",
")",
";",
"if",
"(",
"counterVal",
"==",
"0",
")",
"{",
"if",
"(",
"null",
"!=",
"resourceCallback",
")",
"{",
"resourceCallback",
".",
"onTransitionToIdle",
"(",
")",
";",
"}",
"becameIdleAt",
"=",
"SystemClock",
".",
"uptimeMillis",
"(",
")",
";",
"}",
"if",
"(",
"debugCounting",
")",
"{",
"if",
"(",
"counterVal",
"==",
"0",
")",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"Resource: \"",
"+",
"resourceName",
"+",
"\" went idle! (Time spent not idle: \"",
"+",
"(",
"becameIdleAt",
"-",
"becameBusyAt",
")",
"+",
"\")\"",
")",
";",
"}",
"else",
"{",
"Log",
".",
"i",
"(",
"TAG",
",",
"\"Resource: \"",
"+",
"resourceName",
"+",
"\" in-use-count decremented to: \"",
"+",
"counterVal",
")",
";",
"}",
"}",
"if",
"(",
"counterVal",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Counter has been corrupted!\"",
")",
";",
"}",
"}"
] | decrements the count of in - flight transactions to the resource being monitored . if this operation results in the counter falling below 0 - an exception is raised .
| train | false |
421 | public void removeTestingCallback(OneSheeldTestingCallback testingCallback){
if (testingCallback != null && testingCallbacks.contains(testingCallback)) testingCallbacks.remove(testingCallback);
}
| [
"public",
"void",
"removeTestingCallback",
"(",
"OneSheeldTestingCallback",
"testingCallback",
")",
"{",
"if",
"(",
"testingCallback",
"!=",
"null",
"&&",
"testingCallbacks",
".",
"contains",
"(",
"testingCallback",
")",
")",
"testingCallbacks",
".",
"remove",
"(",
"testingCallback",
")",
";",
"}"
] | remove a testing callback .
| train | false |
422 | public boolean shouldDataBeRouted(SimpleRouterContext context,DataMetaData dataMetaData,Node node,boolean initialLoad,boolean initialLoadSelectUsed,TriggerRouter triggerRouter){
IDataRouter router=getDataRouter(dataMetaData.getRouter());
Set<Node> oneNodeSet=new HashSet<Node>(1);
oneNodeSet.add(node);
Collection<String> nodeIds=router.routeToNodes(context,dataMetaData,oneNodeSet,initialLoad,initialLoadSelectUsed,triggerRouter);
return nodeIds != null && nodeIds.contains(node.getNodeId());
}
| [
"public",
"boolean",
"shouldDataBeRouted",
"(",
"SimpleRouterContext",
"context",
",",
"DataMetaData",
"dataMetaData",
",",
"Node",
"node",
",",
"boolean",
"initialLoad",
",",
"boolean",
"initialLoadSelectUsed",
",",
"TriggerRouter",
"triggerRouter",
")",
"{",
"IDataRouter",
"router",
"=",
"getDataRouter",
"(",
"dataMetaData",
".",
"getRouter",
"(",
")",
")",
";",
"Set",
"<",
"Node",
">",
"oneNodeSet",
"=",
"new",
"HashSet",
"<",
"Node",
">",
"(",
"1",
")",
";",
"oneNodeSet",
".",
"add",
"(",
"node",
")",
";",
"Collection",
"<",
"String",
">",
"nodeIds",
"=",
"router",
".",
"routeToNodes",
"(",
"context",
",",
"dataMetaData",
",",
"oneNodeSet",
",",
"initialLoad",
",",
"initialLoadSelectUsed",
",",
"triggerRouter",
")",
";",
"return",
"nodeIds",
"!=",
"null",
"&&",
"nodeIds",
".",
"contains",
"(",
"node",
".",
"getNodeId",
"(",
")",
")",
";",
"}"
] | for use in data load events
| train | false |
424 | @Override public Object put(Object key,Object value){
Entry tab[]=table;
int hash=0;
int index=0;
if (key != null) {
hash=System.identityHashCode(key);
index=(hash & 0x7FFFFFFF) % tab.length;
for (Entry e=tab[index]; e != null; e=e.next) {
if ((e.hash == hash) && key == e.key) {
Object old=e.value;
e.value=value;
return old;
}
}
}
else {
for (Entry e=tab[0]; e != null; e=e.next) {
if (e.key == null) {
Object old=e.value;
e.value=value;
return old;
}
}
}
modCount++;
if (count >= threshold) {
rehash();
tab=table;
index=(hash & 0x7FFFFFFF) % tab.length;
}
Entry e=new Entry(hash,key,value,tab[index]);
tab[index]=e;
count++;
return null;
}
| [
"@",
"Override",
"public",
"Object",
"put",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"Entry",
"tab",
"[",
"]",
"=",
"table",
";",
"int",
"hash",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"hash",
"=",
"System",
".",
"identityHashCode",
"(",
"key",
")",
";",
"index",
"=",
"(",
"hash",
"&",
"0x7FFFFFFF",
")",
"%",
"tab",
".",
"length",
";",
"for",
"(",
"Entry",
"e",
"=",
"tab",
"[",
"index",
"]",
";",
"e",
"!=",
"null",
";",
"e",
"=",
"e",
".",
"next",
")",
"{",
"if",
"(",
"(",
"e",
".",
"hash",
"==",
"hash",
")",
"&&",
"key",
"==",
"e",
".",
"key",
")",
"{",
"Object",
"old",
"=",
"e",
".",
"value",
";",
"e",
".",
"value",
"=",
"value",
";",
"return",
"old",
";",
"}",
"}",
"}",
"else",
"{",
"for",
"(",
"Entry",
"e",
"=",
"tab",
"[",
"0",
"]",
";",
"e",
"!=",
"null",
";",
"e",
"=",
"e",
".",
"next",
")",
"{",
"if",
"(",
"e",
".",
"key",
"==",
"null",
")",
"{",
"Object",
"old",
"=",
"e",
".",
"value",
";",
"e",
".",
"value",
"=",
"value",
";",
"return",
"old",
";",
"}",
"}",
"}",
"modCount",
"++",
";",
"if",
"(",
"count",
">=",
"threshold",
")",
"{",
"rehash",
"(",
")",
";",
"tab",
"=",
"table",
";",
"index",
"=",
"(",
"hash",
"&",
"0x7FFFFFFF",
")",
"%",
"tab",
".",
"length",
";",
"}",
"Entry",
"e",
"=",
"new",
"Entry",
"(",
"hash",
",",
"key",
",",
"value",
",",
"tab",
"[",
"index",
"]",
")",
";",
"tab",
"[",
"index",
"]",
"=",
"e",
";",
"count",
"++",
";",
"return",
"null",
";",
"}"
] | associates the specified value with the specified key in this map . if the map previously contained a mapping for this key , the old value is replaced .
| train | false |
425 | public static String backQuoteChars(String string,char[] find,String[] replace){
int index;
StringBuilder newStr;
int i;
if (string == null) return string;
for (i=0; i < find.length; i++) {
if (string.indexOf(find[i]) != -1) {
newStr=new StringBuilder();
while ((index=string.indexOf(find[i])) != -1) {
if (index > 0) newStr.append(string.substring(0,index));
newStr.append(replace[i]);
if ((index + 1) < string.length()) string=string.substring(index + 1);
else string="";
}
newStr.append(string);
string=newStr.toString();
}
}
return string;
}
| [
"public",
"static",
"String",
"backQuoteChars",
"(",
"String",
"string",
",",
"char",
"[",
"]",
"find",
",",
"String",
"[",
"]",
"replace",
")",
"{",
"int",
"index",
";",
"StringBuilder",
"newStr",
";",
"int",
"i",
";",
"if",
"(",
"string",
"==",
"null",
")",
"return",
"string",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"find",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"string",
".",
"indexOf",
"(",
"find",
"[",
"i",
"]",
")",
"!=",
"-",
"1",
")",
"{",
"newStr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"while",
"(",
"(",
"index",
"=",
"string",
".",
"indexOf",
"(",
"find",
"[",
"i",
"]",
")",
")",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"index",
">",
"0",
")",
"newStr",
".",
"append",
"(",
"string",
".",
"substring",
"(",
"0",
",",
"index",
")",
")",
";",
"newStr",
".",
"append",
"(",
"replace",
"[",
"i",
"]",
")",
";",
"if",
"(",
"(",
"index",
"+",
"1",
")",
"<",
"string",
".",
"length",
"(",
")",
")",
"string",
"=",
"string",
".",
"substring",
"(",
"index",
"+",
"1",
")",
";",
"else",
"string",
"=",
"\"\"",
";",
"}",
"newStr",
".",
"append",
"(",
"string",
")",
";",
"string",
"=",
"newStr",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"string",
";",
"}"
] | converts specified characters into the string equivalents .
| train | false |
427 | public void addLanguage(ExecutionLanguage language){
languages.add(1,language);
}
| [
"public",
"void",
"addLanguage",
"(",
"ExecutionLanguage",
"language",
")",
"{",
"languages",
".",
"add",
"(",
"1",
",",
"language",
")",
";",
"}"
] | registers a new executionlanguage to the registry .
| train | false |
428 | private static boolean memberEquals(final Class<?> type,final Object o1,final Object o2){
if (o1 == o2) {
return true;
}
if (o1 == null || o2 == null) {
return false;
}
if (type.isArray()) {
return arrayMemberEquals(type.getComponentType(),o1,o2);
}
if (type.isAnnotation()) {
return equals((Annotation)o1,(Annotation)o2);
}
return o1.equals(o2);
}
| [
"private",
"static",
"boolean",
"memberEquals",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"Object",
"o1",
",",
"final",
"Object",
"o2",
")",
"{",
"if",
"(",
"o1",
"==",
"o2",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"o1",
"==",
"null",
"||",
"o2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"type",
".",
"isArray",
"(",
")",
")",
"{",
"return",
"arrayMemberEquals",
"(",
"type",
".",
"getComponentType",
"(",
")",
",",
"o1",
",",
"o2",
")",
";",
"}",
"if",
"(",
"type",
".",
"isAnnotation",
"(",
")",
")",
"{",
"return",
"equals",
"(",
"(",
"Annotation",
")",
"o1",
",",
"(",
"Annotation",
")",
"o2",
")",
";",
"}",
"return",
"o1",
".",
"equals",
"(",
"o2",
")",
";",
"}"
] | helper method for checking whether two objects of the given type are equal . this method is used to compare the parameters of two annotation instances .
| train | true |
429 | public Encoding(String name){
this.name=name;
}
| [
"public",
"Encoding",
"(",
"String",
"name",
")",
"{",
"this",
".",
"name",
"=",
"name",
";",
"}"
] | constructs a new encoding .
| train | false |
430 | private String base64(String value){
StringBuffer cb=new StringBuffer();
int i=0;
for (i=0; i + 2 < value.length(); i+=3) {
long chunk=(int)value.charAt(i);
chunk=(chunk << 8) + (int)value.charAt(i + 1);
chunk=(chunk << 8) + (int)value.charAt(i + 2);
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append(encode(chunk >> 6));
cb.append(encode(chunk));
}
if (i + 1 < value.length()) {
long chunk=(int)value.charAt(i);
chunk=(chunk << 8) + (int)value.charAt(i + 1);
chunk<<=8;
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append(encode(chunk >> 6));
cb.append('=');
}
else if (i < value.length()) {
long chunk=(int)value.charAt(i);
chunk<<=16;
cb.append(encode(chunk >> 18));
cb.append(encode(chunk >> 12));
cb.append('=');
cb.append('=');
}
return cb.toString();
}
| [
"private",
"String",
"base64",
"(",
"String",
"value",
")",
"{",
"StringBuffer",
"cb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"+",
"2",
"<",
"value",
".",
"length",
"(",
")",
";",
"i",
"+=",
"3",
")",
"{",
"long",
"chunk",
"=",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"chunk",
"=",
"(",
"chunk",
"<<",
"8",
")",
"+",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
";",
"chunk",
"=",
"(",
"chunk",
"<<",
"8",
")",
"+",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
"+",
"2",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"18",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"12",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"6",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
")",
")",
";",
"}",
"if",
"(",
"i",
"+",
"1",
"<",
"value",
".",
"length",
"(",
")",
")",
"{",
"long",
"chunk",
"=",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"chunk",
"=",
"(",
"chunk",
"<<",
"8",
")",
"+",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
";",
"chunk",
"<<=",
"8",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"18",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"12",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"6",
")",
")",
";",
"cb",
".",
"append",
"(",
"'='",
")",
";",
"}",
"else",
"if",
"(",
"i",
"<",
"value",
".",
"length",
"(",
")",
")",
"{",
"long",
"chunk",
"=",
"(",
"int",
")",
"value",
".",
"charAt",
"(",
"i",
")",
";",
"chunk",
"<<=",
"16",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"18",
")",
")",
";",
"cb",
".",
"append",
"(",
"encode",
"(",
"chunk",
">",
">",
"12",
")",
")",
";",
"cb",
".",
"append",
"(",
"'='",
")",
";",
"cb",
".",
"append",
"(",
"'='",
")",
";",
"}",
"return",
"cb",
".",
"toString",
"(",
")",
";",
"}"
] | creates the base64 value .
| train | true |
431 | public String writeLongToString(){
StringBuilder builder=new StringBuilder();
for (int i=0; i < (bitSet.getBits().length); ++i) {
builder.append(Long.toString(bitSet.getBits()[i]) + "|");
}
return builder.toString();
}
| [
"public",
"String",
"writeLongToString",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"bitSet",
".",
"getBits",
"(",
")",
".",
"length",
")",
";",
"++",
"i",
")",
"{",
"builder",
".",
"append",
"(",
"Long",
".",
"toString",
"(",
"bitSet",
".",
"getBits",
"(",
")",
"[",
"i",
"]",
")",
"+",
"\"|\"",
")",
";",
"}",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | writes vector to a string of the form 010 etc . ( no delimiters ) . no terminating newline or delimiter .
| train | false |
432 | @Override public void committed(long committedWindowId) throws IOException {
LOG.debug("data manager committed {}",committedWindowId);
for ( Long currentWindow : savedWindows.keySet()) {
if (currentWindow <= largestWindowAddedToTransferQueue) {
continue;
}
if (currentWindow <= committedWindowId) {
LOG.debug("to transfer {}",currentWindow);
largestWindowAddedToTransferQueue=currentWindow;
windowsToTransfer.add(currentWindow);
}
else {
break;
}
}
}
| [
"@",
"Override",
"public",
"void",
"committed",
"(",
"long",
"committedWindowId",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"debug",
"(",
"\"data manager committed {}\"",
",",
"committedWindowId",
")",
";",
"for",
"(",
"Long",
"currentWindow",
":",
"savedWindows",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"currentWindow",
"<=",
"largestWindowAddedToTransferQueue",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"currentWindow",
"<=",
"committedWindowId",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"to transfer {}\"",
",",
"currentWindow",
")",
";",
"largestWindowAddedToTransferQueue",
"=",
"currentWindow",
";",
"windowsToTransfer",
".",
"add",
"(",
"currentWindow",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"}"
] | transfers the data which has been committed till windowid to data files .
| train | false |
433 | public void delete(RandomAccessFile raf,RandomAccessFile tempRaf) throws CannotReadException, CannotWriteException, IOException {
raf.seek(0);
tempRaf.seek(0);
deleteTag(raf,tempRaf);
}
| [
"public",
"void",
"delete",
"(",
"RandomAccessFile",
"raf",
",",
"RandomAccessFile",
"tempRaf",
")",
"throws",
"CannotReadException",
",",
"CannotWriteException",
",",
"IOException",
"{",
"raf",
".",
"seek",
"(",
"0",
")",
";",
"tempRaf",
".",
"seek",
"(",
"0",
")",
";",
"deleteTag",
"(",
"raf",
",",
"tempRaf",
")",
";",
"}"
] | delete the tag ( if any ) present in the given randomaccessfile , and do not close it at the end .
| train | false |
435 | private byte[] pageToByteArray(P page){
try {
if (page == null) {
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(baos);
oos.writeInt(EMPTY_PAGE);
oos.close();
baos.close();
byte[] array=baos.toByteArray();
byte[] result=new byte[pageSize];
System.arraycopy(array,0,result,0,array.length);
return result;
}
else {
ByteArrayOutputStream baos=new ByteArrayOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(baos);
oos.writeInt(FILLED_PAGE);
page.writeExternal(oos);
oos.close();
baos.close();
byte[] array=baos.toByteArray();
if (array.length > this.pageSize) {
throw new IllegalArgumentException("Size of page " + page + " is greater than specified"+ " pagesize: "+ array.length+ " > "+ pageSize);
}
else if (array.length == this.pageSize) {
return array;
}
else {
byte[] result=new byte[pageSize];
System.arraycopy(array,0,result,0,array.length);
return result;
}
}
}
catch ( IOException e) {
throw new RuntimeException("IOException occurred! ",e);
}
}
| [
"private",
"byte",
"[",
"]",
"pageToByteArray",
"(",
"P",
"page",
")",
"{",
"try",
"{",
"if",
"(",
"page",
"==",
"null",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"baos",
")",
";",
"oos",
".",
"writeInt",
"(",
"EMPTY_PAGE",
")",
";",
"oos",
".",
"close",
"(",
")",
";",
"baos",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"array",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"pageSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"0",
",",
"result",
",",
"0",
",",
"array",
".",
"length",
")",
";",
"return",
"result",
";",
"}",
"else",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oos",
"=",
"new",
"ObjectOutputStream",
"(",
"baos",
")",
";",
"oos",
".",
"writeInt",
"(",
"FILLED_PAGE",
")",
";",
"page",
".",
"writeExternal",
"(",
"oos",
")",
";",
"oos",
".",
"close",
"(",
")",
";",
"baos",
".",
"close",
"(",
")",
";",
"byte",
"[",
"]",
"array",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"if",
"(",
"array",
".",
"length",
">",
"this",
".",
"pageSize",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Size of page \"",
"+",
"page",
"+",
"\" is greater than specified\"",
"+",
"\" pagesize: \"",
"+",
"array",
".",
"length",
"+",
"\" > \"",
"+",
"pageSize",
")",
";",
"}",
"else",
"if",
"(",
"array",
".",
"length",
"==",
"this",
".",
"pageSize",
")",
"{",
"return",
"array",
";",
"}",
"else",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"pageSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"array",
",",
"0",
",",
"result",
",",
"0",
",",
"array",
".",
"length",
")",
";",
"return",
"result",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"IOException occurred! \"",
",",
"e",
")",
";",
"}",
"}"
] | serializes an object into a byte array .
| train | true |
436 | void presentDecorAnimations(int position,float offset){
int animMapSize=mDecorAnimations.size();
for (int i=0; i < animMapSize; i++) {
Decor decor=mDecorAnimations.keyAt(i);
ArrayList<Animation> animations=mDecorAnimations.get(decor);
int animListSize=animations.size();
for (int j=0; j < animListSize; j++) {
Animation animation=animations.get(j);
if (animation == null) {
continue;
}
if (!animation.shouldAnimate(position)) {
if (mPreviousPosition < position && animation.pageEnd < position) {
animation.animate(decor.contentView,1,0,position);
}
else if (mPreviousPosition > position && animation.pageStart > position) {
animation.animate(decor.contentView,0,0,position);
}
continue;
}
animation.animate(decor.contentView,offset,0,position);
}
}
mPreviousPosition=position;
}
| [
"void",
"presentDecorAnimations",
"(",
"int",
"position",
",",
"float",
"offset",
")",
"{",
"int",
"animMapSize",
"=",
"mDecorAnimations",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"animMapSize",
";",
"i",
"++",
")",
"{",
"Decor",
"decor",
"=",
"mDecorAnimations",
".",
"keyAt",
"(",
"i",
")",
";",
"ArrayList",
"<",
"Animation",
">",
"animations",
"=",
"mDecorAnimations",
".",
"get",
"(",
"decor",
")",
";",
"int",
"animListSize",
"=",
"animations",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"animListSize",
";",
"j",
"++",
")",
"{",
"Animation",
"animation",
"=",
"animations",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"animation",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"!",
"animation",
".",
"shouldAnimate",
"(",
"position",
")",
")",
"{",
"if",
"(",
"mPreviousPosition",
"<",
"position",
"&&",
"animation",
".",
"pageEnd",
"<",
"position",
")",
"{",
"animation",
".",
"animate",
"(",
"decor",
".",
"contentView",
",",
"1",
",",
"0",
",",
"position",
")",
";",
"}",
"else",
"if",
"(",
"mPreviousPosition",
">",
"position",
"&&",
"animation",
".",
"pageStart",
">",
"position",
")",
"{",
"animation",
".",
"animate",
"(",
"decor",
".",
"contentView",
",",
"0",
",",
"0",
",",
"position",
")",
";",
"}",
"continue",
";",
"}",
"animation",
".",
"animate",
"(",
"decor",
".",
"contentView",
",",
"offset",
",",
"0",
",",
"position",
")",
";",
"}",
"}",
"mPreviousPosition",
"=",
"position",
";",
"}"
] | run the animations based on the decor animations saved within the presenter and the offset of the scrolling .
| train | false |
437 | public static boolean deltree(File directory){
if (directory == null || !directory.exists()) {
return true;
}
boolean result=true;
if (directory.isFile()) {
result=directory.delete();
}
else {
File[] list=directory.listFiles();
for (int i=list.length; i-- > 0; ) {
if (!deltree(list[i])) {
result=false;
}
}
if (!directory.delete()) {
result=false;
}
}
return result;
}
| [
"public",
"static",
"boolean",
"deltree",
"(",
"File",
"directory",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
"||",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"directory",
".",
"isFile",
"(",
")",
")",
"{",
"result",
"=",
"directory",
".",
"delete",
"(",
")",
";",
"}",
"else",
"{",
"File",
"[",
"]",
"list",
"=",
"directory",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"list",
".",
"length",
";",
"i",
"--",
">",
"0",
";",
")",
"{",
"if",
"(",
"!",
"deltree",
"(",
"list",
"[",
"i",
"]",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"}",
"if",
"(",
"!",
"directory",
".",
"delete",
"(",
")",
")",
"{",
"result",
"=",
"false",
";",
"}",
"}",
"return",
"result",
";",
"}"
] | deletes the given file and everything under it .
| train | false |
439 | public void invalidate(long newFileSize){
if (newFileSize < fileSize) {
fileSize=newFileSize;
counters.clear();
blockSize=calcBlockSize(fileSize);
}
else if (newFileSize > fileSize) compact(newFileSize);
}
| [
"public",
"void",
"invalidate",
"(",
"long",
"newFileSize",
")",
"{",
"if",
"(",
"newFileSize",
"<",
"fileSize",
")",
"{",
"fileSize",
"=",
"newFileSize",
";",
"counters",
".",
"clear",
"(",
")",
";",
"blockSize",
"=",
"calcBlockSize",
"(",
"fileSize",
")",
";",
"}",
"else",
"if",
"(",
"newFileSize",
">",
"fileSize",
")",
"compact",
"(",
"newFileSize",
")",
";",
"}"
] | check if counters and blocksize should be adjusted according to file size .
| train | false |
440 | public void addCase(SwitchCase switchCase){
assertNotNull(switchCase);
if (cases == null) {
cases=new ArrayList<SwitchCase>();
}
cases.add(switchCase);
switchCase.setParent(this);
}
| [
"public",
"void",
"addCase",
"(",
"SwitchCase",
"switchCase",
")",
"{",
"assertNotNull",
"(",
"switchCase",
")",
";",
"if",
"(",
"cases",
"==",
"null",
")",
"{",
"cases",
"=",
"new",
"ArrayList",
"<",
"SwitchCase",
">",
"(",
")",
";",
"}",
"cases",
".",
"add",
"(",
"switchCase",
")",
";",
"switchCase",
".",
"setParent",
"(",
"this",
")",
";",
"}"
] | adds a switch case statement to the end of the list .
| train | true |
442 | public void test_atomicAppendFullBlock() throws IOException {
final String id="test";
final int version=0;
Random r=new Random();
final byte[] expected=new byte[BLOCK_SIZE];
r.nextBytes(expected);
final long block0=repo.appendBlock(id,version,expected,0,expected.length);
assertEquals("block#",0L,block0);
assertEquals("blockCount",1,repo.getBlockCount(id,version));
assertEquals("readBlock",expected,repo.readBlock(id,version,block0));
assertEquals("inputStream",expected,read(repo.inputStream(id,version)));
}
| [
"public",
"void",
"test_atomicAppendFullBlock",
"(",
")",
"throws",
"IOException",
"{",
"final",
"String",
"id",
"=",
"\"test\"",
";",
"final",
"int",
"version",
"=",
"0",
";",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"expected",
"=",
"new",
"byte",
"[",
"BLOCK_SIZE",
"]",
";",
"r",
".",
"nextBytes",
"(",
"expected",
")",
";",
"final",
"long",
"block0",
"=",
"repo",
".",
"appendBlock",
"(",
"id",
",",
"version",
",",
"expected",
",",
"0",
",",
"expected",
".",
"length",
")",
";",
"assertEquals",
"(",
"\"block#\"",
",",
"0L",
",",
"block0",
")",
";",
"assertEquals",
"(",
"\"blockCount\"",
",",
"1",
",",
"repo",
".",
"getBlockCount",
"(",
"id",
",",
"version",
")",
")",
";",
"assertEquals",
"(",
"\"readBlock\"",
",",
"expected",
",",
"repo",
".",
"readBlock",
"(",
"id",
",",
"version",
",",
"block0",
")",
")",
";",
"assertEquals",
"(",
"\"inputStream\"",
",",
"expected",
",",
"read",
"(",
"repo",
".",
"inputStream",
"(",
"id",
",",
"version",
")",
")",
")",
";",
"}"
] | atomic append of a full block .
| train | false |
443 | public static int hash(byte[] data,int offset,int length,int seed){
return hash(ByteBuffer.wrap(data,offset,length),seed);
}
| [
"public",
"static",
"int",
"hash",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"length",
",",
"int",
"seed",
")",
"{",
"return",
"hash",
"(",
"ByteBuffer",
".",
"wrap",
"(",
"data",
",",
"offset",
",",
"length",
")",
",",
"seed",
")",
";",
"}"
] | hashes bytes in part of an array .
| train | true |
444 | protected void layoutContainer(){
Rectangle inBounds=p.getBounds();
Insets insets=p.getInsets();
inBounds.x+=insets.left;
inBounds.width-=insets.left;
inBounds.width-=insets.right;
inBounds.y+=insets.top;
inBounds.height-=insets.top;
inBounds.height-=insets.bottom;
backgroundBounds=(Rectangle)inBounds.clone();
occludingBounds=(Rectangle)inBounds.clone();
layoutCardinals();
layoutEast(p.getEast(),occludingBounds.x + occludingBounds.width,occludingBounds.y,occludingBounds.width,occludingBounds.height);
layoutWest(p.getWest(),occludingBounds.x,occludingBounds.y,occludingBounds.width,occludingBounds.height);
int southLeft=inBounds.x + getWidthAtYCardinal(p.getWest(),inBounds.y + inBounds.height - getHeightAtLeftCardinal(p.getSouth()));
int southRight=inBounds.x + inBounds.width - getWidthAtYCardinal(p.getEast(),inBounds.y + inBounds.height - getHeightAtRightCardinal(p.getSouth()));
layoutSouth(p.getSouth(),southLeft,occludingBounds.y + occludingBounds.height,southRight - southLeft,occludingBounds.height);
int northLeft=inBounds.x + getWidthAtYCardinal(p.getWest(),inBounds.y + getHeightAtLeftCardinal(p.getNorth()));
int northRight=inBounds.x + inBounds.width - getWidthAtYCardinal(p.getEast(),inBounds.y + getHeightAtRightCardinal(p.getNorth()));
layoutNorth(p.getNorth(),northLeft,occludingBounds.y,northRight - northLeft,occludingBounds.height);
layoutBackground();
}
| [
"protected",
"void",
"layoutContainer",
"(",
")",
"{",
"Rectangle",
"inBounds",
"=",
"p",
".",
"getBounds",
"(",
")",
";",
"Insets",
"insets",
"=",
"p",
".",
"getInsets",
"(",
")",
";",
"inBounds",
".",
"x",
"+=",
"insets",
".",
"left",
";",
"inBounds",
".",
"width",
"-=",
"insets",
".",
"left",
";",
"inBounds",
".",
"width",
"-=",
"insets",
".",
"right",
";",
"inBounds",
".",
"y",
"+=",
"insets",
".",
"top",
";",
"inBounds",
".",
"height",
"-=",
"insets",
".",
"top",
";",
"inBounds",
".",
"height",
"-=",
"insets",
".",
"bottom",
";",
"backgroundBounds",
"=",
"(",
"Rectangle",
")",
"inBounds",
".",
"clone",
"(",
")",
";",
"occludingBounds",
"=",
"(",
"Rectangle",
")",
"inBounds",
".",
"clone",
"(",
")",
";",
"layoutCardinals",
"(",
")",
";",
"layoutEast",
"(",
"p",
".",
"getEast",
"(",
")",
",",
"occludingBounds",
".",
"x",
"+",
"occludingBounds",
".",
"width",
",",
"occludingBounds",
".",
"y",
",",
"occludingBounds",
".",
"width",
",",
"occludingBounds",
".",
"height",
")",
";",
"layoutWest",
"(",
"p",
".",
"getWest",
"(",
")",
",",
"occludingBounds",
".",
"x",
",",
"occludingBounds",
".",
"y",
",",
"occludingBounds",
".",
"width",
",",
"occludingBounds",
".",
"height",
")",
";",
"int",
"southLeft",
"=",
"inBounds",
".",
"x",
"+",
"getWidthAtYCardinal",
"(",
"p",
".",
"getWest",
"(",
")",
",",
"inBounds",
".",
"y",
"+",
"inBounds",
".",
"height",
"-",
"getHeightAtLeftCardinal",
"(",
"p",
".",
"getSouth",
"(",
")",
")",
")",
";",
"int",
"southRight",
"=",
"inBounds",
".",
"x",
"+",
"inBounds",
".",
"width",
"-",
"getWidthAtYCardinal",
"(",
"p",
".",
"getEast",
"(",
")",
",",
"inBounds",
".",
"y",
"+",
"inBounds",
".",
"height",
"-",
"getHeightAtRightCardinal",
"(",
"p",
".",
"getSouth",
"(",
")",
")",
")",
";",
"layoutSouth",
"(",
"p",
".",
"getSouth",
"(",
")",
",",
"southLeft",
",",
"occludingBounds",
".",
"y",
"+",
"occludingBounds",
".",
"height",
",",
"southRight",
"-",
"southLeft",
",",
"occludingBounds",
".",
"height",
")",
";",
"int",
"northLeft",
"=",
"inBounds",
".",
"x",
"+",
"getWidthAtYCardinal",
"(",
"p",
".",
"getWest",
"(",
")",
",",
"inBounds",
".",
"y",
"+",
"getHeightAtLeftCardinal",
"(",
"p",
".",
"getNorth",
"(",
")",
")",
")",
";",
"int",
"northRight",
"=",
"inBounds",
".",
"x",
"+",
"inBounds",
".",
"width",
"-",
"getWidthAtYCardinal",
"(",
"p",
".",
"getEast",
"(",
")",
",",
"inBounds",
".",
"y",
"+",
"getHeightAtRightCardinal",
"(",
"p",
".",
"getNorth",
"(",
")",
")",
")",
";",
"layoutNorth",
"(",
"p",
".",
"getNorth",
"(",
")",
",",
"northLeft",
",",
"occludingBounds",
".",
"y",
",",
"northRight",
"-",
"northLeft",
",",
"occludingBounds",
".",
"height",
")",
";",
"layoutBackground",
"(",
")",
";",
"}"
] | layout the entire container .
| train | false |
447 | private void checkQopSupport(byte[] qopInChallenge,byte[] ciphersInChallenge) throws IOException {
String qopOptions;
if (qopInChallenge == null) {
qopOptions="auth";
}
else {
qopOptions=new String(qopInChallenge,encoding);
}
String[] serverQopTokens=new String[3];
byte[] serverQop=parseQop(qopOptions,serverQopTokens,true);
byte serverAllQop=combineMasks(serverQop);
switch (findPreferredMask(serverAllQop,qop)) {
case 0:
throw new SaslException("DIGEST-MD5: No common protection " + "layer between client and server");
case NO_PROTECTION:
negotiatedQop="auth";
break;
case INTEGRITY_ONLY_PROTECTION:
negotiatedQop="auth-int";
integrity=true;
rawSendSize=sendMaxBufSize - 16;
break;
case PRIVACY_PROTECTION:
negotiatedQop="auth-conf";
privacy=integrity=true;
rawSendSize=sendMaxBufSize - 26;
checkStrengthSupport(ciphersInChallenge);
break;
}
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE,"DIGEST61:Raw send size: {0}",new Integer(rawSendSize));
}
}
| [
"private",
"void",
"checkQopSupport",
"(",
"byte",
"[",
"]",
"qopInChallenge",
",",
"byte",
"[",
"]",
"ciphersInChallenge",
")",
"throws",
"IOException",
"{",
"String",
"qopOptions",
";",
"if",
"(",
"qopInChallenge",
"==",
"null",
")",
"{",
"qopOptions",
"=",
"\"auth\"",
";",
"}",
"else",
"{",
"qopOptions",
"=",
"new",
"String",
"(",
"qopInChallenge",
",",
"encoding",
")",
";",
"}",
"String",
"[",
"]",
"serverQopTokens",
"=",
"new",
"String",
"[",
"3",
"]",
";",
"byte",
"[",
"]",
"serverQop",
"=",
"parseQop",
"(",
"qopOptions",
",",
"serverQopTokens",
",",
"true",
")",
";",
"byte",
"serverAllQop",
"=",
"combineMasks",
"(",
"serverQop",
")",
";",
"switch",
"(",
"findPreferredMask",
"(",
"serverAllQop",
",",
"qop",
")",
")",
"{",
"case",
"0",
":",
"throw",
"new",
"SaslException",
"(",
"\"DIGEST-MD5: No common protection \"",
"+",
"\"layer between client and server\"",
")",
";",
"case",
"NO_PROTECTION",
":",
"negotiatedQop",
"=",
"\"auth\"",
";",
"break",
";",
"case",
"INTEGRITY_ONLY_PROTECTION",
":",
"negotiatedQop",
"=",
"\"auth-int\"",
";",
"integrity",
"=",
"true",
";",
"rawSendSize",
"=",
"sendMaxBufSize",
"-",
"16",
";",
"break",
";",
"case",
"PRIVACY_PROTECTION",
":",
"negotiatedQop",
"=",
"\"auth-conf\"",
";",
"privacy",
"=",
"integrity",
"=",
"true",
";",
"rawSendSize",
"=",
"sendMaxBufSize",
"-",
"26",
";",
"checkStrengthSupport",
"(",
"ciphersInChallenge",
")",
";",
"break",
";",
"}",
"if",
"(",
"logger",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"logger",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"DIGEST61:Raw send size: {0}\"",
",",
"new",
"Integer",
"(",
"rawSendSize",
")",
")",
";",
"}",
"}"
] | parses the ' qop ' directive . if ' auth - conf ' is specified by the client and offered as a qop option by the server , then a check is client - side supported ciphers is performed .
| train | false |
448 | public void close(boolean pCloseUnderlying) throws IOException {
if (closed) {
return;
}
if (pCloseUnderlying) {
closed=true;
input.close();
}
else {
for (; ; ) {
int av=available();
if (av == 0) {
av=makeAvailable();
if (av == 0) {
break;
}
}
long skip=skip(av);
if (skip != av) {
if (log.isDebugEnabled()) {
log.debug(skip + " bytes been skipped.");
}
}
}
}
closed=true;
}
| [
"public",
"void",
"close",
"(",
"boolean",
"pCloseUnderlying",
")",
"throws",
"IOException",
"{",
"if",
"(",
"closed",
")",
"{",
"return",
";",
"}",
"if",
"(",
"pCloseUnderlying",
")",
"{",
"closed",
"=",
"true",
";",
"input",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"for",
"(",
";",
";",
")",
"{",
"int",
"av",
"=",
"available",
"(",
")",
";",
"if",
"(",
"av",
"==",
"0",
")",
"{",
"av",
"=",
"makeAvailable",
"(",
")",
";",
"if",
"(",
"av",
"==",
"0",
")",
"{",
"break",
";",
"}",
"}",
"long",
"skip",
"=",
"skip",
"(",
"av",
")",
";",
"if",
"(",
"skip",
"!=",
"av",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"skip",
"+",
"\" bytes been skipped.\"",
")",
";",
"}",
"}",
"}",
"}",
"closed",
"=",
"true",
";",
"}"
] | closes the input stream .
| train | false |
449 | protected void addNewEvent(Object eventKey,T event){
if (unwrittenEvents == null) {
unwrittenEvents=Maps.newHashMap();
}
List<T> listEvents=unwrittenEvents.get(eventKey);
if (listEvents == null) {
unwrittenEvents.put(eventKey,Lists.newArrayList(event));
}
else {
listEvents.add(event);
}
}
| [
"protected",
"void",
"addNewEvent",
"(",
"Object",
"eventKey",
",",
"T",
"event",
")",
"{",
"if",
"(",
"unwrittenEvents",
"==",
"null",
")",
"{",
"unwrittenEvents",
"=",
"Maps",
".",
"newHashMap",
"(",
")",
";",
"}",
"List",
"<",
"T",
">",
"listEvents",
"=",
"unwrittenEvents",
".",
"get",
"(",
"eventKey",
")",
";",
"if",
"(",
"listEvents",
"==",
"null",
")",
"{",
"unwrittenEvents",
".",
"put",
"(",
"eventKey",
",",
"Lists",
".",
"newArrayList",
"(",
"event",
")",
")",
";",
"}",
"else",
"{",
"listEvents",
".",
"add",
"(",
"event",
")",
";",
"}",
"}"
] | add the given event into the unwritternevents map
| train | false |
450 | public static Locale localeFromString(final String localeAsString){
if (StringUtils.isBlank(localeAsString)) {
final List<ApiParameterError> dataValidationErrors=new ArrayList<>();
final ApiParameterError error=ApiParameterError.parameterError("validation.msg.invalid.locale.format","The parameter locale is invalid. It cannot be blank.","locale");
dataValidationErrors.add(error);
throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist","Validation errors exist.",dataValidationErrors);
}
String languageCode="";
String countryCode="";
String variantCode="";
final String[] localeParts=localeAsString.split("_");
if (localeParts != null && localeParts.length == 1) {
languageCode=localeParts[0];
}
if (localeParts != null && localeParts.length == 2) {
languageCode=localeParts[0];
countryCode=localeParts[1];
}
if (localeParts != null && localeParts.length == 3) {
languageCode=localeParts[0];
countryCode=localeParts[1];
variantCode=localeParts[2];
}
return localeFrom(languageCode,countryCode,variantCode);
}
| [
"public",
"static",
"Locale",
"localeFromString",
"(",
"final",
"String",
"localeAsString",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"localeAsString",
")",
")",
"{",
"final",
"List",
"<",
"ApiParameterError",
">",
"dataValidationErrors",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"final",
"ApiParameterError",
"error",
"=",
"ApiParameterError",
".",
"parameterError",
"(",
"\"validation.msg.invalid.locale.format\"",
",",
"\"The parameter locale is invalid. It cannot be blank.\"",
",",
"\"locale\"",
")",
";",
"dataValidationErrors",
".",
"add",
"(",
"error",
")",
";",
"throw",
"new",
"PlatformApiDataValidationException",
"(",
"\"validation.msg.validation.errors.exist\"",
",",
"\"Validation errors exist.\"",
",",
"dataValidationErrors",
")",
";",
"}",
"String",
"languageCode",
"=",
"\"\"",
";",
"String",
"countryCode",
"=",
"\"\"",
";",
"String",
"variantCode",
"=",
"\"\"",
";",
"final",
"String",
"[",
"]",
"localeParts",
"=",
"localeAsString",
".",
"split",
"(",
"\"_\"",
")",
";",
"if",
"(",
"localeParts",
"!=",
"null",
"&&",
"localeParts",
".",
"length",
"==",
"1",
")",
"{",
"languageCode",
"=",
"localeParts",
"[",
"0",
"]",
";",
"}",
"if",
"(",
"localeParts",
"!=",
"null",
"&&",
"localeParts",
".",
"length",
"==",
"2",
")",
"{",
"languageCode",
"=",
"localeParts",
"[",
"0",
"]",
";",
"countryCode",
"=",
"localeParts",
"[",
"1",
"]",
";",
"}",
"if",
"(",
"localeParts",
"!=",
"null",
"&&",
"localeParts",
".",
"length",
"==",
"3",
")",
"{",
"languageCode",
"=",
"localeParts",
"[",
"0",
"]",
";",
"countryCode",
"=",
"localeParts",
"[",
"1",
"]",
";",
"variantCode",
"=",
"localeParts",
"[",
"2",
"]",
";",
"}",
"return",
"localeFrom",
"(",
"languageCode",
",",
"countryCode",
",",
"variantCode",
")",
";",
"}"
] | todo : vishwas move all locale related code to a separate utils class
| train | false |
451 | protected Object decodeResponse(InputStream inputStream,String contentType) throws IOException {
Object value;
if (contentType.startsWith(JSON_MIME_TYPE)) {
JSONDecoder decoder=new JSONDecoder();
value=decoder.readValue(inputStream);
}
else if (contentType.startsWith(TEXT_MIME_TYPE_PREFIX)) {
TextDecoder decoder=new TextDecoder();
value=decoder.readValue(inputStream);
}
else {
value=null;
}
return value;
}
| [
"protected",
"Object",
"decodeResponse",
"(",
"InputStream",
"inputStream",
",",
"String",
"contentType",
")",
"throws",
"IOException",
"{",
"Object",
"value",
";",
"if",
"(",
"contentType",
".",
"startsWith",
"(",
"JSON_MIME_TYPE",
")",
")",
"{",
"JSONDecoder",
"decoder",
"=",
"new",
"JSONDecoder",
"(",
")",
";",
"value",
"=",
"decoder",
".",
"readValue",
"(",
"inputStream",
")",
";",
"}",
"else",
"if",
"(",
"contentType",
".",
"startsWith",
"(",
"TEXT_MIME_TYPE_PREFIX",
")",
")",
"{",
"TextDecoder",
"decoder",
"=",
"new",
"TextDecoder",
"(",
")",
";",
"value",
"=",
"decoder",
".",
"readValue",
"(",
"inputStream",
")",
";",
"}",
"else",
"{",
"value",
"=",
"null",
";",
"}",
"return",
"value",
";",
"}"
] | decodes a response value .
| train | false |
452 | protected static Pair<String,String> asrImmediate(final long offset,final ITranslationEnvironment environment,final List<ReilInstruction> instructions,final String registerNodeValue,final String immediateNodeValue){
long baseOffset=offset;
final String shifterOperand=environment.getNextVariableString();
final String shifterCarryOut=environment.getNextVariableString();
if (immediateNodeValue.equals("0")) {
final String tmpVar1=environment.getNextVariableString();
instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,wordSize,thirtyOneSet,byteSize,tmpVar1));
instructions.add(ReilHelpers.createAnd(baseOffset++,byteSize,tmpVar1,byteSize,oneSet,byteSize,shifterCarryOut));
instructions.add(ReilHelpers.createSub(baseOffset++,byteSize,shifterCarryOut,byteSize,String.valueOf(1),dWordSize,shifterOperand));
return new Pair<String,String>(shifterOperand,shifterCarryOut);
}
else {
final String tmpVar1=environment.getNextVariableString();
final String tmpVar2=environment.getNextVariableString();
final String tmpVar3=environment.getNextVariableString();
final String tmpVar4=environment.getNextVariableString();
final String tmpVar5=environment.getNextVariableString();
instructions.add(ReilHelpers.createAdd(baseOffset++,dWordSize,registerNodeValue,dWordSize,bitMaskHighestBitSet,qWordSize,tmpVar1));
instructions.add(ReilHelpers.createBsh(baseOffset++,qWordSize,tmpVar1,wordSize,"-" + immediateNodeValue,dWordSize,tmpVar2));
instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,bitMaskHighestBitSet,wordSize,"-" + immediateNodeValue,dWordSize,tmpVar3));
instructions.add(ReilHelpers.createSub(baseOffset++,dWordSize,tmpVar2,dWordSize,tmpVar3,qWordSize,tmpVar4));
instructions.add(ReilHelpers.createAnd(baseOffset++,qWordSize,tmpVar4,dWordSize,bitMaskAllBitsSet,dWordSize,shifterOperand));
instructions.add(ReilHelpers.createBsh(baseOffset++,dWordSize,registerNodeValue,dWordSize,String.valueOf(-(Integer.decode(immediateNodeValue) - 1)),wordSize,tmpVar5));
instructions.add(ReilHelpers.createAnd(baseOffset++,wordSize,tmpVar5,byteSize,oneSet,byteSize,shifterCarryOut));
return new Pair<String,String>(shifterOperand,shifterCarryOut);
}
}
| [
"protected",
"static",
"Pair",
"<",
"String",
",",
"String",
">",
"asrImmediate",
"(",
"final",
"long",
"offset",
",",
"final",
"ITranslationEnvironment",
"environment",
",",
"final",
"List",
"<",
"ReilInstruction",
">",
"instructions",
",",
"final",
"String",
"registerNodeValue",
",",
"final",
"String",
"immediateNodeValue",
")",
"{",
"long",
"baseOffset",
"=",
"offset",
";",
"final",
"String",
"shifterOperand",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"final",
"String",
"shifterCarryOut",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"if",
"(",
"immediateNodeValue",
".",
"equals",
"(",
"\"0\"",
")",
")",
"{",
"final",
"String",
"tmpVar1",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createBsh",
"(",
"baseOffset",
"++",
",",
"dWordSize",
",",
"registerNodeValue",
",",
"wordSize",
",",
"thirtyOneSet",
",",
"byteSize",
",",
"tmpVar1",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createAnd",
"(",
"baseOffset",
"++",
",",
"byteSize",
",",
"tmpVar1",
",",
"byteSize",
",",
"oneSet",
",",
"byteSize",
",",
"shifterCarryOut",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createSub",
"(",
"baseOffset",
"++",
",",
"byteSize",
",",
"shifterCarryOut",
",",
"byteSize",
",",
"String",
".",
"valueOf",
"(",
"1",
")",
",",
"dWordSize",
",",
"shifterOperand",
")",
")",
";",
"return",
"new",
"Pair",
"<",
"String",
",",
"String",
">",
"(",
"shifterOperand",
",",
"shifterCarryOut",
")",
";",
"}",
"else",
"{",
"final",
"String",
"tmpVar1",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"final",
"String",
"tmpVar2",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"final",
"String",
"tmpVar3",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"final",
"String",
"tmpVar4",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"final",
"String",
"tmpVar5",
"=",
"environment",
".",
"getNextVariableString",
"(",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createAdd",
"(",
"baseOffset",
"++",
",",
"dWordSize",
",",
"registerNodeValue",
",",
"dWordSize",
",",
"bitMaskHighestBitSet",
",",
"qWordSize",
",",
"tmpVar1",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createBsh",
"(",
"baseOffset",
"++",
",",
"qWordSize",
",",
"tmpVar1",
",",
"wordSize",
",",
"\"-\"",
"+",
"immediateNodeValue",
",",
"dWordSize",
",",
"tmpVar2",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createBsh",
"(",
"baseOffset",
"++",
",",
"dWordSize",
",",
"bitMaskHighestBitSet",
",",
"wordSize",
",",
"\"-\"",
"+",
"immediateNodeValue",
",",
"dWordSize",
",",
"tmpVar3",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createSub",
"(",
"baseOffset",
"++",
",",
"dWordSize",
",",
"tmpVar2",
",",
"dWordSize",
",",
"tmpVar3",
",",
"qWordSize",
",",
"tmpVar4",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createAnd",
"(",
"baseOffset",
"++",
",",
"qWordSize",
",",
"tmpVar4",
",",
"dWordSize",
",",
"bitMaskAllBitsSet",
",",
"dWordSize",
",",
"shifterOperand",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createBsh",
"(",
"baseOffset",
"++",
",",
"dWordSize",
",",
"registerNodeValue",
",",
"dWordSize",
",",
"String",
".",
"valueOf",
"(",
"-",
"(",
"Integer",
".",
"decode",
"(",
"immediateNodeValue",
")",
"-",
"1",
")",
")",
",",
"wordSize",
",",
"tmpVar5",
")",
")",
";",
"instructions",
".",
"add",
"(",
"ReilHelpers",
".",
"createAnd",
"(",
"baseOffset",
"++",
",",
"wordSize",
",",
"tmpVar5",
",",
"byteSize",
",",
"oneSet",
",",
"byteSize",
",",
"shifterCarryOut",
")",
")",
";",
"return",
"new",
"Pair",
"<",
"String",
",",
"String",
">",
"(",
"shifterOperand",
",",
"shifterCarryOut",
")",
";",
"}",
"}"
] | < rm > , asr # < shift_imm > operation : if shift_imm = = 0 then if rm [ 31 ] = = 0 then shifter_operand = 0 shifter_carry_out = rm [ 31 ] else / / rm [ 31 ] = = 1 / shifter_operand = 0xffffffff shifter_carry_out = rm [ 31 ] else / shift_imm > 0 / shifter_operand = rm arithmetic_shift_right < shift_imm > shifter_carry_out = rm [ shift_imm - 1 ]
| train | false |
454 | public static void loadModule(final JTree tree,final INaviModule module){
Preconditions.checkNotNull(tree,"IE01195: Tree argument can not be null");
Preconditions.checkNotNull(module,"IE01196: Module argument can not be null");
loadModuleThreaded(SwingUtilities.getWindowAncestor(tree),module,tree);
}
| [
"public",
"static",
"void",
"loadModule",
"(",
"final",
"JTree",
"tree",
",",
"final",
"INaviModule",
"module",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"tree",
",",
"\"IE01195: Tree argument can not be null\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"module",
",",
"\"IE01196: Module argument can not be null\"",
")",
";",
"loadModuleThreaded",
"(",
"SwingUtilities",
".",
"getWindowAncestor",
"(",
"tree",
")",
",",
"module",
",",
"tree",
")",
";",
"}"
] | loads a module while showing a progress dialog .
| train | false |
456 | public void addFunctionalInstrumentation(SpecialInstrumentationPoint functionalInstrumentation){
if (null == functionalInstrumentations) {
functionalInstrumentations=new HashSet<SpecialInstrumentationPoint>(1);
}
functionalInstrumentations.add(functionalInstrumentation);
}
| [
"public",
"void",
"addFunctionalInstrumentation",
"(",
"SpecialInstrumentationPoint",
"functionalInstrumentation",
")",
"{",
"if",
"(",
"null",
"==",
"functionalInstrumentations",
")",
"{",
"functionalInstrumentations",
"=",
"new",
"HashSet",
"<",
"SpecialInstrumentationPoint",
">",
"(",
"1",
")",
";",
"}",
"functionalInstrumentations",
".",
"add",
"(",
"functionalInstrumentation",
")",
";",
"}"
] | adds functional instrumentation point .
| train | false |
457 | public final List<Integer> executeIntListQuery(String sql) throws AdeException {
return SpecialSqlQueries.executeIntListQuery(sql,m_connection);
}
| [
"public",
"final",
"List",
"<",
"Integer",
">",
"executeIntListQuery",
"(",
"String",
"sql",
")",
"throws",
"AdeException",
"{",
"return",
"SpecialSqlQueries",
".",
"executeIntListQuery",
"(",
"sql",
",",
"m_connection",
")",
";",
"}"
] | executes a query that is expected to returned a column of integers .
| train | false |
458 | @ApiOperation(value="Uninstall SymmetricDS on the single engine") @RequestMapping(value="engine/uninstall",method=RequestMethod.POST) @ResponseStatus(HttpStatus.NO_CONTENT) @ResponseBody public final void postUninstall(){
uninstallImpl(getSymmetricEngine());
}
| [
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Uninstall SymmetricDS on the single engine\"",
")",
"@",
"RequestMapping",
"(",
"value",
"=",
"\"engine/uninstall\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"NO_CONTENT",
")",
"@",
"ResponseBody",
"public",
"final",
"void",
"postUninstall",
"(",
")",
"{",
"uninstallImpl",
"(",
"getSymmetricEngine",
"(",
")",
")",
";",
"}"
] | uninstalls all symmetricds objects from the given node ( database ) for the single engine on the node
| train | false |
459 | public boolean oneOutgoingTransitionLeavesCompositeWithExitActions(State state){
Set<State> sourceParentStates=new HashSet<State>(getParentStates(state));
for ( Transition transition : state.getOutgoingTransitions()) {
Set<State> targetParentStates=getParentStates(transition.getTarget());
Set<State> crossedStates=new HashSet<State>(sourceParentStates);
crossedStates.removeAll(targetParentStates);
for ( State crossedCompositeState : crossedStates) {
if (hasExitAction(crossedCompositeState)) return true;
}
}
return false;
}
| [
"public",
"boolean",
"oneOutgoingTransitionLeavesCompositeWithExitActions",
"(",
"State",
"state",
")",
"{",
"Set",
"<",
"State",
">",
"sourceParentStates",
"=",
"new",
"HashSet",
"<",
"State",
">",
"(",
"getParentStates",
"(",
"state",
")",
")",
";",
"for",
"(",
"Transition",
"transition",
":",
"state",
".",
"getOutgoingTransitions",
"(",
")",
")",
"{",
"Set",
"<",
"State",
">",
"targetParentStates",
"=",
"getParentStates",
"(",
"transition",
".",
"getTarget",
"(",
")",
")",
";",
"Set",
"<",
"State",
">",
"crossedStates",
"=",
"new",
"HashSet",
"<",
"State",
">",
"(",
"sourceParentStates",
")",
";",
"crossedStates",
".",
"removeAll",
"(",
"targetParentStates",
")",
";",
"for",
"(",
"State",
"crossedCompositeState",
":",
"crossedStates",
")",
"{",
"if",
"(",
"hasExitAction",
"(",
"crossedCompositeState",
")",
")",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | checks if at least one of the outgoing transitions of the specified state leaves a parent composite of this state which has exit actions .
| train | false |
461 | @Override public int read() throws IOException {
int x=in.read();
if (x != -1) {
check.update(x);
}
return x;
}
| [
"@",
"Override",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"int",
"x",
"=",
"in",
".",
"read",
"(",
")",
";",
"if",
"(",
"x",
"!=",
"-",
"1",
")",
"{",
"check",
".",
"update",
"(",
"x",
")",
";",
"}",
"return",
"x",
";",
"}"
] | reads one byte of data from the underlying input stream and updates the checksum with the byte data .
| train | false |
462 | public static boolean removeTable(Table t){
try {
tableList.remove(t);
}
catch ( Exception e) {
return false;
}
return true;
}
| [
"public",
"static",
"boolean",
"removeTable",
"(",
"Table",
"t",
")",
"{",
"try",
"{",
"tableList",
".",
"remove",
"(",
"t",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | remove the a table .
| train | false |
464 | public Plot add(String label,Population population,int x,int y){
List<Number> xs=new ArrayList<Number>();
List<Number> ys=new ArrayList<Number>();
for ( Solution solution : population) {
if (!solution.violatesConstraints()) {
xs.add(solution.getObjective(x));
ys.add(solution.getObjective(y));
}
}
scatter(label,xs,ys);
setLabelsIfBlank("Objective " + (x + 1),"Objective " + (y + 1));
return this;
}
| [
"public",
"Plot",
"add",
"(",
"String",
"label",
",",
"Population",
"population",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"List",
"<",
"Number",
">",
"xs",
"=",
"new",
"ArrayList",
"<",
"Number",
">",
"(",
")",
";",
"List",
"<",
"Number",
">",
"ys",
"=",
"new",
"ArrayList",
"<",
"Number",
">",
"(",
")",
";",
"for",
"(",
"Solution",
"solution",
":",
"population",
")",
"{",
"if",
"(",
"!",
"solution",
".",
"violatesConstraints",
"(",
")",
")",
"{",
"xs",
".",
"add",
"(",
"solution",
".",
"getObjective",
"(",
"x",
")",
")",
";",
"ys",
".",
"add",
"(",
"solution",
".",
"getObjective",
"(",
"y",
")",
")",
";",
"}",
"}",
"scatter",
"(",
"label",
",",
"xs",
",",
"ys",
")",
";",
"setLabelsIfBlank",
"(",
"\"Objective \"",
"+",
"(",
"x",
"+",
"1",
")",
",",
"\"Objective \"",
"+",
"(",
"y",
"+",
"1",
")",
")",
";",
"return",
"this",
";",
"}"
] | displays the solutions in the given population in a 2d scatter plot . the two given objectives will be displayed .
| train | false |
467 | public final boolean removeElement(int s){
for (int i=0; i < m_firstFree; i++) {
if (m_map[i] == s) {
if ((i + 1) < m_firstFree) System.arraycopy(m_map,i + 1,m_map,i - 1,m_firstFree - i);
else m_map[i]=java.lang.Integer.MIN_VALUE;
m_firstFree--;
return true;
}
}
return false;
}
| [
"public",
"final",
"boolean",
"removeElement",
"(",
"int",
"s",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_firstFree",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_map",
"[",
"i",
"]",
"==",
"s",
")",
"{",
"if",
"(",
"(",
"i",
"+",
"1",
")",
"<",
"m_firstFree",
")",
"System",
".",
"arraycopy",
"(",
"m_map",
",",
"i",
"+",
"1",
",",
"m_map",
",",
"i",
"-",
"1",
",",
"m_firstFree",
"-",
"i",
")",
";",
"else",
"m_map",
"[",
"i",
"]",
"=",
"java",
".",
"lang",
".",
"Integer",
".",
"MIN_VALUE",
";",
"m_firstFree",
"--",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | removes the first occurrence of the argument from this vector . if the object is found in this vector , each component in the vector with an index greater or equal to the object ' s index is shifted downward to have an index one smaller than the value it had previously .
| train | true |
468 | public VNXeCommandJob restoreLunGroupSnap(String snapId,VNXeSnapRestoreParam restoreParam) throws VNXeException {
StringBuilder urlBuilder=new StringBuilder(URL_INSTANCE);
urlBuilder.append(snapId);
urlBuilder.append(URL_RESTORE);
_url=urlBuilder.toString();
return postRequestAsync(restoreParam);
}
| [
"public",
"VNXeCommandJob",
"restoreLunGroupSnap",
"(",
"String",
"snapId",
",",
"VNXeSnapRestoreParam",
"restoreParam",
")",
"throws",
"VNXeException",
"{",
"StringBuilder",
"urlBuilder",
"=",
"new",
"StringBuilder",
"(",
"URL_INSTANCE",
")",
";",
"urlBuilder",
".",
"append",
"(",
"snapId",
")",
";",
"urlBuilder",
".",
"append",
"(",
"URL_RESTORE",
")",
";",
"_url",
"=",
"urlBuilder",
".",
"toString",
"(",
")",
";",
"return",
"postRequestAsync",
"(",
"restoreParam",
")",
";",
"}"
] | restore lun group snapshot
| train | false |
470 | public HaskellCatalog(){
this(HaskellCatalog.XML_PATH);
}
| [
"public",
"HaskellCatalog",
"(",
")",
"{",
"this",
"(",
"HaskellCatalog",
".",
"XML_PATH",
")",
";",
"}"
] | constructs a haskell catalog using the default file location .
| train | false |
471 | public ClassFactory(File dir,ClassLoader parent){
super(parent);
this.output=dir;
dir.mkdirs();
}
| [
"public",
"ClassFactory",
"(",
"File",
"dir",
",",
"ClassLoader",
"parent",
")",
"{",
"super",
"(",
"parent",
")",
";",
"this",
".",
"output",
"=",
"dir",
";",
"dir",
".",
"mkdirs",
"(",
")",
";",
"}"
] | create a given class factory with the given class loader .
| train | false |
472 | static boolean isSameColumn(ConstraintWidget a,ConstraintWidget b){
return Math.max(a.getX(),b.getX()) < Math.min(a.getX() + a.getWidth(),b.getX() + b.getWidth());
}
| [
"static",
"boolean",
"isSameColumn",
"(",
"ConstraintWidget",
"a",
",",
"ConstraintWidget",
"b",
")",
"{",
"return",
"Math",
".",
"max",
"(",
"a",
".",
"getX",
"(",
")",
",",
"b",
".",
"getX",
"(",
")",
")",
"<",
"Math",
".",
"min",
"(",
"a",
".",
"getX",
"(",
")",
"+",
"a",
".",
"getWidth",
"(",
")",
",",
"b",
".",
"getX",
"(",
")",
"+",
"b",
".",
"getWidth",
"(",
")",
")",
";",
"}"
] | are the two widgets in the same vertical area
| train | false |
473 | Remover add(T listener);
| [
"Remover",
"add",
"(",
"T",
"listener",
")",
";"
] | registers a new listener .
| train | false |
475 | @SuppressWarnings("deprecation") protected void stopClassifier(){
if (m_RunThread != null) {
m_RunThread.interrupt();
m_RunThread.stop();
}
}
| [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"void",
"stopClassifier",
"(",
")",
"{",
"if",
"(",
"m_RunThread",
"!=",
"null",
")",
"{",
"m_RunThread",
".",
"interrupt",
"(",
")",
";",
"m_RunThread",
".",
"stop",
"(",
")",
";",
"}",
"}"
] | stops the currently running classifier ( if any ) .
| train | false |
476 | private void sleep(long sleeptime){
try {
Thread.sleep(sleeptime);
}
catch ( InterruptedException e) {
}
}
| [
"private",
"void",
"sleep",
"(",
"long",
"sleeptime",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"sleeptime",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}"
] | make the current thread sleep .
| train | false |
477 | protected void buildPanels(){
keyPanels.clear();
inScrollPane.removeAll();
for ( String key : order) {
String name=names.get(key);
if (name != null) {
String value=values.getProperty(key);
KeyPanel keyPanel=new KeyPanel(name,value);
keyPanel.setAlignmentX(LEFT_ALIGNMENT);
keyPanel.setMaximumSize(guiSize);
inScrollPane.add(keyPanel);
keyPanels.put(key,keyPanel);
}
else {
SpecialSetting special=specials.get(key);
special.setAlignmentX(LEFT_ALIGNMENT);
inScrollPane.add(special);
}
}
}
| [
"protected",
"void",
"buildPanels",
"(",
")",
"{",
"keyPanels",
".",
"clear",
"(",
")",
";",
"inScrollPane",
".",
"removeAll",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"order",
")",
"{",
"String",
"name",
"=",
"names",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"String",
"value",
"=",
"values",
".",
"getProperty",
"(",
"key",
")",
";",
"KeyPanel",
"keyPanel",
"=",
"new",
"KeyPanel",
"(",
"name",
",",
"value",
")",
";",
"keyPanel",
".",
"setAlignmentX",
"(",
"LEFT_ALIGNMENT",
")",
";",
"keyPanel",
".",
"setMaximumSize",
"(",
"guiSize",
")",
";",
"inScrollPane",
".",
"add",
"(",
"keyPanel",
")",
";",
"keyPanels",
".",
"put",
"(",
"key",
",",
"keyPanel",
")",
";",
"}",
"else",
"{",
"SpecialSetting",
"special",
"=",
"specials",
".",
"get",
"(",
"key",
")",
";",
"special",
".",
"setAlignmentX",
"(",
"LEFT_ALIGNMENT",
")",
";",
"inScrollPane",
".",
"add",
"(",
"special",
")",
";",
"}",
"}",
"}"
] | creates all key panels and special settings that have been registered .
| train | false |
478 | public void loadDataStringFromFile(String sFilename,boolean clearCurrentData,String sEncoding){
try {
ByteArrayOutputStream bsOut=new ByteArrayOutputStream();
FileInputStream fiIn=new FileInputStream(sFilename);
int iData=0;
while ((iData=fiIn.read()) > -1) bsOut.write(iData);
String sDataString=bsOut.toString();
setDataString(sDataString,SourceNGramSize,clearCurrentData);
}
catch ( IOException ioe) {
ioe.printStackTrace();
setDataString("",1,false);
}
}
| [
"public",
"void",
"loadDataStringFromFile",
"(",
"String",
"sFilename",
",",
"boolean",
"clearCurrentData",
",",
"String",
"sEncoding",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"bsOut",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"FileInputStream",
"fiIn",
"=",
"new",
"FileInputStream",
"(",
"sFilename",
")",
";",
"int",
"iData",
"=",
"0",
";",
"while",
"(",
"(",
"iData",
"=",
"fiIn",
".",
"read",
"(",
")",
")",
">",
"-",
"1",
")",
"bsOut",
".",
"write",
"(",
"iData",
")",
";",
"String",
"sDataString",
"=",
"bsOut",
".",
"toString",
"(",
")",
";",
"setDataString",
"(",
"sDataString",
",",
"SourceNGramSize",
",",
"clearCurrentData",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"ioe",
".",
"printStackTrace",
"(",
")",
";",
"setDataString",
"(",
"\"\"",
",",
"1",
",",
"false",
")",
";",
"}",
"}"
] | loads the contents of a file as the datastring .
| train | false |
479 | public final char nextChar(CharSequence csq){
return csq.charAt(index++);
}
| [
"public",
"final",
"char",
"nextChar",
"(",
"CharSequence",
"csq",
")",
"{",
"return",
"csq",
".",
"charAt",
"(",
"index",
"++",
")",
";",
"}"
] | returns the next character at this cursor position . the cursor position is incremented by one .
| train | false |
480 | private long dragStartedAgo(){
if (dragStarted == 0) {
return -1;
}
return System.currentTimeMillis() - dragStarted;
}
| [
"private",
"long",
"dragStartedAgo",
"(",
")",
"{",
"if",
"(",
"dragStarted",
"==",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"dragStarted",
";",
"}"
] | returns the time in milliseconds how long ago the current drag started .
| train | false |
481 | protected static double regularizedIncBetaCF(double alpha,double beta,double x){
final double FPMIN=Double.MIN_VALUE / NUM_PRECISION;
double qab=alpha + beta;
double qap=alpha + 1.0;
double qam=alpha - 1.0;
double c=1.0;
double d=1.0 - qab * x / qap;
if (Math.abs(d) < FPMIN) {
d=FPMIN;
}
d=1.0 / d;
double h=d;
for (int m=1; m < 10000; m++) {
int m2=2 * m;
double aa=m * (beta - m) * x / ((qam + m2) * (alpha + m2));
d=1.0 + aa * d;
if (Math.abs(d) < FPMIN) {
d=FPMIN;
}
c=1.0 + aa / c;
if (Math.abs(c) < FPMIN) {
c=FPMIN;
}
d=1.0 / d;
h*=d * c;
aa=-(alpha + m) * (qab + m) * x / ((alpha + m2) * (qap + m2));
d=1.0 + aa * d;
if (Math.abs(d) < FPMIN) {
d=FPMIN;
}
c=1.0 + aa / c;
if (Math.abs(c) < FPMIN) {
c=FPMIN;
}
d=1.0 / d;
double del=d * c;
h*=del;
if (Math.abs(del - 1.0) <= NUM_PRECISION) {
break;
}
}
return h;
}
| [
"protected",
"static",
"double",
"regularizedIncBetaCF",
"(",
"double",
"alpha",
",",
"double",
"beta",
",",
"double",
"x",
")",
"{",
"final",
"double",
"FPMIN",
"=",
"Double",
".",
"MIN_VALUE",
"/",
"NUM_PRECISION",
";",
"double",
"qab",
"=",
"alpha",
"+",
"beta",
";",
"double",
"qap",
"=",
"alpha",
"+",
"1.0",
";",
"double",
"qam",
"=",
"alpha",
"-",
"1.0",
";",
"double",
"c",
"=",
"1.0",
";",
"double",
"d",
"=",
"1.0",
"-",
"qab",
"*",
"x",
"/",
"qap",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"d",
")",
"<",
"FPMIN",
")",
"{",
"d",
"=",
"FPMIN",
";",
"}",
"d",
"=",
"1.0",
"/",
"d",
";",
"double",
"h",
"=",
"d",
";",
"for",
"(",
"int",
"m",
"=",
"1",
";",
"m",
"<",
"10000",
";",
"m",
"++",
")",
"{",
"int",
"m2",
"=",
"2",
"*",
"m",
";",
"double",
"aa",
"=",
"m",
"*",
"(",
"beta",
"-",
"m",
")",
"*",
"x",
"/",
"(",
"(",
"qam",
"+",
"m2",
")",
"*",
"(",
"alpha",
"+",
"m2",
")",
")",
";",
"d",
"=",
"1.0",
"+",
"aa",
"*",
"d",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"d",
")",
"<",
"FPMIN",
")",
"{",
"d",
"=",
"FPMIN",
";",
"}",
"c",
"=",
"1.0",
"+",
"aa",
"/",
"c",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"c",
")",
"<",
"FPMIN",
")",
"{",
"c",
"=",
"FPMIN",
";",
"}",
"d",
"=",
"1.0",
"/",
"d",
";",
"h",
"*=",
"d",
"*",
"c",
";",
"aa",
"=",
"-",
"(",
"alpha",
"+",
"m",
")",
"*",
"(",
"qab",
"+",
"m",
")",
"*",
"x",
"/",
"(",
"(",
"alpha",
"+",
"m2",
")",
"*",
"(",
"qap",
"+",
"m2",
")",
")",
";",
"d",
"=",
"1.0",
"+",
"aa",
"*",
"d",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"d",
")",
"<",
"FPMIN",
")",
"{",
"d",
"=",
"FPMIN",
";",
"}",
"c",
"=",
"1.0",
"+",
"aa",
"/",
"c",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"c",
")",
"<",
"FPMIN",
")",
"{",
"c",
"=",
"FPMIN",
";",
"}",
"d",
"=",
"1.0",
"/",
"d",
";",
"double",
"del",
"=",
"d",
"*",
"c",
";",
"h",
"*=",
"del",
";",
"if",
"(",
"Math",
".",
"abs",
"(",
"del",
"-",
"1.0",
")",
"<=",
"NUM_PRECISION",
")",
"{",
"break",
";",
"}",
"}",
"return",
"h",
";",
"}"
] | returns the regularized incomplete beta function i_x ( a , b ) includes the continued fraction way of computing , based on the book " numerical recipes " .
| train | true |
482 | public DateTimeZoneBuilder addCutover(int year,char mode,int monthOfYear,int dayOfMonth,int dayOfWeek,boolean advanceDayOfWeek,int millisOfDay){
if (iRuleSets.size() > 0) {
OfYear ofYear=new OfYear(mode,monthOfYear,dayOfMonth,dayOfWeek,advanceDayOfWeek,millisOfDay);
RuleSet lastRuleSet=iRuleSets.get(iRuleSets.size() - 1);
lastRuleSet.setUpperLimit(year,ofYear);
}
iRuleSets.add(new RuleSet());
return this;
}
| [
"public",
"DateTimeZoneBuilder",
"addCutover",
"(",
"int",
"year",
",",
"char",
"mode",
",",
"int",
"monthOfYear",
",",
"int",
"dayOfMonth",
",",
"int",
"dayOfWeek",
",",
"boolean",
"advanceDayOfWeek",
",",
"int",
"millisOfDay",
")",
"{",
"if",
"(",
"iRuleSets",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"OfYear",
"ofYear",
"=",
"new",
"OfYear",
"(",
"mode",
",",
"monthOfYear",
",",
"dayOfMonth",
",",
"dayOfWeek",
",",
"advanceDayOfWeek",
",",
"millisOfDay",
")",
";",
"RuleSet",
"lastRuleSet",
"=",
"iRuleSets",
".",
"get",
"(",
"iRuleSets",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"lastRuleSet",
".",
"setUpperLimit",
"(",
"year",
",",
"ofYear",
")",
";",
"}",
"iRuleSets",
".",
"add",
"(",
"new",
"RuleSet",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] | adds a cutover for added rules . the standard offset at the cutover defaults to 0 . call setstandardoffset afterwards to change it .
| train | true |
483 | private boolean isNullSetting(boolean makeDest,MappingType mtd,MappingType mts,StringBuilder result){
if (makeDest && (mtd == ALL_FIELDS || mtd == ONLY_VALUED_FIELDS) && mts == ONLY_NULL_FIELDS) {
result.append(" " + stringOfSetDestination + "(null);"+ newLine);
return true;
}
return false;
}
| [
"private",
"boolean",
"isNullSetting",
"(",
"boolean",
"makeDest",
",",
"MappingType",
"mtd",
",",
"MappingType",
"mts",
",",
"StringBuilder",
"result",
")",
"{",
"if",
"(",
"makeDest",
"&&",
"(",
"mtd",
"==",
"ALL_FIELDS",
"||",
"mtd",
"==",
"ONLY_VALUED_FIELDS",
")",
"&&",
"mts",
"==",
"ONLY_NULL_FIELDS",
")",
"{",
"result",
".",
"append",
"(",
"\" \"",
"+",
"stringOfSetDestination",
"+",
"\"(null);\"",
"+",
"newLine",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | if it is a null setting returns the null mapping
| train | true |
485 | private boolean shouldEmitTypedefByName(JSType realType){
return realType.isRecordType() || realType.isTemplatizedType() || realType.isFunctionType();
}
| [
"private",
"boolean",
"shouldEmitTypedefByName",
"(",
"JSType",
"realType",
")",
"{",
"return",
"realType",
".",
"isRecordType",
"(",
")",
"||",
"realType",
".",
"isTemplatizedType",
"(",
")",
"||",
"realType",
".",
"isFunctionType",
"(",
")",
";",
"}"
] | whether the typedef should be emitted by name or by the type it is defining . because , we do not access the original type signature , the replacement is done for all references of the type ( through the typedef or direct ) . thus it is undesirable to always emit by name . for example :
| train | false |
486 | private synchronized void manageMenu(){
if ((game != null) || (hasBoard && (null == client))) {
fileGameNew.setEnabled(false);
fileGameOpen.setEnabled(false);
fileGameScenario.setEnabled(false);
fileGameConnectBot.setEnabled(false);
fileGameConnect.setEnabled(false);
replacePlayer.setEnabled(false);
if ((phase != IGame.Phase.PHASE_UNKNOWN) && (phase != IGame.Phase.PHASE_LOUNGE) && (phase != IGame.Phase.PHASE_SELECTION)&& (phase != IGame.Phase.PHASE_EXCHANGE)&& (phase != IGame.Phase.PHASE_VICTORY)&& (phase != IGame.Phase.PHASE_STARTING_SCENARIO)) {
fileGameSave.setEnabled(true);
fileGameSaveServer.setEnabled(true);
replacePlayer.setEnabled(true);
}
else {
fileGameSave.setEnabled(false);
fileGameSaveServer.setEnabled(false);
replacePlayer.setEnabled(false);
}
}
else {
fileGameNew.setEnabled(true);
fileGameOpen.setEnabled(true);
fileGameSave.setEnabled(false);
fileGameSaveServer.setEnabled(false);
fileGameScenario.setEnabled(true);
fileGameConnectBot.setEnabled(true);
fileGameConnect.setEnabled(true);
replacePlayer.setEnabled(true);
}
if (game != null) {
viewGameOptions.setEnabled(true);
viewPlayerSettings.setEnabled(true);
}
else {
viewGameOptions.setEnabled(false);
viewPlayerSettings.setEnabled(false);
}
filePrint.setEnabled(false);
if (client != null) {
fileBoardNew.setEnabled(false);
fileBoardOpen.setEnabled(false);
fileBoardSave.setEnabled(false);
fileBoardSaveAs.setEnabled(false);
fileBoardSaveAsImage.setEnabled(false);
}
else {
fileBoardNew.setEnabled(true);
fileBoardOpen.setEnabled(true);
fileBoardSave.setEnabled(false);
fileBoardSaveAs.setEnabled(false);
fileBoardSaveAsImage.setEnabled(false);
}
if (hasBoard) {
fileBoardSave.setEnabled(true);
fileBoardSaveAs.setEnabled(true);
fileBoardSaveAsImage.setEnabled(true);
viewMiniMap.setEnabled(true);
viewZoomIn.setEnabled(true);
viewZoomOut.setEnabled(true);
}
else {
fileBoardSave.setEnabled(false);
fileBoardSaveAs.setEnabled(false);
fileBoardSaveAsImage.setEnabled(false);
viewMiniMap.setEnabled(false);
viewZoomIn.setEnabled(false);
viewZoomOut.setEnabled(false);
}
if (hasUnitList) {
fileUnitsOpen.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
fileUnitsClear.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
}
else {
fileUnitsOpen.setEnabled(phase == IGame.Phase.PHASE_LOUNGE);
fileUnitsClear.setEnabled(false);
}
fileUnitsReinforce.setEnabled(phase != IGame.Phase.PHASE_LOUNGE);
fileUnitsReinforceRAT.setEnabled(phase != IGame.Phase.PHASE_LOUNGE);
if (entity != null) {
viewMekDisplay.setEnabled(true);
}
else {
viewMekDisplay.setEnabled(false);
}
if ((client == null) && hasBoard) {
viewLOSSetting.setEnabled(false);
viewUnitOverview.setEnabled(false);
viewPlayerList.setEnabled(false);
}
else if ((phase == IGame.Phase.PHASE_SET_ARTYAUTOHITHEXES) || (phase == IGame.Phase.PHASE_DEPLOY_MINEFIELDS) || (phase == IGame.Phase.PHASE_MOVEMENT)|| (phase == IGame.Phase.PHASE_FIRING)|| (phase == IGame.Phase.PHASE_PHYSICAL)|| (phase == IGame.Phase.PHASE_OFFBOARD)|| (phase == IGame.Phase.PHASE_TARGETING)|| (phase == IGame.Phase.PHASE_DEPLOYMENT)) {
viewLOSSetting.setEnabled(true);
viewMiniMap.setEnabled(true);
viewZoomIn.setEnabled(true);
viewZoomOut.setEnabled(true);
viewUnitOverview.setEnabled(true);
viewPlayerList.setEnabled(true);
}
else {
viewLOSSetting.setEnabled(false);
viewMiniMap.setEnabled(false);
viewZoomIn.setEnabled(false);
viewZoomOut.setEnabled(false);
viewUnitOverview.setEnabled(false);
viewPlayerList.setEnabled(false);
}
if ((phase == IGame.Phase.PHASE_INITIATIVE) || (phase == IGame.Phase.PHASE_MOVEMENT) || (phase == IGame.Phase.PHASE_FIRING)|| (phase == IGame.Phase.PHASE_PHYSICAL)|| (phase == IGame.Phase.PHASE_OFFBOARD)|| (phase == IGame.Phase.PHASE_TARGETING)|| (phase == IGame.Phase.PHASE_END)|| (phase == IGame.Phase.PHASE_DEPLOYMENT)) {
viewRoundReport.setEnabled(true);
}
else {
viewRoundReport.setEnabled(false);
}
viewClientSettings.setEnabled(true);
if ((phase != IGame.Phase.PHASE_FIRING) || (entity == null)) {
fireCancel.setEnabled(false);
}
else {
fireCancel.setEnabled(true);
}
updateSaveWeaponOrderMenuItem();
}
| [
"private",
"synchronized",
"void",
"manageMenu",
"(",
")",
"{",
"if",
"(",
"(",
"game",
"!=",
"null",
")",
"||",
"(",
"hasBoard",
"&&",
"(",
"null",
"==",
"client",
")",
")",
")",
"{",
"fileGameNew",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameOpen",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameScenario",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameConnectBot",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameConnect",
".",
"setEnabled",
"(",
"false",
")",
";",
"replacePlayer",
".",
"setEnabled",
"(",
"false",
")",
";",
"if",
"(",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_UNKNOWN",
")",
"&&",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
"&&",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_SELECTION",
")",
"&&",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_EXCHANGE",
")",
"&&",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_VICTORY",
")",
"&&",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_STARTING_SCENARIO",
")",
")",
"{",
"fileGameSave",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileGameSaveServer",
".",
"setEnabled",
"(",
"true",
")",
";",
"replacePlayer",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"fileGameSave",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameSaveServer",
".",
"setEnabled",
"(",
"false",
")",
";",
"replacePlayer",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"}",
"else",
"{",
"fileGameNew",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileGameOpen",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileGameSave",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameSaveServer",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileGameScenario",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileGameConnectBot",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileGameConnect",
".",
"setEnabled",
"(",
"true",
")",
";",
"replacePlayer",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"if",
"(",
"game",
"!=",
"null",
")",
"{",
"viewGameOptions",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewPlayerSettings",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"viewGameOptions",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewPlayerSettings",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"filePrint",
".",
"setEnabled",
"(",
"false",
")",
";",
"if",
"(",
"client",
"!=",
"null",
")",
"{",
"fileBoardNew",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardOpen",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSave",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAs",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAsImage",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"{",
"fileBoardNew",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileBoardOpen",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileBoardSave",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAs",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAsImage",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"if",
"(",
"hasBoard",
")",
"{",
"fileBoardSave",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileBoardSaveAs",
".",
"setEnabled",
"(",
"true",
")",
";",
"fileBoardSaveAsImage",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewMiniMap",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewZoomIn",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewZoomOut",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"fileBoardSave",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAs",
".",
"setEnabled",
"(",
"false",
")",
";",
"fileBoardSaveAsImage",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewMiniMap",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewZoomIn",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewZoomOut",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"if",
"(",
"hasUnitList",
")",
"{",
"fileUnitsOpen",
".",
"setEnabled",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
";",
"fileUnitsClear",
".",
"setEnabled",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
";",
"}",
"else",
"{",
"fileUnitsOpen",
".",
"setEnabled",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
";",
"fileUnitsClear",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"fileUnitsReinforce",
".",
"setEnabled",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
";",
"fileUnitsReinforceRAT",
".",
"setEnabled",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_LOUNGE",
")",
";",
"if",
"(",
"entity",
"!=",
"null",
")",
"{",
"viewMekDisplay",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"viewMekDisplay",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"if",
"(",
"(",
"client",
"==",
"null",
")",
"&&",
"hasBoard",
")",
"{",
"viewLOSSetting",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewUnitOverview",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewPlayerList",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_SET_ARTYAUTOHITHEXES",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_DEPLOY_MINEFIELDS",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_MOVEMENT",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_FIRING",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_PHYSICAL",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_OFFBOARD",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_TARGETING",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_DEPLOYMENT",
")",
")",
"{",
"viewLOSSetting",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewMiniMap",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewZoomIn",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewZoomOut",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewUnitOverview",
".",
"setEnabled",
"(",
"true",
")",
";",
"viewPlayerList",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"viewLOSSetting",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewMiniMap",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewZoomIn",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewZoomOut",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewUnitOverview",
".",
"setEnabled",
"(",
"false",
")",
";",
"viewPlayerList",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"if",
"(",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_INITIATIVE",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_MOVEMENT",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_FIRING",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_PHYSICAL",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_OFFBOARD",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_TARGETING",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_END",
")",
"||",
"(",
"phase",
"==",
"IGame",
".",
"Phase",
".",
"PHASE_DEPLOYMENT",
")",
")",
"{",
"viewRoundReport",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"else",
"{",
"viewRoundReport",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"viewClientSettings",
".",
"setEnabled",
"(",
"true",
")",
";",
"if",
"(",
"(",
"phase",
"!=",
"IGame",
".",
"Phase",
".",
"PHASE_FIRING",
")",
"||",
"(",
"entity",
"==",
"null",
")",
")",
"{",
"fireCancel",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"{",
"fireCancel",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"updateSaveWeaponOrderMenuItem",
"(",
")",
";",
"}"
] | a helper function that will manage the enabled states of the items in this menu , based upon the object ' s current state .
| train | false |
489 | public BigInteger calculateClientEvidenceMessage() throws CryptoException {
if ((this.A == null) || (this.B == null) || (this.S == null)) {
throw new CryptoException("Impossible to compute M1: " + "some data are missing from the previous operations (A,B,S)");
}
this.M1=SRP6Util.calculateM1(digest,N,A,B,S);
return M1;
}
| [
"public",
"BigInteger",
"calculateClientEvidenceMessage",
"(",
")",
"throws",
"CryptoException",
"{",
"if",
"(",
"(",
"this",
".",
"A",
"==",
"null",
")",
"||",
"(",
"this",
".",
"B",
"==",
"null",
")",
"||",
"(",
"this",
".",
"S",
"==",
"null",
")",
")",
"{",
"throw",
"new",
"CryptoException",
"(",
"\"Impossible to compute M1: \"",
"+",
"\"some data are missing from the previous operations (A,B,S)\"",
")",
";",
"}",
"this",
".",
"M1",
"=",
"SRP6Util",
".",
"calculateM1",
"(",
"digest",
",",
"N",
",",
"A",
",",
"B",
",",
"S",
")",
";",
"return",
"M1",
";",
"}"
] | computes the client evidence message m1 using the previously received values . to be called after calculating the secret s .
| train | false |
491 | private static Field findAccessibleField(Class clas,String fieldName) throws UtilEvalError, NoSuchFieldException {
Field field;
try {
field=clas.getField(fieldName);
ReflectManager.RMSetAccessible(field);
return field;
}
catch ( NoSuchFieldException e) {
}
while (clas != null) {
try {
field=clas.getDeclaredField(fieldName);
ReflectManager.RMSetAccessible(field);
return field;
}
catch ( NoSuchFieldException e) {
}
clas=clas.getSuperclass();
}
throw new NoSuchFieldException(fieldName);
}
| [
"private",
"static",
"Field",
"findAccessibleField",
"(",
"Class",
"clas",
",",
"String",
"fieldName",
")",
"throws",
"UtilEvalError",
",",
"NoSuchFieldException",
"{",
"Field",
"field",
";",
"try",
"{",
"field",
"=",
"clas",
".",
"getField",
"(",
"fieldName",
")",
";",
"ReflectManager",
".",
"RMSetAccessible",
"(",
"field",
")",
";",
"return",
"field",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"}",
"while",
"(",
"clas",
"!=",
"null",
")",
"{",
"try",
"{",
"field",
"=",
"clas",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"ReflectManager",
".",
"RMSetAccessible",
"(",
"field",
")",
";",
"return",
"field",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"}",
"clas",
"=",
"clas",
".",
"getSuperclass",
"(",
")",
";",
"}",
"throw",
"new",
"NoSuchFieldException",
"(",
"fieldName",
")",
";",
"}"
] | used when accessibility capability is available to locate an occurrence of the field in the most derived class or superclass and set its accessibility flag . note that this method is not needed in the simple non accessible case because we don ' t have to hunt for fields . note that classes may declare overlapping private fields , so the distinction about the most derived is important . java doesn ' t normally allow this kind of access ( super won ' t show private variables ) so there is no real syntax for specifying which class scope to use . . .
| train | false |
492 | public void removeArguments(String label){
List<PBArgument> remove=new ArrayList<>();
for ( PBArgument arg : l_arguments) {
if (arg.isLabel(label)) remove.add(arg);
}
l_arguments.removeAll(remove);
}
| [
"public",
"void",
"removeArguments",
"(",
"String",
"label",
")",
"{",
"List",
"<",
"PBArgument",
">",
"remove",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"PBArgument",
"arg",
":",
"l_arguments",
")",
"{",
"if",
"(",
"arg",
".",
"isLabel",
"(",
"label",
")",
")",
"remove",
".",
"add",
"(",
"arg",
")",
";",
"}",
"l_arguments",
".",
"removeAll",
"(",
"remove",
")",
";",
"}"
] | removes all argument with the specific label .
| train | false |
493 | public POSMikheevFeatureExtractor(String viewName,String json){
this.viewName=viewName;
this.counter=POSMikheevCounter.read(json);
}
| [
"public",
"POSMikheevFeatureExtractor",
"(",
"String",
"viewName",
",",
"String",
"json",
")",
"{",
"this",
".",
"viewName",
"=",
"viewName",
";",
"this",
".",
"counter",
"=",
"POSMikheevCounter",
".",
"read",
"(",
"json",
")",
";",
"}"
] | construct the feature extractor given a trained counter in json format .
| train | false |
494 | public static boolean endsWithIgnoreCase(String src,String subS){
String sub=subS.toLowerCase();
int sublen=sub.length();
int j=0;
int i=src.length() - sublen;
if (i < 0) {
return false;
}
while (j < sublen) {
char source=Character.toLowerCase(src.charAt(i));
if (sub.charAt(j) != source) {
return false;
}
j++;
i++;
}
return true;
}
| [
"public",
"static",
"boolean",
"endsWithIgnoreCase",
"(",
"String",
"src",
",",
"String",
"subS",
")",
"{",
"String",
"sub",
"=",
"subS",
".",
"toLowerCase",
"(",
")",
";",
"int",
"sublen",
"=",
"sub",
".",
"length",
"(",
")",
";",
"int",
"j",
"=",
"0",
";",
"int",
"i",
"=",
"src",
".",
"length",
"(",
")",
"-",
"sublen",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"while",
"(",
"j",
"<",
"sublen",
")",
"{",
"char",
"source",
"=",
"Character",
".",
"toLowerCase",
"(",
"src",
".",
"charAt",
"(",
"i",
")",
")",
";",
"if",
"(",
"sub",
".",
"charAt",
"(",
"j",
")",
"!=",
"source",
")",
"{",
"return",
"false",
";",
"}",
"j",
"++",
";",
"i",
"++",
";",
"}",
"return",
"true",
";",
"}"
] | tests if this string ends with the specified suffix .
| train | true |
497 | @Nullable protected abstract Object extractParameter(@Nullable String cacheName,String typeName,TypeKind typeKind,String fieldName,Object obj) throws CacheException ;
| [
"@",
"Nullable",
"protected",
"abstract",
"Object",
"extractParameter",
"(",
"@",
"Nullable",
"String",
"cacheName",
",",
"String",
"typeName",
",",
"TypeKind",
"typeKind",
",",
"String",
"fieldName",
",",
"Object",
"obj",
")",
"throws",
"CacheException",
";"
] | get field value from object for use as query parameter .
| train | false |
499 | static OCSPResponse check(List<CertId> certIds,URI responderURI,X509Certificate issuerCert,X509Certificate responderCert,Date date,List<Extension> extensions) throws IOException, CertPathValidatorException {
byte[] bytes=null;
OCSPRequest request=null;
try {
request=new OCSPRequest(certIds,extensions);
bytes=request.encodeBytes();
}
catch ( IOException ioe) {
throw new CertPathValidatorException("Exception while encoding OCSPRequest",ioe);
}
InputStream in=null;
OutputStream out=null;
byte[] response=null;
try {
URL url=responderURI.toURL();
if (debug != null) {
debug.println("connecting to OCSP service at: " + url);
}
HttpURLConnection con=(HttpURLConnection)url.openConnection();
con.setConnectTimeout(CONNECT_TIMEOUT);
con.setReadTimeout(CONNECT_TIMEOUT);
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestMethod("POST");
con.setRequestProperty("Content-type","application/ocsp-request");
con.setRequestProperty("Content-length",String.valueOf(bytes.length));
out=con.getOutputStream();
out.write(bytes);
out.flush();
if (debug != null && con.getResponseCode() != HttpURLConnection.HTTP_OK) {
debug.println("Received HTTP error: " + con.getResponseCode() + " - "+ con.getResponseMessage());
}
in=con.getInputStream();
int contentLength=con.getContentLength();
if (contentLength == -1) {
contentLength=Integer.MAX_VALUE;
}
response=new byte[contentLength > 2048 ? 2048 : contentLength];
int total=0;
while (total < contentLength) {
int count=in.read(response,total,response.length - total);
if (count < 0) break;
total+=count;
if (total >= response.length && total < contentLength) {
response=Arrays.copyOf(response,total * 2);
}
}
response=Arrays.copyOf(response,total);
}
catch ( IOException ioe) {
throw new CertPathValidatorException("Unable to determine revocation status due to network error",ioe,null,-1,BasicReason.UNDETERMINED_REVOCATION_STATUS);
}
finally {
if (in != null) {
try {
in.close();
}
catch ( IOException ioe) {
throw ioe;
}
}
if (out != null) {
try {
out.close();
}
catch ( IOException ioe) {
throw ioe;
}
}
}
OCSPResponse ocspResponse=null;
try {
ocspResponse=new OCSPResponse(response);
}
catch ( IOException ioe) {
throw new CertPathValidatorException(ioe);
}
ocspResponse.verify(certIds,issuerCert,responderCert,date,request.getNonce());
return ocspResponse;
}
| [
"static",
"OCSPResponse",
"check",
"(",
"List",
"<",
"CertId",
">",
"certIds",
",",
"URI",
"responderURI",
",",
"X509Certificate",
"issuerCert",
",",
"X509Certificate",
"responderCert",
",",
"Date",
"date",
",",
"List",
"<",
"Extension",
">",
"extensions",
")",
"throws",
"IOException",
",",
"CertPathValidatorException",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"null",
";",
"OCSPRequest",
"request",
"=",
"null",
";",
"try",
"{",
"request",
"=",
"new",
"OCSPRequest",
"(",
"certIds",
",",
"extensions",
")",
";",
"bytes",
"=",
"request",
".",
"encodeBytes",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"CertPathValidatorException",
"(",
"\"Exception while encoding OCSPRequest\"",
",",
"ioe",
")",
";",
"}",
"InputStream",
"in",
"=",
"null",
";",
"OutputStream",
"out",
"=",
"null",
";",
"byte",
"[",
"]",
"response",
"=",
"null",
";",
"try",
"{",
"URL",
"url",
"=",
"responderURI",
".",
"toURL",
"(",
")",
";",
"if",
"(",
"debug",
"!=",
"null",
")",
"{",
"debug",
".",
"println",
"(",
"\"connecting to OCSP service at: \"",
"+",
"url",
")",
";",
"}",
"HttpURLConnection",
"con",
"=",
"(",
"HttpURLConnection",
")",
"url",
".",
"openConnection",
"(",
")",
";",
"con",
".",
"setConnectTimeout",
"(",
"CONNECT_TIMEOUT",
")",
";",
"con",
".",
"setReadTimeout",
"(",
"CONNECT_TIMEOUT",
")",
";",
"con",
".",
"setDoOutput",
"(",
"true",
")",
";",
"con",
".",
"setDoInput",
"(",
"true",
")",
";",
"con",
".",
"setRequestMethod",
"(",
"\"POST\"",
")",
";",
"con",
".",
"setRequestProperty",
"(",
"\"Content-type\"",
",",
"\"application/ocsp-request\"",
")",
";",
"con",
".",
"setRequestProperty",
"(",
"\"Content-length\"",
",",
"String",
".",
"valueOf",
"(",
"bytes",
".",
"length",
")",
")",
";",
"out",
"=",
"con",
".",
"getOutputStream",
"(",
")",
";",
"out",
".",
"write",
"(",
"bytes",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"if",
"(",
"debug",
"!=",
"null",
"&&",
"con",
".",
"getResponseCode",
"(",
")",
"!=",
"HttpURLConnection",
".",
"HTTP_OK",
")",
"{",
"debug",
".",
"println",
"(",
"\"Received HTTP error: \"",
"+",
"con",
".",
"getResponseCode",
"(",
")",
"+",
"\" - \"",
"+",
"con",
".",
"getResponseMessage",
"(",
")",
")",
";",
"}",
"in",
"=",
"con",
".",
"getInputStream",
"(",
")",
";",
"int",
"contentLength",
"=",
"con",
".",
"getContentLength",
"(",
")",
";",
"if",
"(",
"contentLength",
"==",
"-",
"1",
")",
"{",
"contentLength",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"}",
"response",
"=",
"new",
"byte",
"[",
"contentLength",
">",
"2048",
"?",
"2048",
":",
"contentLength",
"]",
";",
"int",
"total",
"=",
"0",
";",
"while",
"(",
"total",
"<",
"contentLength",
")",
"{",
"int",
"count",
"=",
"in",
".",
"read",
"(",
"response",
",",
"total",
",",
"response",
".",
"length",
"-",
"total",
")",
";",
"if",
"(",
"count",
"<",
"0",
")",
"break",
";",
"total",
"+=",
"count",
";",
"if",
"(",
"total",
">=",
"response",
".",
"length",
"&&",
"total",
"<",
"contentLength",
")",
"{",
"response",
"=",
"Arrays",
".",
"copyOf",
"(",
"response",
",",
"total",
"*",
"2",
")",
";",
"}",
"}",
"response",
"=",
"Arrays",
".",
"copyOf",
"(",
"response",
",",
"total",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"CertPathValidatorException",
"(",
"\"Unable to determine revocation status due to network error\"",
",",
"ioe",
",",
"null",
",",
"-",
"1",
",",
"BasicReason",
".",
"UNDETERMINED_REVOCATION_STATUS",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"ioe",
";",
"}",
"}",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"try",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"ioe",
";",
"}",
"}",
"}",
"OCSPResponse",
"ocspResponse",
"=",
"null",
";",
"try",
"{",
"ocspResponse",
"=",
"new",
"OCSPResponse",
"(",
"response",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"new",
"CertPathValidatorException",
"(",
"ioe",
")",
";",
"}",
"ocspResponse",
".",
"verify",
"(",
"certIds",
",",
"issuerCert",
",",
"responderCert",
",",
"date",
",",
"request",
".",
"getNonce",
"(",
")",
")",
";",
"return",
"ocspResponse",
";",
"}"
] | checks the revocation status of a list of certificates using ocsp .
| train | true |
500 | @Override public void reset() throws IOException {
fInputStream.reset();
}
| [
"@",
"Override",
"public",
"void",
"reset",
"(",
")",
"throws",
"IOException",
"{",
"fInputStream",
".",
"reset",
"(",
")",
";",
"}"
] | reset the stream . if the stream has been marked , then attempt to reposition it at the mark . if the stream has not been marked , then attempt to reset it in some way appropriate to the particular stream , for example by repositioning it to its starting point . not all character - input streams support the reset ( ) operation , and some support reset ( ) without supporting mark ( ) .
| train | false |
502 | public LongStreamEx prepend(LongStream other){
return new LongStreamEx(LongStream.concat(other,stream()),context.combine(other));
}
| [
"public",
"LongStreamEx",
"prepend",
"(",
"LongStream",
"other",
")",
"{",
"return",
"new",
"LongStreamEx",
"(",
"LongStream",
".",
"concat",
"(",
"other",
",",
"stream",
"(",
")",
")",
",",
"context",
".",
"combine",
"(",
"other",
")",
")",
";",
"}"
] | creates a lazily concatenated stream whose elements are all the elements of the other stream followed by all the elements of this stream . the resulting stream is ordered if both of the input streams are ordered , and parallel if either of the input streams is parallel . when the resulting stream is closed , the close handlers for both input streams are invoked .
| train | true |
503 | public void disconnect(){
connected=false;
synchronized (connLostWait) {
connLostWait.notify();
}
if (mqtt != null) {
try {
mqtt.disconnect();
}
catch ( Exception ex) {
setTitleText("MQTT disconnect error !");
ex.printStackTrace();
System.exit(1);
}
}
if (led.isFlashing()) {
led.setFlash();
}
led.setRed();
setConnected(false);
synchronized (this) {
writeLogln("WebSphere MQ Telemetry transport disconnected");
}
}
| [
"public",
"void",
"disconnect",
"(",
")",
"{",
"connected",
"=",
"false",
";",
"synchronized",
"(",
"connLostWait",
")",
"{",
"connLostWait",
".",
"notify",
"(",
")",
";",
"}",
"if",
"(",
"mqtt",
"!=",
"null",
")",
"{",
"try",
"{",
"mqtt",
".",
"disconnect",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"setTitleText",
"(",
"\"MQTT disconnect error !\"",
")",
";",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"System",
".",
"exit",
"(",
"1",
")",
";",
"}",
"}",
"if",
"(",
"led",
".",
"isFlashing",
"(",
")",
")",
"{",
"led",
".",
"setFlash",
"(",
")",
";",
"}",
"led",
".",
"setRed",
"(",
")",
";",
"setConnected",
"(",
"false",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"writeLogln",
"(",
"\"WebSphere MQ Telemetry transport disconnected\"",
")",
";",
"}",
"}"
] | a wrapper for the mqtt disconnect method . as well as disconnecting the protocol this method enables / disables buttons as appropriate when in disconnected state . it also sets the correct colour of the indicator led .
| train | false |
505 | private void checkPermissions(){
SecurityManager sm=System.getSecurityManager();
if (sm != null) {
Enumeration<Permission> enum_=permissions.elements();
while (enum_.hasMoreElements()) {
sm.checkPermission(enum_.nextElement());
}
}
}
| [
"private",
"void",
"checkPermissions",
"(",
")",
"{",
"SecurityManager",
"sm",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"sm",
"!=",
"null",
")",
"{",
"Enumeration",
"<",
"Permission",
">",
"enum_",
"=",
"permissions",
".",
"elements",
"(",
")",
";",
"while",
"(",
"enum_",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"sm",
".",
"checkPermission",
"(",
"enum_",
".",
"nextElement",
"(",
")",
")",
";",
"}",
"}",
"}"
] | check that the current access control context has all of the permissions necessary to load classes from this loader .
| train | false |
506 | public SpanManager delete(int start,int end){
sb.delete(start,end);
adjustLists(start,start - end);
if (calculateSrcPositions) for (int i=0; i < end - start; i++) ib.remove(start);
return this;
}
| [
"public",
"SpanManager",
"delete",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"sb",
".",
"delete",
"(",
"start",
",",
"end",
")",
";",
"adjustLists",
"(",
"start",
",",
"start",
"-",
"end",
")",
";",
"if",
"(",
"calculateSrcPositions",
")",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"end",
"-",
"start",
";",
"i",
"++",
")",
"ib",
".",
"remove",
"(",
"start",
")",
";",
"return",
"this",
";",
"}"
] | deletes the content between start ( included ) and end ( excluded ) .
| train | true |
507 | @OnError public void onError(Session session,Throwable t){
callInternal("onError",session,t.getMessage());
logger.error(t.getMessage(),t);
}
| [
"@",
"OnError",
"public",
"void",
"onError",
"(",
"Session",
"session",
",",
"Throwable",
"t",
")",
"{",
"callInternal",
"(",
"\"onError\"",
",",
"session",
",",
"t",
".",
"getMessage",
"(",
")",
")",
";",
"logger",
".",
"error",
"(",
"t",
".",
"getMessage",
"(",
")",
",",
"t",
")",
";",
"}"
] | on error raised handler
| train | false |
508 | public void removeStrategy(final WeightingStrategy strategy){
strategies_.remove(strategy);
}
| [
"public",
"void",
"removeStrategy",
"(",
"final",
"WeightingStrategy",
"strategy",
")",
"{",
"strategies_",
".",
"remove",
"(",
"strategy",
")",
";",
"}"
] | removes the strategy from the weighting strategies collection .
| train | false |
509 | public static GeneralPath cardinalSpline(GeneralPath p,float pts[],int start,int npoints,float slack,boolean closed,float tx,float ty){
try {
int len=2 * npoints;
int end=start + len;
if (len < 6) {
throw new IllegalArgumentException("To create spline requires at least 3 points");
}
float dx1, dy1, dx2, dy2;
if (closed) {
dx2=pts[start + 2] - pts[end - 2];
dy2=pts[start + 3] - pts[end - 1];
}
else {
dx2=pts[start + 4] - pts[start];
dy2=pts[start + 5] - pts[start + 1];
}
int i;
for (i=start + 2; i < end - 2; i+=2) {
dx1=dx2;
dy1=dy2;
dx2=pts[i + 2] - pts[i - 2];
dy2=pts[i + 3] - pts[i - 1];
p.curveTo(tx + pts[i - 2] + slack * dx1,ty + pts[i - 1] + slack * dy1,tx + pts[i] - slack * dx2,ty + pts[i + 1] - slack * dy2,tx + pts[i],ty + pts[i + 1]);
}
if (closed) {
dx1=dx2;
dy1=dy2;
dx2=pts[start] - pts[i - 2];
dy2=pts[start + 1] - pts[i - 1];
p.curveTo(tx + pts[i - 2] + slack * dx1,ty + pts[i - 1] + slack * dy1,tx + pts[i] - slack * dx2,ty + pts[i + 1] - slack * dy2,tx + pts[i],ty + pts[i + 1]);
dx1=dx2;
dy1=dy2;
dx2=pts[start + 2] - pts[end - 2];
dy2=pts[start + 3] - pts[end - 1];
p.curveTo(tx + pts[end - 2] + slack * dx1,ty + pts[end - 1] + slack * dy1,tx + pts[0] - slack * dx2,ty + pts[1] - slack * dy2,tx + pts[0],ty + pts[1]);
p.closePath();
}
else {
p.curveTo(tx + pts[i - 2] + slack * dx2,ty + pts[i - 1] + slack * dy2,tx + pts[i] - slack * dx2,ty + pts[i + 1] - slack * dy2,tx + pts[i],ty + pts[i + 1]);
}
}
catch ( IllegalPathStateException ex) {
}
return p;
}
| [
"public",
"static",
"GeneralPath",
"cardinalSpline",
"(",
"GeneralPath",
"p",
",",
"float",
"pts",
"[",
"]",
",",
"int",
"start",
",",
"int",
"npoints",
",",
"float",
"slack",
",",
"boolean",
"closed",
",",
"float",
"tx",
",",
"float",
"ty",
")",
"{",
"try",
"{",
"int",
"len",
"=",
"2",
"*",
"npoints",
";",
"int",
"end",
"=",
"start",
"+",
"len",
";",
"if",
"(",
"len",
"<",
"6",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"To create spline requires at least 3 points\"",
")",
";",
"}",
"float",
"dx1",
",",
"dy1",
",",
"dx2",
",",
"dy2",
";",
"if",
"(",
"closed",
")",
"{",
"dx2",
"=",
"pts",
"[",
"start",
"+",
"2",
"]",
"-",
"pts",
"[",
"end",
"-",
"2",
"]",
";",
"dy2",
"=",
"pts",
"[",
"start",
"+",
"3",
"]",
"-",
"pts",
"[",
"end",
"-",
"1",
"]",
";",
"}",
"else",
"{",
"dx2",
"=",
"pts",
"[",
"start",
"+",
"4",
"]",
"-",
"pts",
"[",
"start",
"]",
";",
"dy2",
"=",
"pts",
"[",
"start",
"+",
"5",
"]",
"-",
"pts",
"[",
"start",
"+",
"1",
"]",
";",
"}",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"start",
"+",
"2",
";",
"i",
"<",
"end",
"-",
"2",
";",
"i",
"+=",
"2",
")",
"{",
"dx1",
"=",
"dx2",
";",
"dy1",
"=",
"dy2",
";",
"dx2",
"=",
"pts",
"[",
"i",
"+",
"2",
"]",
"-",
"pts",
"[",
"i",
"-",
"2",
"]",
";",
"dy2",
"=",
"pts",
"[",
"i",
"+",
"3",
"]",
"-",
"pts",
"[",
"i",
"-",
"1",
"]",
";",
"p",
".",
"curveTo",
"(",
"tx",
"+",
"pts",
"[",
"i",
"-",
"2",
"]",
"+",
"slack",
"*",
"dx1",
",",
"ty",
"+",
"pts",
"[",
"i",
"-",
"1",
"]",
"+",
"slack",
"*",
"dy1",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
"-",
"slack",
"*",
"dx2",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
"-",
"slack",
"*",
"dy2",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
")",
";",
"}",
"if",
"(",
"closed",
")",
"{",
"dx1",
"=",
"dx2",
";",
"dy1",
"=",
"dy2",
";",
"dx2",
"=",
"pts",
"[",
"start",
"]",
"-",
"pts",
"[",
"i",
"-",
"2",
"]",
";",
"dy2",
"=",
"pts",
"[",
"start",
"+",
"1",
"]",
"-",
"pts",
"[",
"i",
"-",
"1",
"]",
";",
"p",
".",
"curveTo",
"(",
"tx",
"+",
"pts",
"[",
"i",
"-",
"2",
"]",
"+",
"slack",
"*",
"dx1",
",",
"ty",
"+",
"pts",
"[",
"i",
"-",
"1",
"]",
"+",
"slack",
"*",
"dy1",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
"-",
"slack",
"*",
"dx2",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
"-",
"slack",
"*",
"dy2",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
")",
";",
"dx1",
"=",
"dx2",
";",
"dy1",
"=",
"dy2",
";",
"dx2",
"=",
"pts",
"[",
"start",
"+",
"2",
"]",
"-",
"pts",
"[",
"end",
"-",
"2",
"]",
";",
"dy2",
"=",
"pts",
"[",
"start",
"+",
"3",
"]",
"-",
"pts",
"[",
"end",
"-",
"1",
"]",
";",
"p",
".",
"curveTo",
"(",
"tx",
"+",
"pts",
"[",
"end",
"-",
"2",
"]",
"+",
"slack",
"*",
"dx1",
",",
"ty",
"+",
"pts",
"[",
"end",
"-",
"1",
"]",
"+",
"slack",
"*",
"dy1",
",",
"tx",
"+",
"pts",
"[",
"0",
"]",
"-",
"slack",
"*",
"dx2",
",",
"ty",
"+",
"pts",
"[",
"1",
"]",
"-",
"slack",
"*",
"dy2",
",",
"tx",
"+",
"pts",
"[",
"0",
"]",
",",
"ty",
"+",
"pts",
"[",
"1",
"]",
")",
";",
"p",
".",
"closePath",
"(",
")",
";",
"}",
"else",
"{",
"p",
".",
"curveTo",
"(",
"tx",
"+",
"pts",
"[",
"i",
"-",
"2",
"]",
"+",
"slack",
"*",
"dx2",
",",
"ty",
"+",
"pts",
"[",
"i",
"-",
"1",
"]",
"+",
"slack",
"*",
"dy2",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
"-",
"slack",
"*",
"dx2",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
"-",
"slack",
"*",
"dy2",
",",
"tx",
"+",
"pts",
"[",
"i",
"]",
",",
"ty",
"+",
"pts",
"[",
"i",
"+",
"1",
"]",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalPathStateException",
"ex",
")",
"{",
"}",
"return",
"p",
";",
"}"
] | compute a cardinal spline , a series of cubic bezier splines smoothly connecting a set of points . cardinal splines maintain c ( 1 ) continuity , ensuring the connected spline segments form a differentiable curve , ensuring at least a minimum level of smoothness .
| train | false |
510 | public WildcardFileFilter(String[] wildcards,IOCase caseSensitivity){
if (wildcards == null) {
throw new IllegalArgumentException("The wildcard array must not be null");
}
this.wildcards=new String[wildcards.length];
System.arraycopy(wildcards,0,this.wildcards,0,wildcards.length);
this.caseSensitivity=caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
| [
"public",
"WildcardFileFilter",
"(",
"String",
"[",
"]",
"wildcards",
",",
"IOCase",
"caseSensitivity",
")",
"{",
"if",
"(",
"wildcards",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The wildcard array must not be null\"",
")",
";",
"}",
"this",
".",
"wildcards",
"=",
"new",
"String",
"[",
"wildcards",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"wildcards",
",",
"0",
",",
"this",
".",
"wildcards",
",",
"0",
",",
"wildcards",
".",
"length",
")",
";",
"this",
".",
"caseSensitivity",
"=",
"caseSensitivity",
"==",
"null",
"?",
"IOCase",
".",
"SENSITIVE",
":",
"caseSensitivity",
";",
"}"
] | construct a new wildcard filter for an array of wildcards specifying case - sensitivity . < p > the array is not cloned , so could be changed after constructing the instance . this would be inadvisable however .
| train | false |
512 | public byte[] decode(String s){
byte[] b=new byte[(s.length() / 4) * 3];
int cycle=0;
int combined=0;
int j=0;
int len=s.length();
int dummies=0;
for (int i=0; i < len; i++) {
int c=s.charAt(i);
int value=(c <= 255) ? charToValue[c] : IGNORE;
switch (value) {
case IGNORE:
break;
case PAD:
value=0;
dummies++;
default :
switch (cycle) {
case 0:
combined=value;
cycle=1;
break;
case 1:
combined<<=6;
combined|=value;
cycle=2;
break;
case 2:
combined<<=6;
combined|=value;
cycle=3;
break;
case 3:
combined<<=6;
combined|=value;
b[j + 2]=(byte)combined;
combined>>>=8;
b[j + 1]=(byte)combined;
combined>>>=8;
b[j]=(byte)combined;
j+=3;
cycle=0;
break;
}
break;
}
}
if (cycle != 0) {
throw new ArrayIndexOutOfBoundsException("Input to decode not an even multiple of 4 characters; pad with =.");
}
j-=dummies;
if (b.length != j) {
byte[] b2=new byte[j];
System.arraycopy(b,0,b2,0,j);
b=b2;
}
return b;
}
| [
"public",
"byte",
"[",
"]",
"decode",
"(",
"String",
"s",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"(",
"s",
".",
"length",
"(",
")",
"/",
"4",
")",
"*",
"3",
"]",
";",
"int",
"cycle",
"=",
"0",
";",
"int",
"combined",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"int",
"dummies",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"int",
"c",
"=",
"s",
".",
"charAt",
"(",
"i",
")",
";",
"int",
"value",
"=",
"(",
"c",
"<=",
"255",
")",
"?",
"charToValue",
"[",
"c",
"]",
":",
"IGNORE",
";",
"switch",
"(",
"value",
")",
"{",
"case",
"IGNORE",
":",
"break",
";",
"case",
"PAD",
":",
"value",
"=",
"0",
";",
"dummies",
"++",
";",
"default",
":",
"switch",
"(",
"cycle",
")",
"{",
"case",
"0",
":",
"combined",
"=",
"value",
";",
"cycle",
"=",
"1",
";",
"break",
";",
"case",
"1",
":",
"combined",
"<<=",
"6",
";",
"combined",
"|=",
"value",
";",
"cycle",
"=",
"2",
";",
"break",
";",
"case",
"2",
":",
"combined",
"<<=",
"6",
";",
"combined",
"|=",
"value",
";",
"cycle",
"=",
"3",
";",
"break",
";",
"case",
"3",
":",
"combined",
"<<=",
"6",
";",
"combined",
"|=",
"value",
";",
"b",
"[",
"j",
"+",
"2",
"]",
"=",
"(",
"byte",
")",
"combined",
";",
"combined",
">>>=",
"8",
";",
"b",
"[",
"j",
"+",
"1",
"]",
"=",
"(",
"byte",
")",
"combined",
";",
"combined",
">>>=",
"8",
";",
"b",
"[",
"j",
"]",
"=",
"(",
"byte",
")",
"combined",
";",
"j",
"+=",
"3",
";",
"cycle",
"=",
"0",
";",
"break",
";",
"}",
"break",
";",
"}",
"}",
"if",
"(",
"cycle",
"!=",
"0",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"Input to decode not an even multiple of 4 characters; pad with =.\"",
")",
";",
"}",
"j",
"-=",
"dummies",
";",
"if",
"(",
"b",
".",
"length",
"!=",
"j",
")",
"{",
"byte",
"[",
"]",
"b2",
"=",
"new",
"byte",
"[",
"j",
"]",
";",
"System",
".",
"arraycopy",
"(",
"b",
",",
"0",
",",
"b2",
",",
"0",
",",
"j",
")",
";",
"b",
"=",
"b2",
";",
"}",
"return",
"b",
";",
"}"
] | decode a well - formed complete base64 string back into an array of bytes . it must have an even multiple of 4 data characters ( not counting \ n ) , padded out with = as needed .
| train | false |
513 | protected void initializeConnection(MQTTClientProvider provider) throws Exception {
if (!isUseSSL()) {
provider.connect("tcp://localhost:" + port);
}
else {
SSLContext ctx=SSLContext.getInstance("TLS");
ctx.init(new KeyManager[0],new TrustManager[]{new DefaultTrustManager()},new SecureRandom());
provider.setSslContext(ctx);
provider.connect("ssl://localhost:" + port);
}
}
| [
"protected",
"void",
"initializeConnection",
"(",
"MQTTClientProvider",
"provider",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"isUseSSL",
"(",
")",
")",
"{",
"provider",
".",
"connect",
"(",
"\"tcp://localhost:\"",
"+",
"port",
")",
";",
"}",
"else",
"{",
"SSLContext",
"ctx",
"=",
"SSLContext",
".",
"getInstance",
"(",
"\"TLS\"",
")",
";",
"ctx",
".",
"init",
"(",
"new",
"KeyManager",
"[",
"0",
"]",
",",
"new",
"TrustManager",
"[",
"]",
"{",
"new",
"DefaultTrustManager",
"(",
")",
"}",
",",
"new",
"SecureRandom",
"(",
")",
")",
";",
"provider",
".",
"setSslContext",
"(",
"ctx",
")",
";",
"provider",
".",
"connect",
"(",
"\"ssl://localhost:\"",
"+",
"port",
")",
";",
"}",
"}"
] | initialize an mqttclientprovider instance . by default this method uses the port that ' s assigned to be the tcp based port using the base version of addmqttconnector . a subclass can either change the value of port or override this method to assign the correct port .
| train | false |
515 | public int versionPointNumber(){
return Integer.valueOf(properties.getProperty("version.point"));
}
| [
"public",
"int",
"versionPointNumber",
"(",
")",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"properties",
".",
"getProperty",
"(",
"\"version.point\"",
")",
")",
";",
"}"
] | returns the point version number for the directory server .
| train | false |
516 | private String[] splitSeparator(String sep,String s){
Vector v=new Vector();
int tokenStart=0;
int tokenEnd=0;
while ((tokenEnd=s.indexOf(sep,tokenStart)) != -1) {
v.addElement(s.substring(tokenStart,tokenEnd));
tokenStart=tokenEnd + 1;
}
v.addElement(s.substring(tokenStart));
String[] retVal=new String[v.size()];
v.copyInto(retVal);
return retVal;
}
| [
"private",
"String",
"[",
"]",
"splitSeparator",
"(",
"String",
"sep",
",",
"String",
"s",
")",
"{",
"Vector",
"v",
"=",
"new",
"Vector",
"(",
")",
";",
"int",
"tokenStart",
"=",
"0",
";",
"int",
"tokenEnd",
"=",
"0",
";",
"while",
"(",
"(",
"tokenEnd",
"=",
"s",
".",
"indexOf",
"(",
"sep",
",",
"tokenStart",
")",
")",
"!=",
"-",
"1",
")",
"{",
"v",
".",
"addElement",
"(",
"s",
".",
"substring",
"(",
"tokenStart",
",",
"tokenEnd",
")",
")",
";",
"tokenStart",
"=",
"tokenEnd",
"+",
"1",
";",
"}",
"v",
".",
"addElement",
"(",
"s",
".",
"substring",
"(",
"tokenStart",
")",
")",
";",
"String",
"[",
"]",
"retVal",
"=",
"new",
"String",
"[",
"v",
".",
"size",
"(",
")",
"]",
";",
"v",
".",
"copyInto",
"(",
"retVal",
")",
";",
"return",
"retVal",
";",
"}"
] | split a string based on the presence of a specified separator . returns an array of arbitrary length . the end of each element in the array is indicated by the separator of the end of the string . if there is a separator immediately before the end of the string , the final element will be empty . none of the strings will contain the separator . useful when separating strings such as " foo / bar / bas " using separator " / " .
| train | false |
517 | static boolean advanceToFirstFont(AttributedCharacterIterator aci){
for (char ch=aci.first(); ch != CharacterIterator.DONE; ch=aci.setIndex(aci.getRunLimit())) {
if (aci.getAttribute(TextAttribute.CHAR_REPLACEMENT) == null) {
return true;
}
}
return false;
}
| [
"static",
"boolean",
"advanceToFirstFont",
"(",
"AttributedCharacterIterator",
"aci",
")",
"{",
"for",
"(",
"char",
"ch",
"=",
"aci",
".",
"first",
"(",
")",
";",
"ch",
"!=",
"CharacterIterator",
".",
"DONE",
";",
"ch",
"=",
"aci",
".",
"setIndex",
"(",
"aci",
".",
"getRunLimit",
"(",
")",
")",
")",
"{",
"if",
"(",
"aci",
".",
"getAttribute",
"(",
"TextAttribute",
".",
"CHAR_REPLACEMENT",
")",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | when this returns , the aci ' s current position will be at the start of the first run which does not contain a graphicattribute . if no such run exists the aci ' s position will be at the end , and this method will return false .
| train | false |
518 | private static int count(String pattern,String[] possibleValues){
int count=0;
for ( String r : possibleValues) {
if (pattern.contains(r)) {
count++;
}
}
return count;
}
| [
"private",
"static",
"int",
"count",
"(",
"String",
"pattern",
",",
"String",
"[",
"]",
"possibleValues",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"String",
"r",
":",
"possibleValues",
")",
"{",
"if",
"(",
"pattern",
".",
"contains",
"(",
"r",
")",
")",
"{",
"count",
"++",
";",
"}",
"}",
"return",
"count",
";",
"}"
] | count the amount of renamer tokens per group
| train | false |
520 | public static Module load(int id){
return modules.get(id);
}
| [
"public",
"static",
"Module",
"load",
"(",
"int",
"id",
")",
"{",
"return",
"modules",
".",
"get",
"(",
"id",
")",
";",
"}"
] | load the module by id
| train | false |
521 | public Future<Void> updateTableEntityAsync(TableEntity tableEntity,boolean commit){
updateTableEntity(tableEntity,commit);
return new AsyncResult<Void>(null);
}
| [
"public",
"Future",
"<",
"Void",
">",
"updateTableEntityAsync",
"(",
"TableEntity",
"tableEntity",
",",
"boolean",
"commit",
")",
"{",
"updateTableEntity",
"(",
"tableEntity",
",",
"commit",
")",
";",
"return",
"new",
"AsyncResult",
"<",
"Void",
">",
"(",
"null",
")",
";",
"}"
] | updates the solr document for the given table entity asynchronly
| train | false |
522 | boolean hasNextSFeature(){
return (sFeatureIdx < sFeatures.size());
}
| [
"boolean",
"hasNextSFeature",
"(",
")",
"{",
"return",
"(",
"sFeatureIdx",
"<",
"sFeatures",
".",
"size",
"(",
")",
")",
";",
"}"
] | checks for next s feature .
| train | false |
524 | private boolean processSingleEvent(){
if (eventBuffer.remaining() < 20) {
return false;
}
try {
eventBuffer.getInt();
final int bufferLength=eventBuffer.getInt();
final int padding=(4 - bufferLength) & 3;
if (eventBuffer.remaining() < bufferLength + padding + 12) return false;
final byte[] buffer=new byte[bufferLength];
eventBuffer.get(buffer);
eventBuffer.position(eventBuffer.position() + padding);
int eventCount=0;
if (bufferLength > 4) {
eventCount=iscVaxInteger(buffer,bufferLength - 4,4);
}
eventBuffer.getLong();
int eventId=eventBuffer.getInt();
log.debug(String.format("Received event id %d, eventCount %d",eventId,eventCount));
channelListenerDispatcher.eventReceived(this,new AsynchronousChannelListener.Event(eventId,eventCount));
return true;
}
catch ( BufferUnderflowException ex) {
return false;
}
}
| [
"private",
"boolean",
"processSingleEvent",
"(",
")",
"{",
"if",
"(",
"eventBuffer",
".",
"remaining",
"(",
")",
"<",
"20",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"eventBuffer",
".",
"getInt",
"(",
")",
";",
"final",
"int",
"bufferLength",
"=",
"eventBuffer",
".",
"getInt",
"(",
")",
";",
"final",
"int",
"padding",
"=",
"(",
"4",
"-",
"bufferLength",
")",
"&",
"3",
";",
"if",
"(",
"eventBuffer",
".",
"remaining",
"(",
")",
"<",
"bufferLength",
"+",
"padding",
"+",
"12",
")",
"return",
"false",
";",
"final",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"bufferLength",
"]",
";",
"eventBuffer",
".",
"get",
"(",
"buffer",
")",
";",
"eventBuffer",
".",
"position",
"(",
"eventBuffer",
".",
"position",
"(",
")",
"+",
"padding",
")",
";",
"int",
"eventCount",
"=",
"0",
";",
"if",
"(",
"bufferLength",
">",
"4",
")",
"{",
"eventCount",
"=",
"iscVaxInteger",
"(",
"buffer",
",",
"bufferLength",
"-",
"4",
",",
"4",
")",
";",
"}",
"eventBuffer",
".",
"getLong",
"(",
")",
";",
"int",
"eventId",
"=",
"eventBuffer",
".",
"getInt",
"(",
")",
";",
"log",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Received event id %d, eventCount %d\"",
",",
"eventId",
",",
"eventCount",
")",
")",
";",
"channelListenerDispatcher",
".",
"eventReceived",
"(",
"this",
",",
"new",
"AsynchronousChannelListener",
".",
"Event",
"(",
"eventId",
",",
"eventCount",
")",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"BufferUnderflowException",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | processes the event buffer for a single event .
| train | false |
525 | @Override public String toString(){
return name;
}
| [
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"name",
";",
"}"
] | the string representation of this object .
| train | false |
526 | public static <T>GitNoteWriter<T> createNoteWriter(String reviewCommitHash,final Repository db,PersonIdent author,String ref){
return new GitNoteWriter<T>(reviewCommitHash,db,ref,author);
}
| [
"public",
"static",
"<",
"T",
">",
"GitNoteWriter",
"<",
"T",
">",
"createNoteWriter",
"(",
"String",
"reviewCommitHash",
",",
"final",
"Repository",
"db",
",",
"PersonIdent",
"author",
",",
"String",
"ref",
")",
"{",
"return",
"new",
"GitNoteWriter",
"<",
"T",
">",
"(",
"reviewCommitHash",
",",
"db",
",",
"ref",
",",
"author",
")",
";",
"}"
] | creates a writer to write comments to a given review .
| train | false |
527 | private Element toElement(ScheduleTask task){
Element el=doc.createElement("task");
setAttributes(el,task);
return el;
}
| [
"private",
"Element",
"toElement",
"(",
"ScheduleTask",
"task",
")",
"{",
"Element",
"el",
"=",
"doc",
".",
"createElement",
"(",
"\"task\"",
")",
";",
"setAttributes",
"(",
"el",
",",
"task",
")",
";",
"return",
"el",
";",
"}"
] | translate a schedule task object to a xml element
| train | true |
528 | public static int intHash(String ipString){
int val=0;
String[] strs=ipString.split("[^\\p{XDigit}]");
int len=strs.length;
if (len >= 4) {
val=intVal(strs[0]);
val<<=8;
val|=intVal(strs[1]);
val<<=8;
val|=intVal(strs[2]);
val<<=8;
val|=intVal(strs[3]);
}
return val;
}
| [
"public",
"static",
"int",
"intHash",
"(",
"String",
"ipString",
")",
"{",
"int",
"val",
"=",
"0",
";",
"String",
"[",
"]",
"strs",
"=",
"ipString",
".",
"split",
"(",
"\"[^\\\\p{XDigit}]\"",
")",
";",
"int",
"len",
"=",
"strs",
".",
"length",
";",
"if",
"(",
"len",
">=",
"4",
")",
"{",
"val",
"=",
"intVal",
"(",
"strs",
"[",
"0",
"]",
")",
";",
"val",
"<<=",
"8",
";",
"val",
"|=",
"intVal",
"(",
"strs",
"[",
"1",
"]",
")",
";",
"val",
"<<=",
"8",
";",
"val",
"|=",
"intVal",
"(",
"strs",
"[",
"2",
"]",
")",
";",
"val",
"<<=",
"8",
";",
"val",
"|=",
"intVal",
"(",
"strs",
"[",
"3",
"]",
")",
";",
"}",
"return",
"val",
";",
"}"
] | this should be suitable for ipv6 as well but we will have to accommodate for the extra bytes later . expects four integers 0 - 255 separated by some non - numeric character .
| train | false |
529 | public FluentJdbcBuilder connectionProvider(ConnectionProvider connectionProvider){
checkNotNull(connectionProvider,"connectionProvider");
this.connectionProvider=Optional.of(connectionProvider);
return this;
}
| [
"public",
"FluentJdbcBuilder",
"connectionProvider",
"(",
"ConnectionProvider",
"connectionProvider",
")",
"{",
"checkNotNull",
"(",
"connectionProvider",
",",
"\"connectionProvider\"",
")",
";",
"this",
".",
"connectionProvider",
"=",
"Optional",
".",
"of",
"(",
"connectionProvider",
")",
";",
"return",
"this",
";",
"}"
] | sets the connectionprovider for fluentjdbc . queries created by fluentjdbc . query ( ) will use connections returned by this provider
| train | false |
530 | public static void register(String modelName,IWindModel model,int awesomeness){
models.put(modelName,model);
if (modelName.equalsIgnoreCase(userModelChoice)) {
awesomeness=Integer.MAX_VALUE;
}
if (awesomeness > best) {
best=awesomeness;
activeModel=model;
}
}
| [
"public",
"static",
"void",
"register",
"(",
"String",
"modelName",
",",
"IWindModel",
"model",
",",
"int",
"awesomeness",
")",
"{",
"models",
".",
"put",
"(",
"modelName",
",",
"model",
")",
";",
"if",
"(",
"modelName",
".",
"equalsIgnoreCase",
"(",
"userModelChoice",
")",
")",
"{",
"awesomeness",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"}",
"if",
"(",
"awesomeness",
">",
"best",
")",
"{",
"best",
"=",
"awesomeness",
";",
"activeModel",
"=",
"model",
";",
"}",
"}"
] | registers a wind model . might change activemodel , but of course this should be done during load time .
| train | false |
531 | public void notifyTransactionTerminated(CompositeTransaction ct){
boolean notifyOfTerminatedEvent=false;
synchronized (this) {
boolean alreadyTerminated=isTerminated();
Iterator<TransactionContext> it=allContexts.iterator();
while (it.hasNext()) {
TransactionContext b=it.next();
b.transactionTerminated(ct);
}
if (isTerminated() && !alreadyTerminated) notifyOfTerminatedEvent=true;
}
if (notifyOfTerminatedEvent) {
if (LOGGER.isTraceEnabled()) LOGGER.logTrace(this + ": all contexts terminated, firing TerminatedEvent for " + this);
fireTerminatedEvent();
}
}
| [
"public",
"void",
"notifyTransactionTerminated",
"(",
"CompositeTransaction",
"ct",
")",
"{",
"boolean",
"notifyOfTerminatedEvent",
"=",
"false",
";",
"synchronized",
"(",
"this",
")",
"{",
"boolean",
"alreadyTerminated",
"=",
"isTerminated",
"(",
")",
";",
"Iterator",
"<",
"TransactionContext",
">",
"it",
"=",
"allContexts",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"TransactionContext",
"b",
"=",
"it",
".",
"next",
"(",
")",
";",
"b",
".",
"transactionTerminated",
"(",
"ct",
")",
";",
"}",
"if",
"(",
"isTerminated",
"(",
")",
"&&",
"!",
"alreadyTerminated",
")",
"notifyOfTerminatedEvent",
"=",
"true",
";",
"}",
"if",
"(",
"notifyOfTerminatedEvent",
")",
"{",
"if",
"(",
"LOGGER",
".",
"isTraceEnabled",
"(",
")",
")",
"LOGGER",
".",
"logTrace",
"(",
"this",
"+",
"\": all contexts terminated, firing TerminatedEvent for \"",
"+",
"this",
")",
";",
"fireTerminatedEvent",
"(",
")",
";",
"}",
"}"
] | notifies the session that the transaction was terminated .
| train | false |