repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsServer.java | PresentsServer.runServer | public static void runServer (Module... modules)
{
Injector injector = Guice.createInjector(modules);
PresentsServer server = injector.getInstance(PresentsServer.class);
try {
// initialize the server
server.init(injector);
// check to see if we should lo... | java | public static void runServer (Module... modules)
{
Injector injector = Guice.createInjector(modules);
PresentsServer server = injector.getInstance(PresentsServer.class);
try {
// initialize the server
server.init(injector);
// check to see if we should lo... | [
"public",
"static",
"void",
"runServer",
"(",
"Module",
"...",
"modules",
")",
"{",
"Injector",
"injector",
"=",
"Guice",
".",
"createInjector",
"(",
"modules",
")",
";",
"PresentsServer",
"server",
"=",
"injector",
".",
"getInstance",
"(",
"PresentsServer",
"... | Inits and runs the PresentsServer bound in the given modules. This blocks until the server
is shut down. | [
"Inits",
"and",
"runs",
"the",
"PresentsServer",
"bound",
"in",
"the",
"given",
"modules",
".",
"This",
"blocks",
"until",
"the",
"server",
"is",
"shut",
"down",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsServer.java#L118-L147 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsServer.java | PresentsServer.run | public void run ()
{
// wait till everything in the dobjmgr queue and invokers are processed and then start the
// connection manager
((PresentsInvoker)_invoker).postRunnableWhenEmpty(new Runnable() {
public void run () {
// Take as long as you like opening to the... | java | public void run ()
{
// wait till everything in the dobjmgr queue and invokers are processed and then start the
// connection manager
((PresentsInvoker)_invoker).postRunnableWhenEmpty(new Runnable() {
public void run () {
// Take as long as you like opening to the... | [
"public",
"void",
"run",
"(",
")",
"{",
"// wait till everything in the dobjmgr queue and invokers are processed and then start the",
"// connection manager",
"(",
"(",
"PresentsInvoker",
")",
"_invoker",
")",
".",
"postRunnableWhenEmpty",
"(",
"new",
"Runnable",
"(",
")",
... | Starts up all of the server services and enters the main server event loop. | [
"Starts",
"up",
"all",
"of",
"the",
"server",
"services",
"and",
"enters",
"the",
"main",
"server",
"event",
"loop",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsServer.java#L229-L245 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/PresentsServer.java | PresentsServer.openToThePublic | protected void openToThePublic ()
{
if (getListenPorts().length != 0 && !_socketAcceptor.bind()) {
queueShutdown();
} else {
_datagramReader.bind();
_conmgr.start();
}
} | java | protected void openToThePublic ()
{
if (getListenPorts().length != 0 && !_socketAcceptor.bind()) {
queueShutdown();
} else {
_datagramReader.bind();
_conmgr.start();
}
} | [
"protected",
"void",
"openToThePublic",
"(",
")",
"{",
"if",
"(",
"getListenPorts",
"(",
")",
".",
"length",
"!=",
"0",
"&&",
"!",
"_socketAcceptor",
".",
"bind",
"(",
")",
")",
"{",
"queueShutdown",
"(",
")",
";",
"}",
"else",
"{",
"_datagramReader",
... | Opens the server for connections after the event thread is running and all the invokers are
clear after starting up. | [
"Opens",
"the",
"server",
"for",
"connections",
"after",
"the",
"event",
"thread",
"is",
"running",
"and",
"all",
"the",
"invokers",
"are",
"clear",
"after",
"starting",
"up",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/PresentsServer.java#L251-L259 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.readFrom | public void readFrom (File source)
throws IOException
{
// slurp our source file into newline separated strings
_lines = Lists.newArrayList();
BufferedReader bin = new BufferedReader(new FileReader(source));
String line = null;
while ((line = bin.readLine()) != null) ... | java | public void readFrom (File source)
throws IOException
{
// slurp our source file into newline separated strings
_lines = Lists.newArrayList();
BufferedReader bin = new BufferedReader(new FileReader(source));
String line = null;
while ((line = bin.readLine()) != null) ... | [
"public",
"void",
"readFrom",
"(",
"File",
"source",
")",
"throws",
"IOException",
"{",
"// slurp our source file into newline separated strings",
"_lines",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"BufferedReader",
"bin",
"=",
"new",
"BufferedReader",
"(",
... | Reads the code from the supplied source file. | [
"Reads",
"the",
"code",
"from",
"the",
"supplied",
"source",
"file",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L46-L109 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.containsString | public boolean containsString (String text)
{
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
// don't look inside the autogenerated areas
if (!(ii >= _nstart && ii < _nend) && !(ii >= _mstart && ii < _mend) &&
_lines.get(ii).contains(text)) {
... | java | public boolean containsString (String text)
{
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) {
// don't look inside the autogenerated areas
if (!(ii >= _nstart && ii < _nend) && !(ii >= _mstart && ii < _mend) &&
_lines.get(ii).contains(text)) {
... | [
"public",
"boolean",
"containsString",
"(",
"String",
"text",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
",",
"nn",
"=",
"_lines",
".",
"size",
"(",
")",
";",
"ii",
"<",
"nn",
";",
"ii",
"++",
")",
"{",
"// don't look inside the autogenerated areas",
... | Returns true if the supplied text appears in the non-auto-generated section. | [
"Returns",
"true",
"if",
"the",
"supplied",
"text",
"appears",
"in",
"the",
"non",
"-",
"auto",
"-",
"generated",
"section",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L114-L124 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.generate | public String generate (String fsection, String msection)
throws IOException
{
StringWriter writer = new StringWriter();
BufferedWriter bout = new BufferedWriter(writer);
addOrRemoveGeneratedImport(StringUtil.deNull(fsection).contains("@Generated(") ||
StringUtil.deNull(m... | java | public String generate (String fsection, String msection)
throws IOException
{
StringWriter writer = new StringWriter();
BufferedWriter bout = new BufferedWriter(writer);
addOrRemoveGeneratedImport(StringUtil.deNull(fsection).contains("@Generated(") ||
StringUtil.deNull(m... | [
"public",
"String",
"generate",
"(",
"String",
"fsection",
",",
"String",
"msection",
")",
"throws",
"IOException",
"{",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"BufferedWriter",
"bout",
"=",
"new",
"BufferedWriter",
"(",
"writer",
... | Writes the code out to the specified file.
@param fsection the new "generated fields" to write to the file, or null.
@param msection the new "generated methods" to write to the file, or null. | [
"Writes",
"the",
"code",
"out",
"to",
"the",
"specified",
"file",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L132-L184 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.check | protected void check (File source, String mname, int mline, String fname, int fline)
throws IOException
{
if (mline == -1 && fline != -1) {
throw new IOException(
"Found " + fname + " marker (at line " + (fline+1) + ") but no " + mname +
" marker in '" + s... | java | protected void check (File source, String mname, int mline, String fname, int fline)
throws IOException
{
if (mline == -1 && fline != -1) {
throw new IOException(
"Found " + fname + " marker (at line " + (fline+1) + ") but no " + mname +
" marker in '" + s... | [
"protected",
"void",
"check",
"(",
"File",
"source",
",",
"String",
"mname",
",",
"int",
"mline",
",",
"String",
"fname",
",",
"int",
"fline",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mline",
"==",
"-",
"1",
"&&",
"fline",
"!=",
"-",
"1",
")",
... | Helper function for sanity checking marker existence. | [
"Helper",
"function",
"for",
"sanity",
"checking",
"marker",
"existence",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L187-L195 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.writeln | protected void writeln (BufferedWriter bout, String line)
throws IOException
{
bout.write(line);
bout.newLine();
} | java | protected void writeln (BufferedWriter bout, String line)
throws IOException
{
bout.write(line);
bout.newLine();
} | [
"protected",
"void",
"writeln",
"(",
"BufferedWriter",
"bout",
",",
"String",
"line",
")",
"throws",
"IOException",
"{",
"bout",
".",
"write",
"(",
"line",
")",
";",
"bout",
".",
"newLine",
"(",
")",
";",
"}"
] | Helper function for writing a string and a newline to a writer. | [
"Helper",
"function",
"for",
"writing",
"a",
"string",
"and",
"a",
"newline",
"to",
"a",
"writer",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L205-L210 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/SourceFile.java | SourceFile.addOrRemoveGeneratedImport | protected void addOrRemoveGeneratedImport (boolean add)
{
final String IMPORT = "import javax.annotation.Generated;";
int packageLine = -1;
int importLine = -1;
int lastJavaImport = -1;
int firstNonJavaImport = -1;
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) ... | java | protected void addOrRemoveGeneratedImport (boolean add)
{
final String IMPORT = "import javax.annotation.Generated;";
int packageLine = -1;
int importLine = -1;
int lastJavaImport = -1;
int firstNonJavaImport = -1;
for (int ii = 0, nn = _lines.size(); ii < nn; ii++) ... | [
"protected",
"void",
"addOrRemoveGeneratedImport",
"(",
"boolean",
"add",
")",
"{",
"final",
"String",
"IMPORT",
"=",
"\"import javax.annotation.Generated;\"",
";",
"int",
"packageLine",
"=",
"-",
"1",
";",
"int",
"importLine",
"=",
"-",
"1",
";",
"int",
"lastJa... | Add or remove an import for "@Generated", if needed. | [
"Add",
"or",
"remove",
"an",
"import",
"for"
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/SourceFile.java#L215-L262 | train |
threerings/narya | core/src/main/java/com/threerings/admin/client/FieldEditor.java | FieldEditor.updateBorder | protected void updateBorder (boolean modified)
{
if (modified) {
setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.red));
} else {
setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
}
} | java | protected void updateBorder (boolean modified)
{
if (modified) {
setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.red));
} else {
setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
}
} | [
"protected",
"void",
"updateBorder",
"(",
"boolean",
"modified",
")",
"{",
"if",
"(",
"modified",
")",
"{",
"setBorder",
"(",
"BorderFactory",
".",
"createMatteBorder",
"(",
"2",
",",
"2",
",",
"2",
",",
"2",
",",
"Color",
".",
"red",
")",
")",
";",
... | Sets the appropriate border on this field editor based on whether
or not the field is modified. | [
"Sets",
"the",
"appropriate",
"border",
"on",
"this",
"field",
"editor",
"based",
"on",
"whether",
"or",
"not",
"the",
"field",
"is",
"modified",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/admin/client/FieldEditor.java#L185-L192 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.addListener | public void addListener (ChangeListener listener, boolean weak)
{
// only add the listener if they're not already there
int idx = getListenerIndex(listener);
if (idx == -1) {
_listeners = ListUtil.add(_listeners,
weak ? new WeakReference<Object>(listener) : listen... | java | public void addListener (ChangeListener listener, boolean weak)
{
// only add the listener if they're not already there
int idx = getListenerIndex(listener);
if (idx == -1) {
_listeners = ListUtil.add(_listeners,
weak ? new WeakReference<Object>(listener) : listen... | [
"public",
"void",
"addListener",
"(",
"ChangeListener",
"listener",
",",
"boolean",
"weak",
")",
"{",
"// only add the listener if they're not already there",
"int",
"idx",
"=",
"getListenerIndex",
"(",
"listener",
")",
";",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
... | Adds an event listener to this object. The listener will be notified when any events are
dispatched on this object that match their particular listener interface.
<p> Note that the entity adding itself as a listener should have obtained the object
reference by subscribing to it or should be acting on behalf of some ot... | [
"Adds",
"an",
"event",
"listener",
"to",
"this",
"object",
".",
"The",
"listener",
"will",
"be",
"notified",
"when",
"any",
"events",
"are",
"dispatched",
"on",
"this",
"object",
"that",
"match",
"their",
"particular",
"listener",
"interface",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L201-L219 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.removeListener | public void removeListener (ChangeListener listener)
{
int idx = getListenerIndex(listener);
if (idx != -1) {
_listeners[idx] = null;
}
} | java | public void removeListener (ChangeListener listener)
{
int idx = getListenerIndex(listener);
if (idx != -1) {
_listeners[idx] = null;
}
} | [
"public",
"void",
"removeListener",
"(",
"ChangeListener",
"listener",
")",
"{",
"int",
"idx",
"=",
"getListenerIndex",
"(",
"listener",
")",
";",
"if",
"(",
"idx",
"!=",
"-",
"1",
")",
"{",
"_listeners",
"[",
"idx",
"]",
"=",
"null",
";",
"}",
"}"
] | Removes an event listener from this object. The listener will no longer be notified when
events are dispatched on this object.
@param listener the listener to be removed. | [
"Removes",
"an",
"event",
"listener",
"from",
"this",
"object",
".",
"The",
"listener",
"will",
"no",
"longer",
"be",
"notified",
"when",
"events",
"are",
"dispatched",
"on",
"this",
"object",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L227-L233 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.getSet | public final <T extends DSet.Entry> DSet<T> getSet (String setName)
{
@SuppressWarnings("unchecked") DSet<T> casted = (DSet<T>)getAccessor(setName).get(this);
return casted;
} | java | public final <T extends DSet.Entry> DSet<T> getSet (String setName)
{
@SuppressWarnings("unchecked") DSet<T> casted = (DSet<T>)getAccessor(setName).get(this);
return casted;
} | [
"public",
"final",
"<",
"T",
"extends",
"DSet",
".",
"Entry",
">",
"DSet",
"<",
"T",
">",
"getSet",
"(",
"String",
"setName",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"DSet",
"<",
"T",
">",
"casted",
"=",
"(",
"DSet",
"<",
"T",
... | Get the DSet with the specified name. | [
"Get",
"the",
"DSet",
"with",
"the",
"specified",
"name",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L258-L262 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.addToSet | public <T extends DSet.Entry> void addToSet (String setName, T entry)
{
requestEntryAdd(setName, getSet(setName), entry);
} | java | public <T extends DSet.Entry> void addToSet (String setName, T entry)
{
requestEntryAdd(setName, getSet(setName), entry);
} | [
"public",
"<",
"T",
"extends",
"DSet",
".",
"Entry",
">",
"void",
"addToSet",
"(",
"String",
"setName",
",",
"T",
"entry",
")",
"{",
"requestEntryAdd",
"(",
"setName",
",",
"getSet",
"(",
"setName",
")",
",",
"entry",
")",
";",
"}"
] | Request to have the specified item added to the specified DSet. | [
"Request",
"to",
"have",
"the",
"specified",
"item",
"added",
"to",
"the",
"specified",
"DSet",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L267-L270 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.updateSet | public void updateSet (String setName, DSet.Entry entry)
{
requestEntryUpdate(setName, getSet(setName), entry);
} | java | public void updateSet (String setName, DSet.Entry entry)
{
requestEntryUpdate(setName, getSet(setName), entry);
} | [
"public",
"void",
"updateSet",
"(",
"String",
"setName",
",",
"DSet",
".",
"Entry",
"entry",
")",
"{",
"requestEntryUpdate",
"(",
"setName",
",",
"getSet",
"(",
"setName",
")",
",",
"entry",
")",
";",
"}"
] | Request to have the specified item updated in the specified DSet. | [
"Request",
"to",
"have",
"the",
"specified",
"item",
"updated",
"in",
"the",
"specified",
"DSet",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L275-L278 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.removeFromSet | public void removeFromSet (String setName, Comparable<?> key)
{
requestEntryRemove(setName, getSet(setName), key);
} | java | public void removeFromSet (String setName, Comparable<?> key)
{
requestEntryRemove(setName, getSet(setName), key);
} | [
"public",
"void",
"removeFromSet",
"(",
"String",
"setName",
",",
"Comparable",
"<",
"?",
">",
"key",
")",
"{",
"requestEntryRemove",
"(",
"setName",
",",
"getSet",
"(",
"setName",
")",
",",
"key",
")",
";",
"}"
] | Request to have the specified key removed from the specified DSet. | [
"Request",
"to",
"have",
"the",
"specified",
"key",
"removed",
"from",
"the",
"specified",
"DSet",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L283-L286 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.notifyListeners | public void notifyListeners (DEvent event)
{
if (_listeners == null) {
return;
}
for (int ii = 0, ll = _listeners.length; ii < ll; ii++) {
Object listener = _listeners[ii];
if (listener == null) {
continue;
}
if (li... | java | public void notifyListeners (DEvent event)
{
if (_listeners == null) {
return;
}
for (int ii = 0, ll = _listeners.length; ii < ll; ii++) {
Object listener = _listeners[ii];
if (listener == null) {
continue;
}
if (li... | [
"public",
"void",
"notifyListeners",
"(",
"DEvent",
"event",
")",
"{",
"if",
"(",
"_listeners",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"int",
"ii",
"=",
"0",
",",
"ll",
"=",
"_listeners",
".",
"length",
";",
"ii",
"<",
"ll",
";",
... | Called by the distributed object manager after it has applied an event to this object. This
dispatches an event notification to all of the listeners registered with this object.
@param event the event that was just applied. | [
"Called",
"by",
"the",
"distributed",
"object",
"manager",
"after",
"it",
"has",
"applied",
"an",
"event",
"to",
"this",
"object",
".",
"This",
"dispatches",
"an",
"event",
"notification",
"to",
"all",
"of",
"the",
"listeners",
"registered",
"with",
"this",
... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L408-L440 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.notifyProxies | public void notifyProxies (DEvent event)
{
if (_subs == null || event.isPrivate()) {
return;
}
for (Object sub : _subs) {
try {
if (sub != null && sub instanceof ProxySubscriber) {
((ProxySubscriber)sub).eventReceived(event);
... | java | public void notifyProxies (DEvent event)
{
if (_subs == null || event.isPrivate()) {
return;
}
for (Object sub : _subs) {
try {
if (sub != null && sub instanceof ProxySubscriber) {
((ProxySubscriber)sub).eventReceived(event);
... | [
"public",
"void",
"notifyProxies",
"(",
"DEvent",
"event",
")",
"{",
"if",
"(",
"_subs",
"==",
"null",
"||",
"event",
".",
"isPrivate",
"(",
")",
")",
"{",
"return",
";",
"}",
"for",
"(",
"Object",
"sub",
":",
"_subs",
")",
"{",
"try",
"{",
"if",
... | Called by the distributed object manager after it has applied an event to this object. This
dispatches an event notification to all of the proxy listeners registered with this object.
@param event the event that was just applied. | [
"Called",
"by",
"the",
"distributed",
"object",
"manager",
"after",
"it",
"has",
"applied",
"an",
"event",
"to",
"this",
"object",
".",
"This",
"dispatches",
"an",
"event",
"notification",
"to",
"all",
"of",
"the",
"proxy",
"listeners",
"registered",
"with",
... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L448-L463 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.changeAttribute | public void changeAttribute (String name, Object value)
{
Accessor acc = getAccessor(name);
requestAttributeChange(name, value, acc.get(this));
acc.set(this, value);
} | java | public void changeAttribute (String name, Object value)
{
Accessor acc = getAccessor(name);
requestAttributeChange(name, value, acc.get(this));
acc.set(this, value);
} | [
"public",
"void",
"changeAttribute",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"Accessor",
"acc",
"=",
"getAccessor",
"(",
"name",
")",
";",
"requestAttributeChange",
"(",
"name",
",",
"value",
",",
"acc",
".",
"get",
"(",
"this",
")",
")"... | Requests that the specified attribute be changed to the specified value. Normally the
generated setter methods should be used but in rare cases a caller may wish to update
distributed fields in a generic manner. | [
"Requests",
"that",
"the",
"specified",
"attribute",
"be",
"changed",
"to",
"the",
"specified",
"value",
".",
"Normally",
"the",
"generated",
"setter",
"methods",
"should",
"be",
"used",
"but",
"in",
"rare",
"cases",
"a",
"caller",
"may",
"wish",
"to",
"upda... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L470-L475 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.postEvent | public void postEvent (DEvent event)
{
if (_tevent != null) {
_tevent.postEvent(event);
} else if (_omgr != null) {
_omgr.postEvent(event);
} else {
log.info("Dropping event for non- or no longer managed object", "oid", getOid(),
"cl... | java | public void postEvent (DEvent event)
{
if (_tevent != null) {
_tevent.postEvent(event);
} else if (_omgr != null) {
_omgr.postEvent(event);
} else {
log.info("Dropping event for non- or no longer managed object", "oid", getOid(),
"cl... | [
"public",
"void",
"postEvent",
"(",
"DEvent",
"event",
")",
"{",
"if",
"(",
"_tevent",
"!=",
"null",
")",
"{",
"_tevent",
".",
"postEvent",
"(",
"event",
")",
";",
"}",
"else",
"if",
"(",
"_omgr",
"!=",
"null",
")",
"{",
"_omgr",
".",
"postEvent",
... | Posts the specified event either to our dobject manager or to the compound event for which
we are currently transacting. | [
"Posts",
"the",
"specified",
"event",
"either",
"to",
"our",
"dobject",
"manager",
"or",
"to",
"the",
"compound",
"event",
"for",
"which",
"we",
"are",
"currently",
"transacting",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L519-L531 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.which | protected void which (StringBuilder buf)
{
buf.append(StringUtil.shortClassName(this));
buf.append(":").append(_oid);
} | java | protected void which (StringBuilder buf)
{
buf.append(StringUtil.shortClassName(this));
buf.append(":").append(_oid);
} | [
"protected",
"void",
"which",
"(",
"StringBuilder",
"buf",
")",
"{",
"buf",
".",
"append",
"(",
"StringUtil",
".",
"shortClassName",
"(",
"this",
")",
")",
";",
"buf",
".",
"append",
"(",
"\":\"",
")",
".",
"append",
"(",
"_oid",
")",
";",
"}"
] | Used to briefly describe this distributed object. | [
"Used",
"to",
"briefly",
"describe",
"this",
"distributed",
"object",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L681-L685 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.commitTransaction | public void commitTransaction ()
{
if (_tevent == null) {
String errmsg = "Cannot commit: not involved in a transaction [dobj=" + this + "]";
throw new IllegalStateException(errmsg);
}
// if we are nested, we decrement our nesting count rather than committing the tra... | java | public void commitTransaction ()
{
if (_tevent == null) {
String errmsg = "Cannot commit: not involved in a transaction [dobj=" + this + "]";
throw new IllegalStateException(errmsg);
}
// if we are nested, we decrement our nesting count rather than committing the tra... | [
"public",
"void",
"commitTransaction",
"(",
")",
"{",
"if",
"(",
"_tevent",
"==",
"null",
")",
"{",
"String",
"errmsg",
"=",
"\"Cannot commit: not involved in a transaction [dobj=\"",
"+",
"this",
"+",
"\"]\"",
";",
"throw",
"new",
"IllegalStateException",
"(",
"e... | Commits the transaction in which this distributed object is involved.
@see CompoundEvent#commit | [
"Commits",
"the",
"transaction",
"in",
"which",
"this",
"distributed",
"object",
"is",
"involved",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L741-L761 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.cancelTransaction | public void cancelTransaction ()
{
if (_tevent == null) {
String errmsg = "Cannot cancel: not involved in a transaction [dobj=" + this + "]";
throw new IllegalStateException(errmsg);
}
// if we're in a nested transaction, make a note that it is to be cancelled when a... | java | public void cancelTransaction ()
{
if (_tevent == null) {
String errmsg = "Cannot cancel: not involved in a transaction [dobj=" + this + "]";
throw new IllegalStateException(errmsg);
}
// if we're in a nested transaction, make a note that it is to be cancelled when a... | [
"public",
"void",
"cancelTransaction",
"(",
")",
"{",
"if",
"(",
"_tevent",
"==",
"null",
")",
"{",
"String",
"errmsg",
"=",
"\"Cannot cancel: not involved in a transaction [dobj=\"",
"+",
"this",
"+",
"\"]\"",
";",
"throw",
"new",
"IllegalStateException",
"(",
"e... | Cancels the transaction in which this distributed object is involved.
@see CompoundEvent#cancel | [
"Cancels",
"the",
"transaction",
"in",
"which",
"this",
"distributed",
"object",
"is",
"involved",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L776-L792 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.requestOidAdd | protected void requestOidAdd (String name, OidList list, int oid)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
list.add(oid);
}
postEvent(new ObjectAddedEvent(_oid, n... | java | protected void requestOidAdd (String name, OidList list, int oid)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
list.add(oid);
}
postEvent(new ObjectAddedEvent(_oid, n... | [
"protected",
"void",
"requestOidAdd",
"(",
"String",
"name",
",",
"OidList",
"list",
",",
"int",
"oid",
")",
"{",
"// if we're on the authoritative server, we update the set immediately",
"boolean",
"applyImmediately",
"=",
"isAuthoritative",
"(",
")",
";",
"if",
"(",
... | Calls by derived instances when an oid adder method was called. | [
"Calls",
"by",
"derived",
"instances",
"when",
"an",
"oid",
"adder",
"method",
"was",
"called",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L851-L859 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.requestOidRemove | protected void requestOidRemove (String name, OidList list, int oid)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
list.remove(oid);
}
// dispatch an object removed ev... | java | protected void requestOidRemove (String name, OidList list, int oid)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
list.remove(oid);
}
// dispatch an object removed ev... | [
"protected",
"void",
"requestOidRemove",
"(",
"String",
"name",
",",
"OidList",
"list",
",",
"int",
"oid",
")",
"{",
"// if we're on the authoritative server, we update the set immediately",
"boolean",
"applyImmediately",
"=",
"isAuthoritative",
"(",
")",
";",
"if",
"("... | Calls by derived instances when an oid remover method was called. | [
"Calls",
"by",
"derived",
"instances",
"when",
"an",
"oid",
"remover",
"method",
"was",
"called",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L864-L873 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.requestEntryAdd | protected <T extends DSet.Entry> void requestEntryAdd (String name, DSet<T> set, T entry)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
set.add(entry);
}
// dispatch a... | java | protected <T extends DSet.Entry> void requestEntryAdd (String name, DSet<T> set, T entry)
{
// if we're on the authoritative server, we update the set immediately
boolean applyImmediately = isAuthoritative();
if (applyImmediately) {
set.add(entry);
}
// dispatch a... | [
"protected",
"<",
"T",
"extends",
"DSet",
".",
"Entry",
">",
"void",
"requestEntryAdd",
"(",
"String",
"name",
",",
"DSet",
"<",
"T",
">",
"set",
",",
"T",
"entry",
")",
"{",
"// if we're on the authoritative server, we update the set immediately",
"boolean",
"app... | Calls by derived instances when a set adder method was called. | [
"Calls",
"by",
"derived",
"instances",
"when",
"a",
"set",
"adder",
"method",
"was",
"called",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L890-L899 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.requestEntryRemove | protected <T extends DSet.Entry> void requestEntryRemove (
String name, DSet<T> set, Comparable<?> key)
{
// if we're on the authoritative server, we update the set immediately
T oldEntry = null;
if (isAuthoritative()) {
oldEntry = set.removeKey(key);
if (oldE... | java | protected <T extends DSet.Entry> void requestEntryRemove (
String name, DSet<T> set, Comparable<?> key)
{
// if we're on the authoritative server, we update the set immediately
T oldEntry = null;
if (isAuthoritative()) {
oldEntry = set.removeKey(key);
if (oldE... | [
"protected",
"<",
"T",
"extends",
"DSet",
".",
"Entry",
">",
"void",
"requestEntryRemove",
"(",
"String",
"name",
",",
"DSet",
"<",
"T",
">",
"set",
",",
"Comparable",
"<",
"?",
">",
"key",
")",
"{",
"// if we're on the authoritative server, we update the set im... | Calls by derived instances when a set remover method was called. | [
"Calls",
"by",
"derived",
"instances",
"when",
"a",
"set",
"remover",
"method",
"was",
"called",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L904-L918 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.createAccessors | protected Accessor[] createAccessors ()
{
Field[] fields = getClass().getFields();
// assume we have one static field for every non-static field
List<Accessor> accs = Lists.newArrayListWithExpectedSize(fields.length/2);
for (Field field : fields) {
if (!Modifier.isStatic(... | java | protected Accessor[] createAccessors ()
{
Field[] fields = getClass().getFields();
// assume we have one static field for every non-static field
List<Accessor> accs = Lists.newArrayListWithExpectedSize(fields.length/2);
for (Field field : fields) {
if (!Modifier.isStatic(... | [
"protected",
"Accessor",
"[",
"]",
"createAccessors",
"(",
")",
"{",
"Field",
"[",
"]",
"fields",
"=",
"getClass",
"(",
")",
".",
"getFields",
"(",
")",
";",
"// assume we have one static field for every non-static field",
"List",
"<",
"Accessor",
">",
"accs",
"... | Creates the accessors that will be used to read and write this object's attributes. The
default implementation assumes the object's attributes are all public fields and uses
reflection to get and set their values. | [
"Creates",
"the",
"accessors",
"that",
"will",
"be",
"used",
"to",
"read",
"and",
"write",
"this",
"object",
"s",
"attributes",
".",
"The",
"default",
"implementation",
"assumes",
"the",
"object",
"s",
"attributes",
"are",
"all",
"public",
"fields",
"and",
"... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L980-L991 | train |
threerings/narya | core/src/main/java/com/threerings/presents/dobj/DObject.java | DObject.getListenerIndex | protected int getListenerIndex (ChangeListener listener)
{
if (_listeners == null) {
return -1;
}
for (int ii = 0, ll = _listeners.length; ii < ll; ii++) {
Object olistener = _listeners[ii];
if (olistener == listener || (olistener instanceof WeakReference<... | java | protected int getListenerIndex (ChangeListener listener)
{
if (_listeners == null) {
return -1;
}
for (int ii = 0, ll = _listeners.length; ii < ll; ii++) {
Object olistener = _listeners[ii];
if (olistener == listener || (olistener instanceof WeakReference<... | [
"protected",
"int",
"getListenerIndex",
"(",
"ChangeListener",
"listener",
")",
"{",
"if",
"(",
"_listeners",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"ii",
"=",
"0",
",",
"ll",
"=",
"_listeners",
".",
"length",
";",
"... | Returns the index of the identified listener, or -1 if not found. | [
"Returns",
"the",
"index",
"of",
"the",
"identified",
"listener",
"or",
"-",
"1",
"if",
"not",
"found",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L996-L1009 | train |
threerings/narya | core/src/main/java/com/threerings/admin/server/AdminManager.java | AdminManager.getConfigInfo | public void getConfigInfo (ClientObject caller, AdminService.ConfigInfoListener listener)
throws InvocationException
{
// we don't have to validate the request because the user can't do anything with the keys
// or oids unless they're an admin (we put the burden of doing that checking on the... | java | public void getConfigInfo (ClientObject caller, AdminService.ConfigInfoListener listener)
throws InvocationException
{
// we don't have to validate the request because the user can't do anything with the keys
// or oids unless they're an admin (we put the burden of doing that checking on the... | [
"public",
"void",
"getConfigInfo",
"(",
"ClientObject",
"caller",
",",
"AdminService",
".",
"ConfigInfoListener",
"listener",
")",
"throws",
"InvocationException",
"{",
"// we don't have to validate the request because the user can't do anything with the keys",
"// or oids unless the... | from interface AdminProvider | [
"from",
"interface",
"AdminProvider"
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/admin/server/AdminManager.java#L48-L61 | train |
threerings/narya | core/src/main/java/com/threerings/presents/net/ServiceCreds.java | ServiceCreds.createAuthToken | protected static String createAuthToken (String clientId, String sharedSecret)
{
return StringUtil.md5hex(clientId + sharedSecret);
} | java | protected static String createAuthToken (String clientId, String sharedSecret)
{
return StringUtil.md5hex(clientId + sharedSecret);
} | [
"protected",
"static",
"String",
"createAuthToken",
"(",
"String",
"clientId",
",",
"String",
"sharedSecret",
")",
"{",
"return",
"StringUtil",
".",
"md5hex",
"(",
"clientId",
"+",
"sharedSecret",
")",
";",
"}"
] | Creates a unique password for the specified node using the supplied shared secret. | [
"Creates",
"a",
"unique",
"password",
"for",
"the",
"specified",
"node",
"using",
"the",
"supplied",
"shared",
"secret",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/net/ServiceCreds.java#L68-L71 | train |
threerings/narya | core/src/main/java/com/threerings/nio/conman/ServerSocketChannelAcceptor.java | ServerSocketChannelAcceptor.bind | public boolean bind ()
{
// open our TCP listening ports
int successes = 0;
for (int port : _ports) {
try {
acceptConnections(port);
successes++;
} catch (IOException ioe) {
log.warning("Failure listening to socket", "ho... | java | public boolean bind ()
{
// open our TCP listening ports
int successes = 0;
for (int port : _ports) {
try {
acceptConnections(port);
successes++;
} catch (IOException ioe) {
log.warning("Failure listening to socket", "ho... | [
"public",
"boolean",
"bind",
"(",
")",
"{",
"// open our TCP listening ports",
"int",
"successes",
"=",
"0",
";",
"for",
"(",
"int",
"port",
":",
"_ports",
")",
"{",
"try",
"{",
"acceptConnections",
"(",
"port",
")",
";",
"successes",
"++",
";",
"}",
"ca... | Bind to the socket ports and return true if any of the binds succeeded. | [
"Bind",
"to",
"the",
"socket",
"ports",
"and",
"return",
"true",
"if",
"any",
"of",
"the",
"binds",
"succeeded",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/nio/conman/ServerSocketChannelAcceptor.java#L67-L81 | train |
threerings/narya | core/src/main/java/com/threerings/nio/conman/ServerSocketChannelAcceptor.java | ServerSocketChannelAcceptor.shutdown | public void shutdown ()
{
for (ServerSocketChannel ssocket : _ssockets) {
try {
ssocket.socket().close();
} catch (IOException ioe) {
log.warning("Failed to close listening socket: " + ssocket, ioe);
}
}
} | java | public void shutdown ()
{
for (ServerSocketChannel ssocket : _ssockets) {
try {
ssocket.socket().close();
} catch (IOException ioe) {
log.warning("Failed to close listening socket: " + ssocket, ioe);
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"for",
"(",
"ServerSocketChannel",
"ssocket",
":",
"_ssockets",
")",
"{",
"try",
"{",
"ssocket",
".",
"socket",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"lo... | Unbind our listening sockets. | [
"Unbind",
"our",
"listening",
"sockets",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/nio/conman/ServerSocketChannelAcceptor.java#L86-L95 | train |
threerings/narya | tools/src/main/java/com/threerings/presents/tools/InvocationTask.java | InvocationTask.createAndGatherImports | public ServiceMethod createAndGatherImports (Method method, ImportSet imports)
{
ServiceMethod sm = new ServiceMethod(method);
sm.gatherImports(imports);
return sm;
} | java | public ServiceMethod createAndGatherImports (Method method, ImportSet imports)
{
ServiceMethod sm = new ServiceMethod(method);
sm.gatherImports(imports);
return sm;
} | [
"public",
"ServiceMethod",
"createAndGatherImports",
"(",
"Method",
"method",
",",
"ImportSet",
"imports",
")",
"{",
"ServiceMethod",
"sm",
"=",
"new",
"ServiceMethod",
"(",
"method",
")",
";",
"sm",
".",
"gatherImports",
"(",
"imports",
")",
";",
"return",
"s... | Creates a new service method and adds its basic imports to a set.
@param method the method to create
@param imports will be filled with the types required by the method | [
"Creates",
"a",
"new",
"service",
"method",
"and",
"adds",
"its",
"basic",
"imports",
"to",
"a",
"set",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/InvocationTask.java#L95-L100 | train |
threerings/narya | core/src/main/java/com/threerings/presents/data/TimeBaseObject.java | TimeBaseObject.getDelta | protected long getDelta (long timeStamp, long maxValue)
{
boolean even = (evenBase > oddBase);
long base = even ? evenBase : oddBase;
long delta = timeStamp - base;
// make sure this timestamp is not sufficiently old that we can't
// generate a delta time with it
if ... | java | protected long getDelta (long timeStamp, long maxValue)
{
boolean even = (evenBase > oddBase);
long base = even ? evenBase : oddBase;
long delta = timeStamp - base;
// make sure this timestamp is not sufficiently old that we can't
// generate a delta time with it
if ... | [
"protected",
"long",
"getDelta",
"(",
"long",
"timeStamp",
",",
"long",
"maxValue",
")",
"{",
"boolean",
"even",
"=",
"(",
"evenBase",
">",
"oddBase",
")",
";",
"long",
"base",
"=",
"even",
"?",
"evenBase",
":",
"oddBase",
";",
"long",
"delta",
"=",
"t... | Obtains a delta with the specified maximum value, swapping from
even to odd, if necessary. | [
"Obtains",
"a",
"delta",
"with",
"the",
"specified",
"maximum",
"value",
"swapping",
"from",
"even",
"to",
"odd",
"if",
"necessary",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/TimeBaseObject.java#L103-L132 | train |
threerings/narya | core/src/main/java/com/threerings/presents/data/ClientObject.java | ClientObject.checkAccess | public String checkAccess (Permission perm, Object context)
{
if (_permPolicy == null) {
_permPolicy = createPermissionPolicy();
}
return _permPolicy.checkAccess(perm, context);
} | java | public String checkAccess (Permission perm, Object context)
{
if (_permPolicy == null) {
_permPolicy = createPermissionPolicy();
}
return _permPolicy.checkAccess(perm, context);
} | [
"public",
"String",
"checkAccess",
"(",
"Permission",
"perm",
",",
"Object",
"context",
")",
"{",
"if",
"(",
"_permPolicy",
"==",
"null",
")",
"{",
"_permPolicy",
"=",
"createPermissionPolicy",
"(",
")",
";",
"}",
"return",
"_permPolicy",
".",
"checkAccess",
... | Checks whether or not this client has the specified permission.
@return null if the user has access, a fully-qualified translatable message string
indicating the reason for denial of access.
@see ClientObject.PermissionPolicy | [
"Checks",
"whether",
"or",
"not",
"this",
"client",
"has",
"the",
"specified",
"permission",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/ClientObject.java#L73-L79 | train |
xbib/marc | src/main/java/org/xbib/marc/transformer/value/MarcValueTransformers.java | MarcValueTransformers.setMarcValueTransformer | public MarcValueTransformers setMarcValueTransformer(String fieldKey, MarcValueTransformer transformer) {
// split into tag + indicator and subfield IDs
int pos = fieldKey.lastIndexOf('$');
String tagind = pos > 0 ? fieldKey.substring(0, pos) : fieldKey;
String subs = pos > 0 ? fieldKey... | java | public MarcValueTransformers setMarcValueTransformer(String fieldKey, MarcValueTransformer transformer) {
// split into tag + indicator and subfield IDs
int pos = fieldKey.lastIndexOf('$');
String tagind = pos > 0 ? fieldKey.substring(0, pos) : fieldKey;
String subs = pos > 0 ? fieldKey... | [
"public",
"MarcValueTransformers",
"setMarcValueTransformer",
"(",
"String",
"fieldKey",
",",
"MarcValueTransformer",
"transformer",
")",
"{",
"// split into tag + indicator and subfield IDs",
"int",
"pos",
"=",
"fieldKey",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
... | Set MARC value transformer for transforming field values.
@param fieldKey the MARC field key for the field to be transformed
@param transformer the string transformer
@return this handler | [
"Set",
"MARC",
"value",
"transformer",
"for",
"transforming",
"field",
"values",
"."
] | d8426fcfc686507cab59b3d8181b08f83718418c | https://github.com/xbib/marc/blob/d8426fcfc686507cab59b3d8181b08f83718418c/src/main/java/org/xbib/marc/transformer/value/MarcValueTransformers.java#L45-L54 | train |
xbib/marc | src/main/java/org/xbib/marc/transformer/value/MarcValueTransformers.java | MarcValueTransformers.transformValue | public MarcField transformValue(MarcField field) {
String key = field.toTagIndicatorKey();
if (marcValueTransformerMap.isEmpty()) {
return field;
}
final MarcValueTransformer transformer = marcValueTransformerMap.containsKey(key) ?
marcValueTransformerMap.get(... | java | public MarcField transformValue(MarcField field) {
String key = field.toTagIndicatorKey();
if (marcValueTransformerMap.isEmpty()) {
return field;
}
final MarcValueTransformer transformer = marcValueTransformerMap.containsKey(key) ?
marcValueTransformerMap.get(... | [
"public",
"MarcField",
"transformValue",
"(",
"MarcField",
"field",
")",
"{",
"String",
"key",
"=",
"field",
".",
"toTagIndicatorKey",
"(",
")",
";",
"if",
"(",
"marcValueTransformerMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"field",
";",
"}",
"fi... | Transform value.
@param field the MARC field where values are transformed
@return a new MARC field with transformed values | [
"Transform",
"value",
"."
] | d8426fcfc686507cab59b3d8181b08f83718418c | https://github.com/xbib/marc/blob/d8426fcfc686507cab59b3d8181b08f83718418c/src/main/java/org/xbib/marc/transformer/value/MarcValueTransformers.java#L61-L82 | train |
threerings/narya | core/src/main/java/com/threerings/io/ByteBufferOutputStream.java | ByteBufferOutputStream.expand | protected final void expand (int needed)
{
int ocapacity = _buffer.capacity();
int ncapacity = _buffer.position() + needed;
if (ncapacity > ocapacity) {
// increase the buffer size in large increments
ncapacity = Math.max(ocapacity << 1, ncapacity);
ByteBu... | java | protected final void expand (int needed)
{
int ocapacity = _buffer.capacity();
int ncapacity = _buffer.position() + needed;
if (ncapacity > ocapacity) {
// increase the buffer size in large increments
ncapacity = Math.max(ocapacity << 1, ncapacity);
ByteBu... | [
"protected",
"final",
"void",
"expand",
"(",
"int",
"needed",
")",
"{",
"int",
"ocapacity",
"=",
"_buffer",
".",
"capacity",
"(",
")",
";",
"int",
"ncapacity",
"=",
"_buffer",
".",
"position",
"(",
")",
"+",
"needed",
";",
"if",
"(",
"ncapacity",
">",
... | Expands our buffer to accomodate the specified capacity. | [
"Expands",
"our",
"buffer",
"to",
"accomodate",
"the",
"specified",
"capacity",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/io/ByteBufferOutputStream.java#L102-L113 | train |
threerings/narya | core/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java | UserSystemMessage.create | public static UserSystemMessage create (Name sender, String message, String bundle)
{
return new UserSystemMessage(sender, message, bundle, INFO);
} | java | public static UserSystemMessage create (Name sender, String message, String bundle)
{
return new UserSystemMessage(sender, message, bundle, INFO);
} | [
"public",
"static",
"UserSystemMessage",
"create",
"(",
"Name",
"sender",
",",
"String",
"message",
",",
"String",
"bundle",
")",
"{",
"return",
"new",
"UserSystemMessage",
"(",
"sender",
",",
"message",
",",
"bundle",
",",
"INFO",
")",
";",
"}"
] | Construct a INFO-level UserSystemMessage. | [
"Construct",
"a",
"INFO",
"-",
"level",
"UserSystemMessage",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/data/UserSystemMessage.java#L38-L41 | train |
davidmoten/grumpy | grumpy-projection/src/main/java/com/github/davidmoten/grumpy/util/NearBSpline.java | NearBSpline.setLine | public void setLine(int... points) {
double[] pd = new double[points.length];
for (int i = 0; i < points.length; i++) {
pd[i] = points[i];
}
setLine(pd);
} | java | public void setLine(int... points) {
double[] pd = new double[points.length];
for (int i = 0; i < points.length; i++) {
pd[i] = points[i];
}
setLine(pd);
} | [
"public",
"void",
"setLine",
"(",
"int",
"...",
"points",
")",
"{",
"double",
"[",
"]",
"pd",
"=",
"new",
"double",
"[",
"points",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"points",
".",
"length",
";",
"i",
"++"... | Sets the curve using control points given in integer precision
@param points
the control points for the curve | [
"Sets",
"the",
"curve",
"using",
"control",
"points",
"given",
"in",
"integer",
"precision"
] | f2d03e6b9771f15425fb3f76314837efc08c1233 | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-projection/src/main/java/com/github/davidmoten/grumpy/util/NearBSpline.java#L58-L64 | train |
davidmoten/grumpy | grumpy-projection/src/main/java/com/github/davidmoten/grumpy/util/NearBSpline.java | NearBSpline.setLine | public void setLine(Point2D[] points) {
double[] pd = new double[points.length * 2];
for (int i = 0; i < points.length; i++) {
Point2D p = points[i];
pd[i * 2] = p.getX();
pd[i * 2 + 1] = p.getY();
}
setLine(pd);
} | java | public void setLine(Point2D[] points) {
double[] pd = new double[points.length * 2];
for (int i = 0; i < points.length; i++) {
Point2D p = points[i];
pd[i * 2] = p.getX();
pd[i * 2 + 1] = p.getY();
}
setLine(pd);
} | [
"public",
"void",
"setLine",
"(",
"Point2D",
"[",
"]",
"points",
")",
"{",
"double",
"[",
"]",
"pd",
"=",
"new",
"double",
"[",
"points",
".",
"length",
"*",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"points",
".",
"length... | Sets the curve using control points given as Point2D objects
@param points
the control points for the curve | [
"Sets",
"the",
"curve",
"using",
"control",
"points",
"given",
"as",
"Point2D",
"objects"
] | f2d03e6b9771f15425fb3f76314837efc08c1233 | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-projection/src/main/java/com/github/davidmoten/grumpy/util/NearBSpline.java#L128-L136 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.addClientObserver | public void addClientObserver (ClientObserver observer)
{
_clobservers.add(observer);
if (observer instanceof DetailedClientObserver) {
_dclobservers.add((DetailedClientObserver)observer);
}
} | java | public void addClientObserver (ClientObserver observer)
{
_clobservers.add(observer);
if (observer instanceof DetailedClientObserver) {
_dclobservers.add((DetailedClientObserver)observer);
}
} | [
"public",
"void",
"addClientObserver",
"(",
"ClientObserver",
"observer",
")",
"{",
"_clobservers",
".",
"add",
"(",
"observer",
")",
";",
"if",
"(",
"observer",
"instanceof",
"DetailedClientObserver",
")",
"{",
"_dclobservers",
".",
"add",
"(",
"(",
"DetailedCl... | Registers an observer that will be notified when clients start and end their sessions. | [
"Registers",
"an",
"observer",
"that",
"will",
"be",
"notified",
"when",
"clients",
"start",
"and",
"end",
"their",
"sessions",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L219-L225 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.applyToClient | public void applyToClient (Name username, final ClientOp clop)
{
resolveClientObject(username, new ClientResolutionListener() {
public void clientResolved (Name username, ClientObject clobj) {
try {
clop.apply(clobj);
} catch (Exception e) {
... | java | public void applyToClient (Name username, final ClientOp clop)
{
resolveClientObject(username, new ClientResolutionListener() {
public void clientResolved (Name username, ClientObject clobj) {
try {
clop.apply(clobj);
} catch (Exception e) {
... | [
"public",
"void",
"applyToClient",
"(",
"Name",
"username",
",",
"final",
"ClientOp",
"clop",
")",
"{",
"resolveClientObject",
"(",
"username",
",",
"new",
"ClientResolutionListener",
"(",
")",
"{",
"public",
"void",
"clientResolved",
"(",
"Name",
"username",
",... | Resolves the specified client, applies the supplied client operation to them and releases
the client. | [
"Resolves",
"the",
"specified",
"client",
"applies",
"the",
"supplied",
"client",
"operation",
"to",
"them",
"and",
"releases",
"the",
"client",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L262-L281 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.shutdown | public void shutdown ()
{
log.info("Client manager shutting down", "ccount", _usermap.size());
// inform all of our clients that they are being shut down
synchronized (_usermap) {
for (PresentsSession pc : _usermap.values()) {
try {
pc.shutdow... | java | public void shutdown ()
{
log.info("Client manager shutting down", "ccount", _usermap.size());
// inform all of our clients that they are being shut down
synchronized (_usermap) {
for (PresentsSession pc : _usermap.values()) {
try {
pc.shutdow... | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Client manager shutting down\"",
",",
"\"ccount\"",
",",
"_usermap",
".",
"size",
"(",
")",
")",
";",
"// inform all of our clients that they are being shut down",
"synchronized",
"(",
"_usermap"... | from interface Lifecycle.Component | [
"from",
"interface",
"Lifecycle",
".",
"Component"
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L386-L401 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.clientResolved | public synchronized void clientResolved (Name username, ClientObject clobj)
{
// because we added ourselves as a client resolution listener, the client object reference
// count was increased, but we're not a real resolver (who would have to call
// releaseClientObject() to release their ref... | java | public synchronized void clientResolved (Name username, ClientObject clobj)
{
// because we added ourselves as a client resolution listener, the client object reference
// count was increased, but we're not a real resolver (who would have to call
// releaseClientObject() to release their ref... | [
"public",
"synchronized",
"void",
"clientResolved",
"(",
"Name",
"username",
",",
"ClientObject",
"clobj",
")",
"{",
"// because we added ourselves as a client resolution listener, the client object reference",
"// count was increased, but we're not a real resolver (who would have to call"... | documentation inherited from interface ClientResolutionListener | [
"documentation",
"inherited",
"from",
"interface",
"ClientResolutionListener"
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L421-L434 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.connectionEstablished | public synchronized void connectionEstablished (
PresentsConnection conn, Name authname, AuthRequest req, AuthResponse rsp)
{
String type = authname.getClass().getSimpleName();
// see if a session is already registered with this name
PresentsSession session = getClient(authname);
... | java | public synchronized void connectionEstablished (
PresentsConnection conn, Name authname, AuthRequest req, AuthResponse rsp)
{
String type = authname.getClass().getSimpleName();
// see if a session is already registered with this name
PresentsSession session = getClient(authname);
... | [
"public",
"synchronized",
"void",
"connectionEstablished",
"(",
"PresentsConnection",
"conn",
",",
"Name",
"authname",
",",
"AuthRequest",
"req",
",",
"AuthResponse",
"rsp",
")",
"{",
"String",
"type",
"=",
"authname",
".",
"getClass",
"(",
")",
".",
"getSimpleN... | Called by the connection manager to let us know when a new connection has been established. | [
"Called",
"by",
"the",
"connection",
"manager",
"to",
"let",
"us",
"know",
"when",
"a",
"new",
"connection",
"has",
"been",
"established",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L446-L481 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.connectionFailed | public synchronized void connectionFailed (Connection conn, IOException fault)
{
// remove the session from the connection map
PresentsSession session = _conmap.remove(conn);
if (session != null) {
log.info("Unmapped failed session", "session", session, "conn", conn, "fault", fau... | java | public synchronized void connectionFailed (Connection conn, IOException fault)
{
// remove the session from the connection map
PresentsSession session = _conmap.remove(conn);
if (session != null) {
log.info("Unmapped failed session", "session", session, "conn", conn, "fault", fau... | [
"public",
"synchronized",
"void",
"connectionFailed",
"(",
"Connection",
"conn",
",",
"IOException",
"fault",
")",
"{",
"// remove the session from the connection map",
"PresentsSession",
"session",
"=",
"_conmap",
".",
"remove",
"(",
"conn",
")",
";",
"if",
"(",
"s... | Called by the connection manager to let us know when a connection has failed. | [
"Called",
"by",
"the",
"connection",
"manager",
"to",
"let",
"us",
"know",
"when",
"a",
"connection",
"has",
"failed",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L486-L500 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.connectionClosed | public synchronized void connectionClosed (Connection conn)
{
// remove the session from the connection map
PresentsSession session = _conmap.remove(conn);
if (session != null) {
log.debug("Unmapped session", "session", session, "conn", conn);
// let the session know ... | java | public synchronized void connectionClosed (Connection conn)
{
// remove the session from the connection map
PresentsSession session = _conmap.remove(conn);
if (session != null) {
log.debug("Unmapped session", "session", session, "conn", conn);
// let the session know ... | [
"public",
"synchronized",
"void",
"connectionClosed",
"(",
"Connection",
"conn",
")",
"{",
"// remove the session from the connection map",
"PresentsSession",
"session",
"=",
"_conmap",
".",
"remove",
"(",
"conn",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
... | Called by the connection manager to let us know when a connection has been closed. | [
"Called",
"by",
"the",
"connection",
"manager",
"to",
"let",
"us",
"know",
"when",
"a",
"connection",
"has",
"been",
"closed",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L505-L518 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.appendReport | public void appendReport (StringBuilder report, long now, long sinceLast, boolean reset)
{
report.append("* presents.ClientManager:\n");
report.append("- Sessions: ");
synchronized (_usermap) {
report.append(_usermap.size()).append(" total, ");
}
report.append(_co... | java | public void appendReport (StringBuilder report, long now, long sinceLast, boolean reset)
{
report.append("* presents.ClientManager:\n");
report.append("- Sessions: ");
synchronized (_usermap) {
report.append(_usermap.size()).append(" total, ");
}
report.append(_co... | [
"public",
"void",
"appendReport",
"(",
"StringBuilder",
"report",
",",
"long",
"now",
",",
"long",
"sinceLast",
",",
"boolean",
"reset",
")",
"{",
"report",
".",
"append",
"(",
"\"* presents.ClientManager:\\n\"",
")",
";",
"report",
".",
"append",
"(",
"\"- Se... | documentation inherited from interface ReportManager.Reporter | [
"documentation",
"inherited",
"from",
"interface",
"ReportManager",
".",
"Reporter"
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L521-L531 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.clientSessionWillEnd | @EventThread
protected void clientSessionWillEnd (final PresentsSession session)
{
// notify the observers that the session is ended
_dclobservers.apply(new ObserverList.ObserverOp<DetailedClientObserver>() {
public boolean apply (DetailedClientObserver observer) {
ob... | java | @EventThread
protected void clientSessionWillEnd (final PresentsSession session)
{
// notify the observers that the session is ended
_dclobservers.apply(new ObserverList.ObserverOp<DetailedClientObserver>() {
public boolean apply (DetailedClientObserver observer) {
ob... | [
"@",
"EventThread",
"protected",
"void",
"clientSessionWillEnd",
"(",
"final",
"PresentsSession",
"session",
")",
"{",
"// notify the observers that the session is ended",
"_dclobservers",
".",
"apply",
"(",
"new",
"ObserverList",
".",
"ObserverOp",
"<",
"DetailedClientObse... | Called by PresentsSession when it is about to end its session. | [
"Called",
"by",
"PresentsSession",
"when",
"it",
"is",
"about",
"to",
"end",
"its",
"session",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L551-L561 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.clientSessionDidEnd | @EventThread
protected void clientSessionDidEnd (final PresentsSession session)
{
// notify the observers that the session is ended
_clobservers.apply(new ObserverList.ObserverOp<ClientObserver>() {
public boolean apply (ClientObserver observer) {
observer.clientSessi... | java | @EventThread
protected void clientSessionDidEnd (final PresentsSession session)
{
// notify the observers that the session is ended
_clobservers.apply(new ObserverList.ObserverOp<ClientObserver>() {
public boolean apply (ClientObserver observer) {
observer.clientSessi... | [
"@",
"EventThread",
"protected",
"void",
"clientSessionDidEnd",
"(",
"final",
"PresentsSession",
"session",
")",
"{",
"// notify the observers that the session is ended",
"_clobservers",
".",
"apply",
"(",
"new",
"ObserverList",
".",
"ObserverOp",
"<",
"ClientObserver",
"... | Called by PresentsSession when it has ended its session. | [
"Called",
"by",
"PresentsSession",
"when",
"it",
"has",
"ended",
"its",
"session",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L566-L576 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.clearSession | protected void clearSession (PresentsSession session)
{
// remove the session from the username map
PresentsSession rc;
synchronized (_usermap) {
rc = _usermap.remove(session.getAuthName());
}
// sanity check just because we can
if (rc == null) {
... | java | protected void clearSession (PresentsSession session)
{
// remove the session from the username map
PresentsSession rc;
synchronized (_usermap) {
rc = _usermap.remove(session.getAuthName());
}
// sanity check just because we can
if (rc == null) {
... | [
"protected",
"void",
"clearSession",
"(",
"PresentsSession",
"session",
")",
"{",
"// remove the session from the username map",
"PresentsSession",
"rc",
";",
"synchronized",
"(",
"_usermap",
")",
"{",
"rc",
"=",
"_usermap",
".",
"remove",
"(",
"session",
".",
"getA... | Called by PresentsSession to let us know that we can clear it entirely out of the system. | [
"Called",
"by",
"PresentsSession",
"to",
"let",
"us",
"know",
"that",
"we",
"can",
"clear",
"it",
"entirely",
"out",
"of",
"the",
"system",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L581-L597 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/ClientManager.java | ClientManager.flushSessions | protected void flushSessions ()
{
List<PresentsSession> victims = Lists.newArrayList();
long now = System.currentTimeMillis();
// first build a list of our victims
synchronized (_usermap) {
for (PresentsSession session : _usermap.values()) {
if (session.c... | java | protected void flushSessions ()
{
List<PresentsSession> victims = Lists.newArrayList();
long now = System.currentTimeMillis();
// first build a list of our victims
synchronized (_usermap) {
for (PresentsSession session : _usermap.values()) {
if (session.c... | [
"protected",
"void",
"flushSessions",
"(",
")",
"{",
"List",
"<",
"PresentsSession",
">",
"victims",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"// first build a list of our victims",
... | Called once per minute to check for sessions that have been disconnected too long and
forcibly end their sessions. | [
"Called",
"once",
"per",
"minute",
"to",
"check",
"for",
"sessions",
"that",
"have",
"been",
"disconnected",
"too",
"long",
"and",
"forcibly",
"end",
"their",
"sessions",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/ClientManager.java#L603-L627 | train |
dkpro/dkpro-argumentation | dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java | ArgumentTokenBIOAnnotator.getLabel | protected String getLabel(ArgumentComponent argumentComponent, Token token)
{
StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName());
if ("BIO".equals(this.codingGranularity)) {
// Does the component begin here?
if (argumentComponent.getBegin() ==... | java | protected String getLabel(ArgumentComponent argumentComponent, Token token)
{
StringBuilder sb = new StringBuilder(argumentComponent.getClass().getSimpleName());
if ("BIO".equals(this.codingGranularity)) {
// Does the component begin here?
if (argumentComponent.getBegin() ==... | [
"protected",
"String",
"getLabel",
"(",
"ArgumentComponent",
"argumentComponent",
",",
"Token",
"token",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"argumentComponent",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
... | Returns a label for the annotated token
@param argumentComponent covering argument component
@param token token
@return BIO label | [
"Returns",
"a",
"label",
"for",
"the",
"annotated",
"token"
] | 57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-preprocessing/src/main/java/org/dkpro/argumentation/preprocessing/annotation/ArgumentTokenBIOAnnotator.java#L69-L87 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/ClientCommunicator.java | ClientCommunicator.clearPPI | protected synchronized boolean clearPPI (boolean cancel)
{
if (_prefPortInterval != null) {
if (cancel) {
_prefPortInterval.cancel();
_prefPortInterval.failed();
}
_prefPortInterval = null;
return true;
}
return ... | java | protected synchronized boolean clearPPI (boolean cancel)
{
if (_prefPortInterval != null) {
if (cancel) {
_prefPortInterval.cancel();
_prefPortInterval.failed();
}
_prefPortInterval = null;
return true;
}
return ... | [
"protected",
"synchronized",
"boolean",
"clearPPI",
"(",
"boolean",
"cancel",
")",
"{",
"if",
"(",
"_prefPortInterval",
"!=",
"null",
")",
"{",
"if",
"(",
"cancel",
")",
"{",
"_prefPortInterval",
".",
"cancel",
"(",
")",
";",
"_prefPortInterval",
".",
"faile... | Cancels our preferred port saving interval. This method is called from the communication
reader thread and the interval thread and must thus be synchronized. | [
"Cancels",
"our",
"preferred",
"port",
"saving",
"interval",
".",
"This",
"method",
"is",
"called",
"from",
"the",
"communication",
"reader",
"thread",
"and",
"the",
"interval",
"thread",
"and",
"must",
"thus",
"be",
"synchronized",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/ClientCommunicator.java#L125-L136 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/EHCachePeerCoordinator.java | EHCachePeerCoordinator.createCachePeerProvider | @Override
public CacheManagerPeerProvider createCachePeerProvider (
CacheManager cacheManager, Properties properties)
{
if (_instance == null) {
_instance = new Provider(cacheManager);
}
return _instance;
} | java | @Override
public CacheManagerPeerProvider createCachePeerProvider (
CacheManager cacheManager, Properties properties)
{
if (_instance == null) {
_instance = new Provider(cacheManager);
}
return _instance;
} | [
"@",
"Override",
"public",
"CacheManagerPeerProvider",
"createCachePeerProvider",
"(",
"CacheManager",
"cacheManager",
",",
"Properties",
"properties",
")",
"{",
"if",
"(",
"_instance",
"==",
"null",
")",
"{",
"_instance",
"=",
"new",
"Provider",
"(",
"cacheManager"... | Return our provider, creating it if needed. | [
"Return",
"our",
"provider",
"creating",
"it",
"if",
"needed",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/EHCachePeerCoordinator.java#L69-L77 | train |
xbib/marc | src/main/java/org/xbib/marc/io/BaseChunkStream.java | BaseChunkStream.chunks | @Override
public Stream<Chunk<byte[], BytesReference>> chunks() {
Iterator<Chunk<byte[], BytesReference>> iterator = new Iterator<Chunk<byte[], BytesReference>>() {
Chunk<byte[], BytesReference> nextData = null;
@Override
public boolean hasNext() {
if (ne... | java | @Override
public Stream<Chunk<byte[], BytesReference>> chunks() {
Iterator<Chunk<byte[], BytesReference>> iterator = new Iterator<Chunk<byte[], BytesReference>>() {
Chunk<byte[], BytesReference> nextData = null;
@Override
public boolean hasNext() {
if (ne... | [
"@",
"Override",
"public",
"Stream",
"<",
"Chunk",
"<",
"byte",
"[",
"]",
",",
"BytesReference",
">",
">",
"chunks",
"(",
")",
"{",
"Iterator",
"<",
"Chunk",
"<",
"byte",
"[",
"]",
",",
"BytesReference",
">",
">",
"iterator",
"=",
"new",
"Iterator",
... | This methods creates a Java 8 stream of chunks.
@return a stream of chunks | [
"This",
"methods",
"creates",
"a",
"Java",
"8",
"stream",
"of",
"chunks",
"."
] | d8426fcfc686507cab59b3d8181b08f83718418c | https://github.com/xbib/marc/blob/d8426fcfc686507cab59b3d8181b08f83718418c/src/main/java/org/xbib/marc/io/BaseChunkStream.java#L74-L106 | train |
threerings/narya | core/src/main/java/com/threerings/presents/net/AESAuthRequest.java | AESAuthRequest.decrypt | public void decrypt (byte[] key)
throws IOException, ClassNotFoundException
{
if (_clearCreds != null) {
return;
}
_key = key;
try {
_contents = SecureUtil.getAESCipher(Cipher.DECRYPT_MODE, _key).doFinal(_contents);
} catch (GeneralSecurityExcep... | java | public void decrypt (byte[] key)
throws IOException, ClassNotFoundException
{
if (_clearCreds != null) {
return;
}
_key = key;
try {
_contents = SecureUtil.getAESCipher(Cipher.DECRYPT_MODE, _key).doFinal(_contents);
} catch (GeneralSecurityExcep... | [
"public",
"void",
"decrypt",
"(",
"byte",
"[",
"]",
"key",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"if",
"(",
"_clearCreds",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"_key",
"=",
"key",
";",
"try",
"{",
"_contents",
"=",
"S... | Decrypts the request after transmission. | [
"Decrypts",
"the",
"request",
"after",
"transmission",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/net/AESAuthRequest.java#L106-L124 | train |
threerings/narya | core/src/main/java/com/threerings/presents/net/AESAuthRequest.java | AESAuthRequest.writeObject | public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream oOut = new ObjectOutputStream(byteOut);
oOut.writeObject(_clearCreds);
try {
byt... | java | public void writeObject (ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream oOut = new ObjectOutputStream(byteOut);
oOut.writeObject(_clearCreds);
try {
byt... | [
"public",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"defaultWriteObject",
"(",
")",
";",
"ByteArrayOutputStream",
"byteOut",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oOut... | A customized AES encrypting write object. | [
"A",
"customized",
"AES",
"encrypting",
"write",
"object",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/net/AESAuthRequest.java#L129-L146 | train |
threerings/narya | core/src/main/java/com/threerings/presents/net/AESAuthRequest.java | AESAuthRequest.readObject | @Override
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_contents = new byte[in.readInt()];
in.read(_contents);
} | java | @Override
public void readObject (ObjectInputStream in)
throws IOException, ClassNotFoundException
{
in.defaultReadObject();
_contents = new byte[in.readInt()];
in.read(_contents);
} | [
"@",
"Override",
"public",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"in",
".",
"defaultReadObject",
"(",
")",
";",
"_contents",
"=",
"new",
"byte",
"[",
"in",
".",
"readInt",
"(",
... | Read in our encrypted contents. | [
"Read",
"in",
"our",
"encrypted",
"contents",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/net/AESAuthRequest.java#L151-L158 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.connectionFailed | protected synchronized void connectionFailed (final IOException ioe)
{
// make sure the socket isn't already closed down (meaning we've already dealt with the
// failed connection)
if (_channel == null) {
return;
}
log.info("Connection failed", ioe);
// ... | java | protected synchronized void connectionFailed (final IOException ioe)
{
// make sure the socket isn't already closed down (meaning we've already dealt with the
// failed connection)
if (_channel == null) {
return;
}
log.info("Connection failed", ioe);
// ... | [
"protected",
"synchronized",
"void",
"connectionFailed",
"(",
"final",
"IOException",
"ioe",
")",
"{",
"// make sure the socket isn't already closed down (meaning we've already dealt with the",
"// failed connection)",
"if",
"(",
"_channel",
"==",
"null",
")",
"{",
"return",
... | Callback called by the reader or writer thread when something goes awry with our socket
connection to the server. | [
"Callback",
"called",
"by",
"the",
"reader",
"or",
"writer",
"thread",
"when",
"something",
"goes",
"awry",
"with",
"our",
"socket",
"connection",
"to",
"the",
"server",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L214-L233 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.readerDidExit | protected synchronized void readerDidExit ()
{
// clear out our reader reference
_reader = null;
if (_writer == null) {
// there's no writer during authentication, so we may be responsible for closing the
// socket channel
closeChannel();
// ... | java | protected synchronized void readerDidExit ()
{
// clear out our reader reference
_reader = null;
if (_writer == null) {
// there's no writer during authentication, so we may be responsible for closing the
// socket channel
closeChannel();
// ... | [
"protected",
"synchronized",
"void",
"readerDidExit",
"(",
")",
"{",
"// clear out our reader reference",
"_reader",
"=",
"null",
";",
"if",
"(",
"_writer",
"==",
"null",
")",
"{",
"// there's no writer during authentication, so we may be responsible for closing the",
"// soc... | Callback called by the reader thread when it goes away. | [
"Callback",
"called",
"by",
"the",
"reader",
"thread",
"when",
"it",
"goes",
"away",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L254-L269 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.writerDidExit | protected synchronized void writerDidExit ()
{
// clear out our writer reference
_writer = null;
log.debug("Writer thread exited.");
// let the client observers know that we're logged off
notifyClientObservers(new ObserverOps.Session(_client) {
@Override protecte... | java | protected synchronized void writerDidExit ()
{
// clear out our writer reference
_writer = null;
log.debug("Writer thread exited.");
// let the client observers know that we're logged off
notifyClientObservers(new ObserverOps.Session(_client) {
@Override protecte... | [
"protected",
"synchronized",
"void",
"writerDidExit",
"(",
")",
"{",
"// clear out our writer reference",
"_writer",
"=",
"null",
";",
"log",
".",
"debug",
"(",
"\"Writer thread exited.\"",
")",
";",
"// let the client observers know that we're logged off",
"notifyClientObser... | Callback called by the writer thread when it goes away. | [
"Callback",
"called",
"by",
"the",
"writer",
"thread",
"when",
"it",
"goes",
"away",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L274-L295 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.closeDatagramChannel | protected void closeDatagramChannel ()
{
if (_selector != null) {
try {
_selector.close();
} catch (IOException ioe) {
log.warning("Error closing selector: " + ioe);
}
_selector = null;
}
if (_datagramChannel != ... | java | protected void closeDatagramChannel ()
{
if (_selector != null) {
try {
_selector.close();
} catch (IOException ioe) {
log.warning("Error closing selector: " + ioe);
}
_selector = null;
}
if (_datagramChannel != ... | [
"protected",
"void",
"closeDatagramChannel",
"(",
")",
"{",
"if",
"(",
"_selector",
"!=",
"null",
")",
"{",
"try",
"{",
"_selector",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"log",
".",
"warning",
"(",
"\"Error cl... | Closes the datagram channel. | [
"Closes",
"the",
"datagram",
"channel",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L352-L376 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.sendMessage | protected void sendMessage (UpstreamMessage msg)
throws IOException
{
if (debugLogMessages()) {
log.info("SEND " + msg);
}
// first we write the message so that we can measure it's length
_oout.writeObject(msg);
_oout.flush();
// then write the f... | java | protected void sendMessage (UpstreamMessage msg)
throws IOException
{
if (debugLogMessages()) {
log.info("SEND " + msg);
}
// first we write the message so that we can measure it's length
_oout.writeObject(msg);
_oout.flush();
// then write the f... | [
"protected",
"void",
"sendMessage",
"(",
"UpstreamMessage",
"msg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"debugLogMessages",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"SEND \"",
"+",
"msg",
")",
";",
"}",
"// first we write the message so that we ca... | Writes the supplied message to the socket. | [
"Writes",
"the",
"supplied",
"message",
"to",
"the",
"socket",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L381-L414 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.sendDatagram | protected void sendDatagram (UpstreamMessage msg)
throws IOException
{
// reset the stream and write our connection id and hash placeholder
_bout.reset();
_uout.writeInt(_client.getConnectionId());
_uout.writeLong(0L);
// write the datagram through the sequencer
... | java | protected void sendDatagram (UpstreamMessage msg)
throws IOException
{
// reset the stream and write our connection id and hash placeholder
_bout.reset();
_uout.writeInt(_client.getConnectionId());
_uout.writeLong(0L);
// write the datagram through the sequencer
... | [
"protected",
"void",
"sendDatagram",
"(",
"UpstreamMessage",
"msg",
")",
"throws",
"IOException",
"{",
"// reset the stream and write our connection id and hash placeholder",
"_bout",
".",
"reset",
"(",
")",
";",
"_uout",
".",
"writeInt",
"(",
"_client",
".",
"getConnec... | Sends a datagram over the datagram socket. | [
"Sends",
"a",
"datagram",
"over",
"the",
"datagram",
"socket",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L430-L463 | train |
threerings/narya | core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java | BlockingCommunicator.throttleOutgoingMessage | protected void throttleOutgoingMessage ()
{
Throttle throttle = _client.getOutgoingMessageThrottle();
synchronized(throttle) {
while (throttle.throttleOp()) {
try {
Thread.sleep(2);
} catch (InterruptedException ie) {
... | java | protected void throttleOutgoingMessage ()
{
Throttle throttle = _client.getOutgoingMessageThrottle();
synchronized(throttle) {
while (throttle.throttleOp()) {
try {
Thread.sleep(2);
} catch (InterruptedException ie) {
... | [
"protected",
"void",
"throttleOutgoingMessage",
"(",
")",
"{",
"Throttle",
"throttle",
"=",
"_client",
".",
"getOutgoingMessageThrottle",
"(",
")",
";",
"synchronized",
"(",
"throttle",
")",
"{",
"while",
"(",
"throttle",
".",
"throttleOp",
"(",
")",
")",
"{",... | Throttles an outgoing message operation in a thread-safe manner. | [
"Throttles",
"an",
"outgoing",
"message",
"operation",
"in",
"a",
"thread",
"-",
"safe",
"manner",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java#L587-L599 | train |
xbib/marc | src/main/java/org/xbib/marc/transformer/field/MarcFieldTransformer.java | MarcFieldTransformer.interpolate | private String interpolate(MarcField marcField, String value) {
if (value == null) {
return null;
}
Matcher m = REP.matcher(value);
if (m.find()) {
return m.replaceAll(Integer.toString(repeatCounter));
}
m = NREP.matcher(value);
if (m.find(... | java | private String interpolate(MarcField marcField, String value) {
if (value == null) {
return null;
}
Matcher m = REP.matcher(value);
if (m.find()) {
return m.replaceAll(Integer.toString(repeatCounter));
}
m = NREP.matcher(value);
if (m.find(... | [
"private",
"String",
"interpolate",
"(",
"MarcField",
"marcField",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Matcher",
"m",
"=",
"REP",
".",
"matcher",
"(",
"value",
")",
";",
"if",
"("... | Interpolate variables.
@param marcField MARC field
@param value the input value
@return the interpolated string | [
"Interpolate",
"variables",
"."
] | d8426fcfc686507cab59b3d8181b08f83718418c | https://github.com/xbib/marc/blob/d8426fcfc686507cab59b3d8181b08f83718418c/src/main/java/org/xbib/marc/transformer/field/MarcFieldTransformer.java#L216-L233 | train |
threerings/narya | core/src/main/java/com/threerings/crowd/data/PlaceConfig.java | PlaceConfig.createController | public PlaceController createController ()
{
Class<?> cclass = getControllerClass();
if (cclass == null) {
throw new RuntimeException(
"PlaceConfig.createController() must be overridden.");
}
log.warning("Providing backwards compatibility. PlaceConfig." +... | java | public PlaceController createController ()
{
Class<?> cclass = getControllerClass();
if (cclass == null) {
throw new RuntimeException(
"PlaceConfig.createController() must be overridden.");
}
log.warning("Providing backwards compatibility. PlaceConfig." +... | [
"public",
"PlaceController",
"createController",
"(",
")",
"{",
"Class",
"<",
"?",
">",
"cclass",
"=",
"getControllerClass",
"(",
")",
";",
"if",
"(",
"cclass",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"PlaceConfig.createController() mu... | Create the controller that should be used for this place. | [
"Create",
"the",
"controller",
"that",
"should",
"be",
"used",
"for",
"this",
"place",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/data/PlaceConfig.java#L64-L80 | train |
threerings/narya | core/src/main/java/com/threerings/crowd/data/BodyObject.java | BodyObject.addWhoData | protected void addWhoData (StringBuilder buf)
{
buf.append(getOid());
if (status != OccupantInfo.ACTIVE) {
buf.append(" ").append(getStatusTranslation());
}
} | java | protected void addWhoData (StringBuilder buf)
{
buf.append(getOid());
if (status != OccupantInfo.ACTIVE) {
buf.append(" ").append(getStatusTranslation());
}
} | [
"protected",
"void",
"addWhoData",
"(",
"StringBuilder",
"buf",
")",
"{",
"buf",
".",
"append",
"(",
"getOid",
"(",
")",
")",
";",
"if",
"(",
"status",
"!=",
"OccupantInfo",
".",
"ACTIVE",
")",
"{",
"buf",
".",
"append",
"(",
"\" \"",
")",
".",
"appe... | Allows derived classes to add data to the who details. | [
"Allows",
"derived",
"classes",
"to",
"add",
"data",
"to",
"the",
"who",
"details",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/data/BodyObject.java#L217-L223 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java | TimeBaseProvider.init | public static void init (InvocationManager invmgr, RootDObjectManager omgr)
{
// we'll need these later
_invmgr = invmgr;
_omgr = omgr;
// register a provider instance
invmgr.registerProvider(new TimeBaseProvider(), TimeBaseMarshaller.class, GLOBAL_GROUP);
} | java | public static void init (InvocationManager invmgr, RootDObjectManager omgr)
{
// we'll need these later
_invmgr = invmgr;
_omgr = omgr;
// register a provider instance
invmgr.registerProvider(new TimeBaseProvider(), TimeBaseMarshaller.class, GLOBAL_GROUP);
} | [
"public",
"static",
"void",
"init",
"(",
"InvocationManager",
"invmgr",
",",
"RootDObjectManager",
"omgr",
")",
"{",
"// we'll need these later",
"_invmgr",
"=",
"invmgr",
";",
"_omgr",
"=",
"omgr",
";",
"// register a provider instance",
"invmgr",
".",
"registerProvi... | Registers the time provider with the appropriate managers. Called by the presents server at
startup. | [
"Registers",
"the",
"time",
"provider",
"with",
"the",
"appropriate",
"managers",
".",
"Called",
"by",
"the",
"presents",
"server",
"at",
"startup",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java#L47-L55 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java | TimeBaseProvider.createTimeBase | public static TimeBaseObject createTimeBase (String timeBase)
{
TimeBaseObject object = _omgr.registerObject(new TimeBaseObject());
_timeBases.put(timeBase, object);
return object;
} | java | public static TimeBaseObject createTimeBase (String timeBase)
{
TimeBaseObject object = _omgr.registerObject(new TimeBaseObject());
_timeBases.put(timeBase, object);
return object;
} | [
"public",
"static",
"TimeBaseObject",
"createTimeBase",
"(",
"String",
"timeBase",
")",
"{",
"TimeBaseObject",
"object",
"=",
"_omgr",
".",
"registerObject",
"(",
"new",
"TimeBaseObject",
"(",
")",
")",
";",
"_timeBases",
".",
"put",
"(",
"timeBase",
",",
"obj... | Creates a time base object which can subsequently be fetched by the client and used to send
delta times.
@param timeBase the name of the time base to create.
@return the created and registered time base object. | [
"Creates",
"a",
"time",
"base",
"object",
"which",
"can",
"subsequently",
"be",
"fetched",
"by",
"the",
"client",
"and",
"used",
"to",
"send",
"delta",
"times",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java#L65-L70 | train |
threerings/narya | core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java | TimeBaseProvider.getTimeOid | public void getTimeOid (ClientObject source, String timeBase,
TimeBaseService.GotTimeBaseListener listener)
throws InvocationException
{
// look up the time base object in question
TimeBaseObject time = getTimeBase(timeBase);
if (time == null) {
... | java | public void getTimeOid (ClientObject source, String timeBase,
TimeBaseService.GotTimeBaseListener listener)
throws InvocationException
{
// look up the time base object in question
TimeBaseObject time = getTimeBase(timeBase);
if (time == null) {
... | [
"public",
"void",
"getTimeOid",
"(",
"ClientObject",
"source",
",",
"String",
"timeBase",
",",
"TimeBaseService",
".",
"GotTimeBaseListener",
"listener",
")",
"throws",
"InvocationException",
"{",
"// look up the time base object in question",
"TimeBaseObject",
"time",
"=",... | Processes a request from a client to fetch the oid of the specified time object. | [
"Processes",
"a",
"request",
"from",
"a",
"client",
"to",
"fetch",
"the",
"oid",
"of",
"the",
"specified",
"time",
"object",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/TimeBaseProvider.java#L84-L95 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.getNodeObjects | public Iterable<NodeObject> getNodeObjects ()
{
return Iterables.filter(
Iterables.concat(Collections.singleton(_nodeobj),
Iterables.transform(_peers.values(), GET_NODE_OBJECT)),
Predicates.notNull());
} | java | public Iterable<NodeObject> getNodeObjects ()
{
return Iterables.filter(
Iterables.concat(Collections.singleton(_nodeobj),
Iterables.transform(_peers.values(), GET_NODE_OBJECT)),
Predicates.notNull());
} | [
"public",
"Iterable",
"<",
"NodeObject",
">",
"getNodeObjects",
"(",
")",
"{",
"return",
"Iterables",
".",
"filter",
"(",
"Iterables",
".",
"concat",
"(",
"Collections",
".",
"singleton",
"(",
"_nodeobj",
")",
",",
"Iterables",
".",
"transform",
"(",
"_peers... | Returns an iterable over our node object and that of our peers. | [
"Returns",
"an",
"iterable",
"over",
"our",
"node",
"object",
"and",
"that",
"of",
"our",
"peers",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L256-L262 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.locateClient | public ClientInfo locateClient (final Name key)
{
return lookupNodeDatum(new Function<NodeObject,ClientInfo>() {
public ClientInfo apply (NodeObject nodeobj) {
return nodeobj.clients.get(key);
}
});
} | java | public ClientInfo locateClient (final Name key)
{
return lookupNodeDatum(new Function<NodeObject,ClientInfo>() {
public ClientInfo apply (NodeObject nodeobj) {
return nodeobj.clients.get(key);
}
});
} | [
"public",
"ClientInfo",
"locateClient",
"(",
"final",
"Name",
"key",
")",
"{",
"return",
"lookupNodeDatum",
"(",
"new",
"Function",
"<",
"NodeObject",
",",
"ClientInfo",
">",
"(",
")",
"{",
"public",
"ClientInfo",
"apply",
"(",
"NodeObject",
"nodeobj",
")",
... | Locates the client with the specified name. Returns null if the client is not logged onto
any peer. | [
"Locates",
"the",
"client",
"with",
"the",
"specified",
"name",
".",
"Returns",
"null",
"if",
"the",
"client",
"is",
"not",
"logged",
"onto",
"any",
"peer",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L416-L423 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.invokeNodeAction | public void invokeNodeAction (final NodeAction action, final Runnable onDropped)
{
// if we're not on the dobjmgr thread, get there
if (!_omgr.isDispatchThread()) {
_omgr.postRunnable(new Runnable() {
public void run () {
invokeNodeAction(action, onDro... | java | public void invokeNodeAction (final NodeAction action, final Runnable onDropped)
{
// if we're not on the dobjmgr thread, get there
if (!_omgr.isDispatchThread()) {
_omgr.postRunnable(new Runnable() {
public void run () {
invokeNodeAction(action, onDro... | [
"public",
"void",
"invokeNodeAction",
"(",
"final",
"NodeAction",
"action",
",",
"final",
"Runnable",
"onDropped",
")",
"{",
"// if we're not on the dobjmgr thread, get there",
"if",
"(",
"!",
"_omgr",
".",
"isDispatchThread",
"(",
")",
")",
"{",
"_omgr",
".",
"po... | Invokes the supplied action on this and any other server that it indicates is appropriate.
The action will be executed on the distributed object thread, but this method does not need
to be called from the distributed object thread.
@param onDropped a runnable to be executed if the action was not invoked on the local s... | [
"Invokes",
"the",
"supplied",
"action",
"on",
"this",
"and",
"any",
"other",
"server",
"that",
"it",
"indicates",
"is",
"appropriate",
".",
"The",
"action",
"will",
"be",
"executed",
"on",
"the",
"distributed",
"object",
"thread",
"but",
"this",
"method",
"d... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L478-L516 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.invokeNodeRequest | public <T> void invokeNodeRequest (
final NodeRequest request, final NodeRequestsListener<T> listener)
{
// if we're not on the dobjmgr thread, get there
if (!_omgr.isDispatchThread()) {
_omgr.postRunnable(new Runnable() {
public void run () {
... | java | public <T> void invokeNodeRequest (
final NodeRequest request, final NodeRequestsListener<T> listener)
{
// if we're not on the dobjmgr thread, get there
if (!_omgr.isDispatchThread()) {
_omgr.postRunnable(new Runnable() {
public void run () {
... | [
"public",
"<",
"T",
">",
"void",
"invokeNodeRequest",
"(",
"final",
"NodeRequest",
"request",
",",
"final",
"NodeRequestsListener",
"<",
"T",
">",
"listener",
")",
"{",
"// if we're not on the dobjmgr thread, get there",
"if",
"(",
"!",
"_omgr",
".",
"isDispatchThre... | Invokes the supplied request on all servers in parallel. The request will execute on the
distributed object thread, but this method does not need to be called from there.
If any one node reports failure, this function reports failure. If all nodes report success,
this function will report success. | [
"Invokes",
"the",
"supplied",
"request",
"on",
"all",
"servers",
"in",
"parallel",
".",
"The",
"request",
"will",
"execute",
"on",
"the",
"distributed",
"object",
"thread",
"but",
"this",
"method",
"does",
"not",
"need",
"to",
"be",
"called",
"from",
"there"... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L545-L592 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.invokeNodeRequest | public void invokeNodeRequest (String nodeName, NodeRequest request,
InvocationService.ResultListener listener)
{
invokeNodeRequest(nodeName, flattenRequest(request), listener);
} | java | public void invokeNodeRequest (String nodeName, NodeRequest request,
InvocationService.ResultListener listener)
{
invokeNodeRequest(nodeName, flattenRequest(request), listener);
} | [
"public",
"void",
"invokeNodeRequest",
"(",
"String",
"nodeName",
",",
"NodeRequest",
"request",
",",
"InvocationService",
".",
"ResultListener",
"listener",
")",
"{",
"invokeNodeRequest",
"(",
"nodeName",
",",
"flattenRequest",
"(",
"request",
")",
",",
"listener",... | Invokes a node request on a specific node and returns the result through the listener. | [
"Invokes",
"a",
"node",
"request",
"on",
"a",
"specific",
"node",
"and",
"returns",
"the",
"result",
"through",
"the",
"listener",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L614-L618 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.proxyRemoteObject | public <T extends DObject> void proxyRemoteObject (
String nodeName, final int remoteOid, final ResultListener<Integer> listener)
{
proxyRemoteObject(new DObjectAddress(nodeName, remoteOid), listener);
} | java | public <T extends DObject> void proxyRemoteObject (
String nodeName, final int remoteOid, final ResultListener<Integer> listener)
{
proxyRemoteObject(new DObjectAddress(nodeName, remoteOid), listener);
} | [
"public",
"<",
"T",
"extends",
"DObject",
">",
"void",
"proxyRemoteObject",
"(",
"String",
"nodeName",
",",
"final",
"int",
"remoteOid",
",",
"final",
"ResultListener",
"<",
"Integer",
">",
"listener",
")",
"{",
"proxyRemoteObject",
"(",
"new",
"DObjectAddress",... | Initiates a proxy on an object that is managed by the specified peer. The object will be
proxied into this server's distributed object space and its local oid reported back to the
supplied result listener.
<p> Note that proxy requests <em>do not</em> stack like subscription requests. Only one
entity must issue a reque... | [
"Initiates",
"a",
"proxy",
"on",
"an",
"object",
"that",
"is",
"managed",
"by",
"the",
"specified",
"peer",
".",
"The",
"object",
"will",
"be",
"proxied",
"into",
"this",
"server",
"s",
"distributed",
"object",
"space",
"and",
"its",
"local",
"oid",
"repor... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L631-L635 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.unproxyRemoteObject | public void unproxyRemoteObject (DObjectAddress addr)
{
Tuple<Subscriber<?>, DObject> bits = _proxies.remove(addr);
if (bits == null) {
log.warning("Requested to clear unknown proxy", "addr", addr);
return;
}
// If it's local, just remove the subscriber we ad... | java | public void unproxyRemoteObject (DObjectAddress addr)
{
Tuple<Subscriber<?>, DObject> bits = _proxies.remove(addr);
if (bits == null) {
log.warning("Requested to clear unknown proxy", "addr", addr);
return;
}
// If it's local, just remove the subscriber we ad... | [
"public",
"void",
"unproxyRemoteObject",
"(",
"DObjectAddress",
"addr",
")",
"{",
"Tuple",
"<",
"Subscriber",
"<",
"?",
">",
",",
"DObject",
">",
"bits",
"=",
"_proxies",
".",
"remove",
"(",
"addr",
")",
";",
"if",
"(",
"bits",
"==",
"null",
")",
"{",
... | Unsubscribes from and clears a proxied object. The caller must be sure that there are no
remaining subscribers to the object on this local server. | [
"Unsubscribes",
"from",
"and",
"clears",
"a",
"proxied",
"object",
".",
"The",
"caller",
"must",
"be",
"sure",
"that",
"there",
"are",
"no",
"remaining",
"subscribers",
"to",
"the",
"object",
"on",
"this",
"local",
"server",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L698-L729 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.getPeerPublicHostName | public String getPeerPublicHostName (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.publicHostName;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? null : peer.getPublicHostName();
} | java | public String getPeerPublicHostName (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.publicHostName;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? null : peer.getPublicHostName();
} | [
"public",
"String",
"getPeerPublicHostName",
"(",
"String",
"nodeName",
")",
"{",
"if",
"(",
"Objects",
".",
"equal",
"(",
"_nodeName",
",",
"nodeName",
")",
")",
"{",
"return",
"_self",
".",
"publicHostName",
";",
"}",
"PeerNode",
"peer",
"=",
"_peers",
"... | Returns the public hostname to use when connecting to the specified peer or null if the peer
is not currently connected to this server. | [
"Returns",
"the",
"public",
"hostname",
"to",
"use",
"when",
"connecting",
"to",
"the",
"specified",
"peer",
"or",
"null",
"if",
"the",
"peer",
"is",
"not",
"currently",
"connected",
"to",
"this",
"server",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L758-L765 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.getPeerInternalHostName | public String getPeerInternalHostName (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.hostName;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? null : peer.getInternalHostName();
} | java | public String getPeerInternalHostName (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.hostName;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? null : peer.getInternalHostName();
} | [
"public",
"String",
"getPeerInternalHostName",
"(",
"String",
"nodeName",
")",
"{",
"if",
"(",
"Objects",
".",
"equal",
"(",
"_nodeName",
",",
"nodeName",
")",
")",
"{",
"return",
"_self",
".",
"hostName",
";",
"}",
"PeerNode",
"peer",
"=",
"_peers",
".",
... | Returns the internal hostname to use when connecting to the specified peer or null if the
peer is not currently connected to this server. Peers connect to one another via their
internal hostname. Do not publish this data to clients out on the Internets. | [
"Returns",
"the",
"internal",
"hostname",
"to",
"use",
"when",
"connecting",
"to",
"the",
"specified",
"peer",
"or",
"null",
"if",
"the",
"peer",
"is",
"not",
"currently",
"connected",
"to",
"this",
"server",
".",
"Peers",
"connect",
"to",
"one",
"another",
... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L772-L779 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.getPeerPort | public int getPeerPort (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.port;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? -1 : peer.getPort();
} | java | public int getPeerPort (String nodeName)
{
if (Objects.equal(_nodeName, nodeName)) {
return _self.port;
}
PeerNode peer = _peers.get(nodeName);
return (peer == null) ? -1 : peer.getPort();
} | [
"public",
"int",
"getPeerPort",
"(",
"String",
"nodeName",
")",
"{",
"if",
"(",
"Objects",
".",
"equal",
"(",
"_nodeName",
",",
"nodeName",
")",
")",
"{",
"return",
"_self",
".",
"port",
";",
"}",
"PeerNode",
"peer",
"=",
"_peers",
".",
"get",
"(",
"... | Returns the port on which to connect to the specified peer or -1 if the peer is not
currently connected to this server. | [
"Returns",
"the",
"port",
"on",
"which",
"to",
"connect",
"to",
"the",
"specified",
"peer",
"or",
"-",
"1",
"if",
"the",
"peer",
"is",
"not",
"currently",
"connected",
"to",
"this",
"server",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L785-L792 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.acquireLock | public void acquireLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (result =... | java | public void acquireLock (final NodeObject.Lock lock, final ResultListener<String> listener)
{
// wait until any pending resolution is complete
queryLock(lock, new ChainedResultListener<String, String>(listener) {
public void requestCompleted (String result) {
if (result =... | [
"public",
"void",
"acquireLock",
"(",
"final",
"NodeObject",
".",
"Lock",
"lock",
",",
"final",
"ResultListener",
"<",
"String",
">",
"listener",
")",
"{",
"// wait until any pending resolution is complete",
"queryLock",
"(",
"lock",
",",
"new",
"ChainedResultListener... | Acquires a lock on a resource shared amongst this node's peers. If the lock is successfully
acquired, the supplied listener will receive this node's name. If another node acquires the
lock first, then the listener will receive the name of that node. | [
"Acquires",
"a",
"lock",
"on",
"a",
"resource",
"shared",
"amongst",
"this",
"node",
"s",
"peers",
".",
"If",
"the",
"lock",
"is",
"successfully",
"acquired",
"the",
"supplied",
"listener",
"will",
"receive",
"this",
"node",
"s",
"name",
".",
"If",
"anothe... | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L799-L815 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.queryLock | public void queryLock (NodeObject.Lock lock, ResultListener<String> listener)
{
// if it's being resolved, add the listener to the list
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.listeners.add(listener);
return;
}
// otherw... | java | public void queryLock (NodeObject.Lock lock, ResultListener<String> listener)
{
// if it's being resolved, add the listener to the list
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.listeners.add(listener);
return;
}
// otherw... | [
"public",
"void",
"queryLock",
"(",
"NodeObject",
".",
"Lock",
"lock",
",",
"ResultListener",
"<",
"String",
">",
"listener",
")",
"{",
"// if it's being resolved, add the listener to the list",
"LockHandler",
"handler",
"=",
"_locks",
".",
"get",
"(",
"lock",
")",
... | Determines the owner of the specified lock, waiting for any resolution to complete before
notifying the supplied listener. | [
"Determines",
"the",
"owner",
"of",
"the",
"specified",
"lock",
"waiting",
"for",
"any",
"resolution",
"to",
"complete",
"before",
"notifying",
"the",
"supplied",
"listener",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L876-L887 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.addStaleCacheObserver | public void addStaleCacheObserver (String cache, StaleCacheObserver observer)
{
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
list = ObserverList.newFastUnsafe();
_cacheobs.put(cache, list);
}
list.add(observer);
} | java | public void addStaleCacheObserver (String cache, StaleCacheObserver observer)
{
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
list = ObserverList.newFastUnsafe();
_cacheobs.put(cache, list);
}
list.add(observer);
} | [
"public",
"void",
"addStaleCacheObserver",
"(",
"String",
"cache",
",",
"StaleCacheObserver",
"observer",
")",
"{",
"ObserverList",
"<",
"StaleCacheObserver",
">",
"list",
"=",
"_cacheobs",
".",
"get",
"(",
"cache",
")",
";",
"if",
"(",
"list",
"==",
"null",
... | Registers a stale cache observer. | [
"Registers",
"a",
"stale",
"cache",
"observer",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L974-L982 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.removeStaleCacheObserver | public void removeStaleCacheObserver (String cache, StaleCacheObserver observer)
{
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
list.remove(observer);
if (list.isEmpty()) {
_cacheobs.remove(cache);
... | java | public void removeStaleCacheObserver (String cache, StaleCacheObserver observer)
{
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
list.remove(observer);
if (list.isEmpty()) {
_cacheobs.remove(cache);
... | [
"public",
"void",
"removeStaleCacheObserver",
"(",
"String",
"cache",
",",
"StaleCacheObserver",
"observer",
")",
"{",
"ObserverList",
"<",
"StaleCacheObserver",
">",
"list",
"=",
"_cacheobs",
".",
"get",
"(",
"cache",
")",
";",
"if",
"(",
"list",
"==",
"null"... | Removes a stale cache observer registration. | [
"Removes",
"a",
"stale",
"cache",
"observer",
"registration",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L987-L997 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.broadcastStaleCacheData | public void broadcastStaleCacheData (String cache, Streamable data)
{
_nodeobj.setCacheData(new NodeObject.CacheData(cache, data));
} | java | public void broadcastStaleCacheData (String cache, Streamable data)
{
_nodeobj.setCacheData(new NodeObject.CacheData(cache, data));
} | [
"public",
"void",
"broadcastStaleCacheData",
"(",
"String",
"cache",
",",
"Streamable",
"data",
")",
"{",
"_nodeobj",
".",
"setCacheData",
"(",
"new",
"NodeObject",
".",
"CacheData",
"(",
"cache",
",",
"data",
")",
")",
";",
"}"
] | Called when cached data has changed on the local server and needs to inform our peers. | [
"Called",
"when",
"cached",
"data",
"has",
"changed",
"on",
"the",
"local",
"server",
"and",
"needs",
"to",
"inform",
"our",
"peers",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1002-L1005 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.refreshPeer | protected void refreshPeer (NodeRecord record)
{
PeerNode peer = _peers.get(record.nodeName);
if (peer == null) {
peer = _injector.getInstance(getPeerNodeClass());
_peers.put(record.nodeName, peer);
peer.init(record);
}
peer.refresh(record);
} | java | protected void refreshPeer (NodeRecord record)
{
PeerNode peer = _peers.get(record.nodeName);
if (peer == null) {
peer = _injector.getInstance(getPeerNodeClass());
_peers.put(record.nodeName, peer);
peer.init(record);
}
peer.refresh(record);
} | [
"protected",
"void",
"refreshPeer",
"(",
"NodeRecord",
"record",
")",
"{",
"PeerNode",
"peer",
"=",
"_peers",
".",
"get",
"(",
"record",
".",
"nodeName",
")",
";",
"if",
"(",
"peer",
"==",
"null",
")",
"{",
"peer",
"=",
"_injector",
".",
"getInstance",
... | Ensures that we have a connection to the specified node if it has checked in since we last
failed to connect. | [
"Ensures",
"that",
"we",
"have",
"a",
"connection",
"to",
"the",
"specified",
"node",
"if",
"it",
"has",
"checked",
"in",
"since",
"we",
"last",
"failed",
"to",
"connect",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1224-L1233 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.changedCacheData | protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
// if so, notify them
list.apply(new ObserverList.ObserverOp... | java | protected void changedCacheData (String cache, final Streamable data)
{
// see if we have any observers
ObserverList<StaleCacheObserver> list = _cacheobs.get(cache);
if (list == null) {
return;
}
// if so, notify them
list.apply(new ObserverList.ObserverOp... | [
"protected",
"void",
"changedCacheData",
"(",
"String",
"cache",
",",
"final",
"Streamable",
"data",
")",
"{",
"// see if we have any observers",
"ObserverList",
"<",
"StaleCacheObserver",
">",
"list",
"=",
"_cacheobs",
".",
"get",
"(",
"cache",
")",
";",
"if",
... | Called when possibly cached data has changed on one of our peer servers. | [
"Called",
"when",
"possibly",
"cached",
"data",
"has",
"changed",
"on",
"one",
"of",
"our",
"peer",
"servers",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1283-L1297 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.droppedLock | protected void droppedLock (final NodeObject.Lock lock)
{
_nodeobj.removeFromLocks(lock);
_stats.locksHijacked++;
_dropobs.apply(new ObserverList.ObserverOp<DroppedLockObserver>() {
public boolean apply (DroppedLockObserver observer) {
observer.droppedLock(lock);
... | java | protected void droppedLock (final NodeObject.Lock lock)
{
_nodeobj.removeFromLocks(lock);
_stats.locksHijacked++;
_dropobs.apply(new ObserverList.ObserverOp<DroppedLockObserver>() {
public boolean apply (DroppedLockObserver observer) {
observer.droppedLock(lock);
... | [
"protected",
"void",
"droppedLock",
"(",
"final",
"NodeObject",
".",
"Lock",
"lock",
")",
"{",
"_nodeobj",
".",
"removeFromLocks",
"(",
"lock",
")",
";",
"_stats",
".",
"locksHijacked",
"++",
";",
"_dropobs",
".",
"apply",
"(",
"new",
"ObserverList",
".",
... | Called when we have been forced to drop a lock. | [
"Called",
"when",
"we",
"have",
"been",
"forced",
"to",
"drop",
"a",
"lock",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1302-L1312 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.clientLoggedOn | protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName);
... | java | protected void clientLoggedOn (String nodeName, ClientInfo clinfo)
{
PresentsSession session = _clmgr.getClient(clinfo.username);
if (session != null) {
log.info("Booting user that has connected on another node",
"username", clinfo.username, "otherNode", nodeName);
... | [
"protected",
"void",
"clientLoggedOn",
"(",
"String",
"nodeName",
",",
"ClientInfo",
"clinfo",
")",
"{",
"PresentsSession",
"session",
"=",
"_clmgr",
".",
"getClient",
"(",
"clinfo",
".",
"username",
")",
";",
"if",
"(",
"session",
"!=",
"null",
")",
"{",
... | Called when we hear about a client logging on to another node. | [
"Called",
"when",
"we",
"hear",
"about",
"a",
"client",
"logging",
"on",
"to",
"another",
"node",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1357-L1365 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.peerAcquiringLock | protected void peerAcquiringLock (PeerNode peer, NodeObject.Lock lock)
{
// refuse to ratify if we believe someone else owns the lock
String owner = queryLock(lock);
if (owner != null) {
log.warning("Refusing to ratify lock acquisition.", "lock", lock,
"node", pee... | java | protected void peerAcquiringLock (PeerNode peer, NodeObject.Lock lock)
{
// refuse to ratify if we believe someone else owns the lock
String owner = queryLock(lock);
if (owner != null) {
log.warning("Refusing to ratify lock acquisition.", "lock", lock,
"node", pee... | [
"protected",
"void",
"peerAcquiringLock",
"(",
"PeerNode",
"peer",
",",
"NodeObject",
".",
"Lock",
"lock",
")",
"{",
"// refuse to ratify if we believe someone else owns the lock",
"String",
"owner",
"=",
"queryLock",
"(",
"lock",
")",
";",
"if",
"(",
"owner",
"!=",... | Called when a peer announces its intention to acquire a lock. | [
"Called",
"when",
"a",
"peer",
"announces",
"its",
"intention",
"to",
"acquire",
"a",
"lock",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1414-L1442 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.peerReleasingLock | protected void peerReleasingLock (PeerNode peer, NodeObject.Lock lock)
{
// refuse to ratify if we don't believe they own the lock
String owner = queryLock(lock);
if (!peer.getNodeName().equals(owner)) {
log.warning("Refusing to ratify lock release.", "lock", lock,
... | java | protected void peerReleasingLock (PeerNode peer, NodeObject.Lock lock)
{
// refuse to ratify if we don't believe they own the lock
String owner = queryLock(lock);
if (!peer.getNodeName().equals(owner)) {
log.warning("Refusing to ratify lock release.", "lock", lock,
... | [
"protected",
"void",
"peerReleasingLock",
"(",
"PeerNode",
"peer",
",",
"NodeObject",
".",
"Lock",
"lock",
")",
"{",
"// refuse to ratify if we don't believe they own the lock",
"String",
"owner",
"=",
"queryLock",
"(",
"lock",
")",
";",
"if",
"(",
"!",
"peer",
".... | Called when a peer announces its intention to release a lock. | [
"Called",
"when",
"a",
"peer",
"announces",
"its",
"intention",
"to",
"release",
"a",
"lock",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1447-L1465 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.peerAddedLock | protected void peerAddedLock (String nodeName, NodeObject.Lock lock)
{
// check for hijacking
if (_nodeobj.locks.contains(lock)) {
log.warning("Client hijacked lock owned by this node", "lock", lock, "node", nodeName);
droppedLock(lock);
}
// notify the handl... | java | protected void peerAddedLock (String nodeName, NodeObject.Lock lock)
{
// check for hijacking
if (_nodeobj.locks.contains(lock)) {
log.warning("Client hijacked lock owned by this node", "lock", lock, "node", nodeName);
droppedLock(lock);
}
// notify the handl... | [
"protected",
"void",
"peerAddedLock",
"(",
"String",
"nodeName",
",",
"NodeObject",
".",
"Lock",
"lock",
")",
"{",
"// check for hijacking",
"if",
"(",
"_nodeobj",
".",
"locks",
".",
"contains",
"(",
"lock",
")",
")",
"{",
"log",
".",
"warning",
"(",
"\"Cl... | Called when a peer adds a lock. | [
"Called",
"when",
"a",
"peer",
"adds",
"a",
"lock",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1470-L1483 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.peerUpdatedLock | protected void peerUpdatedLock (String nodeName, NodeObject.Lock lock)
{
// notify the handler, if any
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.peerUpdatedLock(nodeName);
}
} | java | protected void peerUpdatedLock (String nodeName, NodeObject.Lock lock)
{
// notify the handler, if any
LockHandler handler = _locks.get(lock);
if (handler != null) {
handler.peerUpdatedLock(nodeName);
}
} | [
"protected",
"void",
"peerUpdatedLock",
"(",
"String",
"nodeName",
",",
"NodeObject",
".",
"Lock",
"lock",
")",
"{",
"// notify the handler, if any",
"LockHandler",
"handler",
"=",
"_locks",
".",
"get",
"(",
"lock",
")",
";",
"if",
"(",
"handler",
"!=",
"null"... | Called when a peer updates a lock. | [
"Called",
"when",
"a",
"peer",
"updates",
"a",
"lock",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1488-L1495 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.flattenAction | protected byte[] flattenAction (NodeAction action)
{
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(action);
return bout.toByteArray();
} catch (Exception e) {
... | java | protected byte[] flattenAction (NodeAction action)
{
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(action);
return bout.toByteArray();
} catch (Exception e) {
... | [
"protected",
"byte",
"[",
"]",
"flattenAction",
"(",
"NodeAction",
"action",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"bout",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oout",
"=",
"new",
"ObjectOutputStream",
"(",
"bout",
"... | Flattens the supplied node action into bytes. | [
"Flattens",
"the",
"supplied",
"node",
"action",
"into",
"bytes",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1512-L1523 | train |
threerings/narya | core/src/main/java/com/threerings/presents/peer/server/PeerManager.java | PeerManager.flattenRequest | protected byte[] flattenRequest (NodeRequest request)
{
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(request);
return bout.toByteArray();
} catch (Exception e) ... | java | protected byte[] flattenRequest (NodeRequest request)
{
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
oout.writeObject(request);
return bout.toByteArray();
} catch (Exception e) ... | [
"protected",
"byte",
"[",
"]",
"flattenRequest",
"(",
"NodeRequest",
"request",
")",
"{",
"try",
"{",
"ByteArrayOutputStream",
"bout",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"ObjectOutputStream",
"oout",
"=",
"new",
"ObjectOutputStream",
"(",
"bout",
... | Flattens the supplied node request into bytes. | [
"Flattens",
"the",
"supplied",
"node",
"request",
"into",
"bytes",
"."
] | 5b01edc8850ed0c32d004b4049e1ac4a02027ede | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1528-L1539 | train |
dkpro/dkpro-argumentation | dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java | ArgumentUnitUtils.propertiesToString | protected static String propertiesToString(Properties properties)
{
StringWriter stringWriter = new StringWriter();
String comments = Properties.class.getName();
try {
properties.store(stringWriter, comments);
}
catch (IOException e) {
throw new Runti... | java | protected static String propertiesToString(Properties properties)
{
StringWriter stringWriter = new StringWriter();
String comments = Properties.class.getName();
try {
properties.store(stringWriter, comments);
}
catch (IOException e) {
throw new Runti... | [
"protected",
"static",
"String",
"propertiesToString",
"(",
"Properties",
"properties",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"String",
"comments",
"=",
"Properties",
".",
"class",
".",
"getName",
"(",
")",
";",
"... | Serializes properties to String
@param properties properties
@return string | [
"Serializes",
"properties",
"to",
"String"
] | 57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb | https://github.com/dkpro/dkpro-argumentation/blob/57ce6f5e73d8075b7088aeeebb107c85b3d4bbcb/dkpro-argumentation-types/src/main/java/org/dkpro/argumentation/types/ArgumentUnitUtils.java#L79-L103 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.