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 |
|---|---|---|---|---|---|
0 | @Override public int runCommand(boolean mergeErrorIntoOutput,String... commands) throws IOException, InterruptedException {
return runCommand(mergeErrorIntoOutput,new ArrayList<String>(Arrays.asList(commands)));
}
| [
"@",
"Override",
"public",
"int",
"runCommand",
"(",
"boolean",
"mergeErrorIntoOutput",
",",
"String",
"...",
"commands",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"runCommand",
"(",
"mergeErrorIntoOutput",
",",
"new",
"ArrayList",
"<... | runs a command on the command line synchronously .
| train | false |
1 | private int findPLV(int M_PriceList_ID){
Timestamp priceDate=null;
String dateStr=Env.getContext(Env.getCtx(),p_WindowNo,"DateOrdered");
if (dateStr != null && dateStr.length() > 0) priceDate=Env.getContextAsDate(Env.getCtx(),p_WindowNo,"DateOrdered");
else {
dateStr=Env.getContext(Env.getCtx(),p_WindowNo,... | [
"private",
"int",
"findPLV",
"(",
"int",
"M_PriceList_ID",
")",
"{",
"Timestamp",
"priceDate",
"=",
"null",
";",
"String",
"dateStr",
"=",
"Env",
".",
"getContext",
"(",
"Env",
".",
"getCtx",
"(",
")",
",",
"p_WindowNo",
",",
"\"DateOrdered\"",
")",
";",
... | find price list version and update context
| train | false |
2 | public static boolean memoryIsLow(){
return availableMemory() * 100 < RUNTIME.totalMemory() * 5;
}
| [
"public",
"static",
"boolean",
"memoryIsLow",
"(",
")",
"{",
"return",
"availableMemory",
"(",
")",
"*",
"100",
"<",
"RUNTIME",
".",
"totalMemory",
"(",
")",
"*",
"5",
";",
"}"
] | returns true if less then 5 % of the available memory is free .
| train | false |
3 | public String describeAttributes(){
StringBuilder sb=new StringBuilder();
sb.append("[");
boolean first=true;
for ( Object key : attributes.keySet()) {
if (first) {
first=false;
}
else {
sb.append(", ");
}
sb.append(key);
sb.append("==");
sb.append(attributes.get(key));
}... | [
"public",
"String",
"describeAttributes",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"[\"",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Object",
"key",
":",
"attributes",... | returns a string representation of the object ' s current attributes
| train | false |
4 | public static byte[] nextBytes(byte[] buffer){
sRandom.nextBytes(buffer);
return buffer;
}
| [
"public",
"static",
"byte",
"[",
"]",
"nextBytes",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"sRandom",
".",
"nextBytes",
"(",
"buffer",
")",
";",
"return",
"buffer",
";",
"}"
] | fill the given buffer with random bytes .
| train | false |
5 | public void removeAllFromDamaged(final Collection<Unit> damagedUnits){
for ( final Unit u : damagedUnits) {
while (m_damaged.contains(u)) {
m_damaged.remove(u);
}
}
}
| [
"public",
"void",
"removeAllFromDamaged",
"(",
"final",
"Collection",
"<",
"Unit",
">",
"damagedUnits",
")",
"{",
"for",
"(",
"final",
"Unit",
"u",
":",
"damagedUnits",
")",
"{",
"while",
"(",
"m_damaged",
".",
"contains",
"(",
"u",
")",
")",
"{",
"m_dam... | can have multiple of the same unit , to show multiple hits to that unit .
| train | false |
6 | private IJavaElement[] computeChildren(ArrayList namesWithoutExtension){
int size=namesWithoutExtension.size();
if (size == 0) return NO_ELEMENTS;
IJavaElement[] children=new IJavaElement[size];
for (int i=0; i < size; i++) {
String nameWithoutExtension=(String)namesWithoutExtension.get(i);
children[i... | [
"private",
"IJavaElement",
"[",
"]",
"computeChildren",
"(",
"ArrayList",
"namesWithoutExtension",
")",
"{",
"int",
"size",
"=",
"namesWithoutExtension",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"NO_ELEMENTS",
";",
"IJavaElement... | compute the children of this package fragment . children of jar package fragments can only be iclassfile ( representing . class files ) .
| train | false |
7 | public Object[] toArray(){
Object[] result=new Object[size];
System.arraycopy(elementData,0,result,0,size);
return result;
}
| [
"public",
"Object",
"[",
"]",
"toArray",
"(",
")",
"{",
"Object",
"[",
"]",
"result",
"=",
"new",
"Object",
"[",
"size",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elementData",
",",
"0",
",",
"result",
",",
"0",
",",
"size",
")",
";",
"return",
... | returns an array containing all of the elements in this list in the correct order .
| train | false |
10 | @Override protected void onDeleteComplete(int token,Object cookie,int result){
if (token == mDeleteToken) {
synchronized (sDeletingThreadsLock) {
sDeletingThreads=false;
if (DELETEDEBUG) {
Log.v(TAG,"Conversation onDeleteComplete sDeletingThreads: " + sDeletingThreads);
}
sDeletingThre... | [
"@",
"Override",
"protected",
"void",
"onDeleteComplete",
"(",
"int",
"token",
",",
"Object",
"cookie",
",",
"int",
"result",
")",
"{",
"if",
"(",
"token",
"==",
"mDeleteToken",
")",
"{",
"synchronized",
"(",
"sDeletingThreadsLock",
")",
"{",
"sDeletingThreads... | always call this super method from your overridden ondeletecomplete function .
| train | false |
11 | public static double log10(double val){
if (val > 0.0) return Math.log10(val);
return HUGE_NEGATIVE;
}
| [
"public",
"static",
"double",
"log10",
"(",
"double",
"val",
")",
"{",
"if",
"(",
"val",
">",
"0.0",
")",
"return",
"Math",
".",
"log10",
"(",
"val",
")",
";",
"return",
"HUGE_NEGATIVE",
";",
"}"
] | adjusted log10 to handle values less or equal to zero . < p > the logarithm does not result in real numbers for arguments less or equal to zero , but the plot should still somehow handle such values without crashing . so anything & le ; 0 is mapped to a ' really big negative ' number just for the sake of plotting . < p... | train | false |
12 | private static ILaunchConfiguration createNewLaunchConfiguration(IProject project) throws CoreException, OperationCanceledException {
String initialName=calculateLaunchConfigName(project);
ILaunchConfiguration launchConfig=GwtSuperDevModeCodeServerLaunchUtil.createLaunchConfig(initialName,project);
return launchC... | [
"private",
"static",
"ILaunchConfiguration",
"createNewLaunchConfiguration",
"(",
"IProject",
"project",
")",
"throws",
"CoreException",
",",
"OperationCanceledException",
"{",
"String",
"initialName",
"=",
"calculateLaunchConfigName",
"(",
"project",
")",
";",
"ILaunchConf... | create a new launch configuration .
| train | false |
13 | protected long parseDate() throws IOException {
if (_utcCalendar == null) _utcCalendar=Calendar.getInstance(TimeZone.getTimeZone("UTC"));
return parseDate(_utcCalendar);
}
| [
"protected",
"long",
"parseDate",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_utcCalendar",
"==",
"null",
")",
"_utcCalendar",
"=",
"Calendar",
".",
"getInstance",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"return",
"parseD... | parses a date value from the stream .
| train | false |
14 | @Override public Request<List<BuilderStatus>> builds(ProjectReference projectReference){
List<DummyBuilderStatus> current=currentBuilderStatuses.get(projectReference.name());
List<BuilderStatus> update=new ArrayList<>();
if (current != null) {
for ( DummyBuilderStatus dummyBuilderStatus : current) {
... | [
"@",
"Override",
"public",
"Request",
"<",
"List",
"<",
"BuilderStatus",
">",
">",
"builds",
"(",
"ProjectReference",
"projectReference",
")",
"{",
"List",
"<",
"DummyBuilderStatus",
">",
"current",
"=",
"currentBuilderStatuses",
".",
"get",
"(",
"projectReference... | gets the project builds for the given project
| train | false |
15 | public String lookahead(){
if (buf != null) {
return new String(buf,bufPos,buf.length - bufPos);
}
else {
return text.substring(pos.getIndex());
}
}
| [
"public",
"String",
"lookahead",
"(",
")",
"{",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"return",
"new",
"String",
"(",
"buf",
",",
"bufPos",
",",
"buf",
".",
"length",
"-",
"bufPos",
")",
";",
"}",
"else",
"{",
"return",
"text",
".",
"substring"... | returns a string containing the remainder of the characters to be returned by this iterator , without any option processing . if the iterator is currently within a variable expansion , this will only extend to the end of the variable expansion . this method is provided so that iterators may interoperate with string - b... | train | true |
18 | public void testObsoleteDstZoneName() throws Exception {
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd'T'HH:mm zzzz",Locale.US);
Date normal=format.parse("1970-01-01T00:00 EET");
Date dst=format.parse("1970-01-01T00:00 EEST");
assertEquals(60 * 60 * 1000,normal.getTime() - dst.getTime());
}
| [
"public",
"void",
"testObsoleteDstZoneName",
"(",
")",
"throws",
"Exception",
"{",
"SimpleDateFormat",
"format",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm zzzz\"",
",",
"Locale",
".",
"US",
")",
";",
"Date",
"normal",
"=",
"format",
".",
"parse",
... | africa / cairo standard time is eet and daylight time is eest . they no longer use their dst zone but we should continue to parse it properly .
| train | false |
19 | public abstract boolean isLoggable(Level level);
| [
"public",
"abstract",
"boolean",
"isLoggable",
"(",
"Level",
"level",
")",
";"
] | " logger like " api to be used by rmi implementation
| train | false |
20 | public String replaceTokens(String queryString,String replacement,String... nonReplacementTokenPrefixes){
Matcher matcher=tokenPattern.matcher(queryString);
StringBuffer buf=new StringBuffer();
while (matcher.find()) {
String origToken=matcher.group(1);
if (origToken != null) {
matcher.appendReplace... | [
"public",
"String",
"replaceTokens",
"(",
"String",
"queryString",
",",
"String",
"replacement",
",",
"String",
"...",
"nonReplacementTokenPrefixes",
")",
"{",
"Matcher",
"matcher",
"=",
"tokenPattern",
".",
"matcher",
"(",
"queryString",
")",
";",
"StringBuffer",
... | replaces a query string with tokens of format $ { token - name } with the specified replacement string for all tokens .
| train | false |
21 | public boolean isPlural(){
return typeString.contains(SUFFIX_PLURAL);
}
| [
"public",
"boolean",
"isPlural",
"(",
")",
"{",
"return",
"typeString",
".",
"contains",
"(",
"SUFFIX_PLURAL",
")",
";",
"}"
] | determine if the expression is in plural form .
| train | false |
22 | public void insert(ForceItem item){
try {
insert(item,root,xMin,yMin,xMax,yMax);
}
catch ( StackOverflowError e) {
e.printStackTrace();
}
}
| [
"public",
"void",
"insert",
"(",
"ForceItem",
"item",
")",
"{",
"try",
"{",
"insert",
"(",
"item",
",",
"root",
",",
"xMin",
",",
"yMin",
",",
"xMax",
",",
"yMax",
")",
";",
"}",
"catch",
"(",
"StackOverflowError",
"e",
")",
"{",
"e",
".",
"printSt... | inserts an item into the quadtree .
| train | false |
23 | private void handleHovering(int x,int y){
handleCellHover(x,y);
if (columnHeadersVisible) {
handleHoverOnColumnHeader(x,y);
}
}
| [
"private",
"void",
"handleHovering",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"handleCellHover",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"columnHeadersVisible",
")",
"{",
"handleHoverOnColumnHeader",
"(",
"x",
",",
"y",
")",
";",
"}",
"}"
] | handles the assignment of the correct values to the hover * field variables that let the painting code now what to paint as hovered .
| train | false |
24 | public static void drawCircledText(Graphics2D g,Font font,String text,int x,int y){
Graphics2D g2=(Graphics2D)g.create();
g2.setFont(font);
FontMetrics fm=g2.getFontMetrics();
int padding=4;
Rectangle2D bounds=fm.getStringBounds(text,g2);
double th=bounds.getHeight();
double tw=bounds.getWidth();
float ... | [
"public",
"static",
"void",
"drawCircledText",
"(",
"Graphics2D",
"g",
",",
"Font",
"font",
",",
"String",
"text",
",",
"int",
"x",
",",
"int",
"y",
")",
"{",
"Graphics2D",
"g2",
"=",
"(",
"Graphics2D",
")",
"g",
".",
"create",
"(",
")",
";",
"g2",
... | utility function to draw a circle text centered at coordinates ( x , y )
| train | false |
25 | private void registerEnd(final String prefixSingular,final String prefixPlural,final String endString){
prefixEndList.add(new PrefixEntry(endString,prefixSingular,prefixPlural));
registerPrefix(prefixSingular,prefixPlural);
}
| [
"private",
"void",
"registerEnd",
"(",
"final",
"String",
"prefixSingular",
",",
"final",
"String",
"prefixPlural",
",",
"final",
"String",
"endString",
")",
"{",
"prefixEndList",
".",
"add",
"(",
"new",
"PrefixEntry",
"(",
"endString",
",",
"prefixSingular",
",... | define the singular and plural prefix strings for an item name to be matched at the end , for example " bottle of . . . potion " .
| train | false |
27 | public String toString(){
return "[PKCS #10 certificate request:\n" + subjectPublicKeyInfo.toString() + " subject: <"+ subject+ ">"+ "\n"+ " attributes: "+ attributeSet.toString()+ "\n]";
}
| [
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"\"[PKCS #10 certificate request:\\n\"",
"+",
"subjectPublicKeyInfo",
".",
"toString",
"(",
")",
"+",
"\" subject: <\"",
"+",
"subject",
"+",
"\">\"",
"+",
"\"\\n\"",
"+",
"\" attributes: \"",
"+",
"attributeS... | provides a short description of this request .
| train | false |
28 | public SystemPropertiesTableModel(){
columnNames=new String[2];
columnNames[0]=res.getString("SystemPropertiesTableModel.NameColumn");
columnNames[1]=res.getString("SystemPropertiesTableModel.ValueColumn");
data=new Object[0][0];
}
| [
"public",
"SystemPropertiesTableModel",
"(",
")",
"{",
"columnNames",
"=",
"new",
"String",
"[",
"2",
"]",
";",
"columnNames",
"[",
"0",
"]",
"=",
"res",
".",
"getString",
"(",
"\"SystemPropertiesTableModel.NameColumn\"",
")",
";",
"columnNames",
"[",
"1",
"]"... | construct a new systempropertiestablemodel .
| train | false |
29 | public boolean cancelJob(long id,boolean isPersistent){
JobHolder holder;
synchronized (getNextJobLock) {
if (jobConsumerExecutor.isRunning(id,isPersistent)) return false;
if (isPersistent) {
synchronized (persistentJobQueue) {
holder=persistentJobQueue.findJobById(id);
if (holder == null)... | [
"public",
"boolean",
"cancelJob",
"(",
"long",
"id",
",",
"boolean",
"isPersistent",
")",
"{",
"JobHolder",
"holder",
";",
"synchronized",
"(",
"getNextJobLock",
")",
"{",
"if",
"(",
"jobConsumerExecutor",
".",
"isRunning",
"(",
"id",
",",
"isPersistent",
")",... | cancels job which is waiting to be run .
| train | false |
30 | public static boolean isSimpleMatchPattern(String str){
return str.indexOf('*') != -1;
}
| [
"public",
"static",
"boolean",
"isSimpleMatchPattern",
"(",
"String",
"str",
")",
"{",
"return",
"str",
".",
"indexOf",
"(",
"'*'",
")",
"!=",
"-",
"1",
";",
"}"
] | is the str a simple match pattern .
| train | false |
31 | public String readScript(String fname) throws IOException {
StringBuilder sb=new StringBuilder();
BufferedReader in=null;
try {
if (fname.startsWith("hdfs:") || fname.startsWith("gpfs:")) {
FileSystem fs=FileSystem.get(ConfigurationManager.getCachedJobConf());
Path scriptPath=new Path(fname);
... | [
"public",
"String",
"readScript",
"(",
"String",
"fname",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"BufferedReader",
"in",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"fname",
".",
"startsWith",
"("... | read a dml or pydml file as a string .
| train | false |
32 | public static BinaryFieldAccessor create(Field field,int id){
BinaryWriteMode mode=BinaryUtils.mode(field.getType());
switch (mode) {
case P_BYTE:
return new BytePrimitiveAccessor(field,id);
case P_BOOLEAN:
return new BooleanPrimitiveAccessor(field,id);
case P_SHORT:
return new ShortPrimitiveAccessor(field,id);... | [
"public",
"static",
"BinaryFieldAccessor",
"create",
"(",
"Field",
"field",
",",
"int",
"id",
")",
"{",
"BinaryWriteMode",
"mode",
"=",
"BinaryUtils",
".",
"mode",
"(",
"field",
".",
"getType",
"(",
")",
")",
";",
"switch",
"(",
"mode",
")",
"{",
"case",... | create accessor for the field .
| train | false |
33 | private String result(HttpURLConnection conn,boolean input) throws IOException {
StringBuffer sb=new StringBuffer();
if (input) {
InputStream is=conn.getInputStream();
BufferedReader reader=new BufferedReader(new InputStreamReader(is,"utf-8"));
String line=null;
while ((line=reader.readLine()) != nu... | [
"private",
"String",
"result",
"(",
"HttpURLConnection",
"conn",
",",
"boolean",
"input",
")",
"throws",
"IOException",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"input",
")",
"{",
"InputStream",
"is",
"=",
"conn",
".... | report the result in json way
| train | false |
34 | public boolean isBannedMethod(String sig){
return banned_methods.contains(sig);
}
| [
"public",
"boolean",
"isBannedMethod",
"(",
"String",
"sig",
")",
"{",
"return",
"banned_methods",
".",
"contains",
"(",
"sig",
")",
";",
"}"
] | used by the specification create to check if a method is legal to put in the spec . must check the method , and all superclass definitions of the method .
| train | false |
35 | private SendReturn send(int messageType,String message) throws InterruptedException, ExtractorException {
String length=String.format("%d",message.length());
String lenlen=String.format("%d",length.length());
String type=String.format("%04d",messageType);
String outMessage;
int bytesRead;
String replyString... | [
"private",
"SendReturn",
"send",
"(",
"int",
"messageType",
",",
"String",
"message",
")",
"throws",
"InterruptedException",
",",
"ExtractorException",
"{",
"String",
"length",
"=",
"String",
".",
"format",
"(",
"\"%d\"",
",",
"message",
".",
"length",
"(",
")... | send message to dslisten - typically an extract next change message
| train | false |
37 | private void attachPlot(SVGPlot newplot){
this.plot=newplot;
if (newplot == null) {
super.setSVGDocument(null);
return;
}
newplot.synchronizeWith(synchronizer);
super.setSVGDocument(newplot.getDocument());
super.setDisableInteractions(newplot.getDisableInteractions());
}
| [
"private",
"void",
"attachPlot",
"(",
"SVGPlot",
"newplot",
")",
"{",
"this",
".",
"plot",
"=",
"newplot",
";",
"if",
"(",
"newplot",
"==",
"null",
")",
"{",
"super",
".",
"setSVGDocument",
"(",
"null",
")",
";",
"return",
";",
"}",
"newplot",
".",
"... | attach to a new plot , and display .
| train | true |
40 | public void shutdown() throws Exception {
try {
if (solrClient != null) solrClient.close();
List<Callable<JettySolrRunner>> shutdowns=new ArrayList<>(jettys.size());
for ( final JettySolrRunner jetty : jettys) {
shutdowns.add(null);
}
jettys.clear();
Collection<Future<JettySolrRun... | [
"public",
"void",
"shutdown",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"solrClient",
"!=",
"null",
")",
"solrClient",
".",
"close",
"(",
")",
";",
"List",
"<",
"Callable",
"<",
"JettySolrRunner",
">",
">",
"shutdowns",
"=",
"new",
"... | shut down the cluster , including all solr nodes and zookeeper
| train | false |
41 | private static Control createRequestControl(final Class clazz,final Class[] paramTypes,final Object[] params){
Constructor constructor=ClassUtils.getConstructorIfAvailable(clazz,paramTypes);
if (constructor == null) {
LdapExceptionUtils.generateErrorException(LdapErrorCodes.ERR_10005_CONTROL_CONTRUCTOR_NOT_FOUN... | [
"private",
"static",
"Control",
"createRequestControl",
"(",
"final",
"Class",
"clazz",
",",
"final",
"Class",
"[",
"]",
"paramTypes",
",",
"final",
"Object",
"[",
"]",
"params",
")",
"{",
"Constructor",
"constructor",
"=",
"ClassUtils",
".",
"getConstructorIfAv... | permite crear una instancia de la clase pasada como parametro .
| train | false |
43 | public boolean isNewState(){
return fileName.equals("");
}
| [
"public",
"boolean",
"isNewState",
"(",
")",
"{",
"return",
"fileName",
".",
"equals",
"(",
"\"\"",
")",
";",
"}"
] | tells whether this session is in a new state or not . a session is in a new state if it was never saved or it was not loaded from an existing session .
| train | false |
44 | public boolean offer(E e){
final ReentrantLock lock=this.lock;
lock.lock();
try {
q.offer(e);
if (q.peek() == e) {
leader=null;
available.signal();
}
return true;
}
finally {
lock.unlock();
}
}
| [
"public",
"boolean",
"offer",
"(",
"E",
"e",
")",
"{",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"q",
".",
"offer",
"(",
"e",
")",
";",
"if",
"(",
"q",
".",
"peek",
"(",
"... | inserts the specified element into this delay queue .
| train | true |
45 | public void updateLeagueHistory(){
Collections.sort(teamList,new TeamCompPoll());
String[] yearTop10=new String[10];
Team tt;
for (int i=0; i < 10; ++i) {
tt=teamList.get(i);
yearTop10[i]=tt.abbr + " (" + tt.wins+ "-"+ tt.losses+ ")";
}
leagueHistory.add(yearTop10);
}
| [
"public",
"void",
"updateLeagueHistory",
"(",
")",
"{",
"Collections",
".",
"sort",
"(",
"teamList",
",",
"new",
"TeamCompPoll",
"(",
")",
")",
";",
"String",
"[",
"]",
"yearTop10",
"=",
"new",
"String",
"[",
"10",
"]",
";",
"Team",
"tt",
";",
"for",
... | at the end of the year , record the top 10 teams for the league ' s history .
| train | false |
47 | private void updateFont(){
String fontName=fontList.getValue();
Integer fontSize=FALLBACK_FONT_SIZE;
try {
fontSize=Integer.parseInt(fontSizeList.getValue());
}
catch ( NumberFormatException ex) {
}
font=new Font(fontName,Font.PLAIN,fontSize);
preview.setFont(font);
}
| [
"private",
"void",
"updateFont",
"(",
")",
"{",
"String",
"fontName",
"=",
"fontList",
".",
"getValue",
"(",
")",
";",
"Integer",
"fontSize",
"=",
"FALLBACK_FONT_SIZE",
";",
"try",
"{",
"fontSize",
"=",
"Integer",
".",
"parseInt",
"(",
"fontSizeList",
".",
... | creates a new font based on the current settings and also updates the preview . the created font is not only used for the preview , but also to return it when requested from the caller .
| train | false |
51 | @Override public void close() throws IOException {
fInputStream.close();
}
| [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"fInputStream",
".",
"close",
"(",
")",
";",
"}"
] | close the stream . once a stream has been closed , further read ( ) , ready ( ) , mark ( ) , or reset ( ) invocations will throw an ioexception . closing a previously - closed stream , however , has no effect .
| train | false |
52 | public static void sleep(){
try {
Thread.sleep(TestSettings.RESPONSE_WAIT);
}
catch ( InterruptedException e) {
}
}
| [
"public",
"static",
"void",
"sleep",
"(",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"TestSettings",
".",
"RESPONSE_WAIT",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"}",
"}"
] | current thread sleeps for a predefined amount of time . if it has been interrupted , the method would be finished and no exception is thrown .
| train | false |
53 | public void add(URI uri,HttpCookie cookie){
if (cookie == null) {
throw new NullPointerException("cookie is null");
}
lock.lock();
try {
cookieJar.remove(cookie);
if (cookie.getMaxAge() != 0) {
cookieJar.add(cookie);
if (cookie.getDomain() != null) {
addIndex(domainIndex,cookie.g... | [
"public",
"void",
"add",
"(",
"URI",
"uri",
",",
"HttpCookie",
"cookie",
")",
"{",
"if",
"(",
"cookie",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"cookie is null\"",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",... | add one cookie into cookie store .
| train | false |
54 | public void delete(RandomAccessFile raf,RandomAccessFile tempRaf) throws IOException, CannotWriteException {
FlacTag emptyTag=new FlacTag(null,new ArrayList<MetadataBlockDataPicture>());
raf.seek(0);
tempRaf.seek(0);
write(emptyTag,raf,tempRaf);
}
| [
"public",
"void",
"delete",
"(",
"RandomAccessFile",
"raf",
",",
"RandomAccessFile",
"tempRaf",
")",
"throws",
"IOException",
",",
"CannotWriteException",
"{",
"FlacTag",
"emptyTag",
"=",
"new",
"FlacTag",
"(",
"null",
",",
"new",
"ArrayList",
"<",
"MetadataBlockD... | delete tag from file
| train | false |
55 | void show(Rectangle bounds){
if (!isCreated()) {
return;
}
if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("showing menu window + " + getWindow() + " at "+ bounds);
}
XToolkit.awtLock();
try {
reshape(bounds.x,bounds.y,bounds.width,bounds.height);
xSetVisible(true);
toFront()... | [
"void",
"show",
"(",
"Rectangle",
"bounds",
")",
"{",
"if",
"(",
"!",
"isCreated",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"PlatformLogger",
".",
"Level",
".",
"FINER",
")",
")",
"{",
"log",
".",
"finer",
... | init window if it ' s not inited yet and show it at specified coordinates
| train | false |
56 | void downcase(final StringBuffer text,final int leng){
for (int i=0; i < leng; i++) {
if (Character.isUpperCase(text.charAt(i))) {
text.setCharAt(i,Character.toLowerCase(text.charAt(i)));
}
}
}
| [
"void",
"downcase",
"(",
"final",
"StringBuffer",
"text",
",",
"final",
"int",
"leng",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"leng",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"text",
".",
"cha... | lowercase the characters up to the given length
| train | false |
58 | public void releaseExternalResources(){
if (!isClosed.get()) {
logger.info("Releasing all ParallelClient resources... ");
ActorConfig.shutDownActorSystemForce();
httpClientStore.shutdown();
tcpSshPingResourceStore.shutdown();
taskManager.cleanWaitTaskQueue();
taskManager.cleanInprogressJobMap(... | [
"public",
"void",
"releaseExternalResources",
"(",
")",
"{",
"if",
"(",
"!",
"isClosed",
".",
"get",
"(",
")",
")",
"{",
"logger",
".",
"info",
"(",
"\"Releasing all ParallelClient resources... \"",
")",
";",
"ActorConfig",
".",
"shutDownActorSystemForce",
"(",
... | releases the external resources that this object depends on . you should not call this method if you still want to use the external resources ( e . g . akka system , async http client store , thread pool for ssh / tcp ) are in use by other objects .
| train | true |
61 | @Override public IScanListIterator<IEntryCacheInfo> establishScan(K startPos,short relation,K endPos,boolean endPosInclusive,boolean ordered){
ordered|=FORCE_ORDERED_SCAN;
long startTime=_recentExtendedIndexUpdates != null ? System.currentTimeMillis() : 0;
IScanListIterator<IEntryCacheInfo> res=ordered ? establis... | [
"@",
"Override",
"public",
"IScanListIterator",
"<",
"IEntryCacheInfo",
">",
"establishScan",
"(",
"K",
"startPos",
",",
"short",
"relation",
",",
"K",
"endPos",
",",
"boolean",
"endPosInclusive",
",",
"boolean",
"ordered",
")",
"{",
"ordered",
"|=",
"FORCE_ORDE... | establish a scan according to the relation given and startpos : the start - scan object , null means scan all values . the relation is from com . j_spaces . client . templatematchcodes : lt , le , gt , ge ( other codes are not relevant ) endpos - key up to ( or null if no limit in index ) endposinclusive : is the endpo... | train | false |
62 | public static BytesToNameCanonicalizer createRoot(){
long now=System.currentTimeMillis();
int seed=(((int)now) + ((int)now >>> 32)) | 1;
return createRoot(seed);
}
| [
"public",
"static",
"BytesToNameCanonicalizer",
"createRoot",
"(",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"int",
"seed",
"=",
"(",
"(",
"(",
"int",
")",
"now",
")",
"+",
"(",
"(",
"int",
")",
"now",
">",
">",... | factory method to call to create a symbol table instance with a randomized seed value .
| train | false |
63 | public void fillFieldValues(List<SynapseUpdateRule> ruleList){
HebbianRule synapseRef=(HebbianRule)ruleList.get(0);
if (!NetworkUtils.isConsistent(ruleList,HebbianRule.class,"getLearningRate")) {
tfLearningRate.setText(SimbrainConstants.NULL_STRING);
}
else {
tfLearningRate.setText(Double.toString(synaps... | [
"public",
"void",
"fillFieldValues",
"(",
"List",
"<",
"SynapseUpdateRule",
">",
"ruleList",
")",
"{",
"HebbianRule",
"synapseRef",
"=",
"(",
"HebbianRule",
")",
"ruleList",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"!",
"NetworkUtils",
".",
"isConsistent",... | populate fields with current data .
| train | false |
64 | public static int countArgumentPlaceholders(final String messagePattern){
if (messagePattern == null) {
return 0;
}
final int delim=messagePattern.indexOf(DELIM_START);
if (delim == -1) {
return 0;
}
int result=0;
boolean isEscaped=false;
for (int i=0; i < messagePattern.length(); i++) {
fin... | [
"public",
"static",
"int",
"countArgumentPlaceholders",
"(",
"final",
"String",
"messagePattern",
")",
"{",
"if",
"(",
"messagePattern",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"final",
"int",
"delim",
"=",
"messagePattern",
".",
"indexOf",
"(",
"DE... | counts the number of unescaped placeholders in the given messagepattern .
| train | false |
65 | protected abstract boolean isEndOfChunk(char currPrefix,String currLabel,char nextPrefix,String nextLabel);
| [
"protected",
"abstract",
"boolean",
"isEndOfChunk",
"(",
"char",
"currPrefix",
",",
"String",
"currLabel",
",",
"char",
"nextPrefix",
",",
"String",
"nextLabel",
")",
";"
] | determines whether the current outcome represents the end of a chunk . both the current outcome and the following outcome are provided for making this decision .
| train | false |
66 | public void clear(){
set.clear();
fireContentsChanged(this,0,0);
}
| [
"public",
"void",
"clear",
"(",
")",
"{",
"set",
".",
"clear",
"(",
")",
";",
"fireContentsChanged",
"(",
"this",
",",
"0",
",",
"0",
")",
";",
"}"
] | clears this list model .
| train | false |
67 | static String toString(@NotNull final Bytes buffer,long position,long len) throws BufferUnderflowException {
final long pos=buffer.readPosition();
final long limit=buffer.readLimit();
buffer.readPositionRemaining(position,len);
try {
final StringBuilder builder=new StringBuilder();
while (buffer.readRem... | [
"static",
"String",
"toString",
"(",
"@",
"NotNull",
"final",
"Bytes",
"buffer",
",",
"long",
"position",
",",
"long",
"len",
")",
"throws",
"BufferUnderflowException",
"{",
"final",
"long",
"pos",
"=",
"buffer",
".",
"readPosition",
"(",
")",
";",
"final",
... | the buffer is not modified by this call
| train | false |
68 | void collectUnresponsiveMembers(Set s){
if (stillWaiting()) {
InternalDistributedMember[] memberList=getMembers();
synchronized (memberList) {
for (int i=0; i < memberList.length; i++) {
InternalDistributedMember m=memberList[i];
if (m != null) {
s.add(m);
}
}
}
... | [
"void",
"collectUnresponsiveMembers",
"(",
"Set",
"s",
")",
"{",
"if",
"(",
"stillWaiting",
"(",
")",
")",
"{",
"InternalDistributedMember",
"[",
"]",
"memberList",
"=",
"getMembers",
"(",
")",
";",
"synchronized",
"(",
"memberList",
")",
"{",
"for",
"(",
... | adds any unresponsive members to s
| train | false |
69 | private void initFromAuthHeader(String authHeader){
this.authHeader=authHeader;
if (authHeader == null) throw new NullPointerException("No authentication header information");
Matcher authMatcher=SCHEME_PATTERN.matcher(authHeader);
if (!authMatcher.matches()) {
throw new IllegalStateException("Unable to p... | [
"private",
"void",
"initFromAuthHeader",
"(",
"String",
"authHeader",
")",
"{",
"this",
".",
"authHeader",
"=",
"authHeader",
";",
"if",
"(",
"authHeader",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"No authentication header information\"",
")... | initializes internal state from the contents of a www - authenticate header .
| train | false |
70 | public String toString(){
String s="KeyIdentifier [\n";
HexDumpEncoder encoder=new HexDumpEncoder();
s+=encoder.encodeBuffer(octetString);
s+="]\n";
return (s);
}
| [
"public",
"String",
"toString",
"(",
")",
"{",
"String",
"s",
"=",
"\"KeyIdentifier [\\n\"",
";",
"HexDumpEncoder",
"encoder",
"=",
"new",
"HexDumpEncoder",
"(",
")",
";",
"s",
"+=",
"encoder",
".",
"encodeBuffer",
"(",
"octetString",
")",
";",
"s",
"+=",
... | returns a printable representation of the keyusage .
| train | false |
71 | public static void addStartupListener(StartUpListener s){
s_startupListeners.add(s);
}
| [
"public",
"static",
"void",
"addStartupListener",
"(",
"StartUpListener",
"s",
")",
"{",
"s_startupListeners",
".",
"add",
"(",
"s",
")",
";",
"}"
] | add a listener to be notified when startup is complete
| train | false |
74 | @Transactional public void save(final List<WorkFlowMatrix> actualWorkFlowMatrixDetails,final String[] departments){
for ( final String dept : departments) {
for ( final WorkFlowMatrix workFlowMatrix : actualWorkFlowMatrixDetails) {
final WorkFlowMatrix wfObj=workFlowMatrix.clone();
if (dept.equals... | [
"@",
"Transactional",
"public",
"void",
"save",
"(",
"final",
"List",
"<",
"WorkFlowMatrix",
">",
"actualWorkFlowMatrixDetails",
",",
"final",
"String",
"[",
"]",
"departments",
")",
"{",
"for",
"(",
"final",
"String",
"dept",
":",
"departments",
")",
"{",
"... | this method saves the workflow matrix details for every department selected
| train | false |
75 | public void write(String file) throws Exception {
write(new File(file));
}
| [
"public",
"void",
"write",
"(",
"String",
"file",
")",
"throws",
"Exception",
"{",
"write",
"(",
"new",
"File",
"(",
"file",
")",
")",
";",
"}"
] | writes the current dom document into the given file .
| train | false |
77 | private boolean extraEntity(String outputString,int charToMap){
boolean extra=false;
if (charToMap < ASCII_MAX) {
switch (charToMap) {
case '"':
if (!outputString.equals(""")) extra=true;
break;
case '&':
if (!outputString.equals("&")) extra=true;
break;
case '<':
if (!outputString.equa... | [
"private",
"boolean",
"extraEntity",
"(",
"String",
"outputString",
",",
"int",
"charToMap",
")",
"{",
"boolean",
"extra",
"=",
"false",
";",
"if",
"(",
"charToMap",
"<",
"ASCII_MAX",
")",
"{",
"switch",
"(",
"charToMap",
")",
"{",
"case",
"'\"'",
":",
"... | this method returns true if there are some non - standard mappings to entities other than quot , amp , lt , gt , and its only purpose is for performance .
| train | true |
78 | public static String quoteIfNeeded(String s,String delim){
if (s == null) return null;
if (s.length() == 0) return "\"\"";
for (int i=0; i < s.length(); i++) {
char c=s.charAt(i);
if (c == '\\' || c == '"' || c == '\'' || Character.isWhitespace(c) || delim.indexOf(c) >= 0) {
StringBuffer b=new S... | [
"public",
"static",
"String",
"quoteIfNeeded",
"(",
"String",
"s",
",",
"String",
"delim",
")",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"return",
"null",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"\"\\\"\\\"\"",
";",
"... | quote a string . the string is quoted only if quoting is required due to embedded delimiters , quote characters or the empty string .
| train | true |
79 | public static void report(){
if (License.isDeveloper()) {
for ( final Object obj : SPIES) {
Diagnostic.developerLog(obj.toString());
}
}
}
| [
"public",
"static",
"void",
"report",
"(",
")",
"{",
"if",
"(",
"License",
".",
"isDeveloper",
"(",
")",
")",
"{",
"for",
"(",
"final",
"Object",
"obj",
":",
"SPIES",
")",
"{",
"Diagnostic",
".",
"developerLog",
"(",
"obj",
".",
"toString",
"(",
")",... | generate a report to the log from all the current spies .
| train | false |
80 | @Deprecated public void write(byte b[],int off,int len){
if (len < 0) throw new ArrayIndexOutOfBoundsException(len);
for (int i=0; i < len; ++i) write(b[off + i]);
}
| [
"@",
"Deprecated",
"public",
"void",
"write",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"if",
"(",
"len",
"<",
"0",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"len",
")",
";",
"for",
"(",
"int",
"i... | write a subarray of bytes . pass each through write byte method .
| train | false |
83 | public Cursor query(SQLiteDatabase db,String[] projectionIn,String selection,String[] selectionArgs,String groupBy,String having,String sortOrder,String limit){
if (mTables == null) {
return null;
}
if (mStrict && selection != null && selection.length() > 0) {
String sqlForValidation=buildQuery(projection... | [
"public",
"Cursor",
"query",
"(",
"SQLiteDatabase",
"db",
",",
"String",
"[",
"]",
"projectionIn",
",",
"String",
"selection",
",",
"String",
"[",
"]",
"selectionArgs",
",",
"String",
"groupBy",
",",
"String",
"having",
",",
"String",
"sortOrder",
",",
"Stri... | perform a query by combining all current settings and the information passed into this method .
| train | false |
84 | private static String replaceChars(String str){
StringBuffer buf=new StringBuffer(str);
int length=buf.length();
for (int i=0; i < length; i++) {
char currentChar=buf.charAt(i);
if (currentChar == ' ') {
buf.setCharAt(i,'%');
buf.insert(i + 1,"20");
length=length + 2;
i=i + 2;
... | [
"private",
"static",
"String",
"replaceChars",
"(",
"String",
"str",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"str",
")",
";",
"int",
"length",
"=",
"buf",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
... | replace spaces with " % 20 " and backslashes with forward slashes in the input string to generate a well - formed uri string .
| train | true |
85 | public boolean isPaused(){
return false;
}
| [
"public",
"boolean",
"isPaused",
"(",
")",
"{",
"return",
"false",
";",
"}"
] | whether or not the game is paused .
| train | false |
86 | public Builder trustCertificates(KeyStore trustStore) throws GeneralSecurityException {
SSLContext sslContext=SslUtils.getTlsSslContext();
SslUtils.initSslContext(sslContext,trustStore,SslUtils.getPkixTrustManagerFactory());
return setSslSocketFactory(sslContext.getSocketFactory());
}
| [
"public",
"Builder",
"trustCertificates",
"(",
"KeyStore",
"trustStore",
")",
"throws",
"GeneralSecurityException",
"{",
"SSLContext",
"sslContext",
"=",
"SslUtils",
".",
"getTlsSslContext",
"(",
")",
";",
"SslUtils",
".",
"initSslContext",
"(",
"sslContext",
",",
"... | sets the ssl socket factory based on a root certificate trust store .
| train | false |
87 | public void rejectReInvite(int code){
if (sLogger.isActivated()) {
sLogger.debug("ReInvite has been rejected");
}
synchronized (mWaitUserAnswer) {
mReInviteStatus=InvitationStatus.INVITATION_REJECTED;
mWaitUserAnswer.notifyAll();
}
}
| [
"public",
"void",
"rejectReInvite",
"(",
"int",
"code",
")",
"{",
"if",
"(",
"sLogger",
".",
"isActivated",
"(",
")",
")",
"{",
"sLogger",
".",
"debug",
"(",
"\"ReInvite has been rejected\"",
")",
";",
"}",
"synchronized",
"(",
"mWaitUserAnswer",
")",
"{",
... | reject the session invitation
| train | false |
89 | public boolean isPrune(){
return prune;
}
| [
"public",
"boolean",
"isPrune",
"(",
")",
"{",
"return",
"prune",
";",
"}"
] | returns the value of the prune attribute .
| train | false |
90 | public void enqueueNormal(String methodName,int count){
Deque<InvocationHandler> handlers=getHandlers(methodName);
for (int i=0; i < count; i++) {
handlers.add(delegateHandler);
}
}
| [
"public",
"void",
"enqueueNormal",
"(",
"String",
"methodName",
",",
"int",
"count",
")",
"{",
"Deque",
"<",
"InvocationHandler",
">",
"handlers",
"=",
"getHandlers",
"(",
"methodName",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
... | enqueues the specified number of normal operations . useful to delay faults .
| train | false |
91 | @SuppressWarnings("unchecked") @Override protected Object readPostProcess(Object o) throws Exception {
Enumeration<Object> enm;
Vector<Vector<?>> deserialized;
Object key;
deserialized=(Vector<Vector<?>>)super.readPostProcess(o);
rebuildBeanConnections(deserialized,REGULAR_CONNECTION);
enm=m_BeanConnectionR... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"protected",
"Object",
"readPostProcess",
"(",
"Object",
"o",
")",
"throws",
"Exception",
"{",
"Enumeration",
"<",
"Object",
">",
"enm",
";",
"Vector",
"<",
"Vector",
"<",
"?",
">",
">",
... | additional post - processing can happen in derived classes after reading from xml . re - builds the beanconnections .
| train | false |
92 | public static boolean canSee(IGame game,Entity ae,Targetable target){
return canSee(game,ae,target,true,null,null);
}
| [
"public",
"static",
"boolean",
"canSee",
"(",
"IGame",
"game",
",",
"Entity",
"ae",
",",
"Targetable",
"target",
")",
"{",
"return",
"canSee",
"(",
"game",
",",
"ae",
",",
"target",
",",
"true",
",",
"null",
",",
"null",
")",
";",
"}"
] | checks to see if the target is visible to the unit , always considering sensors .
| train | false |
93 | @Override void toXML(StringBuilder xml,int level){
indent(xml,level);
xml.append("<string>");
for (int i=0; i < bytes.length; i++) {
byte b=bytes[i];
if (b < 16) xml.append('0');
xml.append(Integer.toHexString(b));
}
xml.append("</string>");
}
| [
"@",
"Override",
"void",
"toXML",
"(",
"StringBuilder",
"xml",
",",
"int",
"level",
")",
"{",
"indent",
"(",
"xml",
",",
"level",
")",
";",
"xml",
".",
"append",
"(",
"\"<string>\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"byt... | there is no xml representation specified for uids . in this implementation uids are represented as strings in the xml output .
| train | false |
94 | public final int readLine(char[] buf,int length,boolean isChop) throws IOException {
byte[] readBuffer=_readBuffer;
int offset=0;
while (true) {
int readOffset=_readOffset;
int sublen=Math.min(length,_readLength - readOffset);
for (; sublen > 0; sublen--) {
int ch=readBuffer[readOffset++] & 0xff... | [
"public",
"final",
"int",
"readLine",
"(",
"char",
"[",
"]",
"buf",
",",
"int",
"length",
",",
"boolean",
"isChop",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"readBuffer",
"=",
"_readBuffer",
";",
"int",
"offset",
"=",
"0",
";",
"while",
"("... | reads a line into the character buffer . \ r \ n is converted to \ n .
| train | true |
95 | public static void gotoOffset(final CDebugPerspectiveModel model,final IAddress offset,final boolean focusMemoryWindow){
model.setActiveMemoryAddress(offset,focusMemoryWindow);
}
| [
"public",
"static",
"void",
"gotoOffset",
"(",
"final",
"CDebugPerspectiveModel",
"model",
",",
"final",
"IAddress",
"offset",
",",
"final",
"boolean",
"focusMemoryWindow",
")",
"{",
"model",
".",
"setActiveMemoryAddress",
"(",
"offset",
",",
"focusMemoryWindow",
")... | sets the caret of a hex control to a given offset .
| train | false |
96 | public List<AbstractCondition> toConditionsList(){
List<AbstractCondition> list=new ArrayList<>();
for ( Node<AbstractCondition> node : toList()) {
list.add(node.getData());
}
return list;
}
| [
"public",
"List",
"<",
"AbstractCondition",
">",
"toConditionsList",
"(",
")",
"{",
"List",
"<",
"AbstractCondition",
">",
"list",
"=",
"new",
"ArrayList",
"<",
">",
"(",
")",
";",
"for",
"(",
"Node",
"<",
"AbstractCondition",
">",
"node",
":",
"toList",
... | get all conditions as a plain list .
| train | false |
97 | protected void initBatchBuffer(){
try {
if (!isIncremental()) {
m_BatchBuffer=m_Loader.getDataSet();
}
else {
m_BatchBuffer=null;
}
}
catch ( Exception e) {
e.printStackTrace();
}
}
| [
"protected",
"void",
"initBatchBuffer",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isIncremental",
"(",
")",
")",
"{",
"m_BatchBuffer",
"=",
"m_Loader",
".",
"getDataSet",
"(",
")",
";",
"}",
"else",
"{",
"m_BatchBuffer",
"=",
"null",
";",
"}",
"}",
... | initializes the batch buffer if necessary , i . e . , for non - incremental loaders .
| train | false |
98 | public BigdataSailRepositoryConnection cxn(){
return tlTx.get();
}
| [
"public",
"BigdataSailRepositoryConnection",
"cxn",
"(",
")",
"{",
"return",
"tlTx",
".",
"get",
"(",
")",
";",
"}"
] | direct access to the unisolated connection . may return null if the connection has not been opened yet by this thread .
| train | false |
99 | public void processConnection(DataInputStream dis,DataOutputStream dosParam) throws IOException, Exception {
GZIPOutputStream gzip=new GZIPOutputStream(new BufferedOutputStream(dosParam));
DataOutputStream dos=new DataOutputStream(gzip);
byte responseStatus=ResponseStatus.STATUS_ERROR;
try {
ByteArrayOutput... | [
"public",
"void",
"processConnection",
"(",
"DataInputStream",
"dis",
",",
"DataOutputStream",
"dosParam",
")",
"throws",
"IOException",
",",
"Exception",
"{",
"GZIPOutputStream",
"gzip",
"=",
"new",
"GZIPOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"dosPar... | called when a new connection has been received . failures are not handled in this class as different servers ( bt , sms , etc ) may want to handle them differently .
| train | false |
100 | public static int hashObject(Object o){
return o == null ? 0 : o.hashCode();
}
| [
"public",
"static",
"int",
"hashObject",
"(",
"Object",
"o",
")",
"{",
"return",
"o",
"==",
"null",
"?",
"0",
":",
"o",
".",
"hashCode",
"(",
")",
";",
"}"
] | null - safe hash code method for objects . returns the object hash code if it is not null , and 0 otherwise .
| train | false |
101 | boolean needToCheckExclude(){
return false;
}
| [
"boolean",
"needToCheckExclude",
"(",
")",
"{",
"return",
"false",
";",
"}"
] | return whether we need to check namespace prefixes against and exclude result prefixes list .
| train | false |
103 | public Area(final StendhalRPZone zone,int x,int y,int width,int height){
this.zone=zone;
final Rectangle2D myshape=new Rectangle2D.Double();
myshape.setRect(x,y,width,height);
this.shape=myshape;
}
| [
"public",
"Area",
"(",
"final",
"StendhalRPZone",
"zone",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"this",
".",
"zone",
"=",
"zone",
";",
"final",
"Rectangle2D",
"myshape",
"=",
"new",
"Rectangle2D",
".",
... | creates a new area .
| train | false |
104 | private byte nextTC() throws IOException {
if (hasPushbackTC) {
hasPushbackTC=false;
}
else {
pushbackTC=input.readByte();
}
return pushbackTC;
}
| [
"private",
"byte",
"nextTC",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"hasPushbackTC",
")",
"{",
"hasPushbackTC",
"=",
"false",
";",
"}",
"else",
"{",
"pushbackTC",
"=",
"input",
".",
"readByte",
"(",
")",
";",
"}",
"return",
"pushbackTC",
";",... | return the next token code ( tc ) from the receiver , which indicates what kind of object follows
| train | false |
105 | private void newline(){
print("\n");
}
| [
"private",
"void",
"newline",
"(",
")",
"{",
"print",
"(",
"\"\\n\"",
")",
";",
"}"
] | put the line separator string onto the print stream .
| train | false |
106 | public int size(){
return seq.size();
}
| [
"public",
"int",
"size",
"(",
")",
"{",
"return",
"seq",
".",
"size",
"(",
")",
";",
"}"
] | return the number of objects in this sequence .
| train | false |
107 | public static String digestString(String pass,String algorithm) throws NoSuchAlgorithmException {
MessageDigest md;
ByteArrayOutputStream bos;
try {
md=MessageDigest.getInstance(algorithm);
byte[] digest=md.digest(pass.getBytes("iso-8859-1"));
bos=new ByteArrayOutputStream();
OutputStream encodedS... | [
"public",
"static",
"String",
"digestString",
"(",
"String",
"pass",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"md",
";",
"ByteArrayOutputStream",
"bos",
";",
"try",
"{",
"md",
"=",
"MessageDigest",
".",
"getInsta... | calculate digest of given string using given algorithm . encode digest in mime - like base64 .
| train | false |
108 | void storeBlock(long lobId,int seq,long pos,byte[] b,String compressAlgorithm) throws SQLException {
long block;
boolean blockExists=false;
if (compressAlgorithm != null) {
b=compress.compress(b,compressAlgorithm);
}
int hash=Arrays.hashCode(b);
assertHoldsLock(conn.getSession());
assertHoldsLock(data... | [
"void",
"storeBlock",
"(",
"long",
"lobId",
",",
"int",
"seq",
",",
"long",
"pos",
",",
"byte",
"[",
"]",
"b",
",",
"String",
"compressAlgorithm",
")",
"throws",
"SQLException",
"{",
"long",
"block",
";",
"boolean",
"blockExists",
"=",
"false",
";",
"if"... | store a block in the lob storage .
| train | false |
109 | public static boolean isDirectory(String path){
File f=new File(path);
return f.isDirectory();
}
| [
"public",
"static",
"boolean",
"isDirectory",
"(",
"String",
"path",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"return",
"f",
".",
"isDirectory",
"(",
")",
";",
"}"
] | checks if the given path is a directory
| train | false |
111 | static void transformKillSlot(final RPObject object){
final RPObject kills=KeyedSlotUtil.getKeyedSlotObject(object,"!kills");
if (kills != null) {
final RPObject newKills=new RPObject();
for ( final String attr : kills) {
if (!attr.equals("id")) {
String newAttr=attr;
String value=k... | [
"static",
"void",
"transformKillSlot",
"(",
"final",
"RPObject",
"object",
")",
"{",
"final",
"RPObject",
"kills",
"=",
"KeyedSlotUtil",
".",
"getKeyedSlotObject",
"(",
"object",
",",
"\"!kills\"",
")",
";",
"if",
"(",
"kills",
"!=",
"null",
")",
"{",
"final... | transform kill slot content to the new kill recording system .
| train | false |
112 | public static CharSequence trimTrailingWhitespace(CharSequence source){
if (source == null) return "";
int i=source.length();
while (--i >= 0 && Character.isWhitespace(source.charAt(i))) {
}
return source.subSequence(0,i + 1);
}
| [
"public",
"static",
"CharSequence",
"trimTrailingWhitespace",
"(",
"CharSequence",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"return",
"\"\"",
";",
"int",
"i",
"=",
"source",
".",
"length",
"(",
")",
";",
"while",
"(",
"--",
"i",
">=",
... | trims trailing whitespace . removes any of these characters : 0009 , horizontal tabulation 000a , line feed 000b , vertical tabulation 000c , form feed 000d , carriage return 001c , file separator 001d , group separator 001e , record separator 001f , unit separator
| train | false |
113 | private static void WriteStringVectorToFile(Vector inputVec,String fileName) throws StringVectorToFileException {
try {
BufferedWriter fileW=new BufferedWriter(new FileWriter(fileName));
int lineNum=0;
while (lineNum < inputVec.size()) {
fileW.write((String)inputVec.elementAt(lineNum));
fileW.... | [
"private",
"static",
"void",
"WriteStringVectorToFile",
"(",
"Vector",
"inputVec",
",",
"String",
"fileName",
")",
"throws",
"StringVectorToFileException",
"{",
"try",
"{",
"BufferedWriter",
"fileW",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"file... | methods for reading and writing files
| train | false |
114 | public boolean before(String userDefinedValue) throws IllegalArgumentException {
try {
return value.before(getDate(userDefinedValue));
}
catch ( DataTypeValidationException e) {
throw new IllegalArgumentException(e.getMessage());
}
}
| [
"public",
"boolean",
"before",
"(",
"String",
"userDefinedValue",
")",
"throws",
"IllegalArgumentException",
"{",
"try",
"{",
"return",
"value",
".",
"before",
"(",
"getDate",
"(",
"userDefinedValue",
")",
")",
";",
"}",
"catch",
"(",
"DataTypeValidationException"... | indicates whether or not provided value is before .
| train | false |
115 | public void close(){
if (null != inputStreamReader) {
CarbonUtil.closeStreams(inputStreamReader);
}
}
| [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"inputStreamReader",
")",
"{",
"CarbonUtil",
".",
"closeStreams",
"(",
"inputStreamReader",
")",
";",
"}",
"}"
] | below method will be used to clear all the stream
| train | false |
116 | public static double exponent(Object left,Object right) throws PageException {
return StrictMath.pow(Caster.toDoubleValue(left),Caster.toDoubleValue(right));
}
| [
"public",
"static",
"double",
"exponent",
"(",
"Object",
"left",
",",
"Object",
"right",
")",
"throws",
"PageException",
"{",
"return",
"StrictMath",
".",
"pow",
"(",
"Caster",
".",
"toDoubleValue",
"(",
"left",
")",
",",
"Caster",
".",
"toDoubleValue",
"(",... | calculate the exponent of the left value
| train | true |
117 | public synchronized void addActionListener(ActionListener actionListener){
if (actionListeners == null) actionListeners=new ArrayList<ActionListener>();
actionListeners.add(actionListener);
if (fired) {
actionListener.actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,""));
}
}
| [
"public",
"synchronized",
"void",
"addActionListener",
"(",
"ActionListener",
"actionListener",
")",
"{",
"if",
"(",
"actionListeners",
"==",
"null",
")",
"actionListeners",
"=",
"new",
"ArrayList",
"<",
"ActionListener",
">",
"(",
")",
";",
"actionListeners",
"."... | adds a listener that will be notified upon completion of all of the running threads . its actionperformed method will be called immediately if the threads already finished .
| train | false |
118 | public String writeDataFile() throws DataFileException {
ByteArrayOutputStream bos=new ByteArrayOutputStream();
writeDataFile(bos);
String outString=bos.toString();
try {
if (bos != null) bos.close();
}
catch ( IOException e) {
Debug.logWarning(e,module);
}
return outString;
}
| [
"public",
"String",
"writeDataFile",
"(",
")",
"throws",
"DataFileException",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"writeDataFile",
"(",
"bos",
")",
";",
"String",
"outString",
"=",
"bos",
".",
"toString",
"(",... | returns the records in this datafile object as a plain text data file content
| train | false |
119 | public static Color determineBackgroundColor(final INaviInstruction startInstruction,final String trackedRegister,final CInstructionResult result){
Preconditions.checkNotNull(startInstruction,"IE01671: Start instruction argument can not be null");
Preconditions.checkNotNull(trackedRegister,"IE01672: Tracked registe... | [
"public",
"static",
"Color",
"determineBackgroundColor",
"(",
"final",
"INaviInstruction",
"startInstruction",
",",
"final",
"String",
"trackedRegister",
",",
"final",
"CInstructionResult",
"result",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"startInstruction",... | determines the background color to be used in the table and in the graph to highlight a given instruction result .
| train | false |
120 | public void removeOnCentralPositionChangedListener(OnCentralPositionChangedListener listener){
mOnCentralPositionChangedListeners.remove(listener);
}
| [
"public",
"void",
"removeOnCentralPositionChangedListener",
"(",
"OnCentralPositionChangedListener",
"listener",
")",
"{",
"mOnCentralPositionChangedListeners",
".",
"remove",
"(",
"listener",
")",
";",
"}"
] | removes a listener that would be called when the central item of the list changes .
| train | false |
121 | public void addPickupRS(){
int old=_pickupRS;
_pickupRS++;
setDirtyAndFirePropertyChange("locationAddPickupRS",Integer.toString(old),Integer.toString(_pickupRS));
}
| [
"public",
"void",
"addPickupRS",
"(",
")",
"{",
"int",
"old",
"=",
"_pickupRS",
";",
"_pickupRS",
"++",
";",
"setDirtyAndFirePropertyChange",
"(",
"\"locationAddPickupRS\"",
",",
"Integer",
".",
"toString",
"(",
"old",
")",
",",
"Integer",
".",
"toString",
"("... | increments the number of cars and or engines that will be picked up by a train at this location .
| train | false |
123 | public double convert(){
return Double.longBitsToDouble(ints2long(high,low));
}
| [
"public",
"double",
"convert",
"(",
")",
"{",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"ints2long",
"(",
"high",
",",
"low",
")",
")",
";",
"}"
] | converts the internal representation ( two ints ) to a double .
| train | false |
125 | public void clearArchiveDirectory(){
File directory=new File(getArchiveDirectory());
if (directory.exists() && directory.isDirectory()) {
String[] listing=directory.list();
for ( String aListing : listing) {
File file=new File(getArchiveDirectory(),aListing);
file.delete();
}
}
if (!d... | [
"public",
"void",
"clearArchiveDirectory",
"(",
")",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"getArchiveDirectory",
"(",
")",
")",
";",
"if",
"(",
"directory",
".",
"exists",
"(",
")",
"&&",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",... | clears the archive directory .
| train | false |
End of preview. Expand in Data Studio
- Downloads last month
- 2