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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java | YarnJobSubmissionClient.logToken | private static void logToken(final Level logLevel, final String msgPrefix, final UserGroupInformation user) {
if (LOG.isLoggable(logLevel)) {
LOG.log(logLevel, "{0} number of tokens: [{1}].",
new Object[] {msgPrefix, user.getCredentials().numberOfTokens()});
for (final org.apache.hadoop.securi... | java | private static void logToken(final Level logLevel, final String msgPrefix, final UserGroupInformation user) {
if (LOG.isLoggable(logLevel)) {
LOG.log(logLevel, "{0} number of tokens: [{1}].",
new Object[] {msgPrefix, user.getCredentials().numberOfTokens()});
for (final org.apache.hadoop.securi... | [
"private",
"static",
"void",
"logToken",
"(",
"final",
"Level",
"logLevel",
",",
"final",
"String",
"msgPrefix",
",",
"final",
"UserGroupInformation",
"user",
")",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"logLevel",
")",
")",
"{",
"LOG",
".",
"log",... | Log all the tokens in the container for thr user.
@param logLevel - the log level.
@param msgPrefix - msg prefix for log.
@param user - the UserGroupInformation object. | [
"Log",
"all",
"the",
"tokens",
"in",
"the",
"container",
"for",
"thr",
"user",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java#L229-L237 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java | YarnJobSubmissionClient.writeDriverHttpEndPoint | private void writeDriverHttpEndPoint(final File driverFolder,
final String applicationId,
final Path dfsPath) throws IOException {
final FileSystem fs = FileSystem.get(yarnConfiguration);
final Path httpEndpointPath = new Path(dfsPat... | java | private void writeDriverHttpEndPoint(final File driverFolder,
final String applicationId,
final Path dfsPath) throws IOException {
final FileSystem fs = FileSystem.get(yarnConfiguration);
final Path httpEndpointPath = new Path(dfsPat... | [
"private",
"void",
"writeDriverHttpEndPoint",
"(",
"final",
"File",
"driverFolder",
",",
"final",
"String",
"applicationId",
",",
"final",
"Path",
"dfsPath",
")",
"throws",
"IOException",
"{",
"final",
"FileSystem",
"fs",
"=",
"FileSystem",
".",
"get",
"(",
"yar... | We leave a file behind in job submission directory so that clr client can figure out
the applicationId and yarn rest endpoint.
@param driverFolder
@param applicationId
@throws IOException | [
"We",
"leave",
"a",
"file",
"behind",
"in",
"job",
"submission",
"directory",
"so",
"that",
"clr",
"client",
"can",
"figure",
"out",
"the",
"applicationId",
"and",
"yarn",
"rest",
"endpoint",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnJobSubmissionClient.java#L246-L299 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/addone/AddOneStart.java | AddOneStart.start | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final Vector<Integer> inputVector = new Vector<>();
for (int i = 0; i < dimension; i++) {
inputVector.add(i);
}
final List<VortexFuture<Integer>> futures = new ArrayList<>();
final AddOneFunction addOneFunction = new Add... | java | @Override
public void start(final VortexThreadPool vortexThreadPool) {
final Vector<Integer> inputVector = new Vector<>();
for (int i = 0; i < dimension; i++) {
inputVector.add(i);
}
final List<VortexFuture<Integer>> futures = new ArrayList<>();
final AddOneFunction addOneFunction = new Add... | [
"@",
"Override",
"public",
"void",
"start",
"(",
"final",
"VortexThreadPool",
"vortexThreadPool",
")",
"{",
"final",
"Vector",
"<",
"Integer",
">",
"inputVector",
"=",
"new",
"Vector",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<... | Perform a simple vector calculation on Vortex. | [
"Perform",
"a",
"simple",
"vector",
"calculation",
"on",
"Vortex",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/examples/addone/AddOneStart.java#L46-L70 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/MemoryUtils.java | MemoryUtils.getTotalPhysicalMemorySizeInMB | public static int getTotalPhysicalMemorySizeInMB() {
int memorySizeInMB;
try {
long memorySizeInBytes = ((com.sun.management.OperatingSystemMXBean) ManagementFactory
.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
memorySizeInMB = (int) (memorySizeInBytes / BYTES_IN_... | java | public static int getTotalPhysicalMemorySizeInMB() {
int memorySizeInMB;
try {
long memorySizeInBytes = ((com.sun.management.OperatingSystemMXBean) ManagementFactory
.getOperatingSystemMXBean()).getTotalPhysicalMemorySize();
memorySizeInMB = (int) (memorySizeInBytes / BYTES_IN_... | [
"public",
"static",
"int",
"getTotalPhysicalMemorySizeInMB",
"(",
")",
"{",
"int",
"memorySizeInMB",
";",
"try",
"{",
"long",
"memorySizeInBytes",
"=",
"(",
"(",
"com",
".",
"sun",
".",
"management",
".",
"OperatingSystemMXBean",
")",
"ManagementFactory",
".",
"... | Returns the total amount of physical memory on the current machine in megabytes.
Some JVMs may not support the underlying API call.
@return memory size in MB if the call succeeds; -1 otherwise | [
"Returns",
"the",
"total",
"amount",
"of",
"physical",
"memory",
"on",
"the",
"current",
"machine",
"in",
"megabytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/MemoryUtils.java#L106-L119 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java | AllocatedEvaluatorBridge.submitContextAndTaskString | public void submitContextAndTaskString(final String evaluatorConfigurationString,
final String contextConfigurationString,
final String taskConfigurationString) {
final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:s... | java | public void submitContextAndTaskString(final String evaluatorConfigurationString,
final String contextConfigurationString,
final String taskConfigurationString) {
final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:s... | [
"public",
"void",
"submitContextAndTaskString",
"(",
"final",
"String",
"evaluatorConfigurationString",
",",
"final",
"String",
"contextConfigurationString",
",",
"final",
"String",
"taskConfigurationString",
")",
"{",
"final",
"DateFormat",
"dateFormat",
"=",
"new",
"Sim... | Bridge function for REEF .NET to submit context and task configurations for the allocated evaluator.
@param evaluatorConfigurationString the evaluator configuration from .NET.
@param contextConfigurationString the context configuration from .NET.
@param taskConfigurationString the task configuration from .NET. | [
"Bridge",
"function",
"for",
"REEF",
".",
"NET",
"to",
"submit",
"context",
"and",
"task",
"configurations",
"for",
"the",
"allocated",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java#L64-L86 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java | AllocatedEvaluatorBridge.submitContextString | public void submitContextString(final String evaluatorConfigurationString,
final String contextConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw new RuntimeException("empty evaluatorConfigurationString provided.");
}
if (contextConfigurationSt... | java | public void submitContextString(final String evaluatorConfigurationString,
final String contextConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw new RuntimeException("empty evaluatorConfigurationString provided.");
}
if (contextConfigurationSt... | [
"public",
"void",
"submitContextString",
"(",
"final",
"String",
"evaluatorConfigurationString",
",",
"final",
"String",
"contextConfigurationString",
")",
"{",
"if",
"(",
"evaluatorConfigurationString",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"RuntimeExce... | Bridge function for REEF .NET to submit context configuration for the allocated evaluator.
@param evaluatorConfigurationString the evaluator configuration from .NET.
@param contextConfigurationString the context configuration from .NET. | [
"Bridge",
"function",
"for",
"REEF",
".",
"NET",
"to",
"submit",
"context",
"configuration",
"for",
"the",
"allocated",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java#L93-L107 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java | AllocatedEvaluatorBridge.submitContextAndServiceString | public void submitContextAndServiceString(final String evaluatorConfigurationString,
final String contextConfigurationString,
final String serviceConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw n... | java | public void submitContextAndServiceString(final String evaluatorConfigurationString,
final String contextConfigurationString,
final String serviceConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw n... | [
"public",
"void",
"submitContextAndServiceString",
"(",
"final",
"String",
"evaluatorConfigurationString",
",",
"final",
"String",
"contextConfigurationString",
",",
"final",
"String",
"serviceConfigurationString",
")",
"{",
"if",
"(",
"evaluatorConfigurationString",
".",
"... | Bridge function for REEF .NET to submit context and service configurations for the allocated evaluator.
@param evaluatorConfigurationString the evaluator configuration from .NET.
@param contextConfigurationString the context configuration from .NET.
@param serviceConfigurationString the service configuration from .NET. | [
"Bridge",
"function",
"for",
"REEF",
".",
"NET",
"to",
"submit",
"context",
"and",
"service",
"configurations",
"for",
"the",
"allocated",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java#L115-L133 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java | AllocatedEvaluatorBridge.submitContextAndServiceAndTaskString | public void submitContextAndServiceAndTaskString(
final String evaluatorConfigurationString,
final String contextConfigurationString,
final String serviceConfigurationString,
final String taskConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw new RuntimeExceptio... | java | public void submitContextAndServiceAndTaskString(
final String evaluatorConfigurationString,
final String contextConfigurationString,
final String serviceConfigurationString,
final String taskConfigurationString) {
if (evaluatorConfigurationString.isEmpty()) {
throw new RuntimeExceptio... | [
"public",
"void",
"submitContextAndServiceAndTaskString",
"(",
"final",
"String",
"evaluatorConfigurationString",
",",
"final",
"String",
"contextConfigurationString",
",",
"final",
"String",
"serviceConfigurationString",
",",
"final",
"String",
"taskConfigurationString",
")",
... | Bridge function for REEF .NET to submit context, service. and task configurations for the allocated evaluator.
@param evaluatorConfigurationString the evaluator configuration from .NET.
@param contextConfigurationString the context configuration from .NET.
@param serviceConfigurationString the service configuration fro... | [
"Bridge",
"function",
"for",
"REEF",
".",
"NET",
"to",
"submit",
"context",
"service",
".",
"and",
"task",
"configurations",
"for",
"the",
"allocated",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java#L142-L165 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java | AllocatedEvaluatorBridge.getEvaluatorDescriptorString | public String getEvaluatorDescriptorString() {
final String descriptorString =
Utilities.getEvaluatorDescriptorString(jallocatedEvaluator.getEvaluatorDescriptor());
LOG.log(Level.INFO, "allocated evaluator - serialized evaluator descriptor: " + descriptorString);
return descriptorString;
} | java | public String getEvaluatorDescriptorString() {
final String descriptorString =
Utilities.getEvaluatorDescriptorString(jallocatedEvaluator.getEvaluatorDescriptor());
LOG.log(Level.INFO, "allocated evaluator - serialized evaluator descriptor: " + descriptorString);
return descriptorString;
} | [
"public",
"String",
"getEvaluatorDescriptorString",
"(",
")",
"{",
"final",
"String",
"descriptorString",
"=",
"Utilities",
".",
"getEvaluatorDescriptorString",
"(",
"jallocatedEvaluator",
".",
"getEvaluatorDescriptor",
"(",
")",
")",
";",
"LOG",
".",
"log",
"(",
"L... | Gets the serialized evaluator descriptor from the Java allocated evaluator.
@return the serialized evaluator descriptor. | [
"Gets",
"the",
"serialized",
"evaluator",
"descriptor",
"from",
"the",
"Java",
"allocated",
"evaluator",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/AllocatedEvaluatorBridge.java#L171-L176 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java | GraphvizInjectionPlanVisitor.getGraphvizString | public static String getGraphvizString(
final InjectionPlan<?> injectionPlan, final boolean showLegend) {
final GraphvizInjectionPlanVisitor visitor = new GraphvizInjectionPlanVisitor(showLegend);
Walk.preorder(visitor, visitor, injectionPlan);
return visitor.toString();
} | java | public static String getGraphvizString(
final InjectionPlan<?> injectionPlan, final boolean showLegend) {
final GraphvizInjectionPlanVisitor visitor = new GraphvizInjectionPlanVisitor(showLegend);
Walk.preorder(visitor, visitor, injectionPlan);
return visitor.toString();
} | [
"public",
"static",
"String",
"getGraphvizString",
"(",
"final",
"InjectionPlan",
"<",
"?",
">",
"injectionPlan",
",",
"final",
"boolean",
"showLegend",
")",
"{",
"final",
"GraphvizInjectionPlanVisitor",
"visitor",
"=",
"new",
"GraphvizInjectionPlanVisitor",
"(",
"sho... | Produce a Graphviz DOT string for a given TANG injection plan.
@param injectionPlan TANG injection plan.
@param showLegend if true, show legend on the graph.
@return Injection plan represented as a string in Graphviz DOT format. | [
"Produce",
"a",
"Graphviz",
"DOT",
"string",
"for",
"a",
"given",
"TANG",
"injection",
"plan",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java#L73-L78 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java | GraphvizInjectionPlanVisitor.visit | @Override
public boolean visit(final Constructor<?> node) {
this.graphStr
.append(" \"")
.append(node.getClass())
.append('_')
.append(node.getNode().getName())
.append("\" [label=\"")
.append(node.getNode().getName())
.append("\", shape=box];\n");
retu... | java | @Override
public boolean visit(final Constructor<?> node) {
this.graphStr
.append(" \"")
.append(node.getClass())
.append('_')
.append(node.getNode().getName())
.append("\" [label=\"")
.append(node.getNode().getName())
.append("\", shape=box];\n");
retu... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"Constructor",
"<",
"?",
">",
"node",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \\\"\"",
")",
".",
"append",
"(",
"node",
".",
"getClass",
"(",
")",
")",
".",
"append",
"(... | Process current injection plan node of Constructor type.
@param node Current injection plan node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"injection",
"plan",
"node",
"of",
"Constructor",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java#L86-L97 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java | GraphvizInjectionPlanVisitor.visit | @Override
public boolean visit(final JavaInstance<?> node) {
this.graphStr
.append(" \"")
.append(node.getClass())
.append('_')
.append(node.getNode().getName())
.append("\" [label=\"")
.append(node.getNode().getName())
.append(" = ")
.append(node.g... | java | @Override
public boolean visit(final JavaInstance<?> node) {
this.graphStr
.append(" \"")
.append(node.getClass())
.append('_')
.append(node.getNode().getName())
.append("\" [label=\"")
.append(node.getNode().getName())
.append(" = ")
.append(node.g... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"JavaInstance",
"<",
"?",
">",
"node",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \\\"\"",
")",
".",
"append",
"(",
"node",
".",
"getClass",
"(",
")",
")",
".",
"append",
"... | Process current injection plan node of JavaInstance type.
@param node Current injection plan node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"injection",
"plan",
"node",
"of",
"JavaInstance",
"type",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java#L105-L118 | train |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java | GraphvizInjectionPlanVisitor.visit | @Override
public boolean visit(final InjectionPlan<?> nodeFrom, final InjectionPlan<?> nodeTo) {
this.graphStr
.append(" \"")
.append(nodeFrom.getClass())
.append('_')
.append(nodeFrom.getNode().getName())
.append("\" -> \"")
.append(nodeTo.getClass())
.app... | java | @Override
public boolean visit(final InjectionPlan<?> nodeFrom, final InjectionPlan<?> nodeTo) {
this.graphStr
.append(" \"")
.append(nodeFrom.getClass())
.append('_')
.append(nodeFrom.getNode().getName())
.append("\" -> \"")
.append(nodeTo.getClass())
.app... | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"InjectionPlan",
"<",
"?",
">",
"nodeFrom",
",",
"final",
"InjectionPlan",
"<",
"?",
">",
"nodeTo",
")",
"{",
"this",
".",
"graphStr",
".",
"append",
"(",
"\" \\\"\"",
")",
".",
"append",
"(",... | Process current edge of the injection plan.
@param nodeFrom Current injection plan node.
@param nodeTo Destination injection plan node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"edge",
"of",
"the",
"injection",
"plan",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizInjectionPlanVisitor.java#L146-L159 | train |
apache/reef | lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/Launch.java | Launch.main | public static void main(final String[] args) {
LOG.log(Level.INFO, "Entering Launch at :::" + new Date());
try {
if (args == null || args.length == 0) {
throw new IllegalArgumentException("No arguments provided, at least a clrFolder should be supplied.");
}
final File dotNetFolder = ne... | java | public static void main(final String[] args) {
LOG.log(Level.INFO, "Entering Launch at :::" + new Date());
try {
if (args == null || args.length == 0) {
throw new IllegalArgumentException("No arguments provided, at least a clrFolder should be supplied.");
}
final File dotNetFolder = ne... | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Entering Launch at :::\"",
"+",
"new",
"Date",
"(",
")",
")",
";",
"try",
"{",
"if",
"(",
"args",
"==",
"n... | Main method that starts the CLR Bridge from Java.
@param args command line parameters. | [
"Main",
"method",
"that",
"starts",
"the",
"CLR",
"Bridge",
"from",
"Java",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-java/src/main/java/org/apache/reef/javabridge/generic/Launch.java#L141-L175 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextClientCodeException.java | ContextClientCodeException.getIdentifier | public static String getIdentifier(final Configuration c) {
try {
return Tang.Factory.getTang().newInjector(c).getNamedInstance(
ContextIdentifier.class);
} catch (final InjectionException e) {
throw new RuntimeException("Unable to determine context identifier. Giving up.", e);
}
} | java | public static String getIdentifier(final Configuration c) {
try {
return Tang.Factory.getTang().newInjector(c).getNamedInstance(
ContextIdentifier.class);
} catch (final InjectionException e) {
throw new RuntimeException("Unable to determine context identifier. Giving up.", e);
}
} | [
"public",
"static",
"String",
"getIdentifier",
"(",
"final",
"Configuration",
"c",
")",
"{",
"try",
"{",
"return",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"c",
")",
".",
"getNamedInstance",
"(",
"ContextIdentifier",
".",
... | Extracts a context id from the given configuration.
@param c
@return the context id in the given configuration.
@throws RuntimeException if the configuration can't be parsed. | [
"Extracts",
"a",
"context",
"id",
"from",
"the",
"given",
"configuration",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/context/ContextClientCodeException.java#L56-L63 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeImpl.java | LoggingScopeImpl.log | private void log(final String message) {
if (this.optionalParams.isPresent()) {
logger.log(logLevel, message, params);
} else {
logger.log(logLevel, message);
}
} | java | private void log(final String message) {
if (this.optionalParams.isPresent()) {
logger.log(logLevel, message, params);
} else {
logger.log(logLevel, message);
}
} | [
"private",
"void",
"log",
"(",
"final",
"String",
"message",
")",
"{",
"if",
"(",
"this",
".",
"optionalParams",
".",
"isPresent",
"(",
")",
")",
"{",
"logger",
".",
"log",
"(",
"logLevel",
",",
"message",
",",
"params",
")",
";",
"}",
"else",
"{",
... | Log message.
@param message | [
"Log",
"message",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LoggingScopeImpl.java#L97-L103 | train |
apache/reef | lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java | RunningWorkers.getWhereTaskletWasScheduledTo | String getWhereTaskletWasScheduledTo(final int taskletId) {
for (final Map.Entry<String, VortexWorkerManager> entry : runningWorkers.entrySet()) {
final String workerId = entry.getKey();
final VortexWorkerManager vortexWorkerManager = entry.getValue();
if (vortexWorkerManager.containsTasklet(taskl... | java | String getWhereTaskletWasScheduledTo(final int taskletId) {
for (final Map.Entry<String, VortexWorkerManager> entry : runningWorkers.entrySet()) {
final String workerId = entry.getKey();
final VortexWorkerManager vortexWorkerManager = entry.getValue();
if (vortexWorkerManager.containsTasklet(taskl... | [
"String",
"getWhereTaskletWasScheduledTo",
"(",
"final",
"int",
"taskletId",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"VortexWorkerManager",
">",
"entry",
":",
"runningWorkers",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"St... | Find where a tasklet is scheduled to.
@param taskletId id of the tasklet in question
@return id of the worker (null if the tasklet was not scheduled to any worker) | [
"Find",
"where",
"a",
"tasklet",
"is",
"scheduled",
"to",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-applications/reef-vortex/src/main/java/org/apache/reef/vortex/driver/RunningWorkers.java#L256-L265 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java | ThreadLogger.logThreads | public static void logThreads(
final Logger logger, final Level level, final String prefix,
final String threadPrefix, final String stackElementPrefix) {
if (logger.isLoggable(level)) {
logger.log(level, getFormattedThreadList(prefix, threadPrefix, stackElementPrefix));
}
} | java | public static void logThreads(
final Logger logger, final Level level, final String prefix,
final String threadPrefix, final String stackElementPrefix) {
if (logger.isLoggable(level)) {
logger.log(level, getFormattedThreadList(prefix, threadPrefix, stackElementPrefix));
}
} | [
"public",
"static",
"void",
"logThreads",
"(",
"final",
"Logger",
"logger",
",",
"final",
"Level",
"level",
",",
"final",
"String",
"prefix",
",",
"final",
"String",
"threadPrefix",
",",
"final",
"String",
"stackElementPrefix",
")",
"{",
"if",
"(",
"logger",
... | Logs the currently active threads and their stack trace to the given Logger and Level.
@param logger the Logger instance to log to.
@param level the Level to log into.
@param prefix a prefix of the log message.
@param threadPrefix logged before each thread, e.g. "\n\t" to cre... | [
"Logs",
"the",
"currently",
"active",
"threads",
"and",
"their",
"stack",
"trace",
"to",
"the",
"given",
"Logger",
"and",
"Level",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java#L57-L64 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java | ThreadLogger.getFormattedThreadList | public static String getFormattedThreadList(
final String prefix, final String threadPrefix, final String stackElementPrefix) {
// Sort by thread name
final TreeMap<String, StackTraceElement[]> threadNames = new TreeMap<>();
for (final Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStack... | java | public static String getFormattedThreadList(
final String prefix, final String threadPrefix, final String stackElementPrefix) {
// Sort by thread name
final TreeMap<String, StackTraceElement[]> threadNames = new TreeMap<>();
for (final Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStack... | [
"public",
"static",
"String",
"getFormattedThreadList",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"threadPrefix",
",",
"final",
"String",
"stackElementPrefix",
")",
"{",
"// Sort by thread name",
"final",
"TreeMap",
"<",
"String",
",",
"StackTraceEleme... | Produces a String representation of the currently running threads.
@param prefix The prefix of the string returned.
@param threadPrefix Printed before each thread, e.g. "\n\t" to create an indented list.
@param stackElementPrefix Printed before each stack trace element, e.g. "\n\t\t" to create an ind... | [
"Produces",
"a",
"String",
"representation",
"of",
"the",
"currently",
"running",
"threads",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java#L74-L102 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java | ThreadLogger.getFormattedDeadlockInfo | public static String getFormattedDeadlockInfo(
final String prefix, final String threadPrefix, final String stackElementPrefix) {
final StringBuilder message = new StringBuilder(prefix);
final DeadlockInfo deadlockInfo = new DeadlockInfo();
final ThreadInfo[] deadlockedThreads = deadlockInfo.getDead... | java | public static String getFormattedDeadlockInfo(
final String prefix, final String threadPrefix, final String stackElementPrefix) {
final StringBuilder message = new StringBuilder(prefix);
final DeadlockInfo deadlockInfo = new DeadlockInfo();
final ThreadInfo[] deadlockedThreads = deadlockInfo.getDead... | [
"public",
"static",
"String",
"getFormattedDeadlockInfo",
"(",
"final",
"String",
"prefix",
",",
"final",
"String",
"threadPrefix",
",",
"final",
"String",
"stackElementPrefix",
")",
"{",
"final",
"StringBuilder",
"message",
"=",
"new",
"StringBuilder",
"(",
"prefix... | Produces a String representation of threads that are deadlocked, including lock information.
@param prefix The prefix of the string returned.
@param threadPrefix Printed before each thread, e.g. "\n\t" to create an indented list.
@param stackElementPrefix Printed before each stack trace element, e.g. ... | [
"Produces",
"a",
"String",
"representation",
"of",
"threads",
"that",
"are",
"deadlocked",
"including",
"lock",
"information",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/ThreadLogger.java#L118-L155 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java | TFileParser.parseOneFile | void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputWriter);
scanner.advance();
}
}
} | java | void parseOneFile(final Path inputPath, final Writer outputWriter) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputWriter);
scanner.advance();
}
}
} | [
"void",
"parseOneFile",
"(",
"final",
"Path",
"inputPath",
",",
"final",
"Writer",
"outputWriter",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"TFile",
".",
"Reader",
".",
"Scanner",
"scanner",
"=",
"this",
".",
"getScanner",
"(",
"inputPath",
")... | Parses the given file and writes its contents into the outputWriter for all logs in it.
@param inputPath
@param outputWriter
@throws IOException | [
"Parses",
"the",
"given",
"file",
"and",
"writes",
"its",
"contents",
"into",
"the",
"outputWriter",
"for",
"all",
"logs",
"in",
"it",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java#L52-L59 | train |
apache/reef | lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java | TFileParser.parseOneFile | void parseOneFile(final Path inputPath, final File outputFolder) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputFolder);
scanner.advance();
}
}
} | java | void parseOneFile(final Path inputPath, final File outputFolder) throws IOException {
try (final TFile.Reader.Scanner scanner = this.getScanner(inputPath)) {
while (!scanner.atEnd()) {
new LogFileEntry(scanner.entry()).write(outputFolder);
scanner.advance();
}
}
} | [
"void",
"parseOneFile",
"(",
"final",
"Path",
"inputPath",
",",
"final",
"File",
"outputFolder",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"TFile",
".",
"Reader",
".",
"Scanner",
"scanner",
"=",
"this",
".",
"getScanner",
"(",
"inputPath",
")",... | Parses the given file and stores the logs for each container in a file named after the container in the given.
outputFolder
@param inputPath
@param outputFolder
@throws IOException | [
"Parses",
"the",
"given",
"file",
"and",
"stores",
"the",
"logs",
"for",
"each",
"container",
"in",
"a",
"file",
"named",
"after",
"the",
"container",
"in",
"the",
"given",
".",
"outputFolder"
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-hdinsight/src/main/java/org/apache/reef/runtime/hdinsight/cli/TFileParser.java#L69-L76 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSMessageCodec.java | NSMessageCodec.encode | @Override
public byte[] encode(final NSMessage<T> obj) {
if (isStreamingCodec) {
final StreamingCodec<T> streamingCodec = (StreamingCodec<T>) codec;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
try (DataOutputStream daos = new DataOutputStream(baos)) {
daos.writeU... | java | @Override
public byte[] encode(final NSMessage<T> obj) {
if (isStreamingCodec) {
final StreamingCodec<T> streamingCodec = (StreamingCodec<T>) codec;
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
try (DataOutputStream daos = new DataOutputStream(baos)) {
daos.writeU... | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"encode",
"(",
"final",
"NSMessage",
"<",
"T",
">",
"obj",
")",
"{",
"if",
"(",
"isStreamingCodec",
")",
"{",
"final",
"StreamingCodec",
"<",
"T",
">",
"streamingCodec",
"=",
"(",
"StreamingCodec",
"<",
"T",
... | Encodes a network service message to bytes.
@param obj a message
@return bytes | [
"Encodes",
"a",
"network",
"service",
"message",
"to",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSMessageCodec.java#L63-L91 | train |
apache/reef | lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSMessageCodec.java | NSMessageCodec.decode | @Override
public NSMessage<T> decode(final byte[] buf) {
if (isStreamingCodec) {
final StreamingCodec<T> streamingCodec = (StreamingCodec<T>) codec;
try (ByteArrayInputStream bais = new ByteArrayInputStream(buf)) {
try (DataInputStream dais = new DataInputStream(bais)) {
final Identi... | java | @Override
public NSMessage<T> decode(final byte[] buf) {
if (isStreamingCodec) {
final StreamingCodec<T> streamingCodec = (StreamingCodec<T>) codec;
try (ByteArrayInputStream bais = new ByteArrayInputStream(buf)) {
try (DataInputStream dais = new DataInputStream(bais)) {
final Identi... | [
"@",
"Override",
"public",
"NSMessage",
"<",
"T",
">",
"decode",
"(",
"final",
"byte",
"[",
"]",
"buf",
")",
"{",
"if",
"(",
"isStreamingCodec",
")",
"{",
"final",
"StreamingCodec",
"<",
"T",
">",
"streamingCodec",
"=",
"(",
"StreamingCodec",
"<",
"T",
... | Decodes a network service message from bytes.
@param buf bytes
@return a message | [
"Decodes",
"a",
"network",
"service",
"message",
"from",
"bytes",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/impl/NSMessageCodec.java#L99-L131 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskLifeCycleHandlers.java | TaskLifeCycleHandlers.beforeTaskStart | @SuppressWarnings("checkstyle:illegalcatch")
public void beforeTaskStart() throws TaskStartHandlerFailure {
LOG.log(Level.FINEST, "Sending TaskStart event to the registered event handlers.");
for (final EventHandler<TaskStart> startHandler : this.taskStartHandlers) {
try {
startHandler.onNext(th... | java | @SuppressWarnings("checkstyle:illegalcatch")
public void beforeTaskStart() throws TaskStartHandlerFailure {
LOG.log(Level.FINEST, "Sending TaskStart event to the registered event handlers.");
for (final EventHandler<TaskStart> startHandler : this.taskStartHandlers) {
try {
startHandler.onNext(th... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"public",
"void",
"beforeTaskStart",
"(",
")",
"throws",
"TaskStartHandlerFailure",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Sending TaskStart event to the registered event handlers.\"",
... | Sends the TaskStart event to the handlers for it. | [
"Sends",
"the",
"TaskStart",
"event",
"to",
"the",
"handlers",
"for",
"it",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskLifeCycleHandlers.java#L64-L75 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskLifeCycleHandlers.java | TaskLifeCycleHandlers.afterTaskExit | @SuppressWarnings("checkstyle:illegalcatch")
public void afterTaskExit() throws TaskStopHandlerFailure {
LOG.log(Level.FINEST, "Sending TaskStop event to the registered event handlers.");
for (final EventHandler<TaskStop> stopHandler : this.taskStopHandlers) {
try {
stopHandler.onNext(this.taskS... | java | @SuppressWarnings("checkstyle:illegalcatch")
public void afterTaskExit() throws TaskStopHandlerFailure {
LOG.log(Level.FINEST, "Sending TaskStop event to the registered event handlers.");
for (final EventHandler<TaskStop> stopHandler : this.taskStopHandlers) {
try {
stopHandler.onNext(this.taskS... | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalcatch\"",
")",
"public",
"void",
"afterTaskExit",
"(",
")",
"throws",
"TaskStopHandlerFailure",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Sending TaskStop event to the registered event handlers.\"",
")"... | Sends the TaskStop event to the handlers for it. | [
"Sends",
"the",
"TaskStop",
"event",
"to",
"the",
"handlers",
"for",
"it",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/evaluator/task/TaskLifeCycleHandlers.java#L80-L91 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyLink.java | NettyLink.write | @Override
public void write(final T message) {
LOG.log(Level.FINEST, "write {0} :: {1}", new Object[] {channel, message});
final ChannelFuture future = channel.writeAndFlush(Unpooled.wrappedBuffer(encoder.encode(message)));
if (listener != null) {
future.addListener(new NettyChannelFutureListener<>... | java | @Override
public void write(final T message) {
LOG.log(Level.FINEST, "write {0} :: {1}", new Object[] {channel, message});
final ChannelFuture future = channel.writeAndFlush(Unpooled.wrappedBuffer(encoder.encode(message)));
if (listener != null) {
future.addListener(new NettyChannelFutureListener<>... | [
"@",
"Override",
"public",
"void",
"write",
"(",
"final",
"T",
"message",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"write {0} :: {1}\"",
",",
"new",
"Object",
"[",
"]",
"{",
"channel",
",",
"message",
"}",
")",
";",
"final",
"... | Writes the message to this link.
@param message the message | [
"Writes",
"the",
"message",
"to",
"this",
"link",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyLink.java#L77-L84 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java | REEFLauncher.readConfigurationFromDisk | private static Configuration readConfigurationFromDisk(
final String configPath, final ConfigurationSerializer serializer) {
LOG.log(Level.FINER, "Loading configuration file: {0}", configPath);
final File evaluatorConfigFile = new File(configPath);
if (!evaluatorConfigFile.exists()) {
thr... | java | private static Configuration readConfigurationFromDisk(
final String configPath, final ConfigurationSerializer serializer) {
LOG.log(Level.FINER, "Loading configuration file: {0}", configPath);
final File evaluatorConfigFile = new File(configPath);
if (!evaluatorConfigFile.exists()) {
thr... | [
"private",
"static",
"Configuration",
"readConfigurationFromDisk",
"(",
"final",
"String",
"configPath",
",",
"final",
"ConfigurationSerializer",
"serializer",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINER",
",",
"\"Loading configuration file: {0}\"",
",",
"c... | Read configuration from a given file and deserialize it
into Tang configuration object that can be used for injection.
Configuration is currently serialized using Avro.
This method also prints full deserialized configuration into log.
@param configPath Path to the local file that contains serialized configuration
of a ... | [
"Read",
"configuration",
"from",
"a",
"given",
"file",
"and",
"deserialize",
"it",
"into",
"Tang",
"configuration",
"object",
"that",
"can",
"be",
"used",
"for",
"injection",
".",
"Configuration",
"is",
"currently",
"serialized",
"using",
"Avro",
".",
"This",
... | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java#L124-L153 | train |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceRequestQueue.java | ResourceRequestQueue.satisfyOne | synchronized ResourceRequestEvent satisfyOne() {
final ResourceRequest req = this.requestQueue.element();
req.satisfyOne();
if (req.isSatisfied()) {
this.requestQueue.poll();
}
return req.getRequestProto();
} | java | synchronized ResourceRequestEvent satisfyOne() {
final ResourceRequest req = this.requestQueue.element();
req.satisfyOne();
if (req.isSatisfied()) {
this.requestQueue.poll();
}
return req.getRequestProto();
} | [
"synchronized",
"ResourceRequestEvent",
"satisfyOne",
"(",
")",
"{",
"final",
"ResourceRequest",
"req",
"=",
"this",
".",
"requestQueue",
".",
"element",
"(",
")",
";",
"req",
".",
"satisfyOne",
"(",
")",
";",
"if",
"(",
"req",
".",
"isSatisfied",
"(",
")"... | Satisfies one resource for the front-most request. If that satisfies the
request, it is removed from the queue. | [
"Satisfies",
"one",
"resource",
"for",
"the",
"front",
"-",
"most",
"request",
".",
"If",
"that",
"satisfies",
"the",
"request",
"it",
"is",
"removed",
"from",
"the",
"queue",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/driver/ResourceRequestQueue.java#L57-L64 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/impl/MessageSerializerImpl.java | MessageSerializerImpl.serialize | public void serialize(final ByteArrayOutputStream outputStream,
final SpecificRecord message, final long sequence) throws IOException {
// Binary encoder for both the header and message.
final BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(outputStream, null);
// Write th... | java | public void serialize(final ByteArrayOutputStream outputStream,
final SpecificRecord message, final long sequence) throws IOException {
// Binary encoder for both the header and message.
final BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(outputStream, null);
// Write th... | [
"public",
"void",
"serialize",
"(",
"final",
"ByteArrayOutputStream",
"outputStream",
",",
"final",
"SpecificRecord",
"message",
",",
"final",
"long",
"sequence",
")",
"throws",
"IOException",
"{",
"// Binary encoder for both the header and message.",
"final",
"BinaryEncode... | Deserialize messages of type TMessage from input outputStream.
@param outputStream A ByteArrayOutputStream where the message to
be serialized will be written.
@param message An Avro message class which implements the Avro SpcificRecord interface.
@param sequence The numerical position of the message in the outgoing mes... | [
"Deserialize",
"messages",
"of",
"type",
"TMessage",
"from",
"input",
"outputStream",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/avro/impl/MessageSerializerImpl.java#L59-L67 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/RunningJobImpl.java | RunningJobImpl.onJobFailure | private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED;
final String id = this.jobId;
final Optional<byte[]> data = jobStatusProto.hasException() ?
Optional.of(jobStatusProto.getException().toByteArray()) :
... | java | private synchronized void onJobFailure(final JobStatusProto jobStatusProto) {
assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED;
final String id = this.jobId;
final Optional<byte[]> data = jobStatusProto.hasException() ?
Optional.of(jobStatusProto.getException().toByteArray()) :
... | [
"private",
"synchronized",
"void",
"onJobFailure",
"(",
"final",
"JobStatusProto",
"jobStatusProto",
")",
"{",
"assert",
"jobStatusProto",
".",
"getState",
"(",
")",
"==",
"ReefServiceProtos",
".",
"State",
".",
"FAILED",
";",
"final",
"String",
"id",
"=",
"this... | Inform the client of a failed job.
@param jobStatusProto status of the failed job | [
"Inform",
"the",
"client",
"of",
"a",
"failed",
"job",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/RunningJobImpl.java#L146-L166 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java | DFSEvaluatorPreserver.recoverEvaluators | @Override
public synchronized Set<String> recoverEvaluators() {
final Set<String> expectedContainers = new HashSet<>();
try {
if (this.fileSystem == null || this.changeLogLocation == null) {
LOG.log(Level.WARNING, "Unable to recover evaluators due to failure to instantiate FileSystem. Returning ... | java | @Override
public synchronized Set<String> recoverEvaluators() {
final Set<String> expectedContainers = new HashSet<>();
try {
if (this.fileSystem == null || this.changeLogLocation == null) {
LOG.log(Level.WARNING, "Unable to recover evaluators due to failure to instantiate FileSystem. Returning ... | [
"@",
"Override",
"public",
"synchronized",
"Set",
"<",
"String",
">",
"recoverEvaluators",
"(",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"expectedContainers",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"fileSyste... | Recovers the set of evaluators that are alive. | [
"Recovers",
"the",
"set",
"of",
"evaluators",
"that",
"are",
"alive",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java#L127-L166 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java | DFSEvaluatorPreserver.recordAllocatedEvaluator | @Override
public synchronized void recordAllocatedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = ADD_FLAG + id + System.lineSeparator();
this.logContainerChange(entry);
}
} | java | @Override
public synchronized void recordAllocatedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = ADD_FLAG + id + System.lineSeparator();
this.logContainerChange(entry);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"recordAllocatedEvaluator",
"(",
"final",
"String",
"id",
")",
"{",
"if",
"(",
"this",
".",
"fileSystem",
"!=",
"null",
"&&",
"this",
".",
"changeLogLocation",
"!=",
"null",
")",
"{",
"final",
"String",
"ent... | Adds the allocated evaluator entry to the evaluator log.
@param id | [
"Adds",
"the",
"allocated",
"evaluator",
"entry",
"to",
"the",
"evaluator",
"log",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java#L172-L178 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java | DFSEvaluatorPreserver.recordRemovedEvaluator | @Override
public synchronized void recordRemovedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = REMOVE_FLAG + id + System.lineSeparator();
this.logContainerChange(entry);
}
} | java | @Override
public synchronized void recordRemovedEvaluator(final String id) {
if (this.fileSystem != null && this.changeLogLocation != null) {
final String entry = REMOVE_FLAG + id + System.lineSeparator();
this.logContainerChange(entry);
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"recordRemovedEvaluator",
"(",
"final",
"String",
"id",
")",
"{",
"if",
"(",
"this",
".",
"fileSystem",
"!=",
"null",
"&&",
"this",
".",
"changeLogLocation",
"!=",
"null",
")",
"{",
"final",
"String",
"entry... | Adds the removed evaluator entry to the evaluator log.
@param id | [
"Adds",
"the",
"removed",
"evaluator",
"entry",
"to",
"the",
"evaluator",
"log",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java#L184-L190 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java | DFSEvaluatorPreserver.close | @Override
public synchronized void close() throws Exception {
if (this.readerWriter != null && !this.writerClosed) {
this.readerWriter.close();
this.writerClosed = true;
}
} | java | @Override
public synchronized void close() throws Exception {
if (this.readerWriter != null && !this.writerClosed) {
this.readerWriter.close();
this.writerClosed = true;
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"this",
".",
"readerWriter",
"!=",
"null",
"&&",
"!",
"this",
".",
"writerClosed",
")",
"{",
"this",
".",
"readerWriter",
".",
"close",
"(",
")",... | Closes the readerWriter, which in turn closes the FileSystem.
@throws Exception | [
"Closes",
"the",
"readerWriter",
"which",
"in",
"turn",
"closes",
"the",
"FileSystem",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/restart/DFSEvaluatorPreserver.java#L229-L235 | train |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java | ReefRunnableProcessObserver.onCleanExit | private void onCleanExit(final String processId) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.DONE)
.setExitCode(0)
.build()
);
} | java | private void onCleanExit(final String processId) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.DONE)
.setExitCode(0)
.build()
);
} | [
"private",
"void",
"onCleanExit",
"(",
"final",
"String",
"processId",
")",
"{",
"this",
".",
"onResourceStatus",
"(",
"ResourceStatusEventImpl",
".",
"newBuilder",
"(",
")",
".",
"setIdentifier",
"(",
"processId",
")",
".",
"setState",
"(",
"State",
".",
"DON... | Inform REEF of a cleanly exited process.
@param processId | [
"Inform",
"REEF",
"of",
"a",
"cleanly",
"exited",
"process",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java#L86-L94 | train |
apache/reef | lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java | ReefRunnableProcessObserver.onUncleanExit | private void onUncleanExit(final String processId, final int exitCode) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.FAILED)
.setExitCode(exitCode)
.build()
);
} | java | private void onUncleanExit(final String processId, final int exitCode) {
this.onResourceStatus(
ResourceStatusEventImpl.newBuilder()
.setIdentifier(processId)
.setState(State.FAILED)
.setExitCode(exitCode)
.build()
);
} | [
"private",
"void",
"onUncleanExit",
"(",
"final",
"String",
"processId",
",",
"final",
"int",
"exitCode",
")",
"{",
"this",
".",
"onResourceStatus",
"(",
"ResourceStatusEventImpl",
".",
"newBuilder",
"(",
")",
".",
"setIdentifier",
"(",
"processId",
")",
".",
... | Inform REEF of an unclean process exit.
@param processId
@param exitCode | [
"Inform",
"REEF",
"of",
"an",
"unclean",
"process",
"exit",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/process/ReefRunnableProcessObserver.java#L102-L110 | train |
apache/reef | lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/DriverClientDispatcher.java | DriverClientDispatcher.dispatch | @SuppressWarnings("checkstyle:illegalCatch")
public Throwable dispatch(final StopTime stopTime) {
try {
for (final EventHandler<StopTime> handler : stopHandlers) {
handler.onNext(stopTime);
}
return null;
} catch (Throwable t) {
return t;
}
} | java | @SuppressWarnings("checkstyle:illegalCatch")
public Throwable dispatch(final StopTime stopTime) {
try {
for (final EventHandler<StopTime> handler : stopHandlers) {
handler.onNext(stopTime);
}
return null;
} catch (Throwable t) {
return t;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:illegalCatch\"",
")",
"public",
"Throwable",
"dispatch",
"(",
"final",
"StopTime",
"stopTime",
")",
"{",
"try",
"{",
"for",
"(",
"final",
"EventHandler",
"<",
"StopTime",
">",
"handler",
":",
"stopHandlers",
")",
"{",
... | We must implement this synchronously in order to catch exceptions and
forward them back via the bridge before the server shuts down, after
this method returns.
@param stopTime stop time | [
"We",
"must",
"implement",
"this",
"synchronously",
"in",
"order",
"to",
"catch",
"exceptions",
"and",
"forward",
"them",
"back",
"via",
"the",
"bridge",
"before",
"the",
"server",
"shuts",
"down",
"after",
"this",
"method",
"returns",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-proto-java/src/main/java/org/apache/reef/bridge/driver/client/DriverClientDispatcher.java#L289-L299 | train |
apache/reef | lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java | REEFExecutor.launchTask | @Override
public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
driver.sendStatusUpdate(TaskStatus.newBuilder()
.setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build())
.setState(TaskState.TASK_STARTING)
.setSlaveId(task.getSlaveId())
.setMessage(... | java | @Override
public void launchTask(final ExecutorDriver driver, final TaskInfo task) {
driver.sendStatusUpdate(TaskStatus.newBuilder()
.setTaskId(TaskID.newBuilder().setValue(this.mesosExecutorId).build())
.setState(TaskState.TASK_STARTING)
.setSlaveId(task.getSlaveId())
.setMessage(... | [
"@",
"Override",
"public",
"void",
"launchTask",
"(",
"final",
"ExecutorDriver",
"driver",
",",
"final",
"TaskInfo",
"task",
")",
"{",
"driver",
".",
"sendStatusUpdate",
"(",
"TaskStatus",
".",
"newBuilder",
"(",
")",
".",
"setTaskId",
"(",
"TaskID",
".",
"n... | We assume a long-running Mesos Task that manages a REEF Evaluator process, leveraging Mesos Executor's interface. | [
"We",
"assume",
"a",
"long",
"-",
"running",
"Mesos",
"Task",
"that",
"manages",
"a",
"REEF",
"Evaluator",
"process",
"leveraging",
"Mesos",
"Executor",
"s",
"interface",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java#L109-L117 | train |
apache/reef | lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java | REEFExecutor.main | public static void main(final String[] args) throws Exception {
final Injector injector = Tang.Factory.getTang().newInjector(parseCommandLine(args));
final REEFExecutor reefExecutor = injector.getInstance(REEFExecutor.class);
reefExecutor.onStart();
} | java | public static void main(final String[] args) throws Exception {
final Injector injector = Tang.Factory.getTang().newInjector(parseCommandLine(args));
final REEFExecutor reefExecutor = injector.getInstance(REEFExecutor.class);
reefExecutor.onStart();
} | [
"public",
"static",
"void",
"main",
"(",
"final",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"final",
"Injector",
"injector",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"parseCommandLine",
"(",
"args",... | The starting point of the executor. | [
"The",
"starting",
"point",
"of",
"the",
"executor",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/evaluator/REEFExecutor.java#L250-L254 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/SecurityTokensReader.java | SecurityTokensReader.addTokensFromFile | void addTokensFromFile(final UserGroupInformation ugi) throws IOException {
LOG.log(Level.FINE, "Reading security tokens from file: {0}", this.securityTokensFile);
try (final FileInputStream stream = new FileInputStream(securityTokensFile)) {
final BinaryDecoder decoder = decoderFactory.binaryDecoder(str... | java | void addTokensFromFile(final UserGroupInformation ugi) throws IOException {
LOG.log(Level.FINE, "Reading security tokens from file: {0}", this.securityTokensFile);
try (final FileInputStream stream = new FileInputStream(securityTokensFile)) {
final BinaryDecoder decoder = decoderFactory.binaryDecoder(str... | [
"void",
"addTokensFromFile",
"(",
"final",
"UserGroupInformation",
"ugi",
")",
"throws",
"IOException",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"FINE",
",",
"\"Reading security tokens from file: {0}\"",
",",
"this",
".",
"securityTokensFile",
")",
";",
"try",
"... | Read tokens from a file and add them to the user's credentials.
@param ugi user's credentials to add tokens to.
@throws IOException if there are errors in reading the tokens' file. | [
"Read",
"tokens",
"from",
"a",
"file",
"and",
"add",
"them",
"to",
"the",
"user",
"s",
"credentials",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/SecurityTokensReader.java#L61-L81 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/UploaderToJobfolder.java | UploaderToJobFolder.makeLocalResourceForJarFile | LocalResource makeLocalResourceForJarFile(final Path path) throws IOException {
final LocalResource localResource = Records.newRecord(LocalResource.class);
final FileStatus status = FileContext.getFileContext(this.fileSystem.getUri()).getFileStatus(path);
localResource.setType(LocalResourceType.ARCHIVE);
... | java | LocalResource makeLocalResourceForJarFile(final Path path) throws IOException {
final LocalResource localResource = Records.newRecord(LocalResource.class);
final FileStatus status = FileContext.getFileContext(this.fileSystem.getUri()).getFileStatus(path);
localResource.setType(LocalResourceType.ARCHIVE);
... | [
"LocalResource",
"makeLocalResourceForJarFile",
"(",
"final",
"Path",
"path",
")",
"throws",
"IOException",
"{",
"final",
"LocalResource",
"localResource",
"=",
"Records",
".",
"newRecord",
"(",
"LocalResource",
".",
"class",
")",
";",
"final",
"FileStatus",
"status... | Creates a LocalResource instance for the JAR file referenced by the given Path.
@param path
@return
@throws IOException | [
"Creates",
"a",
"LocalResource",
"instance",
"for",
"the",
"JAR",
"file",
"referenced",
"by",
"the",
"given",
"Path",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/driver/UploaderToJobfolder.java#L84-L93 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java | LogParser.getFilteredLinesFromFile | public static ArrayList<String> getFilteredLinesFromFile(final String fileName,
final String filter,
final String removeBeforeToken,
final Stri... | java | public static ArrayList<String> getFilteredLinesFromFile(final String fileName,
final String filter,
final String removeBeforeToken,
final Stri... | [
"public",
"static",
"ArrayList",
"<",
"String",
">",
"getFilteredLinesFromFile",
"(",
"final",
"String",
"fileName",
",",
"final",
"String",
"filter",
",",
"final",
"String",
"removeBeforeToken",
",",
"final",
"String",
"removeAfterToken",
")",
"throws",
"IOExceptio... | Get lines from a given file with a specified filter, trim the line by removing strings
before removeBeforeToken and after removeAfterToken.
@param fileName
@param filter
@return
@throws IOException | [
"Get",
"lines",
"from",
"a",
"given",
"file",
"with",
"a",
"specified",
"filter",
"trim",
"the",
"line",
"by",
"removing",
"strings",
"before",
"removeBeforeToken",
"and",
"after",
"removeAfterToken",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java#L66-L101 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java | LogParser.getFilteredLinesFromFile | public static ArrayList<String> getFilteredLinesFromFile(final String fileName, final String filter)
throws IOException {
return getFilteredLinesFromFile(fileName, filter, null, null);
} | java | public static ArrayList<String> getFilteredLinesFromFile(final String fileName, final String filter)
throws IOException {
return getFilteredLinesFromFile(fileName, filter, null, null);
} | [
"public",
"static",
"ArrayList",
"<",
"String",
">",
"getFilteredLinesFromFile",
"(",
"final",
"String",
"fileName",
",",
"final",
"String",
"filter",
")",
"throws",
"IOException",
"{",
"return",
"getFilteredLinesFromFile",
"(",
"fileName",
",",
"filter",
",",
"nu... | get lines from given file with specified filter.
@param fileName
@param filter
@return
@throws IOException | [
"get",
"lines",
"from",
"given",
"file",
"with",
"specified",
"filter",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java#L110-L113 | train |
apache/reef | lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java | LogParser.findStages | public static ArrayList<String> findStages(final ArrayList<String> lines, final String[] stageIndicators) {
final ArrayList<String> stages = new ArrayList<>();
int i = 0;
for (final String line: lines) {
if (line.contains(stageIndicators[i])){
stages.add(stageIndicators[i]);
if (i < s... | java | public static ArrayList<String> findStages(final ArrayList<String> lines, final String[] stageIndicators) {
final ArrayList<String> stages = new ArrayList<>();
int i = 0;
for (final String line: lines) {
if (line.contains(stageIndicators[i])){
stages.add(stageIndicators[i]);
if (i < s... | [
"public",
"static",
"ArrayList",
"<",
"String",
">",
"findStages",
"(",
"final",
"ArrayList",
"<",
"String",
">",
"lines",
",",
"final",
"String",
"[",
"]",
"stageIndicators",
")",
"{",
"final",
"ArrayList",
"<",
"String",
">",
"stages",
"=",
"new",
"Array... | find lines that contain stage indicators. The stageIndicators must be in sequence which appear in the lines.
@param lines
@param stageIndicators
@return | [
"find",
"lines",
"that",
"contain",
"stage",
"indicators",
".",
"The",
"stageIndicators",
"must",
"be",
"in",
"sequence",
"which",
"appear",
"in",
"the",
"lines",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/util/logging/LogParser.java#L140-L153 | train |
apache/reef | lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFNoClient.java | HelloREEFNoClient.runHelloReefWithoutClient | public static void runHelloReefWithoutClient(final Configuration runtimeConf) throws InjectionException {
final REEF reef = Tang.Factory.getTang().newInjector(runtimeConf).getInstance(REEF.class);
final Configuration driverConf = getDriverConfiguration();
reef.submit(driverConf);
} | java | public static void runHelloReefWithoutClient(final Configuration runtimeConf) throws InjectionException {
final REEF reef = Tang.Factory.getTang().newInjector(runtimeConf).getInstance(REEF.class);
final Configuration driverConf = getDriverConfiguration();
reef.submit(driverConf);
} | [
"public",
"static",
"void",
"runHelloReefWithoutClient",
"(",
"final",
"Configuration",
"runtimeConf",
")",
"throws",
"InjectionException",
"{",
"final",
"REEF",
"reef",
"=",
"Tang",
".",
"Factory",
".",
"getTang",
"(",
")",
".",
"newInjector",
"(",
"runtimeConf",... | Used in the HDInsight example.
@param runtimeConf the configuration of the runtime
@throws InjectionException | [
"Used",
"in",
"the",
"HDInsight",
"example",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-examples/src/main/java/org/apache/reef/examples/hello/HelloREEFNoClient.java#L71-L75 | train |
apache/reef | lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/REEFScheduler.java | REEFScheduler.resourceOffers | @Override
@SuppressWarnings("checkstyle:hiddenfield")
public void resourceOffers(final SchedulerDriver driver, final List<Protos.Offer> offers) {
final Map<String, NodeDescriptorEventImpl.Builder> nodeDescriptorEvents = new HashMap<>();
for (final Offer offer : offers) {
if (nodeDescriptorEvents.get(... | java | @Override
@SuppressWarnings("checkstyle:hiddenfield")
public void resourceOffers(final SchedulerDriver driver, final List<Protos.Offer> offers) {
final Map<String, NodeDescriptorEventImpl.Builder> nodeDescriptorEvents = new HashMap<>();
for (final Offer offer : offers) {
if (nodeDescriptorEvents.get(... | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:hiddenfield\"",
")",
"public",
"void",
"resourceOffers",
"(",
"final",
"SchedulerDriver",
"driver",
",",
"final",
"List",
"<",
"Protos",
".",
"Offer",
">",
"offers",
")",
"{",
"final",
"Map",
"<",
"S... | All offers in each batch of offers will be either be launched or declined. | [
"All",
"offers",
"in",
"each",
"batch",
"of",
"offers",
"will",
"be",
"either",
"be",
"launched",
"or",
"declined",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-mesos/src/main/java/org/apache/reef/runtime/mesos/driver/REEFScheduler.java#L160-L187 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java | YarnSubmissionHelper.addLocalResource | public YarnSubmissionHelper addLocalResource(final String resourceName, final LocalResource resource) {
resources.put(resourceName, resource);
return this;
} | java | public YarnSubmissionHelper addLocalResource(final String resourceName, final LocalResource resource) {
resources.put(resourceName, resource);
return this;
} | [
"public",
"YarnSubmissionHelper",
"addLocalResource",
"(",
"final",
"String",
"resourceName",
",",
"final",
"LocalResource",
"resource",
")",
"{",
"resources",
".",
"put",
"(",
"resourceName",
",",
"resource",
")",
";",
"return",
"this",
";",
"}"
] | Add a file to be localized on the driver.
@param resourceName
@param resource
@return | [
"Add",
"a",
"file",
"to",
"be",
"localized",
"on",
"the",
"driver",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L161-L164 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java | YarnSubmissionHelper.setPreserveEvaluators | public YarnSubmissionHelper setPreserveEvaluators(final boolean preserveEvaluators) {
if (preserveEvaluators) {
// when supported, set KeepContainersAcrossApplicationAttempts to be true
// so that when driver (AM) crashes, evaluators will still be running and we can recover later.
if (YarnTypes.is... | java | public YarnSubmissionHelper setPreserveEvaluators(final boolean preserveEvaluators) {
if (preserveEvaluators) {
// when supported, set KeepContainersAcrossApplicationAttempts to be true
// so that when driver (AM) crashes, evaluators will still be running and we can recover later.
if (YarnTypes.is... | [
"public",
"YarnSubmissionHelper",
"setPreserveEvaluators",
"(",
"final",
"boolean",
"preserveEvaluators",
")",
"{",
"if",
"(",
"preserveEvaluators",
")",
"{",
"// when supported, set KeepContainersAcrossApplicationAttempts to be true",
"// so that when driver (AM) crashes, evaluators w... | Set whether or not the resource manager should preserve evaluators across driver restarts.
@param preserveEvaluators
@return | [
"Set",
"whether",
"or",
"not",
"the",
"resource",
"manager",
"should",
"preserve",
"evaluators",
"across",
"driver",
"restarts",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L181-L205 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java | YarnSubmissionHelper.setJobSubmissionEnvMap | public YarnSubmissionHelper setJobSubmissionEnvMap(final Map<String, String> map) {
for (final Map.Entry<String, String> entry : map.entrySet()) {
environmentVariablesMap.put(entry.getKey(), entry.getValue());
}
return this;
} | java | public YarnSubmissionHelper setJobSubmissionEnvMap(final Map<String, String> map) {
for (final Map.Entry<String, String> entry : map.entrySet()) {
environmentVariablesMap.put(entry.getKey(), entry.getValue());
}
return this;
} | [
"public",
"YarnSubmissionHelper",
"setJobSubmissionEnvMap",
"(",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"map",
")",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
"... | Sets environment variable map.
@param map
@return | [
"Sets",
"environment",
"variable",
"map",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L255-L260 | train |
apache/reef | lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java | YarnSubmissionHelper.setJobSubmissionEnvVariable | public YarnSubmissionHelper setJobSubmissionEnvVariable(final String key, final String value) {
environmentVariablesMap.put(key, value);
return this;
} | java | public YarnSubmissionHelper setJobSubmissionEnvVariable(final String key, final String value) {
environmentVariablesMap.put(key, value);
return this;
} | [
"public",
"YarnSubmissionHelper",
"setJobSubmissionEnvVariable",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"value",
")",
"{",
"environmentVariablesMap",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a job submission environment variable.
@param key
@param value
@return | [
"Adds",
"a",
"job",
"submission",
"environment",
"variable",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/YarnSubmissionHelper.java#L268-L271 | train |
apache/reef | lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/LoggingLinkListener.java | LoggingLinkListener.onException | @Override
public void onException(final Throwable cause, final SocketAddress remoteAddress, final T message) {
if (LOG.isLoggable(Level.FINEST)) {
LOG.log(Level.FINEST, "Error sending message " + message + " to " + remoteAddress, cause);
}
} | java | @Override
public void onException(final Throwable cause, final SocketAddress remoteAddress, final T message) {
if (LOG.isLoggable(Level.FINEST)) {
LOG.log(Level.FINEST, "Error sending message " + message + " to " + remoteAddress, cause);
}
} | [
"@",
"Override",
"public",
"void",
"onException",
"(",
"final",
"Throwable",
"cause",
",",
"final",
"SocketAddress",
"remoteAddress",
",",
"final",
"T",
"message",
")",
"{",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINEST",
")",
")",
"{",
... | Called when the sent message to remoteAddress is failed to be transferred. | [
"Called",
"when",
"the",
"sent",
"message",
"to",
"remoteAddress",
"is",
"failed",
"to",
"be",
"transferred",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/LoggingLinkListener.java#L47-L52 | train |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnClusterSubmissionFromCS.java | YarnClusterSubmissionFromCS.fromJobSubmissionParametersFile | static YarnClusterSubmissionFromCS fromJobSubmissionParametersFile(final File yarnClusterAppSubmissionParametersFile,
final File yarnClusterJobSubmissionParametersFile)
throws IOException {
try (final FileInputStream appFileInputStream = new... | java | static YarnClusterSubmissionFromCS fromJobSubmissionParametersFile(final File yarnClusterAppSubmissionParametersFile,
final File yarnClusterJobSubmissionParametersFile)
throws IOException {
try (final FileInputStream appFileInputStream = new... | [
"static",
"YarnClusterSubmissionFromCS",
"fromJobSubmissionParametersFile",
"(",
"final",
"File",
"yarnClusterAppSubmissionParametersFile",
",",
"final",
"File",
"yarnClusterJobSubmissionParametersFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"final",
"FileInputStream",
... | Takes the YARN cluster job submission configuration file, deserializes it, and creates submission object. | [
"Takes",
"the",
"YARN",
"cluster",
"job",
"submission",
"configuration",
"file",
"deserializes",
"it",
"and",
"creates",
"submission",
"object",
"."
] | e2c47121cde21108a602c560cf76565a40d0e916 | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/YarnClusterSubmissionFromCS.java#L255-L264 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.onMeasure | @Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int measuredHeight = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.g... | java | @Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int measuredWidth = MeasureSpec.getSize(widthMeasureSpec);
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
int measuredHeight = MeasureSpec.getSize(heightMeasureSpec);
int heightMode = MeasureSpec.g... | [
"@",
"Override",
"public",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"int",
"measuredWidth",
"=",
"MeasureSpec",
".",
"getSize",
"(",
"widthMeasureSpec",
")",
";",
"int",
"widthMode",
"=",
"MeasureSpec",
".",... | Measure the view to end up as a square, based on the minimum of the height and width. | [
"Measure",
"the",
"view",
"to",
"end",
"up",
"as",
"a",
"square",
"based",
"on",
"the",
"minimum",
"of",
"the",
"height",
"and",
"width",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java#L142-L152 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.setItem | private void setItem(int index, int value) {
if (index == HOUR_INDEX) {
setValueForItem(HOUR_INDEX, value);
int hourDegrees = (value % 12) * HOUR_VALUE_TO_DEGREES_STEP_SIZE;
mHourRadialSelectorView.setSelection(hourDegrees, isHourInnerCircle(value), false);
mHourR... | java | private void setItem(int index, int value) {
if (index == HOUR_INDEX) {
setValueForItem(HOUR_INDEX, value);
int hourDegrees = (value % 12) * HOUR_VALUE_TO_DEGREES_STEP_SIZE;
mHourRadialSelectorView.setSelection(hourDegrees, isHourInnerCircle(value), false);
mHourR... | [
"private",
"void",
"setItem",
"(",
"int",
"index",
",",
"int",
"value",
")",
"{",
"if",
"(",
"index",
"==",
"HOUR_INDEX",
")",
"{",
"setValueForItem",
"(",
"HOUR_INDEX",
",",
"value",
")",
";",
"int",
"hourDegrees",
"=",
"(",
"value",
"%",
"12",
")",
... | Set either the hour or the minute. Will set the internal value, and set the selection. | [
"Set",
"either",
"the",
"hour",
"or",
"the",
"minute",
".",
"Will",
"set",
"the",
"internal",
"value",
"and",
"set",
"the",
"selection",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java#L225-L237 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.setCurrentItemShowing | public void setCurrentItemShowing(int index, boolean animate) {
if (index != HOUR_INDEX && index != MINUTE_INDEX) {
Log.e(TAG, "TimePicker does not support view at index " + index);
return;
}
int lastIndex = getCurrentItemShowing();
mCurrentItemShowing = index;
... | java | public void setCurrentItemShowing(int index, boolean animate) {
if (index != HOUR_INDEX && index != MINUTE_INDEX) {
Log.e(TAG, "TimePicker does not support view at index " + index);
return;
}
int lastIndex = getCurrentItemShowing();
mCurrentItemShowing = index;
... | [
"public",
"void",
"setCurrentItemShowing",
"(",
"int",
"index",
",",
"boolean",
"animate",
")",
"{",
"if",
"(",
"index",
"!=",
"HOUR_INDEX",
"&&",
"index",
"!=",
"MINUTE_INDEX",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"TimePicker does not support view at... | Set either minutes or hours as showing.
@param animate True to animate the transition, false to show with no animation. | [
"Set",
"either",
"minutes",
"or",
"hours",
"as",
"showing",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/RadialPickerLayout.java#L515-L553 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/addon/IAddonBase.java | IAddonBase.attach | public final void attach(T object, IAddon parent) {
if (mObject != null || object == null || mParent != null || parent == null) {
throw new IllegalStateException();
}
mParent = parent;
onAttach(mObject = object);
} | java | public final void attach(T object, IAddon parent) {
if (mObject != null || object == null || mParent != null || parent == null) {
throw new IllegalStateException();
}
mParent = parent;
onAttach(mObject = object);
} | [
"public",
"final",
"void",
"attach",
"(",
"T",
"object",
",",
"IAddon",
"parent",
")",
"{",
"if",
"(",
"mObject",
"!=",
"null",
"||",
"object",
"==",
"null",
"||",
"mParent",
"!=",
"null",
"||",
"parent",
"==",
"null",
")",
"{",
"throw",
"new",
"Ille... | Only for system usage, don't call it! | [
"Only",
"for",
"system",
"usage",
"don",
"t",
"call",
"it!"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/addon/IAddonBase.java#L16-L22 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java | TouchExplorationHelper.setFocusedItem | public void setFocusedItem(T item) {
final int itemId = getIdForItem(item);
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS, null);
} | java | public void setFocusedItem(T item) {
final int itemId = getIdForItem(item);
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS, null);
} | [
"public",
"void",
"setFocusedItem",
"(",
"T",
"item",
")",
"{",
"final",
"int",
"itemId",
"=",
"getIdForItem",
"(",
"item",
")",
";",
"if",
"(",
"itemId",
"==",
"INVALID_ID",
")",
"{",
"return",
";",
"}",
"performAction",
"(",
"itemId",
",",
"Accessibili... | Requests accessibility focus be placed on the specified item.
@param item The item to place focus on. | [
"Requests",
"accessibility",
"focus",
"be",
"placed",
"on",
"the",
"specified",
"item",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java#L97-L104 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java | TouchExplorationHelper.clearFocusedItem | public void clearFocusedItem() {
final int itemId = mFocusedItemId;
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);
} | java | public void clearFocusedItem() {
final int itemId = mFocusedItemId;
if (itemId == INVALID_ID) {
return;
}
performAction(itemId, AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS, null);
} | [
"public",
"void",
"clearFocusedItem",
"(",
")",
"{",
"final",
"int",
"itemId",
"=",
"mFocusedItemId",
";",
"if",
"(",
"itemId",
"==",
"INVALID_ID",
")",
"{",
"return",
";",
"}",
"performAction",
"(",
"itemId",
",",
"AccessibilityNodeInfoCompat",
".",
"ACTION_C... | Clears the current accessibility focused item. | [
"Clears",
"the",
"current",
"accessibility",
"focused",
"item",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java#L109-L116 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java | TouchExplorationHelper.sendEventForItem | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean sendEventForItem(T item, int eventType) {
if (!mManager.isEnabled() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return false;
}
final AccessibilityEvent event = getEventForItem(item, event... | java | @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public boolean sendEventForItem(T item, int eventType) {
if (!mManager.isEnabled() || Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return false;
}
final AccessibilityEvent event = getEventForItem(item, event... | [
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"ICE_CREAM_SANDWICH",
")",
"public",
"boolean",
"sendEventForItem",
"(",
"T",
"item",
",",
"int",
"eventType",
")",
"{",
"if",
"(",
"!",
"mManager",
".",
"isEnabled",
"(",
")",
"||",
"Build",
".",
... | Populates an event of the specified type with information about an item
and attempts to send it up through the view hierarchy.
@param item The item for which to send an event.
@param eventType The type of event to send.
@return {@code true} if the event was sent successfully. | [
"Populates",
"an",
"event",
"of",
"the",
"specified",
"type",
"with",
"information",
"about",
"an",
"item",
"and",
"attempts",
"to",
"send",
"it",
"up",
"through",
"the",
"view",
"hierarchy",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/TouchExplorationHelper.java#L151-L161 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/ListView.java | ListView.drawDivider | void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
final Drawable divider = getDivider();
divider.setBounds(bounds);
divider.draw(canvas);
} | java | void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
final Drawable divider = getDivider();
divider.setBounds(bounds);
divider.draw(canvas);
} | [
"void",
"drawDivider",
"(",
"Canvas",
"canvas",
",",
"Rect",
"bounds",
",",
"int",
"childIndex",
")",
"{",
"final",
"Drawable",
"divider",
"=",
"getDivider",
"(",
")",
";",
"divider",
".",
"setBounds",
"(",
"bounds",
")",
";",
"divider",
".",
"draw",
"("... | O_O This method doesn't override super method, but super class invoke it
instead of android.widget.ListView.drawDivider. It's fucking magic of
dalvik? | [
"O_O",
"This",
"method",
"doesn",
"t",
"override",
"super",
"method",
"but",
"super",
"class",
"invoke",
"it",
"instead",
"of",
"android",
".",
"widget",
".",
"ListView",
".",
"drawDivider",
".",
"It",
"s",
"fucking",
"magic",
"of",
"dalvik?"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/ListView.java#L212-L216 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/TextView.java | TextView.parseFontStyle | @SuppressLint("InlinedApi")
private static Object[] parseFontStyle(Context context, AttributeSet attrs, int defStyleAttr) {
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.TextAppearance, defStyleAttr, 0);
final Object[] result = parseFontStyle(a);
a.re... | java | @SuppressLint("InlinedApi")
private static Object[] parseFontStyle(Context context, AttributeSet attrs, int defStyleAttr) {
final TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.TextAppearance, defStyleAttr, 0);
final Object[] result = parseFontStyle(a);
a.re... | [
"@",
"SuppressLint",
"(",
"\"InlinedApi\"",
")",
"private",
"static",
"Object",
"[",
"]",
"parseFontStyle",
"(",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
")",
"{",
"final",
"TypedArray",
"a",
"=",
"context",
".",
"obtainS... | Looks ugly? Yea, i know. | [
"Looks",
"ugly?",
"Yea",
"i",
"know",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/TextView.java#L48-L55 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/view/menu/MenuBuilder.java | MenuBuilder.removeItemAtInt | private void removeItemAtInt(int index, boolean updateChildrenOnMenuViews) {
if ((index < 0) || (index >= mItems.size())) {
return;
}
mItems.remove(index);
if (updateChildrenOnMenuViews) {
onItemsChanged(true);
}
} | java | private void removeItemAtInt(int index, boolean updateChildrenOnMenuViews) {
if ((index < 0) || (index >= mItems.size())) {
return;
}
mItems.remove(index);
if (updateChildrenOnMenuViews) {
onItemsChanged(true);
}
} | [
"private",
"void",
"removeItemAtInt",
"(",
"int",
"index",
",",
"boolean",
"updateChildrenOnMenuViews",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"0",
")",
"||",
"(",
"index",
">=",
"mItems",
".",
"size",
"(",
")",
")",
")",
"{",
"return",
";",
"}",
"m... | Remove the item at the given index and optionally forces menu views to update.
@param index The index of the item to be removed. If this index is
invalid an exception is thrown.
@param updateChildrenOnMenuViews Whether to force update on menu views. Please make sure you
eventually call this after y... | [
"Remove",
"the",
"item",
"at",
"the",
"given",
"index",
"and",
"optionally",
"forces",
"menu",
"views",
"to",
"update",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/view/menu/MenuBuilder.java#L520-L530 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java | BaseMenuPresenter.updateMenuView | public void updateMenuView(boolean cleared) {
final ViewGroup parent = (ViewGroup) mMenuView;
if (parent == null) {
return;
}
int childIndex = 0;
if (mMenu != null) {
mMenu.flagActionItems();
ArrayList<MenuItemImpl> visibleItems = mMenu.getVis... | java | public void updateMenuView(boolean cleared) {
final ViewGroup parent = (ViewGroup) mMenuView;
if (parent == null) {
return;
}
int childIndex = 0;
if (mMenu != null) {
mMenu.flagActionItems();
ArrayList<MenuItemImpl> visibleItems = mMenu.getVis... | [
"public",
"void",
"updateMenuView",
"(",
"boolean",
"cleared",
")",
"{",
"final",
"ViewGroup",
"parent",
"=",
"(",
"ViewGroup",
")",
"mMenuView",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
";",
"}",
"int",
"childIndex",
"=",
"0",
";",
... | Reuses item views when it can | [
"Reuses",
"item",
"views",
"when",
"it",
"can"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/view/menu/BaseMenuPresenter.java#L83-L121 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/app/ActionBarActivityDelegateBase.java | ActionBarActivityDelegateBase.updateProgressBars | private void updateProgressBars(int value) {
ProgressBar circularProgressBar = getCircularProgressBar();
ProgressBar horizontalProgressBar = getHorizontalProgressBar();
if (value == Window.PROGRESS_VISIBILITY_ON) {
if (mFeatureProgress) {
int level = horizontalProgre... | java | private void updateProgressBars(int value) {
ProgressBar circularProgressBar = getCircularProgressBar();
ProgressBar horizontalProgressBar = getHorizontalProgressBar();
if (value == Window.PROGRESS_VISIBILITY_ON) {
if (mFeatureProgress) {
int level = horizontalProgre... | [
"private",
"void",
"updateProgressBars",
"(",
"int",
"value",
")",
"{",
"ProgressBar",
"circularProgressBar",
"=",
"getCircularProgressBar",
"(",
")",
";",
"ProgressBar",
"horizontalProgressBar",
"=",
"getHorizontalProgressBar",
"(",
")",
";",
"if",
"(",
"value",
"=... | Progress Bar function. Mostly extracted from PhoneWindow.java | [
"Progress",
"Bar",
"function",
".",
"Mostly",
"extracted",
"from",
"PhoneWindow",
".",
"java"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/app/ActionBarActivityDelegateBase.java#L488-L525 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/date/SimpleMonthView.java | SimpleMonthView.getDayFromLocation | public CalendarDay getDayFromLocation(float x, float y) {
int dayStart = mPadding;
if (x < dayStart || x > mWidth - mPadding) {
return null;
}
// Selection is (x - start) / (pixels/day) == (x -s) * day / pixels
int row = (int) (y - MONTH_HEADER_SIZE) / mRowHeight;
... | java | public CalendarDay getDayFromLocation(float x, float y) {
int dayStart = mPadding;
if (x < dayStart || x > mWidth - mPadding) {
return null;
}
// Selection is (x - start) / (pixels/day) == (x -s) * day / pixels
int row = (int) (y - MONTH_HEADER_SIZE) / mRowHeight;
... | [
"public",
"CalendarDay",
"getDayFromLocation",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"int",
"dayStart",
"=",
"mPadding",
";",
"if",
"(",
"x",
"<",
"dayStart",
"||",
"x",
">",
"mWidth",
"-",
"mPadding",
")",
"{",
"return",
"null",
";",
"}",
... | Calculates the day that the given x position is in, accounting for week
number. Returns a Time referencing that day or null if
@param x The x position of the touch event
@return A time object for the tapped day or null if the position wasn't
in a day | [
"Calculates",
"the",
"day",
"that",
"the",
"given",
"x",
"position",
"is",
"in",
"accounting",
"for",
"week",
"number",
".",
"Returns",
"a",
"Time",
"referencing",
"that",
"day",
"or",
"null",
"if"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/date/SimpleMonthView.java#L448-L463 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/widget/SuggestionsAdapter.java | SuggestionsAdapter.getDrawable | private Drawable getDrawable(Uri uri) {
try {
String scheme = uri.getScheme();
if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
// Load drawables through Resources, to get the source density information
try {
return getDraw... | java | private Drawable getDrawable(Uri uri) {
try {
String scheme = uri.getScheme();
if (ContentResolver.SCHEME_ANDROID_RESOURCE.equals(scheme)) {
// Load drawables through Resources, to get the source density information
try {
return getDraw... | [
"private",
"Drawable",
"getDrawable",
"(",
"Uri",
"uri",
")",
"{",
"try",
"{",
"String",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"if",
"(",
"ContentResolver",
".",
"SCHEME_ANDROID_RESOURCE",
".",
"equals",
"(",
"scheme",
")",
")",
"{",
"//... | Gets a drawable by URI, without using the cache.
@return A drawable, or {@code null} if the drawable could not be loaded. | [
"Gets",
"a",
"drawable",
"by",
"URI",
"without",
"using",
"the",
"cache",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/widget/SuggestionsAdapter.java#L519-L549 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/widget/SuggestionsAdapter.java | SuggestionsAdapter.getDefaultIcon1 | private Drawable getDefaultIcon1(Cursor cursor) {
// Check the component that gave us the suggestion
Drawable drawable = getActivityIconWithCache(mSearchable.getSearchActivity());
if (drawable != null) {
return drawable;
}
// Fall back to a default icon
retur... | java | private Drawable getDefaultIcon1(Cursor cursor) {
// Check the component that gave us the suggestion
Drawable drawable = getActivityIconWithCache(mSearchable.getSearchActivity());
if (drawable != null) {
return drawable;
}
// Fall back to a default icon
retur... | [
"private",
"Drawable",
"getDefaultIcon1",
"(",
"Cursor",
"cursor",
")",
"{",
"// Check the component that gave us the suggestion",
"Drawable",
"drawable",
"=",
"getActivityIconWithCache",
"(",
"mSearchable",
".",
"getSearchActivity",
"(",
")",
")",
";",
"if",
"(",
"draw... | Gets the left-hand side icon that will be used for the current suggestion
if the suggestion contains an icon column but no icon or a broken icon.
@param cursor A cursor positioned at the current suggestion.
@return A non-null drawable. | [
"Gets",
"the",
"left",
"-",
"hand",
"side",
"icon",
"that",
"will",
"be",
"used",
"for",
"the",
"current",
"suggestion",
"if",
"the",
"suggestion",
"contains",
"an",
"icon",
"column",
"but",
"no",
"icon",
"or",
"a",
"broken",
"icon",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/widget/SuggestionsAdapter.java#L575-L584 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.getDefaultActivity | public ResolveInfo getDefaultActivity() {
synchronized (mInstanceLock) {
ensureConsistentState();
if (!mActivities.isEmpty()) {
return mActivities.get(0).resolveInfo;
}
}
return null;
} | java | public ResolveInfo getDefaultActivity() {
synchronized (mInstanceLock) {
ensureConsistentState();
if (!mActivities.isEmpty()) {
return mActivities.get(0).resolveInfo;
}
}
return null;
} | [
"public",
"ResolveInfo",
"getDefaultActivity",
"(",
")",
"{",
"synchronized",
"(",
"mInstanceLock",
")",
"{",
"ensureConsistentState",
"(",
")",
";",
"if",
"(",
"!",
"mActivities",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"mActivities",
".",
"get",
"(",... | Gets the default activity, The default activity is defined as the one
with highest rank i.e. the first one in the list of activities that can
handle the intent.
@return The default activity, <code>null</code> id not activities.
@see #getActivity(int) | [
"Gets",
"the",
"default",
"activity",
"The",
"default",
"activity",
"is",
"defined",
"as",
"the",
"one",
"with",
"highest",
"rank",
"i",
".",
"e",
".",
"the",
"first",
"one",
"in",
"the",
"list",
"of",
"activities",
"that",
"can",
"handle",
"the",
"inten... | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L514-L522 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.setDefaultActivity | public void setDefaultActivity(int index) {
synchronized (mInstanceLock) {
ensureConsistentState();
ActivityResolveInfo newDefaultActivity = mActivities.get(index);
ActivityResolveInfo oldDefaultActivity = mActivities.get(0);
final float weight;
if (... | java | public void setDefaultActivity(int index) {
synchronized (mInstanceLock) {
ensureConsistentState();
ActivityResolveInfo newDefaultActivity = mActivities.get(index);
ActivityResolveInfo oldDefaultActivity = mActivities.get(0);
final float weight;
if (... | [
"public",
"void",
"setDefaultActivity",
"(",
"int",
"index",
")",
"{",
"synchronized",
"(",
"mInstanceLock",
")",
"{",
"ensureConsistentState",
"(",
")",
";",
"ActivityResolveInfo",
"newDefaultActivity",
"=",
"mActivities",
".",
"get",
"(",
"index",
")",
";",
"A... | Sets the default activity. The default activity is set by adding a
historical record with weight high enough that this activity will
become the highest ranked. Such a strategy guarantees that the default
will eventually change if not used. Also the weight of the record for
setting a default is inflated with a constant ... | [
"Sets",
"the",
"default",
"activity",
".",
"The",
"default",
"activity",
"is",
"set",
"by",
"adding",
"a",
"historical",
"record",
"with",
"weight",
"high",
"enough",
"that",
"this",
"activity",
"will",
"become",
"the",
"highest",
"ranked",
".",
"Such",
"a",... | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L534-L557 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.setActivitySorter | public void setActivitySorter(ActivitySorter activitySorter) {
synchronized (mInstanceLock) {
if (mActivitySorter == activitySorter) {
return;
}
mActivitySorter = activitySorter;
if (sortActivitiesIfNeeded()) {
notifyChanged();
... | java | public void setActivitySorter(ActivitySorter activitySorter) {
synchronized (mInstanceLock) {
if (mActivitySorter == activitySorter) {
return;
}
mActivitySorter = activitySorter;
if (sortActivitiesIfNeeded()) {
notifyChanged();
... | [
"public",
"void",
"setActivitySorter",
"(",
"ActivitySorter",
"activitySorter",
")",
"{",
"synchronized",
"(",
"mInstanceLock",
")",
"{",
"if",
"(",
"mActivitySorter",
"==",
"activitySorter",
")",
"{",
"return",
";",
"}",
"mActivitySorter",
"=",
"activitySorter",
... | Sets the sorter for ordering activities based on historical data and an intent.
@param activitySorter The sorter.
@see ActivitySorter | [
"Sets",
"the",
"sorter",
"for",
"ordering",
"activities",
"based",
"on",
"historical",
"data",
"and",
"an",
"intent",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L602-L612 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.sortActivitiesIfNeeded | private boolean sortActivitiesIfNeeded() {
if (mActivitySorter != null && mIntent != null
&& !mActivities.isEmpty() && !mHistoricalRecords.isEmpty()) {
mActivitySorter.sort(mIntent, mActivities,
Collections.unmodifiableList(mHistoricalRecords));
return... | java | private boolean sortActivitiesIfNeeded() {
if (mActivitySorter != null && mIntent != null
&& !mActivities.isEmpty() && !mHistoricalRecords.isEmpty()) {
mActivitySorter.sort(mIntent, mActivities,
Collections.unmodifiableList(mHistoricalRecords));
return... | [
"private",
"boolean",
"sortActivitiesIfNeeded",
"(",
")",
"{",
"if",
"(",
"mActivitySorter",
"!=",
"null",
"&&",
"mIntent",
"!=",
"null",
"&&",
"!",
"mActivities",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"mHistoricalRecords",
".",
"isEmpty",
"(",
")",
")",
"{... | Sorts the activities if necessary which is if there is a
sorter, there are some activities to sort, and there is some
historical data.
@return Whether sorting was performed. | [
"Sorts",
"the",
"activities",
"if",
"necessary",
"which",
"is",
"if",
"there",
"is",
"a",
"sorter",
"there",
"are",
"some",
"activities",
"to",
"sort",
"and",
"there",
"is",
"some",
"historical",
"data",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L686-L694 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.loadActivitiesIfNeeded | private boolean loadActivitiesIfNeeded() {
if (mReloadActivities && mIntent != null) {
mReloadActivities = false;
mActivities.clear();
List<ResolveInfo> resolveInfos = mContext.getPackageManager()
.queryIntentActivities(mIntent, 0);
final int r... | java | private boolean loadActivitiesIfNeeded() {
if (mReloadActivities && mIntent != null) {
mReloadActivities = false;
mActivities.clear();
List<ResolveInfo> resolveInfos = mContext.getPackageManager()
.queryIntentActivities(mIntent, 0);
final int r... | [
"private",
"boolean",
"loadActivitiesIfNeeded",
"(",
")",
"{",
"if",
"(",
"mReloadActivities",
"&&",
"mIntent",
"!=",
"null",
")",
"{",
"mReloadActivities",
"=",
"false",
";",
"mActivities",
".",
"clear",
"(",
")",
";",
"List",
"<",
"ResolveInfo",
">",
"reso... | Loads the activities for the current intent if needed which is
if they are not already loaded for the current intent.
@return Whether loading was performed. | [
"Loads",
"the",
"activities",
"for",
"the",
"current",
"intent",
"if",
"needed",
"which",
"is",
"if",
"they",
"are",
"not",
"already",
"loaded",
"for",
"the",
"current",
"intent",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L702-L716 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.readHistoricalDataIfNeeded | private boolean readHistoricalDataIfNeeded() {
if (mCanReadHistoricalData && mHistoricalRecordsChanged &&
!TextUtils.isEmpty(mHistoryFileName)) {
mCanReadHistoricalData = false;
mReadShareHistoryCalled = true;
readHistoricalDataImpl();
return true;... | java | private boolean readHistoricalDataIfNeeded() {
if (mCanReadHistoricalData && mHistoricalRecordsChanged &&
!TextUtils.isEmpty(mHistoryFileName)) {
mCanReadHistoricalData = false;
mReadShareHistoryCalled = true;
readHistoricalDataImpl();
return true;... | [
"private",
"boolean",
"readHistoricalDataIfNeeded",
"(",
")",
"{",
"if",
"(",
"mCanReadHistoricalData",
"&&",
"mHistoricalRecordsChanged",
"&&",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"mHistoryFileName",
")",
")",
"{",
"mCanReadHistoricalData",
"=",
"false",
";",
"m... | Reads the historical data if necessary which is it has
changed, there is a history file, and there is not persist
in progress.
@return Whether reading was performed. | [
"Reads",
"the",
"historical",
"data",
"if",
"necessary",
"which",
"is",
"it",
"has",
"changed",
"there",
"is",
"a",
"history",
"file",
"and",
"there",
"is",
"not",
"persist",
"in",
"progress",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L725-L734 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.pruneExcessiveHistoricalRecordsIfNeeded | private void pruneExcessiveHistoricalRecordsIfNeeded() {
final int pruneCount = mHistoricalRecords.size() - mHistoryMaxSize;
if (pruneCount <= 0) {
return;
}
mHistoricalRecordsChanged = true;
for (int i = 0; i < pruneCount; i++) {
HistoricalRecord prunedRe... | java | private void pruneExcessiveHistoricalRecordsIfNeeded() {
final int pruneCount = mHistoricalRecords.size() - mHistoryMaxSize;
if (pruneCount <= 0) {
return;
}
mHistoricalRecordsChanged = true;
for (int i = 0; i < pruneCount; i++) {
HistoricalRecord prunedRe... | [
"private",
"void",
"pruneExcessiveHistoricalRecordsIfNeeded",
"(",
")",
"{",
"final",
"int",
"pruneCount",
"=",
"mHistoricalRecords",
".",
"size",
"(",
")",
"-",
"mHistoryMaxSize",
";",
"if",
"(",
"pruneCount",
"<=",
"0",
")",
"{",
"return",
";",
"}",
"mHistor... | Prunes older excessive records to guarantee maxHistorySize. | [
"Prunes",
"older",
"excessive",
"records",
"to",
"guarantee",
"maxHistorySize",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L757-L769 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/widget/ActivityChooserModel.java | ActivityChooserModel.readHistoricalDataImpl | private void readHistoricalDataImpl() {
FileInputStream fis = null;
try {
fis = mContext.openFileInput(mHistoryFileName);
} catch (FileNotFoundException fnfe) {
if (DEBUG) {
Log.i(LOG_TAG, "Could not open historical records file: " + mHistoryFileName);
... | java | private void readHistoricalDataImpl() {
FileInputStream fis = null;
try {
fis = mContext.openFileInput(mHistoryFileName);
} catch (FileNotFoundException fnfe) {
if (DEBUG) {
Log.i(LOG_TAG, "Could not open historical records file: " + mHistoryFileName);
... | [
"private",
"void",
"readHistoricalDataImpl",
"(",
")",
"{",
"FileInputStream",
"fis",
"=",
"null",
";",
"try",
"{",
"fis",
"=",
"mContext",
".",
"openFileInput",
"(",
"mHistoryFileName",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"fnfe",
")",
"{",
... | Command for reading the historical records from a file off the UI thread. | [
"Command",
"for",
"reading",
"the",
"historical",
"records",
"from",
"a",
"file",
"off",
"the",
"UI",
"thread",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/widget/ActivityChooserModel.java#L975-L1044 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.applyTheme | public static void applyTheme(Activity activity, boolean force) {
if (force || ThemeManager.hasSpecifiedTheme(activity)) {
activity.setTheme(ThemeManager.getTheme(activity));
}
} | java | public static void applyTheme(Activity activity, boolean force) {
if (force || ThemeManager.hasSpecifiedTheme(activity)) {
activity.setTheme(ThemeManager.getTheme(activity));
}
} | [
"public",
"static",
"void",
"applyTheme",
"(",
"Activity",
"activity",
",",
"boolean",
"force",
")",
"{",
"if",
"(",
"force",
"||",
"ThemeManager",
".",
"hasSpecifiedTheme",
"(",
"activity",
")",
")",
"{",
"activity",
".",
"setTheme",
"(",
"ThemeManager",
".... | Apply theme from intent. Only system use, don't call it! | [
"Apply",
"theme",
"from",
"intent",
".",
"Only",
"system",
"use",
"don",
"t",
"call",
"it!"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L237-L241 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.cloneTheme | public static void cloneTheme(Intent sourceIntent, Intent intent,
boolean force) {
final boolean hasSourceTheme = hasSpecifiedTheme(sourceIntent);
if (force || hasSourceTheme) {
intent.putExtra(_THEME_TAG, hasSourceTheme ? getTheme(sourceIntent)
... | java | public static void cloneTheme(Intent sourceIntent, Intent intent,
boolean force) {
final boolean hasSourceTheme = hasSpecifiedTheme(sourceIntent);
if (force || hasSourceTheme) {
intent.putExtra(_THEME_TAG, hasSourceTheme ? getTheme(sourceIntent)
... | [
"public",
"static",
"void",
"cloneTheme",
"(",
"Intent",
"sourceIntent",
",",
"Intent",
"intent",
",",
"boolean",
"force",
")",
"{",
"final",
"boolean",
"hasSourceTheme",
"=",
"hasSpecifiedTheme",
"(",
"sourceIntent",
")",
";",
"if",
"(",
"force",
"||",
"hasSo... | Clone theme from sourceIntent to intent, if it specified for sourceIntent
or set flag force
@param sourceIntent Intent with specified {@link #_THEME_TAG}
@param intent Intent into which will be put a theme
@param force Clone theme even if sourceIntent not contain
{@link #_THEME_TAG} | [
"Clone",
"theme",
"from",
"sourceIntent",
"to",
"intent",
"if",
"it",
"specified",
"for",
"sourceIntent",
"or",
"set",
"flag",
"force"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L262-L269 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.setDefaultTheme | public static void setDefaultTheme(int theme) {
ThemeManager._DEFAULT_THEME = theme;
if (theme < _START_RESOURCES_ID) {
ThemeManager._DEFAULT_THEME &= ThemeManager._THEME_MASK;
}
} | java | public static void setDefaultTheme(int theme) {
ThemeManager._DEFAULT_THEME = theme;
if (theme < _START_RESOURCES_ID) {
ThemeManager._DEFAULT_THEME &= ThemeManager._THEME_MASK;
}
} | [
"public",
"static",
"void",
"setDefaultTheme",
"(",
"int",
"theme",
")",
"{",
"ThemeManager",
".",
"_DEFAULT_THEME",
"=",
"theme",
";",
"if",
"(",
"theme",
"<",
"_START_RESOURCES_ID",
")",
"{",
"ThemeManager",
".",
"_DEFAULT_THEME",
"&=",
"ThemeManager",
".",
... | Set default theme. May be theme resource instead flags, but it not
recommend.
@param theme Theme
@see #modifyDefaultTheme(int)
@see #modifyDefaultThemeClear(int)
@see #getDefaultTheme() | [
"Set",
"default",
"theme",
".",
"May",
"be",
"theme",
"resource",
"instead",
"flags",
"but",
"it",
"not",
"recommend",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L302-L307 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.getTheme | public static int getTheme(Intent intent, boolean applyModifier) {
return prepareFlags(intent.getIntExtra(ThemeManager._THEME_TAG,
ThemeManager._DEFAULT_THEME), applyModifier);
} | java | public static int getTheme(Intent intent, boolean applyModifier) {
return prepareFlags(intent.getIntExtra(ThemeManager._THEME_TAG,
ThemeManager._DEFAULT_THEME), applyModifier);
} | [
"public",
"static",
"int",
"getTheme",
"(",
"Intent",
"intent",
",",
"boolean",
"applyModifier",
")",
"{",
"return",
"prepareFlags",
"(",
"intent",
".",
"getIntExtra",
"(",
"ThemeManager",
".",
"_THEME_TAG",
",",
"ThemeManager",
".",
"_DEFAULT_THEME",
")",
",",
... | Extract theme flags from intent | [
"Extract",
"theme",
"flags",
"from",
"intent"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L345-L348 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.getThemeResource | public static int getThemeResource(int themeTag, boolean applyModifier) {
if (themeTag >= _START_RESOURCES_ID) {
return themeTag;
}
themeTag = prepareFlags(themeTag, applyModifier);
if (ThemeManager.sThemeGetters != null) {
int getterResource;
final Th... | java | public static int getThemeResource(int themeTag, boolean applyModifier) {
if (themeTag >= _START_RESOURCES_ID) {
return themeTag;
}
themeTag = prepareFlags(themeTag, applyModifier);
if (ThemeManager.sThemeGetters != null) {
int getterResource;
final Th... | [
"public",
"static",
"int",
"getThemeResource",
"(",
"int",
"themeTag",
",",
"boolean",
"applyModifier",
")",
"{",
"if",
"(",
"themeTag",
">=",
"_START_RESOURCES_ID",
")",
"{",
"return",
"themeTag",
";",
"}",
"themeTag",
"=",
"prepareFlags",
"(",
"themeTag",
",... | Resolve theme resource id by flags | [
"Resolve",
"theme",
"resource",
"id",
"by",
"flags"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L371-L392 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.modifyDefaultThemeClear | public static void modifyDefaultThemeClear(int mod) {
mod &= ThemeManager._THEME_MASK;
ThemeManager._DEFAULT_THEME |= mod;
ThemeManager._DEFAULT_THEME ^= mod;
} | java | public static void modifyDefaultThemeClear(int mod) {
mod &= ThemeManager._THEME_MASK;
ThemeManager._DEFAULT_THEME |= mod;
ThemeManager._DEFAULT_THEME ^= mod;
} | [
"public",
"static",
"void",
"modifyDefaultThemeClear",
"(",
"int",
"mod",
")",
"{",
"mod",
"&=",
"ThemeManager",
".",
"_THEME_MASK",
";",
"ThemeManager",
".",
"_DEFAULT_THEME",
"|=",
"mod",
";",
"ThemeManager",
".",
"_DEFAULT_THEME",
"^=",
"mod",
";",
"}"
] | Clear modifier from default theme
@see #modifyDefaultTheme(int)
@see #setDefaultTheme(int)
@see #getDefaultTheme() | [
"Clear",
"modifier",
"from",
"default",
"theme"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L649-L653 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/ThemeManager.java | ThemeManager.reset | public static void reset() {
if ((_DEFAULT_THEME & COLOR_SCHEME_MASK) == 0) {
_DEFAULT_THEME = DARK;
}
_THEME_MODIFIER = 0;
_THEMES_MAP.clear();
map(DARK,
Holo_Theme);
map(DARK | FULLSCREEN,
Holo_Theme_Fullscreen);
map(... | java | public static void reset() {
if ((_DEFAULT_THEME & COLOR_SCHEME_MASK) == 0) {
_DEFAULT_THEME = DARK;
}
_THEME_MODIFIER = 0;
_THEMES_MAP.clear();
map(DARK,
Holo_Theme);
map(DARK | FULLSCREEN,
Holo_Theme_Fullscreen);
map(... | [
"public",
"static",
"void",
"reset",
"(",
")",
"{",
"if",
"(",
"(",
"_DEFAULT_THEME",
"&",
"COLOR_SCHEME_MASK",
")",
"==",
"0",
")",
"{",
"_DEFAULT_THEME",
"=",
"DARK",
";",
"}",
"_THEME_MODIFIER",
"=",
"0",
";",
"_THEMES_MAP",
".",
"clear",
"(",
")",
... | Reset all themes to default | [
"Reset",
"all",
"themes",
"to",
"default"
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/ThemeManager.java#L689-L782 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/app/ActionBarActivity.java | ActionBarActivity.onSupportNavigateUp | public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
... | java | public boolean onSupportNavigateUp() {
Intent upIntent = getSupportParentActivityIntent();
if (upIntent != null) {
if (supportShouldUpRecreateTask(upIntent)) {
TaskStackBuilder b = TaskStackBuilder.create(this);
onCreateSupportNavigateUpTaskStack(b);
... | [
"public",
"boolean",
"onSupportNavigateUp",
"(",
")",
"{",
"Intent",
"upIntent",
"=",
"getSupportParentActivityIntent",
"(",
")",
";",
"if",
"(",
"upIntent",
"!=",
"null",
")",
"{",
"if",
"(",
"supportShouldUpRecreateTask",
"(",
"upIntent",
")",
")",
"{",
"Tas... | This method is called whenever the user chooses to navigate Up within your application's
activity hierarchy from the action bar.
<p>If a parent was specified in the manifest for this activity or an activity-alias to it,
default Up navigation will be handled automatically. See
{@link #getSupportParentActivityIntent()} ... | [
"This",
"method",
"is",
"called",
"whenever",
"the",
"user",
"chooses",
"to",
"navigate",
"Up",
"within",
"your",
"application",
"s",
"activity",
"hierarchy",
"from",
"the",
"action",
"bar",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/app/ActionBarActivity.java#L356-L381 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/widget/SearchView.java | SearchView.updateSearchAutoComplete | private void updateSearchAutoComplete() {
mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
mQueryTextView.setImeOptions(mSearchable.getImeOptions());
int inputType = mSearchable.getInputType();
// We only touch this if the input type is set up for text (which it almost cer... | java | private void updateSearchAutoComplete() {
mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
mQueryTextView.setImeOptions(mSearchable.getImeOptions());
int inputType = mSearchable.getInputType();
// We only touch this if the input type is set up for text (which it almost cer... | [
"private",
"void",
"updateSearchAutoComplete",
"(",
")",
"{",
"mQueryTextView",
".",
"setThreshold",
"(",
"mSearchable",
".",
"getSuggestThreshold",
"(",
")",
")",
";",
"mQueryTextView",
".",
"setImeOptions",
"(",
"mSearchable",
".",
"getImeOptions",
"(",
")",
")"... | Updates the auto-complete text view. | [
"Updates",
"the",
"auto",
"-",
"complete",
"text",
"view",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/widget/SearchView.java#L1039-L1074 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/widget/SearchView.java | SearchView.setQuery | private void setQuery(CharSequence query) {
mQueryTextView.setText(query);
// Move the cursor to the end
mQueryTextView.setSelection(TextUtils.isEmpty(query) ? 0 : query.length());
} | java | private void setQuery(CharSequence query) {
mQueryTextView.setText(query);
// Move the cursor to the end
mQueryTextView.setSelection(TextUtils.isEmpty(query) ? 0 : query.length());
} | [
"private",
"void",
"setQuery",
"(",
"CharSequence",
"query",
")",
"{",
"mQueryTextView",
".",
"setText",
"(",
"query",
")",
";",
"// Move the cursor to the end",
"mQueryTextView",
".",
"setSelection",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"query",
")",
"?",
"0"... | Sets the text in the query box, without updating the suggestions. | [
"Sets",
"the",
"text",
"in",
"the",
"query",
"box",
"without",
"updating",
"the",
"suggestions",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/widget/SearchView.java#L1366-L1370 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/view/SupportMenuInflater.java | SupportMenuInflater.parseMenu | private void parseMenu(XmlPullParser parser, AttributeSet attrs, Menu menu)
throws XmlPullParserException, IOException {
MenuState menuState = new MenuState(menu);
int eventType = parser.getEventType();
String tagName;
boolean lookingForEndOfUnknownTag = false;
Strin... | java | private void parseMenu(XmlPullParser parser, AttributeSet attrs, Menu menu)
throws XmlPullParserException, IOException {
MenuState menuState = new MenuState(menu);
int eventType = parser.getEventType();
String tagName;
boolean lookingForEndOfUnknownTag = false;
Strin... | [
"private",
"void",
"parseMenu",
"(",
"XmlPullParser",
"parser",
",",
"AttributeSet",
"attrs",
",",
"Menu",
"menu",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"MenuState",
"menuState",
"=",
"new",
"MenuState",
"(",
"menu",
")",
";",
"int",
... | Called internally to fill the given menu. If a sub menu is seen, it will
call this recursively. | [
"Called",
"internally",
"to",
"fill",
"the",
"given",
"menu",
".",
"If",
"a",
"sub",
"menu",
"is",
"seen",
"it",
"will",
"call",
"this",
"recursively",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/view/SupportMenuInflater.java#L130-L208 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java | TimePickerDialog.tryStartingKbMode | private void tryStartingKbMode(int keyCode) {
if (mTimePicker.trySettingInputEnabled(false) &&
(keyCode == -1 || addKeyIfLegal(keyCode))) {
mInKbMode = true;
mDoneButton.setEnabled(false);
updateDisplay(false);
}
} | java | private void tryStartingKbMode(int keyCode) {
if (mTimePicker.trySettingInputEnabled(false) &&
(keyCode == -1 || addKeyIfLegal(keyCode))) {
mInKbMode = true;
mDoneButton.setEnabled(false);
updateDisplay(false);
}
} | [
"private",
"void",
"tryStartingKbMode",
"(",
"int",
"keyCode",
")",
"{",
"if",
"(",
"mTimePicker",
".",
"trySettingInputEnabled",
"(",
"false",
")",
"&&",
"(",
"keyCode",
"==",
"-",
"1",
"||",
"addKeyIfLegal",
"(",
"keyCode",
")",
")",
")",
"{",
"mInKbMode... | Try to start keyboard mode with the specified key, as long as the timepicker is not in the
middle of a touch-event.
@param keyCode The key to use as the first press. Keyboard mode will not be started if the
key is not legal to start with. Or, pass in -1 to get into keyboard mode without a starting
key. | [
"Try",
"to",
"start",
"keyboard",
"mode",
"with",
"the",
"specified",
"key",
"as",
"long",
"as",
"the",
"timepicker",
"is",
"not",
"in",
"the",
"middle",
"of",
"a",
"touch",
"-",
"event",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java#L467-L474 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java | TimePickerDialog.finishKbMode | private void finishKbMode(boolean updateDisplays) {
mInKbMode = false;
if (!mTypedTimes.isEmpty()) {
int values[] = getEnteredTime(null);
mTimePicker.setTime(values[0], values[1]);
if (!mIs24HourMode) {
mTimePicker.setAmOrPm(values[2]);
}
... | java | private void finishKbMode(boolean updateDisplays) {
mInKbMode = false;
if (!mTypedTimes.isEmpty()) {
int values[] = getEnteredTime(null);
mTimePicker.setTime(values[0], values[1]);
if (!mIs24HourMode) {
mTimePicker.setAmOrPm(values[2]);
}
... | [
"private",
"void",
"finishKbMode",
"(",
"boolean",
"updateDisplays",
")",
"{",
"mInKbMode",
"=",
"false",
";",
"if",
"(",
"!",
"mTypedTimes",
".",
"isEmpty",
"(",
")",
")",
"{",
"int",
"values",
"[",
"]",
"=",
"getEnteredTime",
"(",
"null",
")",
";",
"... | Get out of keyboard mode. If there is nothing in typedTimes, revert to TimePicker's time.
@param updateDisplays If true, update the displays with the relevant time. | [
"Get",
"out",
"of",
"keyboard",
"mode",
".",
"If",
"there",
"is",
"nothing",
"in",
"typedTimes",
"revert",
"to",
"TimePicker",
"s",
"time",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java#L549-L563 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java | TimePickerDialog.getEnteredTime | private int[] getEnteredTime(Boolean[] enteredZeros) {
int amOrPm = -1;
int startIndex = 1;
if (!mIs24HourMode && isTypedTimeFullyLegal()) {
int keyCode = mTypedTimes.get(mTypedTimes.size() - 1);
if (keyCode == getAmOrPmKeyCode(AM)) {
amOrPm = AM;
... | java | private int[] getEnteredTime(Boolean[] enteredZeros) {
int amOrPm = -1;
int startIndex = 1;
if (!mIs24HourMode && isTypedTimeFullyLegal()) {
int keyCode = mTypedTimes.get(mTypedTimes.size() - 1);
if (keyCode == getAmOrPmKeyCode(AM)) {
amOrPm = AM;
... | [
"private",
"int",
"[",
"]",
"getEnteredTime",
"(",
"Boolean",
"[",
"]",
"enteredZeros",
")",
"{",
"int",
"amOrPm",
"=",
"-",
"1",
";",
"int",
"startIndex",
"=",
"1",
";",
"if",
"(",
"!",
"mIs24HourMode",
"&&",
"isTypedTimeFullyLegal",
"(",
")",
")",
"{... | Get the currently-entered time, as integer values of the hours and minutes typed.
@param enteredZeros A size-2 boolean array, which the caller should initialize, and which
may then be used for the caller to know whether zeros had been explicitly entered as either
hours of minutes. This is helpful for deciding whether ... | [
"Get",
"the",
"currently",
"-",
"entered",
"time",
"as",
"integer",
"values",
"of",
"the",
"hours",
"and",
"minutes",
"typed",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java#L641-L676 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java | TimePickerDialog.getAmOrPmKeyCode | private int getAmOrPmKeyCode(int amOrPm) {
// Cache the codes.
if (mAmKeyCode == -1 || mPmKeyCode == -1) {
// Find the first character in the AM/PM text that is unique.
KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
char amChar;
... | java | private int getAmOrPmKeyCode(int amOrPm) {
// Cache the codes.
if (mAmKeyCode == -1 || mPmKeyCode == -1) {
// Find the first character in the AM/PM text that is unique.
KeyCharacterMap kcm = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
char amChar;
... | [
"private",
"int",
"getAmOrPmKeyCode",
"(",
"int",
"amOrPm",
")",
"{",
"// Cache the codes.",
"if",
"(",
"mAmKeyCode",
"==",
"-",
"1",
"||",
"mPmKeyCode",
"==",
"-",
"1",
")",
"{",
"// Find the first character in the AM/PM text that is unique.",
"KeyCharacterMap",
"kcm... | Get the keycode value for AM and PM in the current language. | [
"Get",
"the",
"keycode",
"value",
"for",
"AM",
"and",
"PM",
"in",
"the",
"current",
"language",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/time/TimePickerDialog.java#L681-L711 | train |
Prototik/HoloEverywhere | library/src/android/support/v7/internal/view/menu/MenuDialogHelper.java | MenuDialogHelper.show | public void show(IBinder windowToken) {
// Many references to mMenu, create local reference
final MenuBuilder menu = mMenu;
// Get the builder for the dialog
final AlertDialog.Builder builder = new AlertDialog.Builder(menu.getContext());
mPresenter = new ListMenuPresenter(build... | java | public void show(IBinder windowToken) {
// Many references to mMenu, create local reference
final MenuBuilder menu = mMenu;
// Get the builder for the dialog
final AlertDialog.Builder builder = new AlertDialog.Builder(menu.getContext());
mPresenter = new ListMenuPresenter(build... | [
"public",
"void",
"show",
"(",
"IBinder",
"windowToken",
")",
"{",
"// Many references to mMenu, create local reference",
"final",
"MenuBuilder",
"menu",
"=",
"mMenu",
";",
"// Get the builder for the dialog",
"final",
"AlertDialog",
".",
"Builder",
"builder",
"=",
"new",... | Shows menu as a dialog.
@param windowToken Optional token to assign to the window. | [
"Shows",
"menu",
"as",
"a",
"dialog",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/android/support/v7/internal/view/menu/MenuDialogHelper.java#L53-L91 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/date/DayPickerView.java | DayPickerView.onScroll | @Override
public void onScroll(
AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
SimpleMonthView child = (SimpleMonthView) view.getChildAt(0);
if (child == null) {
return;
}
// Figure out where we are
long currScroll... | java | @Override
public void onScroll(
AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
SimpleMonthView child = (SimpleMonthView) view.getChildAt(0);
if (child == null) {
return;
}
// Figure out where we are
long currScroll... | [
"@",
"Override",
"public",
"void",
"onScroll",
"(",
"AbsListView",
"view",
",",
"int",
"firstVisibleItem",
",",
"int",
"visibleItemCount",
",",
"int",
"totalItemCount",
")",
"{",
"SimpleMonthView",
"child",
"=",
"(",
"SimpleMonthView",
")",
"view",
".",
"getChil... | Updates the title and selected month if the view has moved to a new
month. | [
"Updates",
"the",
"title",
"and",
"selected",
"month",
"if",
"the",
"view",
"has",
"moved",
"to",
"a",
"new",
"month",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/date/DayPickerView.java#L225-L237 | train |
Prototik/HoloEverywhere | library/src/org/holoeverywhere/widget/datetimepicker/date/DayPickerView.java | DayPickerView.getMostVisiblePosition | public int getMostVisiblePosition() {
final int firstPosition = getFirstVisiblePosition();
final int height = getHeight();
int maxDisplayedHeight = 0;
int mostVisibleIndex = 0;
int i = 0;
int bottom = 0;
while (bottom < height) {
View child = getChild... | java | public int getMostVisiblePosition() {
final int firstPosition = getFirstVisiblePosition();
final int height = getHeight();
int maxDisplayedHeight = 0;
int mostVisibleIndex = 0;
int i = 0;
int bottom = 0;
while (bottom < height) {
View child = getChild... | [
"public",
"int",
"getMostVisiblePosition",
"(",
")",
"{",
"final",
"int",
"firstPosition",
"=",
"getFirstVisiblePosition",
"(",
")",
";",
"final",
"int",
"height",
"=",
"getHeight",
"(",
")",
";",
"int",
"maxDisplayedHeight",
"=",
"0",
";",
"int",
"mostVisible... | Gets the position of the view that is most prominently displayed within the list view. | [
"Gets",
"the",
"position",
"of",
"the",
"view",
"that",
"is",
"most",
"prominently",
"displayed",
"within",
"the",
"list",
"view",
"."
] | b870abb5ab009a5a6dbab3fb855ec2854e35e125 | https://github.com/Prototik/HoloEverywhere/blob/b870abb5ab009a5a6dbab3fb855ec2854e35e125/library/src/org/holoeverywhere/widget/datetimepicker/date/DayPickerView.java#L258-L280 | train |
cloudbees/zendesk-java-client | src/main/java/org/zendesk/client/v2/Zendesk.java | Zendesk.createUploadArticle | public ArticleAttachments createUploadArticle(long articleId, File file) throws IOException {
return createUploadArticle(articleId, file, false);
} | java | public ArticleAttachments createUploadArticle(long articleId, File file) throws IOException {
return createUploadArticle(articleId, file, false);
} | [
"public",
"ArticleAttachments",
"createUploadArticle",
"(",
"long",
"articleId",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"return",
"createUploadArticle",
"(",
"articleId",
",",
"file",
",",
"false",
")",
";",
"}"
] | Create upload article with inline false | [
"Create",
"upload",
"article",
"with",
"inline",
"false"
] | 029b6cccd3f45fbfe0a344950586d33628b84520 | https://github.com/cloudbees/zendesk-java-client/blob/029b6cccd3f45fbfe0a344950586d33628b84520/src/main/java/org/zendesk/client/v2/Zendesk.java#L603-L605 | train |
opsgenie/opsgenieclient | sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/model/AddAlertDetailsRequest.java | AddAlertDetailsRequest.getDetails | @NotNull
@ApiModelProperty(required = true, value = "Key-value pairs to add as custom property into alert. You can refer here for example values")
public Map<String, String> getDetails() {
return details;
} | java | @NotNull
@ApiModelProperty(required = true, value = "Key-value pairs to add as custom property into alert. You can refer here for example values")
public Map<String, String> getDetails() {
return details;
} | [
"@",
"NotNull",
"@",
"ApiModelProperty",
"(",
"required",
"=",
"true",
",",
"value",
"=",
"\"Key-value pairs to add as custom property into alert. You can refer here for example values\"",
")",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getDetails",
"(",
")",
... | Key-value pairs to add as custom property into alert. You can refer here for example values
@return details | [
"Key",
"-",
"value",
"pairs",
"to",
"add",
"as",
"custom",
"property",
"into",
"alert",
".",
"You",
"can",
"refer",
"here",
"for",
"example",
"values"
] | 6d94efb16bbc74be189c86e9329af510ac8a048c | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/model/AddAlertDetailsRequest.java#L113-L117 | train |
opsgenie/opsgenieclient | sdk/src/main/java/com/ifountain/opsgenie/client/model/BaseRequest.java | BaseRequest.serialize | @Deprecated
public Map serialize() throws OpsGenieClientValidationException {
validate();
try {
return JsonUtils.toMap(this);
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | java | @Deprecated
public Map serialize() throws OpsGenieClientValidationException {
validate();
try {
return JsonUtils.toMap(this);
} catch (Exception e) {
e.printStackTrace();
}
return null;
} | [
"@",
"Deprecated",
"public",
"Map",
"serialize",
"(",
")",
"throws",
"OpsGenieClientValidationException",
"{",
"validate",
"(",
")",
";",
"try",
"{",
"return",
"JsonUtils",
".",
"toMap",
"(",
"this",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",... | convertes request to map | [
"convertes",
"request",
"to",
"map"
] | 6d94efb16bbc74be189c86e9329af510ac8a048c | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk/src/main/java/com/ifountain/opsgenie/client/model/BaseRequest.java#L78-L87 | train |
opsgenie/opsgenieclient | sdk/src/main/java/com/ifountain/opsgenie/client/model/BaseResponse.java | BaseResponse.fromJson | public void fromJson(String json) throws IOException, ParseException {
JsonUtils.fromJson(this, json);
this.json = json;
} | java | public void fromJson(String json) throws IOException, ParseException {
JsonUtils.fromJson(this, json);
this.json = json;
} | [
"public",
"void",
"fromJson",
"(",
"String",
"json",
")",
"throws",
"IOException",
",",
"ParseException",
"{",
"JsonUtils",
".",
"fromJson",
"(",
"this",
",",
"json",
")",
";",
"this",
".",
"json",
"=",
"json",
";",
"}"
] | Convert json data to response | [
"Convert",
"json",
"data",
"to",
"response"
] | 6d94efb16bbc74be189c86e9329af510ac8a048c | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk/src/main/java/com/ifountain/opsgenie/client/model/BaseResponse.java#L81-L84 | train |
opsgenie/opsgenieclient | sdk/src/main/java/com/ifountain/opsgenie/client/OpsGenieClient.java | OpsGenieClient.setApiKey | public void setApiKey(String apiKey) {
if (this.jsonHttpClient != null) {
this.jsonHttpClient.setApiKey(apiKey);
}
if (this.restApiClient != null) {
this.restApiClient.setApiKey(apiKey);
}
if (this.swaggerApiClient != null) {
ApiKeyAuth... | java | public void setApiKey(String apiKey) {
if (this.jsonHttpClient != null) {
this.jsonHttpClient.setApiKey(apiKey);
}
if (this.restApiClient != null) {
this.restApiClient.setApiKey(apiKey);
}
if (this.swaggerApiClient != null) {
ApiKeyAuth... | [
"public",
"void",
"setApiKey",
"(",
"String",
"apiKey",
")",
"{",
"if",
"(",
"this",
".",
"jsonHttpClient",
"!=",
"null",
")",
"{",
"this",
".",
"jsonHttpClient",
".",
"setApiKey",
"(",
"apiKey",
")",
";",
"}",
"if",
"(",
"this",
".",
"restApiClient",
... | Sets the customer key used for authenticating API requests. | [
"Sets",
"the",
"customer",
"key",
"used",
"for",
"authenticating",
"API",
"requests",
"."
] | 6d94efb16bbc74be189c86e9329af510ac8a048c | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk/src/main/java/com/ifountain/opsgenie/client/OpsGenieClient.java#L423-L435 | train |
opsgenie/opsgenieclient | sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java | AlertApi.deleteAlert | public SuccessResponse deleteAlert(DeleteAlertRequest params) throws ApiException {
String identifier = params.getIdentifier();
String identifierType = params.getIdentifierType().getValue();
String source = params.getSource();
String user = params.getUser();
Object localVarPostBody = null;
//... | java | public SuccessResponse deleteAlert(DeleteAlertRequest params) throws ApiException {
String identifier = params.getIdentifier();
String identifierType = params.getIdentifierType().getValue();
String source = params.getSource();
String user = params.getUser();
Object localVarPostBody = null;
//... | [
"public",
"SuccessResponse",
"deleteAlert",
"(",
"DeleteAlertRequest",
"params",
")",
"throws",
"ApiException",
"{",
"String",
"identifier",
"=",
"params",
".",
"getIdentifier",
"(",
")",
";",
"String",
"identifierType",
"=",
"params",
".",
"getIdentifierType",
"(",... | Delete Alert
Deletes an alert using alert id, tiny id or alias
@param params.identifier Identifier of alert which could be alert id, tiny id or alert alias (required)
@param params.identifierType Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or &... | [
"Delete",
"Alert",
"Deletes",
"an",
"alert",
"using",
"alert",
"id",
"tiny",
"id",
"or",
"alias"
] | 6d94efb16bbc74be189c86e9329af510ac8a048c | https://github.com/opsgenie/opsgenieclient/blob/6d94efb16bbc74be189c86e9329af510ac8a048c/sdk-swagger/src/main/java/com/ifountain/opsgenie/client/swagger/api/AlertApi.java#L514-L557 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.