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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/GlobalRequestProcessorStats.java | GlobalRequestProcessorStats.update | public void update(long aRequestCount, long aMaxTime, long aBytesReceived, long aBytesSent, long aProcessingTime, long aErrorCount) {
requestCount.setValueAsLong(aRequestCount);
maxTime.setValueAsLong(aMaxTime);
bytesReceived.setValueAsLong(aBytesReceived);
bytesSent.setValueAsLong(aByte... | java | public void update(long aRequestCount, long aMaxTime, long aBytesReceived, long aBytesSent, long aProcessingTime, long aErrorCount) {
requestCount.setValueAsLong(aRequestCount);
maxTime.setValueAsLong(aMaxTime);
bytesReceived.setValueAsLong(aBytesReceived);
bytesSent.setValueAsLong(aByte... | [
"public",
"void",
"update",
"(",
"long",
"aRequestCount",
",",
"long",
"aMaxTime",
",",
"long",
"aBytesReceived",
",",
"long",
"aBytesSent",
",",
"long",
"aProcessingTime",
",",
"long",
"aErrorCount",
")",
"{",
"requestCount",
".",
"setValueAsLong",
"(",
"aReque... | Updates stats.
@param aRequestCount request count
@param aMaxTime max time
@param aBytesReceived bytes received
@param aBytesSent bytes sent
@param aProcessingTime processing time
@param aErrorCount error count | [
"Updates",
"stats",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/GlobalRequestProcessorStats.java#L150-L157 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryImpl.java | ProducerRegistryImpl.reset | void reset() {
cleanup(); // cleaning up all context before reseting producer registry instance
listeners.clear();
registry.clear();
String junittest = System.getProperty("JUNITTEST");
if (junittest != null && junittest.equalsIgnoreCase("true")) // preventing listener's initial... | java | void reset() {
cleanup(); // cleaning up all context before reseting producer registry instance
listeners.clear();
registry.clear();
String junittest = System.getProperty("JUNITTEST");
if (junittest != null && junittest.equalsIgnoreCase("true")) // preventing listener's initial... | [
"void",
"reset",
"(",
")",
"{",
"cleanup",
"(",
")",
";",
"// cleaning up all context before reseting producer registry instance",
"listeners",
".",
"clear",
"(",
")",
";",
"registry",
".",
"clear",
"(",
")",
";",
"String",
"junittest",
"=",
"System",
".",
"getP... | Resets the impl for unittests. | [
"Resets",
"the",
"impl",
"for",
"unittests",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryImpl.java#L148-L160 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryImpl.java | ProducerRegistryImpl.cleanup | public void cleanup() {
ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
for (ProducerReference p : producerReferences) {
try {
if (p.get() != null)
unregisterProducer(p.get());
} catch (Exc... | java | public void cleanup() {
ArrayList<ProducerReference> producerReferences = new ArrayList<ProducerReference>(registry.values());
for (ProducerReference p : producerReferences) {
try {
if (p.get() != null)
unregisterProducer(p.get());
} catch (Exc... | [
"public",
"void",
"cleanup",
"(",
")",
"{",
"ArrayList",
"<",
"ProducerReference",
">",
"producerReferences",
"=",
"new",
"ArrayList",
"<",
"ProducerReference",
">",
"(",
"registry",
".",
"values",
"(",
")",
")",
";",
"for",
"(",
"ProducerReference",
"p",
":... | This method is primary used for unit tests. | [
"This",
"method",
"is",
"primary",
"used",
"for",
"unit",
"tests",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/registry/ProducerRegistryImpl.java#L165-L175 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanProducerFactory.java | MBeanProducerFactory.isMBeanRequired | private static boolean isMBeanRequired(final ObjectInstance mBean) {
final String domain = mBean.getObjectName().getDomain();
final String className = mBean.getClassName();
return !domain.startsWith("moskito.") // we have to skip all the moskito internal MBeans
&& conf.isMBeanR... | java | private static boolean isMBeanRequired(final ObjectInstance mBean) {
final String domain = mBean.getObjectName().getDomain();
final String className = mBean.getClassName();
return !domain.startsWith("moskito.") // we have to skip all the moskito internal MBeans
&& conf.isMBeanR... | [
"private",
"static",
"boolean",
"isMBeanRequired",
"(",
"final",
"ObjectInstance",
"mBean",
")",
"{",
"final",
"String",
"domain",
"=",
"mBean",
".",
"getObjectName",
"(",
")",
".",
"getDomain",
"(",
")",
";",
"final",
"String",
"className",
"=",
"mBean",
".... | Checks, is mbean required to be registered as producer
@param mBean mbean to check requirements
@return true - mbean need to be registered
false - no | [
"Checks",
"is",
"mbean",
"required",
"to",
"be",
"registered",
"as",
"producer"
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanProducerFactory.java#L40-L48 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanProducerFactory.java | MBeanProducerFactory.buildProducers | public static void buildProducers() {
// Registering decorator for mbean stats
DecoratorRegistryFactory.getDecoratorRegistry().addDecorator(
MBeanStats.class,
new GeneralMBeanDecorator()
);
for (MBeanServer server : MBeanServerFactory.findMBeanServer(nul... | java | public static void buildProducers() {
// Registering decorator for mbean stats
DecoratorRegistryFactory.getDecoratorRegistry().addDecorator(
MBeanStats.class,
new GeneralMBeanDecorator()
);
for (MBeanServer server : MBeanServerFactory.findMBeanServer(nul... | [
"public",
"static",
"void",
"buildProducers",
"(",
")",
"{",
"// Registering decorator for mbean stats",
"DecoratorRegistryFactory",
".",
"getDecoratorRegistry",
"(",
")",
".",
"addDecorator",
"(",
"MBeanStats",
".",
"class",
",",
"new",
"GeneralMBeanDecorator",
"(",
")... | Builds all mbean producer that required by mbean producers
configuration. | [
"Builds",
"all",
"mbean",
"producer",
"that",
"required",
"by",
"mbean",
"producers",
"configuration",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanProducerFactory.java#L72-L93 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java | ProxyUtils.createInstance | public static <T> T createInstance(T impl, String name, String category, String subsystem, IOnDemandCallHandler handler, IOnDemandStatsFactory<? extends IStats> statsFactory, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){
if (name==null)
name = extractName(interf);
Class<?>[] interf... | java | public static <T> T createInstance(T impl, String name, String category, String subsystem, IOnDemandCallHandler handler, IOnDemandStatsFactory<? extends IStats> statsFactory, boolean attachLoggers, Class<T> interf, Class<?>... additionalInterfaces){
if (name==null)
name = extractName(interf);
Class<?>[] interf... | [
"public",
"static",
"<",
"T",
">",
"T",
"createInstance",
"(",
"T",
"impl",
",",
"String",
"name",
",",
"String",
"category",
",",
"String",
"subsystem",
",",
"IOnDemandCallHandler",
"handler",
",",
"IOnDemandStatsFactory",
"<",
"?",
"extends",
"IStats",
">",
... | Creates a new proxied instance for an existing implementation.
@param <T> interface type.
@param impl the implementation of the interface.
@param name name of the producer.
@param category category of the producer, i.e. service, dao, api, controller.
@param subsystem subsystem of the producer, i.e. messaging, payment, ... | [
"Creates",
"a",
"new",
"proxied",
"instance",
"for",
"an",
"existing",
"implementation",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L44-L68 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java | ProxyUtils.createServiceInstance | public static <T> T createServiceInstance(T impl, String category, String subsystem, Class<T> interf, Class<?>... additionalInterfaces){
return createServiceInstance(impl, null, category, subsystem, interf, additionalInterfaces);
} | java | public static <T> T createServiceInstance(T impl, String category, String subsystem, Class<T> interf, Class<?>... additionalInterfaces){
return createServiceInstance(impl, null, category, subsystem, interf, additionalInterfaces);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createServiceInstance",
"(",
"T",
"impl",
",",
"String",
"category",
",",
"String",
"subsystem",
",",
"Class",
"<",
"T",
">",
"interf",
",",
"Class",
"<",
"?",
">",
"...",
"additionalInterfaces",
")",
"{",
"return... | Shortcut method to create service instance. Creates an instance with service interface name as instance name, custom category and subsystem, ServiceStatsCallHandler and ServiceStatsFactory.
@param <T>
@param impl
@param category
@param subsystem
@param interf
@param additionalInterfaces
@return a newly created proxy of... | [
"Shortcut",
"method",
"to",
"create",
"service",
"instance",
".",
"Creates",
"an",
"instance",
"with",
"service",
"interface",
"name",
"as",
"instance",
"name",
"custom",
"category",
"and",
"subsystem",
"ServiceStatsCallHandler",
"and",
"ServiceStatsFactory",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L143-L145 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java | ProxyUtils.extractName | private static String extractName(Class<?> clazz){
String name = clazz.getName();
if (name==null)
name = "";
int indexOfDot = name.lastIndexOf('.');
return indexOfDot == -1 ? name : name.substring(indexOfDot+1);
} | java | private static String extractName(Class<?> clazz){
String name = clazz.getName();
if (name==null)
name = "";
int indexOfDot = name.lastIndexOf('.');
return indexOfDot == -1 ? name : name.substring(indexOfDot+1);
} | [
"private",
"static",
"String",
"extractName",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"String",
"name",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"name",
"=",
"\"\"",
";",
"int",
"indexOfDot",
"=",
"... | Internal method which extracts name of the service out of it class. net.java.dev.moskito.core.dynamic.ProxyUtils -> ProxyUtils.
@param clazz the target clazz..
@return | [
"Internal",
"method",
"which",
"extracts",
"name",
"of",
"the",
"service",
"out",
"of",
"it",
"class",
".",
"net",
".",
"java",
".",
"dev",
".",
"moskito",
".",
"core",
".",
"dynamic",
".",
"ProxyUtils",
"-",
">",
"ProxyUtils",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L195-L201 | train |
anotheria/moskito | moskito-extensions/moskito-php/src/main/java/net/anotheria/extensions/php/mappers/StatsValues.java | StatsValues.parseValue | private Object parseValue(String value) {
// Try to parse value as number
try {
return Double.valueOf(value);
} catch (NumberFormatException ignored){}
if (value.equals("true") || value.equals("false"))
return Boolean.valueOf(value);
throw new IllegalAr... | java | private Object parseValue(String value) {
// Try to parse value as number
try {
return Double.valueOf(value);
} catch (NumberFormatException ignored){}
if (value.equals("true") || value.equals("false"))
return Boolean.valueOf(value);
throw new IllegalAr... | [
"private",
"Object",
"parseValue",
"(",
"String",
"value",
")",
"{",
"// Try to parse value as number",
"try",
"{",
"return",
"Double",
".",
"valueOf",
"(",
"value",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ignored",
")",
"{",
"}",
"if",
"(",
"... | Helper method to parse string representation
of value item to number or boolean type
@param value string representation of value item
@return parsed value item | [
"Helper",
"method",
"to",
"parse",
"string",
"representation",
"of",
"value",
"item",
"to",
"number",
"or",
"boolean",
"type"
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-php/src/main/java/net/anotheria/extensions/php/mappers/StatsValues.java#L19-L31 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/snapshot/SnapshotRepository.java | SnapshotRepository.addConsumer | public void addConsumer(SnapshotConsumer consumer){
if (consumers.contains(consumer))
consumers.remove(consumer);
consumers.add(consumer);
} | java | public void addConsumer(SnapshotConsumer consumer){
if (consumers.contains(consumer))
consumers.remove(consumer);
consumers.add(consumer);
} | [
"public",
"void",
"addConsumer",
"(",
"SnapshotConsumer",
"consumer",
")",
"{",
"if",
"(",
"consumers",
".",
"contains",
"(",
"consumer",
")",
")",
"consumers",
".",
"remove",
"(",
"consumer",
")",
";",
"consumers",
".",
"add",
"(",
"consumer",
")",
";",
... | Adds a new snapshot consumer.
@param consumer | [
"Adds",
"a",
"new",
"snapshot",
"consumer",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/snapshot/SnapshotRepository.java#L146-L150 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalNameParser.java | IntervalNameParser.guessLengthFromName | static final int guessLengthFromName(String aName) {
if (aName.startsWith(Constants.PREFIX_SNAPSHOT_INTERVAL))
return -1;
int unitFactor;
int value;
try {
value = Integer.parseInt(aName.substring(0, aName.length() - 1));
} catch (NumberFormatException e) {
throw new UnknownIntervalLengthExce... | java | static final int guessLengthFromName(String aName) {
if (aName.startsWith(Constants.PREFIX_SNAPSHOT_INTERVAL))
return -1;
int unitFactor;
int value;
try {
value = Integer.parseInt(aName.substring(0, aName.length() - 1));
} catch (NumberFormatException e) {
throw new UnknownIntervalLengthExce... | [
"static",
"final",
"int",
"guessLengthFromName",
"(",
"String",
"aName",
")",
"{",
"if",
"(",
"aName",
".",
"startsWith",
"(",
"Constants",
".",
"PREFIX_SNAPSHOT_INTERVAL",
")",
")",
"return",
"-",
"1",
";",
"int",
"unitFactor",
";",
"int",
"value",
";",
"... | This method parses the given Interval name and returns the length of such an Interval in
seconds.
@param aName the name of the Interval
@return the appropriate length
@throws UnknownIntervalLengthException if the name could not be parsed | [
"This",
"method",
"parses",
"the",
"given",
"Interval",
"name",
"and",
"returns",
"the",
"length",
"of",
"such",
"an",
"Interval",
"in",
"seconds",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/IntervalNameParser.java#L118-L144 | train |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/metrics/GenericMetrics.java | GenericMetrics.getMetricsOfType | protected static <T extends GenericMetrics> List<T> getMetricsOfType(Class<T> type) {
List<T> metricsList = (List<T>)registry.get(type);
if (metricsList == null) {
metricsList = new CopyOnWriteArrayList<>();
List<T> previous = (List<T>)registry.putIfAbsent(type, metricsList);
... | java | protected static <T extends GenericMetrics> List<T> getMetricsOfType(Class<T> type) {
List<T> metricsList = (List<T>)registry.get(type);
if (metricsList == null) {
metricsList = new CopyOnWriteArrayList<>();
List<T> previous = (List<T>)registry.putIfAbsent(type, metricsList);
... | [
"protected",
"static",
"<",
"T",
"extends",
"GenericMetrics",
">",
"List",
"<",
"T",
">",
"getMetricsOfType",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"List",
"<",
"T",
">",
"metricsList",
"=",
"(",
"List",
"<",
"T",
">",
")",
"registry",
".",
... | Get all registered metrics of given Class.
@param type metrics of this class method should return.
@param <T> class type.
@return list of metrics of the desired type, or null if there are none. | [
"Get",
"all",
"registered",
"metrics",
"of",
"given",
"Class",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/metrics/GenericMetrics.java#L36-L45 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/config/accumulators/AccumulatorsConfig.java | AccumulatorsConfig.getAccumulatorColor | public String getAccumulatorColor(final String accumulatorName) {
if (StringUtils.isEmpty(accumulatorName))
throw new IllegalArgumentException("accumulatorName is null");
if (accumulatorsColors == null || accumulatorsColors.length == 0)
return null;
for (AccumulatorGraphColor accumulator : accumulatorsColo... | java | public String getAccumulatorColor(final String accumulatorName) {
if (StringUtils.isEmpty(accumulatorName))
throw new IllegalArgumentException("accumulatorName is null");
if (accumulatorsColors == null || accumulatorsColors.length == 0)
return null;
for (AccumulatorGraphColor accumulator : accumulatorsColo... | [
"public",
"String",
"getAccumulatorColor",
"(",
"final",
"String",
"accumulatorName",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"accumulatorName",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"accumulatorName is null\"",
")",
";",
"if"... | Returns accumulator color by given accumulator name.
@param accumulatorName name of the accumulator
@return accumulator color or {@code null} if accumulator with given name was not found | [
"Returns",
"accumulator",
"color",
"by",
"given",
"accumulator",
"name",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/config/accumulators/AccumulatorsConfig.java#L102-L114 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java | MBeanUtil.registerMBean | public String registerMBean(Object bean, String name, boolean replace)
throws MalformedObjectNameException, NotCompliantMBeanException, MBeanRegistrationException{
synchronized (mBeanServer) {
ObjectName newBeanName = null;
try {
newBeanName = new ObjectNam... | java | public String registerMBean(Object bean, String name, boolean replace)
throws MalformedObjectNameException, NotCompliantMBeanException, MBeanRegistrationException{
synchronized (mBeanServer) {
ObjectName newBeanName = null;
try {
newBeanName = new ObjectNam... | [
"public",
"String",
"registerMBean",
"(",
"Object",
"bean",
",",
"String",
"name",
",",
"boolean",
"replace",
")",
"throws",
"MalformedObjectNameException",
",",
"NotCompliantMBeanException",
",",
"MBeanRegistrationException",
"{",
"synchronized",
"(",
"mBeanServer",
")... | Registers MBean in local MBean server.
Method has mechanism to resolve bean name duplication
depends on `replace` parameter of ths method.
If true - old bean be replaced by new one.
If false - prefix been added to bean name from method parameter
Prefix format:
copy{$number}.{$originalName}
where:
$number - bea... | [
"Registers",
"MBean",
"in",
"local",
"MBean",
"server",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java#L131-L157 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java | MBeanUtil.unregisterMBean | public boolean unregisterMBean(String name) throws MBeanRegistrationException {
synchronized (mBeanServer) {
ObjectName toRemoveName;
try {
toRemoveName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
return false; // bean... | java | public boolean unregisterMBean(String name) throws MBeanRegistrationException {
synchronized (mBeanServer) {
ObjectName toRemoveName;
try {
toRemoveName = new ObjectName(name);
} catch (MalformedObjectNameException e) {
return false; // bean... | [
"public",
"boolean",
"unregisterMBean",
"(",
"String",
"name",
")",
"throws",
"MBeanRegistrationException",
"{",
"synchronized",
"(",
"mBeanServer",
")",
"{",
"ObjectName",
"toRemoveName",
";",
"try",
"{",
"toRemoveName",
"=",
"new",
"ObjectName",
"(",
"name",
")"... | Unregisters MBean from platform MBean server.
@param name name of MBean to unregister
@return true - bean unregistered
false - bean with such name not found
@throws MBeanRegistrationException thrown by MBeanServer | [
"Unregisters",
"MBean",
"from",
"platform",
"MBean",
"server",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java#L166-L189 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java | MBeanUtil.cleanup | public void cleanup(){
synchronized (mBeanServer) {
for (ObjectName beanName : beansNames)
try {
mBeanServer.unregisterMBean(beanName);
} catch (InstanceNotFoundException ignored) {
// Bean previously been unregistered
... | java | public void cleanup(){
synchronized (mBeanServer) {
for (ObjectName beanName : beansNames)
try {
mBeanServer.unregisterMBean(beanName);
} catch (InstanceNotFoundException ignored) {
// Bean previously been unregistered
... | [
"public",
"void",
"cleanup",
"(",
")",
"{",
"synchronized",
"(",
"mBeanServer",
")",
"{",
"for",
"(",
"ObjectName",
"beanName",
":",
"beansNames",
")",
"try",
"{",
"mBeanServer",
".",
"unregisterMBean",
"(",
"beanName",
")",
";",
"}",
"catch",
"(",
"Instan... | Unregisters all beans, that been registered by this utility object. | [
"Unregisters",
"all",
"beans",
"that",
"been",
"registered",
"by",
"this",
"utility",
"object",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/MBeanUtil.java#L194-L209 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/resource/DashboardResource.java | DashboardResource.getDashboard | @GET @Path("/{name}")
public ReplyObject getDashboard(@PathParam("name")String name){
try{
ReplyObject ret = ReplyObject.success();
DashboardAO dashboard = getDashboardAPI().getDashboard(name);
ret.addResult("dashboard", dashboard);
return ret;
}catch(APIException e){
return ReplyObject.error(e.getM... | java | @GET @Path("/{name}")
public ReplyObject getDashboard(@PathParam("name")String name){
try{
ReplyObject ret = ReplyObject.success();
DashboardAO dashboard = getDashboardAPI().getDashboard(name);
ret.addResult("dashboard", dashboard);
return ret;
}catch(APIException e){
return ReplyObject.error(e.getM... | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{name}\"",
")",
"public",
"ReplyObject",
"getDashboard",
"(",
"@",
"PathParam",
"(",
"\"name\"",
")",
"String",
"name",
")",
"{",
"try",
"{",
"ReplyObject",
"ret",
"=",
"ReplyObject",
".",
"success",
"(",
")",
";",
"Dash... | Returns a dashboard by its name.
@param name
@return | [
"Returns",
"a",
"dashboard",
"by",
"its",
"name",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/resource/DashboardResource.java#L36-L46 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/BuiltInThreadStatesProducer.java | BuiltInThreadStatesProducer.readThreads | private void readThreads(){
long[] ids = threadMxBean.getAllThreadIds();
Map<Thread.State, Long> count = new EnumMap<>(Thread.State.class);
for (int i = 0; i<ids.length; i++){
long id = ids[i];
ThreadInfo info = threadMxBean.getThreadInfo(id);
if (info!=null){
Thread.State state = info.getThreadStat... | java | private void readThreads(){
long[] ids = threadMxBean.getAllThreadIds();
Map<Thread.State, Long> count = new EnumMap<>(Thread.State.class);
for (int i = 0; i<ids.length; i++){
long id = ids[i];
ThreadInfo info = threadMxBean.getThreadInfo(id);
if (info!=null){
Thread.State state = info.getThreadStat... | [
"private",
"void",
"readThreads",
"(",
")",
"{",
"long",
"[",
"]",
"ids",
"=",
"threadMxBean",
".",
"getAllThreadIds",
"(",
")",
";",
"Map",
"<",
"Thread",
".",
"State",
",",
"Long",
">",
"count",
"=",
"new",
"EnumMap",
"<>",
"(",
"Thread",
".",
"Sta... | Reads and updates the thread info. | [
"Reads",
"and",
"updates",
"the",
"thread",
"info",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/BuiltInThreadStatesProducer.java#L72-L99 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/ShowDashboardAction.java | ShowDashboardAction.getDashboardRestApiUrl | private String getDashboardRestApiUrl(final HttpServletRequest request, final String dashboardName) {
String contextPath = request.getContextPath();
if (contextPath == null) {
contextPath = "";
}
if (!contextPath.endsWith("/")) {
contextPath += "/";
}
return contextPath + "moskito-inspect-rest/dash... | java | private String getDashboardRestApiUrl(final HttpServletRequest request, final String dashboardName) {
String contextPath = request.getContextPath();
if (contextPath == null) {
contextPath = "";
}
if (!contextPath.endsWith("/")) {
contextPath += "/";
}
return contextPath + "moskito-inspect-rest/dash... | [
"private",
"String",
"getDashboardRestApiUrl",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"dashboardName",
")",
"{",
"String",
"contextPath",
"=",
"request",
".",
"getContextPath",
"(",
")",
";",
"if",
"(",
"contextPath",
"==",
"null",
... | Creates Dashboard REST API url for given dashboard.
Used at UI.
@param request {@link HttpServletRequest}
@param dashboardName dashboard name
@return Dashboard REST API url, including context path | [
"Creates",
"Dashboard",
"REST",
"API",
"url",
"for",
"given",
"dashboard",
".",
"Used",
"at",
"UI",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/ShowDashboardAction.java#L228-L240 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/ShowDashboardAction.java | ShowDashboardAction.getDashboardRefreshRate | private long getDashboardRefreshRate(final DashboardConfig selectedDashboardConfig) {
if (selectedDashboardConfig == null) {
return DEFAULT_DASHBOARD_REFRESH_RATE;
}
return TimeUnit.SECONDS.toMillis(selectedDashboardConfig.getRefresh());
} | java | private long getDashboardRefreshRate(final DashboardConfig selectedDashboardConfig) {
if (selectedDashboardConfig == null) {
return DEFAULT_DASHBOARD_REFRESH_RATE;
}
return TimeUnit.SECONDS.toMillis(selectedDashboardConfig.getRefresh());
} | [
"private",
"long",
"getDashboardRefreshRate",
"(",
"final",
"DashboardConfig",
"selectedDashboardConfig",
")",
"{",
"if",
"(",
"selectedDashboardConfig",
"==",
"null",
")",
"{",
"return",
"DEFAULT_DASHBOARD_REFRESH_RATE",
";",
"}",
"return",
"TimeUnit",
".",
"SECONDS",
... | Returns dashboard refresh rate in ms.
Used at UI for refreshing the dashboard.
@param selectedDashboardConfig {@link DashboardConfig}
@return dashboard refresh rate in ms | [
"Returns",
"dashboard",
"refresh",
"rate",
"in",
"ms",
".",
"Used",
"at",
"UI",
"for",
"refreshing",
"the",
"dashboard",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/ShowDashboardAction.java#L249-L255 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/helper/TieableRepository.java | TieableRepository.getListener | private IntervalListener getListener(String intervalName){
IntervalListener listener = listeners.get(intervalName);
if (listener!=null)
return listener;
try {
Interval interval = IntervalRegistry.getInstance().getIntervalOnlyIfExisting(intervalName);
listener = new IntervalListener();
IntervalListene... | java | private IntervalListener getListener(String intervalName){
IntervalListener listener = listeners.get(intervalName);
if (listener!=null)
return listener;
try {
Interval interval = IntervalRegistry.getInstance().getIntervalOnlyIfExisting(intervalName);
listener = new IntervalListener();
IntervalListene... | [
"private",
"IntervalListener",
"getListener",
"(",
"String",
"intervalName",
")",
"{",
"IntervalListener",
"listener",
"=",
"listeners",
".",
"get",
"(",
"intervalName",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"return",
"listener",
";",
"try",
"{",... | Returns interval listener for the specified interval. If there already was a listener, it will be returned, otherwise a new one will be created.
However, if there have been no such interval, the interval listener will be substituted for a dummy object and no further action will be taken.
@param intervalName
@return | [
"Returns",
"interval",
"listener",
"for",
"the",
"specified",
"interval",
".",
"If",
"there",
"already",
"was",
"a",
"listener",
"it",
"will",
"be",
"returned",
"otherwise",
"a",
"new",
"one",
"will",
"be",
"created",
".",
"However",
"if",
"there",
"have",
... | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/helper/TieableRepository.java#L89-L105 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/helper/TieableRepository.java | TieableRepository.removeTieable | public void removeTieable(String name){
T t = tieables.remove(name);
if (t==null)
return;
detachFromListener(t);
try{
//in case its yet untied.
yetUntied.remove(t);
}catch(Exception e){/* ignored */}
} | java | public void removeTieable(String name){
T t = tieables.remove(name);
if (t==null)
return;
detachFromListener(t);
try{
//in case its yet untied.
yetUntied.remove(t);
}catch(Exception e){/* ignored */}
} | [
"public",
"void",
"removeTieable",
"(",
"String",
"name",
")",
"{",
"T",
"t",
"=",
"tieables",
".",
"remove",
"(",
"name",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"return",
";",
"detachFromListener",
"(",
"t",
")",
";",
"try",
"{",
"//in case it... | Removes previously added tieable by name.
@param name name of the tieable to remove. | [
"Removes",
"previously",
"added",
"tieable",
"by",
"name",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/helper/TieableRepository.java#L189-L199 | train |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java | MonitoringAspect.doProfilingMethod | @Around(value = "execution(* *(..)) && (@annotation(method))")
public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable {
return doProfiling(pjp, method.producerId(), method.subsystem(), method.category());
} | java | @Around(value = "execution(* *(..)) && (@annotation(method))")
public Object doProfilingMethod(ProceedingJoinPoint pjp, Monitor method) throws Throwable {
return doProfiling(pjp, method.producerId(), method.subsystem(), method.category());
} | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *(..)) && (@annotation(method))\"",
")",
"public",
"Object",
"doProfilingMethod",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"Monitor",
"method",
")",
"throws",
"Throwable",
"{",
"return",
"doProfiling",
"(",
"pjp",
",",
... | Common method profiling entry-point.
@param pjp
{@link ProceedingJoinPoint}
@param method
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()} | [
"Common",
"method",
"profiling",
"entry",
"-",
"point",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L36-L39 | train |
anotheria/moskito | moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java | MonitoringAspect.doProfilingClass | @Around(value = "execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)")
public Object doProfilingClass(ProceedingJoinPoint pjp, Monitor monitor) throws Throwable {
return doProfiling(pjp, monitor.producerId(), monitor.subsystem(), monitor.category());
... | java | @Around(value = "execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)")
public Object doProfilingClass(ProceedingJoinPoint pjp, Monitor monitor) throws Throwable {
return doProfiling(pjp, monitor.producerId(), monitor.subsystem(), monitor.category());
... | [
"@",
"Around",
"(",
"value",
"=",
"\"execution(* *.*(..)) && @within(monitor) && !@annotation(net.anotheria.moskito.aop.annotation.DontMonitor)\"",
")",
"public",
"Object",
"doProfilingClass",
"(",
"ProceedingJoinPoint",
"pjp",
",",
"Monitor",
"monitor",
")",
"throws",
"Throwable... | Common class profiling entry-point.
@param pjp
{@link ProceedingJoinPoint}
@param monitor
{@link Monitor}
@return call result
@throws Throwable
in case of error during {@link ProceedingJoinPoint#proceed()} | [
"Common",
"class",
"profiling",
"entry",
"-",
"point",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/MonitoringAspect.java#L52-L55 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/context/MoSKitoContext.java | MoSKitoContext.reset | public void reset(){
tags = new HashMap<>();
errorOccured = new AtomicBoolean(false);
seenErrors = new HashSet<>();
tracerFired = false;
} | java | public void reset(){
tags = new HashMap<>();
errorOccured = new AtomicBoolean(false);
seenErrors = new HashSet<>();
tracerFired = false;
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"tags",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"errorOccured",
"=",
"new",
"AtomicBoolean",
"(",
"false",
")",
";",
"seenErrors",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"tracerFired",
"=",
"false",
... | Resets the current context. Especially useful for unit-testing. | [
"Resets",
"the",
"current",
"context",
".",
"Especially",
"useful",
"for",
"unit",
"-",
"testing",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/context/MoSKitoContext.java#L89-L94 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java | PluginRepository.addPlugin | public void addPlugin(String name, MoskitoPlugin plugin, PluginConfig config){
plugins.put(name, plugin);
try{
plugin.initialize();
configs.put(name, config);
}catch(Exception e){
log.warn("couldn't initialize plugin "+name+" - "+plugin+", removing", e);
plugins.remove(name);
}
} | java | public void addPlugin(String name, MoskitoPlugin plugin, PluginConfig config){
plugins.put(name, plugin);
try{
plugin.initialize();
configs.put(name, config);
}catch(Exception e){
log.warn("couldn't initialize plugin "+name+" - "+plugin+", removing", e);
plugins.remove(name);
}
} | [
"public",
"void",
"addPlugin",
"(",
"String",
"name",
",",
"MoskitoPlugin",
"plugin",
",",
"PluginConfig",
"config",
")",
"{",
"plugins",
".",
"put",
"(",
"name",
",",
"plugin",
")",
";",
"try",
"{",
"plugin",
".",
"initialize",
"(",
")",
";",
"configs",... | Adds a new loaded plugin.
@param name name of the plugin for ui.
@param plugin the plugin instance.
@param config plugin config which was used to load the plugin. | [
"Adds",
"a",
"new",
"loaded",
"plugin",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java#L82-L91 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java | PluginRepository.removePlugin | public void removePlugin(String name){
configs.remove(name);
MoskitoPlugin plugin = plugins.remove(name);
if (plugin==null){
log.warn("Trying to remove not registered plugin "+name);
return;
}
try{
plugin.deInitialize();
}catch(Exception e){
log.warn("Couldn't de-initialize plugin "+name+" - "+p... | java | public void removePlugin(String name){
configs.remove(name);
MoskitoPlugin plugin = plugins.remove(name);
if (plugin==null){
log.warn("Trying to remove not registered plugin "+name);
return;
}
try{
plugin.deInitialize();
}catch(Exception e){
log.warn("Couldn't de-initialize plugin "+name+" - "+p... | [
"public",
"void",
"removePlugin",
"(",
"String",
"name",
")",
"{",
"configs",
".",
"remove",
"(",
"name",
")",
";",
"MoskitoPlugin",
"plugin",
"=",
"plugins",
".",
"remove",
"(",
"name",
")",
";",
"if",
"(",
"plugin",
"==",
"null",
")",
"{",
"log",
"... | Removes a plugin. This call will call deInitialize on the plugin. The plugin is responsible to
free all used resources and un-register itself from listening.
@param name name of the plugin. | [
"Removes",
"a",
"plugin",
".",
"This",
"call",
"will",
"call",
"deInitialize",
"on",
"the",
"plugin",
".",
"The",
"plugin",
"is",
"responsible",
"to",
"free",
"all",
"used",
"resources",
"and",
"un",
"-",
"register",
"itself",
"from",
"listening",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java#L98-L110 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java | PluginRepository.getPluginNames | public List<String> getPluginNames() {
ArrayList<String> ret = new ArrayList<String>(plugins.keySet());
return ret;
} | java | public List<String> getPluginNames() {
ArrayList<String> ret = new ArrayList<String>(plugins.keySet());
return ret;
} | [
"public",
"List",
"<",
"String",
">",
"getPluginNames",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"plugins",
".",
"keySet",
"(",
")",
")",
";",
"return",
"ret",
";",
"}"
] | Returns the names of the active plugins.
@return list of loaded plugins names. | [
"Returns",
"the",
"names",
"of",
"the",
"active",
"plugins",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java#L116-L119 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java | PluginRepository.getPlugins | public List<MoskitoPlugin> getPlugins() {
ArrayList<MoskitoPlugin> ret = new ArrayList<MoskitoPlugin>(plugins.values());
return ret;
} | java | public List<MoskitoPlugin> getPlugins() {
ArrayList<MoskitoPlugin> ret = new ArrayList<MoskitoPlugin>(plugins.values());
return ret;
} | [
"public",
"List",
"<",
"MoskitoPlugin",
">",
"getPlugins",
"(",
")",
"{",
"ArrayList",
"<",
"MoskitoPlugin",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"MoskitoPlugin",
">",
"(",
"plugins",
".",
"values",
"(",
")",
")",
";",
"return",
"ret",
";",
"}"
] | Returns all active plugins.
@return list of loaded plugins. | [
"Returns",
"all",
"active",
"plugins",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/plugins/PluginRepository.java#L125-L128 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TraceStep.java | TraceStep.getLastStep | public TraceStep getLastStep() {
TraceStep result = this;
while (true) {
if (result.children == null || result.children.size() == 0)
return result;
result = result.children.get(result.children.size() - 1);
}
} | java | public TraceStep getLastStep() {
TraceStep result = this;
while (true) {
if (result.children == null || result.children.size() == 0)
return result;
result = result.children.get(result.children.size() - 1);
}
} | [
"public",
"TraceStep",
"getLastStep",
"(",
")",
"{",
"TraceStep",
"result",
"=",
"this",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"result",
".",
"children",
"==",
"null",
"||",
"result",
".",
"children",
".",
"size",
"(",
")",
"==",
"0",
")",
... | Returns the last step in this execution.
@return this step if it has no chidlren or the last step from the children. | [
"Returns",
"the",
"last",
"step",
"in",
"this",
"execution",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TraceStep.java#L133-L140 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TraceStep.java | TraceStep.getNetDuration | public long getNetDuration(){
long ret = duration;
for (TraceStep s : children )
ret -= s.getDuration();
return ret;
} | java | public long getNetDuration(){
long ret = duration;
for (TraceStep s : children )
ret -= s.getDuration();
return ret;
} | [
"public",
"long",
"getNetDuration",
"(",
")",
"{",
"long",
"ret",
"=",
"duration",
";",
"for",
"(",
"TraceStep",
"s",
":",
"children",
")",
"ret",
"-=",
"s",
".",
"getDuration",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | Returns the net duration, which means total duration minus the duration of all children.
@return | [
"Returns",
"the",
"net",
"duration",
"which",
"means",
"total",
"duration",
"minus",
"the",
"duration",
"of",
"all",
"children",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/calltrace/TraceStep.java#L209-L214 | train |
anotheria/moskito | moskito-extensions/moskito-php/src/main/java/net/anotheria/extensions/php/stats/PHPScriptExecutionStats.java | PHPScriptExecutionStats.addMemoryUsage | public void addMemoryUsage(long memoryUsed) {
totalMemoryUsage.increaseByLong(memoryUsed);
minMemoryUsage.setValueIfLesserThanCurrentAsLong(memoryUsed);
maxMemoryUsage.setValueIfGreaterThanCurrentAsLong(memoryUsed);
} | java | public void addMemoryUsage(long memoryUsed) {
totalMemoryUsage.increaseByLong(memoryUsed);
minMemoryUsage.setValueIfLesserThanCurrentAsLong(memoryUsed);
maxMemoryUsage.setValueIfGreaterThanCurrentAsLong(memoryUsed);
} | [
"public",
"void",
"addMemoryUsage",
"(",
"long",
"memoryUsed",
")",
"{",
"totalMemoryUsage",
".",
"increaseByLong",
"(",
"memoryUsed",
")",
";",
"minMemoryUsage",
".",
"setValueIfLesserThanCurrentAsLong",
"(",
"memoryUsed",
")",
";",
"maxMemoryUsage",
".",
"setValueIf... | Adds memory used by script call
@param memoryUsed amount of memory used in bytes | [
"Adds",
"memory",
"used",
"by",
"script",
"call"
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-php/src/main/java/net/anotheria/extensions/php/stats/PHPScriptExecutionStats.java#L59-L63 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/accumulators/api/AccumulatedSingleGraphAO.java | AccumulatedSingleGraphAO.mapColorDataToJSON | public JSONObject mapColorDataToJSON() {
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("name", name);
jsonObject.put("color", color);
} catch (JSONException e) {
final String message = LogMessageUtil.failMsg(e);
LoggerFactory.getLogger(AccumulatedSingleGraphAO.class).warn(messa... | java | public JSONObject mapColorDataToJSON() {
final JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("name", name);
jsonObject.put("color", color);
} catch (JSONException e) {
final String message = LogMessageUtil.failMsg(e);
LoggerFactory.getLogger(AccumulatedSingleGraphAO.class).warn(messa... | [
"public",
"JSONObject",
"mapColorDataToJSON",
"(",
")",
"{",
"final",
"JSONObject",
"jsonObject",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"jsonObject",
".",
"put",
"(",
"\"name\"",
",",
"name",
")",
";",
"jsonObject",
".",
"put",
"(",
"\"color... | Maps accumulator's color and name to JSON object.
@return JSON object with accumulator color | [
"Maps",
"accumulator",
"s",
"color",
"and",
"name",
"to",
"JSON",
"object",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/accumulators/api/AccumulatedSingleGraphAO.java#L126-L138 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/tracer/TracerRepository.java | TracerRepository.isTracingEnabledForProducer | public boolean isTracingEnabledForProducer(String producerId){
//check if tracing is completely disabled.
if (!MoskitoConfigurationHolder.getConfiguration().getTracingConfig().isTracingEnabled())
return false;
Tracer tracer = tracers.get(producerId);
return tracer != null && tracer.isEnabled();
} | java | public boolean isTracingEnabledForProducer(String producerId){
//check if tracing is completely disabled.
if (!MoskitoConfigurationHolder.getConfiguration().getTracingConfig().isTracingEnabled())
return false;
Tracer tracer = tracers.get(producerId);
return tracer != null && tracer.isEnabled();
} | [
"public",
"boolean",
"isTracingEnabledForProducer",
"(",
"String",
"producerId",
")",
"{",
"//check if tracing is completely disabled.",
"if",
"(",
"!",
"MoskitoConfigurationHolder",
".",
"getConfiguration",
"(",
")",
".",
"getTracingConfig",
"(",
")",
".",
"isTracingEnab... | Returns true if tracing is enabled globally and in particular for this producer.
@param producerId
@return | [
"Returns",
"true",
"if",
"tracing",
"is",
"enabled",
"globally",
"and",
"in",
"particular",
"for",
"this",
"producer",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/tracer/TracerRepository.java#L60-L68 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java | StatValueFactory.createStatValue | public static final StatValue createStatValue(Object aPattern, String aName, Interval[] aIntervals) {
return createStatValue(StatValueTypeUtility.object2type(aPattern),aName, aIntervals);
} | java | public static final StatValue createStatValue(Object aPattern, String aName, Interval[] aIntervals) {
return createStatValue(StatValueTypeUtility.object2type(aPattern),aName, aIntervals);
} | [
"public",
"static",
"final",
"StatValue",
"createStatValue",
"(",
"Object",
"aPattern",
",",
"String",
"aName",
",",
"Interval",
"[",
"]",
"aIntervals",
")",
"{",
"return",
"createStatValue",
"(",
"StatValueTypeUtility",
".",
"object2type",
"(",
"aPattern",
")",
... | This method creates a new StatValue instance.
The new object will be from the same type as the given template object.
@param aPattern the template object
@param aName the name of the value
@param aIntervals the list of Intervals to be used
@return the StatValue instance | [
"This",
"method",
"creates",
"a",
"new",
"StatValue",
"instance",
".",
"The",
"new",
"object",
"will",
"be",
"from",
"the",
"same",
"type",
"as",
"the",
"given",
"template",
"object",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java#L61-L63 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java | StatValueFactory.createStatValue | public static TypeAwareStatValue createStatValue(StatValueTypes aType, String aName, Interval[] aIntervals) {
IValueHolderFactory valueHolderFactory = StatValueTypeUtility.createValueHolderFactory(aType);
TypeAwareStatValue value = new TypeAwareStatValueImpl(aName, aType, valueHolderFactory);
// now we have to ad... | java | public static TypeAwareStatValue createStatValue(StatValueTypes aType, String aName, Interval[] aIntervals) {
IValueHolderFactory valueHolderFactory = StatValueTypeUtility.createValueHolderFactory(aType);
TypeAwareStatValue value = new TypeAwareStatValueImpl(aName, aType, valueHolderFactory);
// now we have to ad... | [
"public",
"static",
"TypeAwareStatValue",
"createStatValue",
"(",
"StatValueTypes",
"aType",
",",
"String",
"aName",
",",
"Interval",
"[",
"]",
"aIntervals",
")",
"{",
"IValueHolderFactory",
"valueHolderFactory",
"=",
"StatValueTypeUtility",
".",
"createValueHolderFactory... | This method creates a StatValue instance.
@param aType the type of the value
@param aName the name of the value
@param aIntervals the list of Intervals to be used
@return the StatValue instance | [
"This",
"method",
"creates",
"a",
"StatValue",
"instance",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/stats/impl/StatValueFactory.java#L73-L81 | train |
anotheria/moskito | moskito-web/src/main/java/net/anotheria/moskito/web/MoskitoAction.java | MoskitoAction.preProcessExecute | protected void preProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{
} | java | protected void preProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{
} | [
"protected",
"void",
"preProcessExecute",
"(",
"ActionMapping",
"mapping",
",",
"ActionForm",
"af",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"Exception",
"{",
"}"
] | This method allows you to perform some tasks prior to call to the moskitoExecute.
@param mapping
@param af
@param req
@param res
@throws Exception | [
"This",
"method",
"allows",
"you",
"to",
"perform",
"some",
"tasks",
"prior",
"to",
"call",
"to",
"the",
"moskitoExecute",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-web/src/main/java/net/anotheria/moskito/web/MoskitoAction.java#L131-L138 | train |
anotheria/moskito | moskito-web/src/main/java/net/anotheria/moskito/web/filters/DebugRequestFilter.java | DebugRequestFilter.debug | private void debug(final HttpServletRequest request) {
if (!logger.isInfoEnabled()) {
logger.warn("Logger INTO not enabled!");
return;
}
logger.info(HEADERS);
Enumeration headerEnumeration = request.getHeaderNames();
while (headerEnumeration.hasMoreElemen... | java | private void debug(final HttpServletRequest request) {
if (!logger.isInfoEnabled()) {
logger.warn("Logger INTO not enabled!");
return;
}
logger.info(HEADERS);
Enumeration headerEnumeration = request.getHeaderNames();
while (headerEnumeration.hasMoreElemen... | [
"private",
"void",
"debug",
"(",
"final",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"!",
"logger",
".",
"isInfoEnabled",
"(",
")",
")",
"{",
"logger",
".",
"warn",
"(",
"\"Logger INTO not enabled!\"",
")",
";",
"return",
";",
"}",
"logger",
"."... | Dump out to sysOut request parameters.
@param request provided {@link HttpServletRequest} | [
"Dump",
"out",
"to",
"sysOut",
"request",
"parameters",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-web/src/main/java/net/anotheria/moskito/web/filters/DebugRequestFilter.java#L71-L116 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/resource/ReplyObject.java | ReplyObject.error | public static ReplyObject error(String message){
ReplyObject ret = new ReplyObject();
ret.success = false;
ret.message = message;
return ret;
} | java | public static ReplyObject error(String message){
ReplyObject ret = new ReplyObject();
ret.success = false;
ret.message = message;
return ret;
} | [
"public",
"static",
"ReplyObject",
"error",
"(",
"String",
"message",
")",
"{",
"ReplyObject",
"ret",
"=",
"new",
"ReplyObject",
"(",
")",
";",
"ret",
".",
"success",
"=",
"false",
";",
"ret",
".",
"message",
"=",
"message",
";",
"return",
"ret",
";",
... | Factory method that creates a new erroneous reply object.
@param message
@return | [
"Factory",
"method",
"that",
"creates",
"a",
"new",
"erroneous",
"reply",
"object",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/resource/ReplyObject.java#L88-L93 | train |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/NginxStats.java | NginxStats.handleStatsResetIfNeeded | protected void handleStatsResetIfNeeded(StatusData<NginxMetrics> status) {
StatValue previousHandled = getStatValue(NginxMetrics.HANDLED);
Long currentHandled = Long.class.cast(status.get(NginxMetrics.HANDLED));
if (previousHandled != null && currentHandled != null && previousHandled.getValueAsL... | java | protected void handleStatsResetIfNeeded(StatusData<NginxMetrics> status) {
StatValue previousHandled = getStatValue(NginxMetrics.HANDLED);
Long currentHandled = Long.class.cast(status.get(NginxMetrics.HANDLED));
if (previousHandled != null && currentHandled != null && previousHandled.getValueAsL... | [
"protected",
"void",
"handleStatsResetIfNeeded",
"(",
"StatusData",
"<",
"NginxMetrics",
">",
"status",
")",
"{",
"StatValue",
"previousHandled",
"=",
"getStatValue",
"(",
"NginxMetrics",
".",
"HANDLED",
")",
";",
"Long",
"currentHandled",
"=",
"Long",
".",
"class... | Check HANDLED metric and if its value is lower than the stored one -
monitored Nginx server was restarted. In this case all DIFFLONG statValues
need resetting.
@param status latest status data. | [
"Check",
"HANDLED",
"metric",
"and",
"if",
"its",
"value",
"is",
"lower",
"than",
"the",
"stored",
"one",
"-",
"monitored",
"Nginx",
"server",
"was",
"restarted",
".",
"In",
"this",
"case",
"all",
"DIFFLONG",
"statValues",
"need",
"resetting",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/stats/NginxStats.java#L39-L51 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/accumulation/AccumulatorRepository.java | AccumulatorRepository.readConfig | private void readConfig(){
AccumulatorsConfig config = MoskitoConfigurationHolder.getConfiguration().getAccumulatorsConfig();
AccumulatorConfig[] acs = config.getAccumulators();
if (acs!=null && acs.length>0){
for (AccumulatorConfig ac : acs){
AccumulatorDefinition ad = new AccumulatorDefinition();
ad... | java | private void readConfig(){
AccumulatorsConfig config = MoskitoConfigurationHolder.getConfiguration().getAccumulatorsConfig();
AccumulatorConfig[] acs = config.getAccumulators();
if (acs!=null && acs.length>0){
for (AccumulatorConfig ac : acs){
AccumulatorDefinition ad = new AccumulatorDefinition();
ad... | [
"private",
"void",
"readConfig",
"(",
")",
"{",
"AccumulatorsConfig",
"config",
"=",
"MoskitoConfigurationHolder",
".",
"getConfiguration",
"(",
")",
".",
"getAccumulatorsConfig",
"(",
")",
";",
"AccumulatorConfig",
"[",
"]",
"acs",
"=",
"config",
".",
"getAccumul... | Reads the config and creates configured accumulators. For now this method is only executed on startup. | [
"Reads",
"the",
"config",
"and",
"creates",
"configured",
"accumulators",
".",
"For",
"now",
"this",
"method",
"is",
"only",
"executed",
"on",
"startup",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/accumulation/AccumulatorRepository.java#L103-L137 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/threshold/Thresholds.java | Thresholds.addThreshold | public static void addThreshold(String name, String producerName, String statName, String valueName, String intervalName,
ThresholdConditionGuard... guards) {
ThresholdDefinition definition = new ThresholdDefinition();
definition.setName(name);
definition.setProducerName(producerName);
definition.setStatName... | java | public static void addThreshold(String name, String producerName, String statName, String valueName, String intervalName,
ThresholdConditionGuard... guards) {
ThresholdDefinition definition = new ThresholdDefinition();
definition.setName(name);
definition.setProducerName(producerName);
definition.setStatName... | [
"public",
"static",
"void",
"addThreshold",
"(",
"String",
"name",
",",
"String",
"producerName",
",",
"String",
"statName",
",",
"String",
"valueName",
",",
"String",
"intervalName",
",",
"ThresholdConditionGuard",
"...",
"guards",
")",
"{",
"ThresholdDefinition",
... | Creates a new Threshold and adds it to repository.
@param name name of the Threshold.
@param producerName name of the associated producer.
@param statName name of the associated stat.
@param valueName name of the associated value.
@param intervalName name of the associated interval.
@param guards threshold guards. | [
"Creates",
"a",
"new",
"Threshold",
"and",
"adds",
"it",
"to",
"repository",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/threshold/Thresholds.java#L21-L36 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/MoskitoUIFilter.java | MoskitoUIFilter.isAuthorized | private boolean isAuthorized(HttpServletRequest request){
if(Boolean.TRUE.equals(
request.getSession(true).getAttribute(AuthConstants.AUTH_SESSION_ATTR_NAME)
))
return true; // Session contains auth flag - user is authorized
// Session not contains auth flag. Trying to find valid auth cookie
final Aut... | java | private boolean isAuthorized(HttpServletRequest request){
if(Boolean.TRUE.equals(
request.getSession(true).getAttribute(AuthConstants.AUTH_SESSION_ATTR_NAME)
))
return true; // Session contains auth flag - user is authorized
// Session not contains auth flag. Trying to find valid auth cookie
final Aut... | [
"private",
"boolean",
"isAuthorized",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"Boolean",
".",
"TRUE",
".",
"equals",
"(",
"request",
".",
"getSession",
"(",
"true",
")",
".",
"getAttribute",
"(",
"AuthConstants",
".",
"AUTH_SESSION_ATTR_NAME",... | Check is current connection user
authorized in moskito-inspect.
First checks authorization flag in session attributes.
Then tries to find valid authorization cookie, if flag not found.
If cookie was found - sets authorization flag to true.
@param request current servlet http request
@return true - user is authorized in... | [
"Check",
"is",
"current",
"connection",
"user",
"authorized",
"in",
"moskito",
"-",
"inspect",
".",
"First",
"checks",
"authorization",
"flag",
"in",
"session",
"attributes",
".",
"Then",
"tries",
"to",
"find",
"valid",
"authorization",
"cookie",
"if",
"flag",
... | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/MoskitoUIFilter.java#L70-L103 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/MoskitoUIFilter.java | MoskitoUIFilter.doFilter | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (!(request instanceof HttpServletRequest)){
chain.doFilter(request, response);
return;
}
HttpServletRequest httpServletRequest = ((HttpServletRequest) request);
... | java | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (!(request instanceof HttpServletRequest)){
chain.doFilter(request, response);
return;
}
HttpServletRequest httpServletRequest = ((HttpServletRequest) request);
... | [
"@",
"Override",
"public",
"void",
"doFilter",
"(",
"ServletRequest",
"request",
",",
"ServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"if",
"(",
"!",
"(",
"request",
"instanceof",
"HttpServlet... | Checks user authorization if it enabled in config | [
"Checks",
"user",
"authorization",
"if",
"it",
"enabled",
"in",
"config"
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/MoskitoUIFilter.java#L108-L147 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/threadhistory/ThreadHistoryEvent.java | ThreadHistoryEvent.created | public static final ThreadHistoryEvent created(long threadId, String threadName){
return new ThreadHistoryEvent(threadId, threadName, OPERATION.CREATED);
} | java | public static final ThreadHistoryEvent created(long threadId, String threadName){
return new ThreadHistoryEvent(threadId, threadName, OPERATION.CREATED);
} | [
"public",
"static",
"final",
"ThreadHistoryEvent",
"created",
"(",
"long",
"threadId",
",",
"String",
"threadName",
")",
"{",
"return",
"new",
"ThreadHistoryEvent",
"(",
"threadId",
",",
"threadName",
",",
"OPERATION",
".",
"CREATED",
")",
";",
"}"
] | Factory method to create new 'created' event.
@param threadId
@param threadName
@return | [
"Factory",
"method",
"to",
"create",
"new",
"created",
"event",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/threadhistory/ThreadHistoryEvent.java#L85-L87 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/util/threadhistory/ThreadHistoryEvent.java | ThreadHistoryEvent.deleted | public static final ThreadHistoryEvent deleted(long threadId, String threadName){
return new ThreadHistoryEvent(threadId, threadName, OPERATION.DELETED);
} | java | public static final ThreadHistoryEvent deleted(long threadId, String threadName){
return new ThreadHistoryEvent(threadId, threadName, OPERATION.DELETED);
} | [
"public",
"static",
"final",
"ThreadHistoryEvent",
"deleted",
"(",
"long",
"threadId",
",",
"String",
"threadName",
")",
"{",
"return",
"new",
"ThreadHistoryEvent",
"(",
"threadId",
",",
"threadName",
",",
"OPERATION",
".",
"DELETED",
")",
";",
"}"
] | Factory method to create new 'deleted' event.
@param threadId
@param threadName
@return | [
"Factory",
"method",
"to",
"create",
"new",
"deleted",
"event",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/util/threadhistory/ThreadHistoryEvent.java#L94-L96 | train |
anotheria/moskito | moskito-core/src/main/java/net/anotheria/moskito/core/predefined/ServletStats.java | ServletStats.initializeMe | private void initializeMe(){
Long pattern = Long.valueOf(0);
ioExceptions = StatValueFactory.createStatValue(pattern, "ioexceptions", getSelectedIntervals());
servletExceptions = StatValueFactory.createStatValue(pattern, "servletExceptions", getSelectedIntervals());
runtimeExceptions = StatValueFactory.createSt... | java | private void initializeMe(){
Long pattern = Long.valueOf(0);
ioExceptions = StatValueFactory.createStatValue(pattern, "ioexceptions", getSelectedIntervals());
servletExceptions = StatValueFactory.createStatValue(pattern, "servletExceptions", getSelectedIntervals());
runtimeExceptions = StatValueFactory.createSt... | [
"private",
"void",
"initializeMe",
"(",
")",
"{",
"Long",
"pattern",
"=",
"Long",
".",
"valueOf",
"(",
"0",
")",
";",
"ioExceptions",
"=",
"StatValueFactory",
".",
"createStatValue",
"(",
"pattern",
",",
"\"ioexceptions\"",
",",
"getSelectedIntervals",
"(",
")... | Initializes this object. | [
"Initializes",
"this",
"object",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/ServletStats.java#L85-L91 | train |
anotheria/moskito | moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/GenericMonitor.java | GenericMonitor.reconfigureMonitor | public static void reconfigureMonitor(MonitoringPluginConfig config) {
for (GenericMonitor monitor : MONITORS) {
if (monitor.config == config) {
monitor.stop();
monitor.setup();
}
}
} | java | public static void reconfigureMonitor(MonitoringPluginConfig config) {
for (GenericMonitor monitor : MONITORS) {
if (monitor.config == config) {
monitor.stop();
monitor.setup();
}
}
} | [
"public",
"static",
"void",
"reconfigureMonitor",
"(",
"MonitoringPluginConfig",
"config",
")",
"{",
"for",
"(",
"GenericMonitor",
"monitor",
":",
"MONITORS",
")",
"{",
"if",
"(",
"monitor",
".",
"config",
"==",
"config",
")",
"{",
"monitor",
".",
"stop",
"(... | Called when MonitoringPluginConfig source changed at runtime. | [
"Called",
"when",
"MonitoringPluginConfig",
"source",
"changed",
"at",
"runtime",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-extensions/moskito-monitoring-plugin/src/main/java/net/anotheria/moskito/extensions/monitoring/GenericMonitor.java#L142-L149 | train |
anotheria/moskito | moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/BaseDashboardAction.java | BaseDashboardAction.getSelectedDashboard | protected String getSelectedDashboard(HttpServletRequest req) throws APIException{
String dashboardName = req.getParameter("dashboard");
if (dashboardName!=null)
return dashboardName;
return getDashboardAPI().getDefaultDashboardName();
} | java | protected String getSelectedDashboard(HttpServletRequest req) throws APIException{
String dashboardName = req.getParameter("dashboard");
if (dashboardName!=null)
return dashboardName;
return getDashboardAPI().getDefaultDashboardName();
} | [
"protected",
"String",
"getSelectedDashboard",
"(",
"HttpServletRequest",
"req",
")",
"throws",
"APIException",
"{",
"String",
"dashboardName",
"=",
"req",
".",
"getParameter",
"(",
"\"dashboard\"",
")",
";",
"if",
"(",
"dashboardName",
"!=",
"null",
")",
"return"... | Returns currently selected dashboard.
@param req the http servlet request.
@return
@throws APIException | [
"Returns",
"currently",
"selected",
"dashboard",
"."
] | 0fdb79053b98a6ece610fa159f59bc3331e4cf05 | https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/dashboards/action/BaseDashboardAction.java#L57-L62 | train |
feroult/yawp | yawp-core/src/main/java/io/yawp/repository/pipes/pump/Pump.java | Pump.writeObject | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(clazz);
out.writeInt(defaultBatchSize);
out.writeInt(queryIndex);
out.writeObject(cursor);
out.writeObject(generators);
out.writeInt(generatorIndex);
writeObjects(out);
} | java | private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(clazz);
out.writeInt(defaultBatchSize);
out.writeInt(queryIndex);
out.writeObject(cursor);
out.writeObject(generators);
out.writeInt(generatorIndex);
writeObjects(out);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"writeObject",
"(",
"clazz",
")",
";",
"out",
".",
"writeInt",
"(",
"defaultBatchSize",
")",
";",
"out",
".",
"writeInt",
"(",
"queryIndex",
")... | Pumps may be serialized to be processed by asynchronous queues | [
"Pumps",
"may",
"be",
"serialized",
"to",
"be",
"processed",
"by",
"asynchronous",
"queues"
] | b90deb905edd3fdb3009a5525e310cd17ead7f3d | https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/repository/pipes/pump/Pump.java#L162-L170 | train |
feroult/yawp | yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java | ResourceFinder.findAvailableStrings | public List<String> findAvailableStrings(String uri) throws IOException {
resourcesNotLoaded.clear();
String fulluri = path + uri;
List<String> strings = new ArrayList<>();
Enumeration<URL> resources = getResources(fulluri);
while (resources.hasMoreElements()) {
URL... | java | public List<String> findAvailableStrings(String uri) throws IOException {
resourcesNotLoaded.clear();
String fulluri = path + uri;
List<String> strings = new ArrayList<>();
Enumeration<URL> resources = getResources(fulluri);
while (resources.hasMoreElements()) {
URL... | [
"public",
"List",
"<",
"String",
">",
"findAvailableStrings",
"(",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"resourcesNotLoaded",
".",
"clear",
"(",
")",
";",
"String",
"fulluri",
"=",
"path",
"+",
"uri",
";",
"List",
"<",
"String",
">",
"string... | Reads the contents of the found URLs as a Strings and returns them.
Individual URLs that cannot be read are skipped and added to the
list of 'resourcesNotLoaded'
@param uri
@return a list of the content of each resource URL found
@throws IOException if classLoader.getResources throws an exception | [
"Reads",
"the",
"contents",
"of",
"the",
"found",
"URLs",
"as",
"a",
"Strings",
"and",
"returns",
"them",
".",
"Individual",
"URLs",
"that",
"cannot",
"be",
"read",
"are",
"skipped",
"and",
"added",
"to",
"the",
"list",
"of",
"resourcesNotLoaded"
] | b90deb905edd3fdb3009a5525e310cd17ead7f3d | https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L192-L209 | train |
c-rack/cbor-java | src/main/java/co/nstant/in/cbor/encoder/HalfPrecisionFloatEncoder.java | HalfPrecisionFloatEncoder.fromFloat | public static int fromFloat(float fval) {
int fbits = Float.floatToIntBits(fval);
int sign = fbits >>> 16 & 0x8000; // sign only
int val = 0x1000 + fbits & 0x7fffffff; // rounded value
if (val >= 0x47800000) // might be or become NaN/Inf
{ // avoid Inf due to rounding
if ((fbits & 0x7fffffff) >= 0x4780000... | java | public static int fromFloat(float fval) {
int fbits = Float.floatToIntBits(fval);
int sign = fbits >>> 16 & 0x8000; // sign only
int val = 0x1000 + fbits & 0x7fffffff; // rounded value
if (val >= 0x47800000) // might be or become NaN/Inf
{ // avoid Inf due to rounding
if ((fbits & 0x7fffffff) >= 0x4780000... | [
"public",
"static",
"int",
"fromFloat",
"(",
"float",
"fval",
")",
"{",
"int",
"fbits",
"=",
"Float",
".",
"floatToIntBits",
"(",
"fval",
")",
";",
"int",
"sign",
"=",
"fbits",
">>>",
"16",
"&",
"0x8000",
";",
"// sign only",
"int",
"val",
"=",
"0x1000... | returns all higher 16 bits as 0 for all results | [
"returns",
"all",
"higher",
"16",
"bits",
"as",
"0",
"for",
"all",
"results"
] | 06bab3ac3fdb3dabcf059dbdae6804045e98b913 | https://github.com/c-rack/cbor-java/blob/06bab3ac3fdb3dabcf059dbdae6804045e98b913/src/main/java/co/nstant/in/cbor/encoder/HalfPrecisionFloatEncoder.java#L28-L56 | train |
c-rack/cbor-java | src/main/java/co/nstant/in/cbor/CborDecoder.java | CborDecoder.decode | public void decode(DataItemListener dataItemListener) throws CborException {
Objects.requireNonNull(dataItemListener);
DataItem dataItem = decodeNext();
while (dataItem != null) {
dataItemListener.onDataItem(dataItem);
dataItem = decodeNext();
}
} | java | public void decode(DataItemListener dataItemListener) throws CborException {
Objects.requireNonNull(dataItemListener);
DataItem dataItem = decodeNext();
while (dataItem != null) {
dataItemListener.onDataItem(dataItem);
dataItem = decodeNext();
}
} | [
"public",
"void",
"decode",
"(",
"DataItemListener",
"dataItemListener",
")",
"throws",
"CborException",
"{",
"Objects",
".",
"requireNonNull",
"(",
"dataItemListener",
")",
";",
"DataItem",
"dataItem",
"=",
"decodeNext",
"(",
")",
";",
"while",
"(",
"dataItem",
... | Streaming decoding of an input stream. On each decoded DataItem, the
callback listener is invoked.
@param dataItemListener
the callback listener
@throws CborException
if decoding failed | [
"Streaming",
"decoding",
"of",
"an",
"input",
"stream",
".",
"On",
"each",
"decoded",
"DataItem",
"the",
"callback",
"listener",
"is",
"invoked",
"."
] | 06bab3ac3fdb3dabcf059dbdae6804045e98b913 | https://github.com/c-rack/cbor-java/blob/06bab3ac3fdb3dabcf059dbdae6804045e98b913/src/main/java/co/nstant/in/cbor/CborDecoder.java#L105-L112 | train |
c-rack/cbor-java | src/main/java/co/nstant/in/cbor/CborDecoder.java | CborDecoder.decodeNext | public DataItem decodeNext() throws CborException {
int symbol;
try {
symbol = inputStream.read();
} catch (IOException ioException) {
throw new CborException(ioException);
}
if (symbol == -1) {
return null;
}
switch (MajorType.... | java | public DataItem decodeNext() throws CborException {
int symbol;
try {
symbol = inputStream.read();
} catch (IOException ioException) {
throw new CborException(ioException);
}
if (symbol == -1) {
return null;
}
switch (MajorType.... | [
"public",
"DataItem",
"decodeNext",
"(",
")",
"throws",
"CborException",
"{",
"int",
"symbol",
";",
"try",
"{",
"symbol",
"=",
"inputStream",
".",
"read",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioException",
")",
"{",
"throw",
"new",
"CborExcept... | Decodes exactly one DataItem from the input stream.
@return a {@link DataItem} or null if end of stream has reached.
@throws CborException
if decoding failed | [
"Decodes",
"exactly",
"one",
"DataItem",
"from",
"the",
"input",
"stream",
"."
] | 06bab3ac3fdb3dabcf059dbdae6804045e98b913 | https://github.com/c-rack/cbor-java/blob/06bab3ac3fdb3dabcf059dbdae6804045e98b913/src/main/java/co/nstant/in/cbor/CborDecoder.java#L121-L168 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.callback | public Fingerprint callback(FingerprintSecureCallback fingerprintSecureCallback, String KEY_NAME){
this.fingerprintSecureCallback = fingerprintSecureCallback;
this.cipherHelper = new CipherHelper(KEY_NAME);
return this;
} | java | public Fingerprint callback(FingerprintSecureCallback fingerprintSecureCallback, String KEY_NAME){
this.fingerprintSecureCallback = fingerprintSecureCallback;
this.cipherHelper = new CipherHelper(KEY_NAME);
return this;
} | [
"public",
"Fingerprint",
"callback",
"(",
"FingerprintSecureCallback",
"fingerprintSecureCallback",
",",
"String",
"KEY_NAME",
")",
"{",
"this",
".",
"fingerprintSecureCallback",
"=",
"fingerprintSecureCallback",
";",
"this",
".",
"cipherHelper",
"=",
"new",
"CipherHelper... | Set fingerprint secure callback.
@param fingerprintSecureCallback secure callback
@param KEY_NAME key that will be used for the cipher
@return the Fingerprint object itself | [
"Set",
"fingerprint",
"secure",
"callback",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L185-L189 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.fingerprintScanningColor | public Fingerprint fingerprintScanningColor(int fingerprintScanning) {
this.fingerprintScanning = fingerprintScanning;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintScanning)));
return this;
} | java | public Fingerprint fingerprintScanningColor(int fingerprintScanning) {
this.fingerprintScanning = fingerprintScanning;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintScanning)));
return this;
} | [
"public",
"Fingerprint",
"fingerprintScanningColor",
"(",
"int",
"fingerprintScanning",
")",
"{",
"this",
".",
"fingerprintScanning",
"=",
"fingerprintScanning",
";",
"this",
".",
"fingerprintImageView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",... | Set the fingerprint icon color in scanning state.
@param fingerprintScanning color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"icon",
"color",
"in",
"scanning",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L206-L210 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.fingerprintSuccessColor | public Fingerprint fingerprintSuccessColor(int fingerprintSuccess) {
this.fingerprintSuccess = fingerprintSuccess;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintSuccess)));
return this;
} | java | public Fingerprint fingerprintSuccessColor(int fingerprintSuccess) {
this.fingerprintSuccess = fingerprintSuccess;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintSuccess)));
return this;
} | [
"public",
"Fingerprint",
"fingerprintSuccessColor",
"(",
"int",
"fingerprintSuccess",
")",
"{",
"this",
".",
"fingerprintSuccess",
"=",
"fingerprintSuccess",
";",
"this",
".",
"fingerprintImageView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",
"... | Set the fingerprint icon color in success state.
@param fingerprintSuccess color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"icon",
"color",
"in",
"success",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L217-L221 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.fingerprintErrorColor | public Fingerprint fingerprintErrorColor(int fingerprintError) {
this.fingerprintError = fingerprintError;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintError)));
return this;
} | java | public Fingerprint fingerprintErrorColor(int fingerprintError) {
this.fingerprintError = fingerprintError;
this.fingerprintImageView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(fingerprintError)));
return this;
} | [
"public",
"Fingerprint",
"fingerprintErrorColor",
"(",
"int",
"fingerprintError",
")",
"{",
"this",
".",
"fingerprintError",
"=",
"fingerprintError",
";",
"this",
".",
"fingerprintImageView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",
"(",
"g... | Set the fingerprint icon color in error state.
@param fingerprintError color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"icon",
"color",
"in",
"error",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L228-L232 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.circleScanningColor | public Fingerprint circleScanningColor(int circleScanning) {
this.circleScanning = circleScanning;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleScanning)));
return this;
} | java | public Fingerprint circleScanningColor(int circleScanning) {
this.circleScanning = circleScanning;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleScanning)));
return this;
} | [
"public",
"Fingerprint",
"circleScanningColor",
"(",
"int",
"circleScanning",
")",
"{",
"this",
".",
"circleScanning",
"=",
"circleScanning",
";",
"this",
".",
"circleView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",
"(",
"getContext",
"(",... | Set the fingerprint circular background color in scanning state.
@param circleScanning color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"circular",
"background",
"color",
"in",
"scanning",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L239-L243 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.circleSuccessColor | public Fingerprint circleSuccessColor(int circleSuccess) {
this.circleSuccess = circleSuccess;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleSuccess)));
return this;
} | java | public Fingerprint circleSuccessColor(int circleSuccess) {
this.circleSuccess = circleSuccess;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleSuccess)));
return this;
} | [
"public",
"Fingerprint",
"circleSuccessColor",
"(",
"int",
"circleSuccess",
")",
"{",
"this",
".",
"circleSuccess",
"=",
"circleSuccess",
";",
"this",
".",
"circleView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",
"(",
"getContext",
"(",
"... | Set the fingerprint circular background color in success state.
@param circleSuccess color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"circular",
"background",
"color",
"in",
"success",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L250-L254 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.circleErrorColor | public Fingerprint circleErrorColor(int circleError) {
this.circleError = circleError;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleError)));
return this;
} | java | public Fingerprint circleErrorColor(int circleError) {
this.circleError = circleError;
this.circleView.setBackgroundTintList(ColorStateList.valueOf(getContext().getColor(circleError)));
return this;
} | [
"public",
"Fingerprint",
"circleErrorColor",
"(",
"int",
"circleError",
")",
"{",
"this",
".",
"circleError",
"=",
"circleError",
";",
"this",
".",
"circleView",
".",
"setBackgroundTintList",
"(",
"ColorStateList",
".",
"valueOf",
"(",
"getContext",
"(",
")",
".... | Set the fingerprint circular background color in error state.
@param circleError color id
@return the Fingerprint object itself | [
"Set",
"the",
"fingerprint",
"circular",
"background",
"color",
"in",
"error",
"state",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L261-L265 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.isAvailable | public static boolean isAvailable(Context context){
FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if(fingerprintManager!=null){
return (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints(... | java | public static boolean isAvailable(Context context){
FingerprintManager fingerprintManager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if(fingerprintManager!=null){
return (fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints(... | [
"public",
"static",
"boolean",
"isAvailable",
"(",
"Context",
"context",
")",
"{",
"FingerprintManager",
"fingerprintManager",
"=",
"(",
"FingerprintManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"FINGERPRINT_SERVICE",
")",
";",
"if",
"(",
... | Check if fingerprint authentication is supported by the device and if a fingerprint is enrolled in the device.
@param context an activity context
@return a boolean value | [
"Check",
"if",
"fingerprint",
"authentication",
"is",
"supported",
"by",
"the",
"device",
"and",
"if",
"a",
"fingerprint",
"is",
"enrolled",
"in",
"the",
"device",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L294-L300 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java | Fingerprint.authenticate | public void authenticate(){
if(fingerprintSecureCallback!=null){
if(cryptoObject!=null){
throw new RuntimeException("If you specify a CryptoObject you have to use FingerprintCallback");
}
cryptoObject = cipherHelper.getEncryptionCryptoObject();
if(... | java | public void authenticate(){
if(fingerprintSecureCallback!=null){
if(cryptoObject!=null){
throw new RuntimeException("If you specify a CryptoObject you have to use FingerprintCallback");
}
cryptoObject = cipherHelper.getEncryptionCryptoObject();
if(... | [
"public",
"void",
"authenticate",
"(",
")",
"{",
"if",
"(",
"fingerprintSecureCallback",
"!=",
"null",
")",
"{",
"if",
"(",
"cryptoObject",
"!=",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"If you specify a CryptoObject you have to use FingerprintCal... | start fingerprint scan | [
"start",
"fingerprint",
"scan"
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/view/Fingerprint.java#L305-L378 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java | FingerprintDialog.isAvailable | public static boolean isAvailable(Context context){
FingerprintManager manager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
return (manager!=null && manager.isHardwareDetected() && manager.hasEnrolledFingerprints());
} | java | public static boolean isAvailable(Context context){
FingerprintManager manager = (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
return (manager!=null && manager.isHardwareDetected() && manager.hasEnrolledFingerprints());
} | [
"public",
"static",
"boolean",
"isAvailable",
"(",
"Context",
"context",
")",
"{",
"FingerprintManager",
"manager",
"=",
"(",
"FingerprintManager",
")",
"context",
".",
"getSystemService",
"(",
"Context",
".",
"FINGERPRINT_SERVICE",
")",
";",
"return",
"(",
"manag... | Check if a fingerprint scanner is available and if at least one finger is enrolled in the phone.
@param context A context
@return True is authentication is available, False otherwise | [
"Check",
"if",
"a",
"fingerprint",
"scanner",
"is",
"available",
"and",
"if",
"at",
"least",
"one",
"finger",
"is",
"enrolled",
"in",
"the",
"phone",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java#L72-L75 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java | FingerprintDialog.callback | public FingerprintDialog callback(FingerprintDialogSecureCallback fingerprintDialogSecureCallback, String KEY_NAME){
this.fingerprintDialogSecureCallback = fingerprintDialogSecureCallback;
this.fingerprint.callback(fingerprintSecureCallback, KEY_NAME);
return this;
} | java | public FingerprintDialog callback(FingerprintDialogSecureCallback fingerprintDialogSecureCallback, String KEY_NAME){
this.fingerprintDialogSecureCallback = fingerprintDialogSecureCallback;
this.fingerprint.callback(fingerprintSecureCallback, KEY_NAME);
return this;
} | [
"public",
"FingerprintDialog",
"callback",
"(",
"FingerprintDialogSecureCallback",
"fingerprintDialogSecureCallback",
",",
"String",
"KEY_NAME",
")",
"{",
"this",
".",
"fingerprintDialogSecureCallback",
"=",
"fingerprintDialogSecureCallback",
";",
"this",
".",
"fingerprint",
... | Set a callback for secured authentication.
@param fingerprintDialogSecureCallback The callback
@param KEY_NAME An arbitrary string used to create a cipher pair in the Android KeyStore
@return FingerprintDialog object | [
"Set",
"a",
"callback",
"for",
"secured",
"authentication",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java#L103-L107 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java | FingerprintDialog.tryLimit | public FingerprintDialog tryLimit(int limit, final FailAuthCounterDialogCallback counterCallback){
this.fingerprint.tryLimit(limit, new FailAuthCounterCallback() {
@Override
public void onTryLimitReached(Fingerprint fingerprint) {
counterCallback.onTryLimitReached(Fingerp... | java | public FingerprintDialog tryLimit(int limit, final FailAuthCounterDialogCallback counterCallback){
this.fingerprint.tryLimit(limit, new FailAuthCounterCallback() {
@Override
public void onTryLimitReached(Fingerprint fingerprint) {
counterCallback.onTryLimitReached(Fingerp... | [
"public",
"FingerprintDialog",
"tryLimit",
"(",
"int",
"limit",
",",
"final",
"FailAuthCounterDialogCallback",
"counterCallback",
")",
"{",
"this",
".",
"fingerprint",
".",
"tryLimit",
"(",
"limit",
",",
"new",
"FailAuthCounterCallback",
"(",
")",
"{",
"@",
"Overr... | Set a fail limit. Android blocks automatically when 5 attempts failed.
@param limit number of tries
@param counterCallback callback to be triggered when limit is reached
@return FingerprintDialog object | [
"Set",
"a",
"fail",
"limit",
".",
"Android",
"blocks",
"automatically",
"when",
"5",
"attempts",
"failed",
"."
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/dialog/FingerprintDialog.java#L236-L244 | train |
OmarAflak/Fingerprint | fingerprint/src/main/java/me/aflak/libraries/dialog/PasswordDialog.java | PasswordDialog.show | public void show(){
if(title==null || message==null) {
throw new RuntimeException("Title or message cannot be null.");
}
dialogView = layoutInflater.inflate(R.layout.password_dialog, null);
((TextView) dialogView.findViewById(R.id.password_dialog_title)).setText(title);
... | java | public void show(){
if(title==null || message==null) {
throw new RuntimeException("Title or message cannot be null.");
}
dialogView = layoutInflater.inflate(R.layout.password_dialog, null);
((TextView) dialogView.findViewById(R.id.password_dialog_title)).setText(title);
... | [
"public",
"void",
"show",
"(",
")",
"{",
"if",
"(",
"title",
"==",
"null",
"||",
"message",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Title or message cannot be null.\"",
")",
";",
"}",
"dialogView",
"=",
"layoutInflater",
".",
"inf... | Show the password dialog | [
"Show",
"the",
"password",
"dialog"
] | 4a4cd4a8f092a126f4204eea087d845360342a62 | https://github.com/OmarAflak/Fingerprint/blob/4a4cd4a8f092a126f4204eea087d845360342a62/fingerprint/src/main/java/me/aflak/libraries/dialog/PasswordDialog.java#L82-L153 | train |
NaluKit/nalu | nalu/src/main/java/com/github/nalukit/nalu/client/internal/PropertyFactory.java | PropertyFactory.register | public void register(boolean hasHistory,
boolean usingHash,
boolean usingColonForParametersInUrl) {
this.hasHistory = hasHistory;
this.usingHash = usingHash;
this.usingColonForParametersInUrl = usingColonForParametersInUrl;
} | java | public void register(boolean hasHistory,
boolean usingHash,
boolean usingColonForParametersInUrl) {
this.hasHistory = hasHistory;
this.usingHash = usingHash;
this.usingColonForParametersInUrl = usingColonForParametersInUrl;
} | [
"public",
"void",
"register",
"(",
"boolean",
"hasHistory",
",",
"boolean",
"usingHash",
",",
"boolean",
"usingColonForParametersInUrl",
")",
"{",
"this",
".",
"hasHistory",
"=",
"hasHistory",
";",
"this",
".",
"usingHash",
"=",
"usingHash",
";",
"this",
".",
... | Do NOT cll this method!
@param hasHistory Will Nalu support a histroy toekn?
@param usingHash Will Nalu use a hash for Navigation?
@param usingColonForParametersInUrl Will Nalu use colons to mark parameters inside the url? | [
"Do",
"NOT",
"cll",
"this",
"method!"
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/com/github/nalukit/nalu/client/internal/PropertyFactory.java#L60-L66 | train |
NaluKit/nalu | nalu/src/main/java/org/gwtproject/event/shared/Event.java | Event.toDebugString | public String toDebugString() {
String name = this.getClass()
.getName();
name = name.substring(name.lastIndexOf(".") + 1);
return "event: " + name + ":";
} | java | public String toDebugString() {
String name = this.getClass()
.getName();
name = name.substring(name.lastIndexOf(".") + 1);
return "event: " + name + ":";
} | [
"public",
"String",
"toDebugString",
"(",
")",
"{",
"String",
"name",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"name",
"=",
"name",
".",
"substring",
"(",
"name",
".",
"lastIndexOf",
"(",
"\".\"",
")",
"+",
"1",
")",
"... | This is a method used primarily for debugging. It gives a string representation of the event
details. This does not override the toString method because the compiler cannot always optimize
toString out correctly. Event types should override as desired.
@return a string representing the event's specifics. | [
"This",
"is",
"a",
"method",
"used",
"primarily",
"for",
"debugging",
".",
"It",
"gives",
"a",
"string",
"representation",
"of",
"the",
"event",
"details",
".",
"This",
"does",
"not",
"override",
"the",
"toString",
"method",
"because",
"the",
"compiler",
"ca... | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/org/gwtproject/event/shared/Event.java#L75-L80 | train |
NaluKit/nalu | nalu/src/main/java/com/github/nalukit/nalu/client/component/AbstractComponentController.java | AbstractComponentController.getComposite | @SuppressWarnings("unchecked")
public <S extends AbstractCompositeController<?, ?, ?>> S getComposite(String name) {
return (S) this.getComposites()
.get(name);
} | java | @SuppressWarnings("unchecked")
public <S extends AbstractCompositeController<?, ?, ?>> S getComposite(String name) {
return (S) this.getComposites()
.get(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"S",
"extends",
"AbstractCompositeController",
"<",
"?",
",",
"?",
",",
"?",
">",
">",
"S",
"getComposite",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"S",
")",
"this",
".",
"getComp... | Returns the composite stored under the composite name.
@param name the name of the composite
@param <S> type of the composite
@return instance of the composite | [
"Returns",
"the",
"composite",
"stored",
"under",
"the",
"composite",
"name",
"."
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/com/github/nalukit/nalu/client/component/AbstractComponentController.java#L170-L174 | train |
NaluKit/nalu | nalu-plugin-gwt-processor/src/main/java/com/github/nalukit/nalu/processor/ProcessorUtils.java | ProcessorUtils.extendsClassOrInterface | public boolean extendsClassOrInterface(Types types,
TypeMirror typeMirror,
TypeMirror toImplement) {
String clearedToImplement = this.removeGenericsFromClassName(toImplement.toString());
Set<TypeMirror> setOfSuperType = this.getFl... | java | public boolean extendsClassOrInterface(Types types,
TypeMirror typeMirror,
TypeMirror toImplement) {
String clearedToImplement = this.removeGenericsFromClassName(toImplement.toString());
Set<TypeMirror> setOfSuperType = this.getFl... | [
"public",
"boolean",
"extendsClassOrInterface",
"(",
"Types",
"types",
",",
"TypeMirror",
"typeMirror",
",",
"TypeMirror",
"toImplement",
")",
"{",
"String",
"clearedToImplement",
"=",
"this",
".",
"removeGenericsFromClassName",
"(",
"toImplement",
".",
"toString",
"(... | checks if a class or interface is implemented.
@param types types
@param typeMirror of the class to check
@param toImplement the type mirror to implement
@return true - class is implemented | [
"checks",
"if",
"a",
"class",
"or",
"interface",
"is",
"implemented",
"."
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu-plugin-gwt-processor/src/main/java/com/github/nalukit/nalu/processor/ProcessorUtils.java#L123-L135 | train |
NaluKit/nalu | nalu/src/main/java/org/gwtproject/event/shared/ResettableEventBus.java | ResettableEventBus.removeHandlers | public void removeHandlers() {
Iterator<HandlerRegistration> it = registrations.iterator();
while (it.hasNext()) {
HandlerRegistration r = it.next();
/*
* must remove before we call removeHandler. Might have come from nested
* ResettableEventBus
*/
it.remove();
r.r... | java | public void removeHandlers() {
Iterator<HandlerRegistration> it = registrations.iterator();
while (it.hasNext()) {
HandlerRegistration r = it.next();
/*
* must remove before we call removeHandler. Might have come from nested
* ResettableEventBus
*/
it.remove();
r.r... | [
"public",
"void",
"removeHandlers",
"(",
")",
"{",
"Iterator",
"<",
"HandlerRegistration",
">",
"it",
"=",
"registrations",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"HandlerRegistration",
"r",
"=",
"it",
"."... | Remove all handlers that have been added through this wrapper. | [
"Remove",
"all",
"handlers",
"that",
"have",
"been",
"added",
"through",
"this",
"wrapper",
"."
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/org/gwtproject/event/shared/ResettableEventBus.java#L72-L85 | train |
NaluKit/nalu | nalu/src/main/java/com/github/nalukit/nalu/client/internal/route/AbstractRouter.java | AbstractRouter.storeInCache | public <C extends AbstractComponentController<?, ?, ?>> void storeInCache(C controller) {
ControllerFactory.get()
.storeInCache(controller);
controller.setCached(true);
} | java | public <C extends AbstractComponentController<?, ?, ?>> void storeInCache(C controller) {
ControllerFactory.get()
.storeInCache(controller);
controller.setCached(true);
} | [
"public",
"<",
"C",
"extends",
"AbstractComponentController",
"<",
"?",
",",
"?",
",",
"?",
">",
">",
"void",
"storeInCache",
"(",
"C",
"controller",
")",
"{",
"ControllerFactory",
".",
"get",
"(",
")",
".",
"storeInCache",
"(",
"controller",
")",
";",
"... | Stores the instance of the controller in the cache, so that it can be reused the next time
the route is called.
@param controller controller to store
@param <C> controller type | [
"Stores",
"the",
"instance",
"of",
"the",
"controller",
"in",
"the",
"cache",
"so",
"that",
"it",
"can",
"be",
"reused",
"the",
"next",
"time",
"the",
"route",
"is",
"called",
"."
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/com/github/nalukit/nalu/client/internal/route/AbstractRouter.java#L207-L211 | train |
NaluKit/nalu | nalu/src/main/java/com/github/nalukit/nalu/client/internal/route/AbstractRouter.java | AbstractRouter.removeFromCache | public <C extends AbstractComponentController<?, ?, ?>> void removeFromCache(C controller) {
ControllerFactory.get()
.removeFromCache(controller);
controller.setCached(false);
} | java | public <C extends AbstractComponentController<?, ?, ?>> void removeFromCache(C controller) {
ControllerFactory.get()
.removeFromCache(controller);
controller.setCached(false);
} | [
"public",
"<",
"C",
"extends",
"AbstractComponentController",
"<",
"?",
",",
"?",
",",
"?",
">",
">",
"void",
"removeFromCache",
"(",
"C",
"controller",
")",
"{",
"ControllerFactory",
".",
"get",
"(",
")",
".",
"removeFromCache",
"(",
"controller",
")",
";... | Removes a controller from the chache
@param controller controller to be removed
@param <C> controller type | [
"Removes",
"a",
"controller",
"from",
"the",
"chache"
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/com/github/nalukit/nalu/client/internal/route/AbstractRouter.java#L219-L223 | train |
NaluKit/nalu | nalu-plugin-core-web/src/main/java/com/github/nalukit/nalu/plugin/core/web/client/NaluPluginCoreWeb.java | NaluPluginCoreWeb.logNewUrl | public static void logNewUrl(String newUrl) {
StringBuilder sb = new StringBuilder();
sb.append("Router: new url ->>")
.append(newUrl)
.append("<<");
ClientLogger.get()
.logSimple(sb.toString(),
0);
} | java | public static void logNewUrl(String newUrl) {
StringBuilder sb = new StringBuilder();
sb.append("Router: new url ->>")
.append(newUrl)
.append("<<");
ClientLogger.get()
.logSimple(sb.toString(),
0);
} | [
"public",
"static",
"void",
"logNewUrl",
"(",
"String",
"newUrl",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"Router: new url ->>\"",
")",
".",
"append",
"(",
"newUrl",
")",
".",
"append",
"(",
... | Log's the new URL on the browser's console
@param newUrl new url to log | [
"Log",
"s",
"the",
"new",
"URL",
"on",
"the",
"browser",
"s",
"console"
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu-plugin-core-web/src/main/java/com/github/nalukit/nalu/plugin/core/web/client/NaluPluginCoreWeb.java#L44-L52 | train |
NaluKit/nalu | nalu/src/main/java/com/github/nalukit/nalu/client/internal/application/AbstractApplication.java | AbstractApplication.onFinishLoading | private void onFinishLoading() {
// save the current hash
String hashOnStart = this.plugin.getStartRoute(isUsingHash());
// check if the url contains a hash.
// in case it has a hash, use this to route otherwise
// use the startRoute from the annotation
if (hashOnStart != null &&
hashOnS... | java | private void onFinishLoading() {
// save the current hash
String hashOnStart = this.plugin.getStartRoute(isUsingHash());
// check if the url contains a hash.
// in case it has a hash, use this to route otherwise
// use the startRoute from the annotation
if (hashOnStart != null &&
hashOnS... | [
"private",
"void",
"onFinishLoading",
"(",
")",
"{",
"// save the current hash",
"String",
"hashOnStart",
"=",
"this",
".",
"plugin",
".",
"getStartRoute",
"(",
"isUsingHash",
"(",
")",
")",
";",
"// check if the url contains a hash.",
"// in case it has a hash, use this ... | Once the loader did his job, we will continue | [
"Once",
"the",
"loader",
"did",
"his",
"job",
"we",
"will",
"continue"
] | 0c110cdc0437d2ad03c27ce847dadd5d3f5168e1 | https://github.com/NaluKit/nalu/blob/0c110cdc0437d2ad03c27ce847dadd5d3f5168e1/nalu/src/main/java/com/github/nalukit/nalu/client/internal/application/AbstractApplication.java#L213-L243 | train |
dynjs/dynjs | src/main/java/org/dynjs/runtime/modules/ModuleProvider.java | ModuleProvider.setLocalVar | public static void setLocalVar(ExecutionContext context, String name, Object value) {
LexicalEnvironment localEnv = context.getLexicalEnvironment();
localEnv.getRecord().createMutableBinding(context, name, false);
localEnv.getRecord().setMutableBinding(context, name, value, false);
} | java | public static void setLocalVar(ExecutionContext context, String name, Object value) {
LexicalEnvironment localEnv = context.getLexicalEnvironment();
localEnv.getRecord().createMutableBinding(context, name, false);
localEnv.getRecord().setMutableBinding(context, name, value, false);
} | [
"public",
"static",
"void",
"setLocalVar",
"(",
"ExecutionContext",
"context",
",",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"LexicalEnvironment",
"localEnv",
"=",
"context",
".",
"getLexicalEnvironment",
"(",
")",
";",
"localEnv",
".",
"getRecord",
"... | A convenience for module providers. Sets a scoped variable on the provided
ExecutionContext.
@param context The execution context to bind the variable to
@param name The name of the variable
@param value The value to set the variable to | [
"A",
"convenience",
"for",
"module",
"providers",
".",
"Sets",
"a",
"scoped",
"variable",
"on",
"the",
"provided",
"ExecutionContext",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/ModuleProvider.java#L45-L49 | train |
dynjs/dynjs | src/main/java/org/dynjs/runtime/modules/ModuleProvider.java | ModuleProvider.getLocalVar | public static Object getLocalVar(ExecutionContext context, String name) {
LexicalEnvironment localEnv = context.getLexicalEnvironment();
if (localEnv.getRecord().hasBinding(context, name)) {
return localEnv.getRecord().getBindingValue(context, name, false);
}
return null;
... | java | public static Object getLocalVar(ExecutionContext context, String name) {
LexicalEnvironment localEnv = context.getLexicalEnvironment();
if (localEnv.getRecord().hasBinding(context, name)) {
return localEnv.getRecord().getBindingValue(context, name, false);
}
return null;
... | [
"public",
"static",
"Object",
"getLocalVar",
"(",
"ExecutionContext",
"context",
",",
"String",
"name",
")",
"{",
"LexicalEnvironment",
"localEnv",
"=",
"context",
".",
"getLexicalEnvironment",
"(",
")",
";",
"if",
"(",
"localEnv",
".",
"getRecord",
"(",
")",
... | A convenience for module providers. Gets a scoped variable from
the provided ExecutionContext
@param context The context to search for name
@param name The name of the variable
@return The value of the variable | [
"A",
"convenience",
"for",
"module",
"providers",
".",
"Gets",
"a",
"scoped",
"variable",
"from",
"the",
"provided",
"ExecutionContext"
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/ModuleProvider.java#L58-L64 | train |
dynjs/dynjs | src/main/java/org/dynjs/runtime/modules/ModuleProvider.java | ModuleProvider.normalizeName | protected String normalizeName(String originalName) {
if (originalName == null || originalName.endsWith(".js")) {
return originalName;
}
return originalName + ".js";
} | java | protected String normalizeName(String originalName) {
if (originalName == null || originalName.endsWith(".js")) {
return originalName;
}
return originalName + ".js";
} | [
"protected",
"String",
"normalizeName",
"(",
"String",
"originalName",
")",
"{",
"if",
"(",
"originalName",
"==",
"null",
"||",
"originalName",
".",
"endsWith",
"(",
"\".js\"",
")",
")",
"{",
"return",
"originalName",
";",
"}",
"return",
"originalName",
"+",
... | Helper method. Since module names should not include the .js extension, but the actual
modules themselves usually do.
@param originalName the module name
@return the normalized name | [
"Helper",
"method",
".",
"Since",
"module",
"names",
"should",
"not",
"include",
"the",
".",
"js",
"extension",
"but",
"the",
"actual",
"modules",
"themselves",
"usually",
"do",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/ModuleProvider.java#L72-L77 | train |
dynjs/dynjs | src/main/java/org/dynjs/ir/representations/CFG.java | CFG.buildExitBasicBlock | private BasicBlock buildExitBasicBlock(Stack<ExceptionRegion> nestedExceptionRegions, BasicBlock firstBB,
List<BasicBlock> returnBBs, List<BasicBlock> exceptionBBs, boolean nextIsFallThrough, BasicBlock currBB, BasicBlock entryBB) {
exitBB = createBB(nestedExceptionReg... | java | private BasicBlock buildExitBasicBlock(Stack<ExceptionRegion> nestedExceptionRegions, BasicBlock firstBB,
List<BasicBlock> returnBBs, List<BasicBlock> exceptionBBs, boolean nextIsFallThrough, BasicBlock currBB, BasicBlock entryBB) {
exitBB = createBB(nestedExceptionReg... | [
"private",
"BasicBlock",
"buildExitBasicBlock",
"(",
"Stack",
"<",
"ExceptionRegion",
">",
"nestedExceptionRegions",
",",
"BasicBlock",
"firstBB",
",",
"List",
"<",
"BasicBlock",
">",
"returnBBs",
",",
"List",
"<",
"BasicBlock",
">",
"exceptionBBs",
",",
"boolean",
... | Create special empty exit BasicBlock that all BasicBlocks will eventually
flow into. All Edges to this 'dummy' BasicBlock will get marked with
an edge type of EXIT.
Special BasicBlocks worth noting:
1. Exceptions, Returns, Entry(why?) -> ExitBB
2. Returns -> ExitBB | [
"Create",
"special",
"empty",
"exit",
"BasicBlock",
"that",
"all",
"BasicBlocks",
"will",
"eventually",
"flow",
"into",
".",
"All",
"Edges",
"to",
"this",
"dummy",
"BasicBlock",
"will",
"get",
"marked",
"with",
"an",
"edge",
"type",
"of",
"EXIT",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/representations/CFG.java#L267-L285 | train |
dynjs/dynjs | src/main/java/org/dynjs/ir/Scope.java | Scope.findVariable | public LocalVariable findVariable(String name, int depth) {
LocalVariable variable = localVariables.get(name);
if (variable != null) {
// Destined scope need adjusted variable since it need to know how deep to look for it.
if (depth != 0) {
return new LocalVariab... | java | public LocalVariable findVariable(String name, int depth) {
LocalVariable variable = localVariables.get(name);
if (variable != null) {
// Destined scope need adjusted variable since it need to know how deep to look for it.
if (depth != 0) {
return new LocalVariab... | [
"public",
"LocalVariable",
"findVariable",
"(",
"String",
"name",
",",
"int",
"depth",
")",
"{",
"LocalVariable",
"variable",
"=",
"localVariables",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"variable",
"!=",
"null",
")",
"{",
"// Destined scope need adjus... | Tries to find a variable or returns null if it cannot. This
will walk all scopes to find a captured variable. | [
"Tries",
"to",
"find",
"a",
"variable",
"or",
"returns",
"null",
"if",
"it",
"cannot",
".",
"This",
"will",
"walk",
"all",
"scopes",
"to",
"find",
"a",
"captured",
"variable",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/Scope.java#L89-L106 | train |
dynjs/dynjs | src/main/java/org/dynjs/ir/Scope.java | Scope.acquireLocalVariable | public Variable acquireLocalVariable(String name) {
int depth = 0;
LocalVariable variable = findVariable(name, depth);
if (variable == null) {
variable = new LocalVariable(name, localVariablesIndex, 0);
localVariables.put(name, variable);
localVariablesIndex+... | java | public Variable acquireLocalVariable(String name) {
int depth = 0;
LocalVariable variable = findVariable(name, depth);
if (variable == null) {
variable = new LocalVariable(name, localVariablesIndex, 0);
localVariables.put(name, variable);
localVariablesIndex+... | [
"public",
"Variable",
"acquireLocalVariable",
"(",
"String",
"name",
")",
"{",
"int",
"depth",
"=",
"0",
";",
"LocalVariable",
"variable",
"=",
"findVariable",
"(",
"name",
",",
"depth",
")",
";",
"if",
"(",
"variable",
"==",
"null",
")",
"{",
"variable",
... | Return an existing variable or return a new one made in this scope. | [
"Return",
"an",
"existing",
"variable",
"or",
"return",
"a",
"new",
"one",
"made",
"in",
"this",
"scope",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/Scope.java#L115-L126 | train |
dynjs/dynjs | src/main/java/org/dynjs/runtime/modules/FilesystemModuleProvider.java | FilesystemModuleProvider.findFile | protected File findFile(List<String> loadPaths, String moduleName) {
String fileName = normalizeName(moduleName);
File file = new File( moduleName );
if ( file.isAbsolute() ) {
if ( file.exists() ) {
return file;
}
}
for (String loadPath : ... | java | protected File findFile(List<String> loadPaths, String moduleName) {
String fileName = normalizeName(moduleName);
File file = new File( moduleName );
if ( file.isAbsolute() ) {
if ( file.exists() ) {
return file;
}
}
for (String loadPath : ... | [
"protected",
"File",
"findFile",
"(",
"List",
"<",
"String",
">",
"loadPaths",
",",
"String",
"moduleName",
")",
"{",
"String",
"fileName",
"=",
"normalizeName",
"(",
"moduleName",
")",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"moduleName",
")",
";",
... | Finds the module file based on the known load paths.
@param loadPaths the list of load paths to search
@param moduleName the name of the module to find
@return the File if found, else null | [
"Finds",
"the",
"module",
"file",
"based",
"on",
"the",
"known",
"load",
"paths",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/runtime/modules/FilesystemModuleProvider.java#L64-L79 | train |
dynjs/dynjs | src/main/java/org/dynjs/ir/representations/CFGLinearizer.java | CFGLinearizer.addJumpIfNextNotDestination | private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instruction lastInstr, BasicBlock current) {
Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator();
BasicBlock target = outs.hasNext() ? outs.next() : null;
if (target != null && !outs.hasNext()) {
... | java | private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instruction lastInstr, BasicBlock current) {
Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator();
BasicBlock target = outs.hasNext() ? outs.next() : null;
if (target != null && !outs.hasNext()) {
... | [
"private",
"static",
"void",
"addJumpIfNextNotDestination",
"(",
"CFG",
"cfg",
",",
"BasicBlock",
"next",
",",
"Instruction",
"lastInstr",
",",
"BasicBlock",
"current",
")",
"{",
"Iterator",
"<",
"BasicBlock",
">",
"outs",
"=",
"cfg",
".",
"getOutgoingDestinations... | If there is no jump at add of block and the next block is not destination insert a valid jump | [
"If",
"there",
"is",
"no",
"jump",
"at",
"add",
"of",
"block",
"and",
"the",
"next",
"block",
"is",
"not",
"destination",
"insert",
"a",
"valid",
"jump"
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/representations/CFGLinearizer.java#L127-L136 | train |
dynjs/dynjs | src/main/java/org/dynjs/ir/Instruction.java | Instruction.getUsedVariables | public List<Variable> getUsedVariables() {
ArrayList<Variable> vars = new ArrayList<Variable>();
for (Operand o : getOperands()) {
o.addUsedVariables(vars);
}
return vars;
} | java | public List<Variable> getUsedVariables() {
ArrayList<Variable> vars = new ArrayList<Variable>();
for (Operand o : getOperands()) {
o.addUsedVariables(vars);
}
return vars;
} | [
"public",
"List",
"<",
"Variable",
">",
"getUsedVariables",
"(",
")",
"{",
"ArrayList",
"<",
"Variable",
">",
"vars",
"=",
"new",
"ArrayList",
"<",
"Variable",
">",
"(",
")",
";",
"for",
"(",
"Operand",
"o",
":",
"getOperands",
"(",
")",
")",
"{",
"o... | List of all variables used by this instruction. | [
"List",
"of",
"all",
"variables",
"used",
"by",
"this",
"instruction",
"."
] | 4bc6715eff8768f8cd92c6a167d621bbfc1e1a91 | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/Instruction.java#L44-L52 | train |
konmik/solid | streams/src/main/java/solid/stream/Range.java | Range.range | public static Stream<Integer> range(final int from, final int to, final int step) {
return new Stream<Integer>() {
@Override
public Iterator<Integer> iterator() {
return new ReadOnlyIterator<Integer>() {
int value = from;
@Overrid... | java | public static Stream<Integer> range(final int from, final int to, final int step) {
return new Stream<Integer>() {
@Override
public Iterator<Integer> iterator() {
return new ReadOnlyIterator<Integer>() {
int value = from;
@Overrid... | [
"public",
"static",
"Stream",
"<",
"Integer",
">",
"range",
"(",
"final",
"int",
"from",
",",
"final",
"int",
"to",
",",
"final",
"int",
"step",
")",
"{",
"return",
"new",
"Stream",
"<",
"Integer",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iter... | Creates a stream that contains a given number of integers starting from a given number.
@param from a staring value
@param to an ending value, exclusive
@param step the value to add to for the next item
@return a stream that contains a given number of integers starting from a given number. | [
"Creates",
"a",
"stream",
"that",
"contains",
"a",
"given",
"number",
"of",
"integers",
"starting",
"from",
"a",
"given",
"number",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Range.java#L15-L37 | train |
konmik/solid | streams/src/main/java/solid/optional/Optional.java | Optional.of | public static <T> Optional<T> of(T value) {
return value == null ? (Optional<T>) EMPTY : new Optional<>(value);
} | java | public static <T> Optional<T> of(T value) {
return value == null ? (Optional<T>) EMPTY : new Optional<>(value);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"of",
"(",
"T",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"(",
"Optional",
"<",
"T",
">",
")",
"EMPTY",
":",
"new",
"Optional",
"<>",
"(",
"value",
")",
";",
"}"
] | Returns an optional for a given value | [
"Returns",
"an",
"optional",
"for",
"a",
"given",
"value"
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/optional/Optional.java#L31-L33 | train |
konmik/solid | streams/src/main/java/solid/optional/Optional.java | Optional.or | public T or(Func0<T> func1) {
return value != null ? value : func1.call();
} | java | public T or(Func0<T> func1) {
return value != null ? value : func1.call();
} | [
"public",
"T",
"or",
"(",
"Func0",
"<",
"T",
">",
"func1",
")",
"{",
"return",
"value",
"!=",
"null",
"?",
"value",
":",
"func1",
".",
"call",
"(",
")",
";",
"}"
] | Returns value of uses a given factory if the value does not exist. | [
"Returns",
"value",
"of",
"uses",
"a",
"given",
"factory",
"if",
"the",
"value",
"does",
"not",
"exist",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/optional/Optional.java#L69-L71 | train |
konmik/solid | streams/src/main/java/solid/optional/Optional.java | Optional.map | public <R> Optional<R> map(Func1<T, R> func1) {
return value == null ? Optional.<R>empty() : Optional.of(func1.call(value));
} | java | public <R> Optional<R> map(Func1<T, R> func1) {
return value == null ? Optional.<R>empty() : Optional.of(func1.call(value));
} | [
"public",
"<",
"R",
">",
"Optional",
"<",
"R",
">",
"map",
"(",
"Func1",
"<",
"T",
",",
"R",
">",
"func1",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"Optional",
".",
"<",
"R",
">",
"empty",
"(",
")",
":",
"Optional",
".",
"of",
"(",
"fu... | Transforms the value if exists, returns empty Optional otherwise. | [
"Transforms",
"the",
"value",
"if",
"exists",
"returns",
"empty",
"Optional",
"otherwise",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/optional/Optional.java#L83-L85 | train |
konmik/solid | collections/src/main/java/solid/collections/SolidMap.java | SolidMap.map | public static <K, V> SolidMap<K, V> map(K key, V value, Object... pairs) {
if (pairs.length % 2 != 0)
throw new IllegalArgumentException("SolidMap.map(...) takes even number of arguments");
LinkedHashMap<K, V> m = new LinkedHashMap<>();
m.put(key, value);
for (int i = 0; i < ... | java | public static <K, V> SolidMap<K, V> map(K key, V value, Object... pairs) {
if (pairs.length % 2 != 0)
throw new IllegalArgumentException("SolidMap.map(...) takes even number of arguments");
LinkedHashMap<K, V> m = new LinkedHashMap<>();
m.put(key, value);
for (int i = 0; i < ... | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"SolidMap",
"<",
"K",
",",
"V",
">",
"map",
"(",
"K",
"key",
",",
"V",
"value",
",",
"Object",
"...",
"pairs",
")",
"{",
"if",
"(",
"pairs",
".",
"length",
"%",
"2",
"!=",
"0",
")",
"throw",
"new",... | Creates a map using interleaving keys and values.
Warning: this method does not provide type safety.
@param key first map key
@param value first map value
@param pairs items that will be transformed into value-map pairs. Warning: there is no
type safety here!
@param <K> type of map keys
@param <V> type of map v... | [
"Creates",
"a",
"map",
"using",
"interleaving",
"keys",
"and",
"values",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/collections/src/main/java/solid/collections/SolidMap.java#L80-L88 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.of | public static <T> Stream<T> of(final T value) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
boolean has = true;
@Override
public boolean hasNext() {
... | java | public static <T> Stream<T> of(final T value) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
boolean has = true;
@Override
public boolean hasNext() {
... | [
"public",
"static",
"<",
"T",
">",
"Stream",
"<",
"T",
">",
"of",
"(",
"final",
"T",
"value",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"r... | Returns a stream with just one given element.
@param value the element value.
@param <T> the type of the stream.
@return a stream with just one given element. | [
"Returns",
"a",
"stream",
"with",
"just",
"one",
"given",
"element",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L66-L87 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.collect | public <R> R collect(Func1<Iterable<T>, R> collector) {
return collector.call(this);
} | java | public <R> R collect(Func1<Iterable<T>, R> collector) {
return collector.call(this);
} | [
"public",
"<",
"R",
">",
"R",
"collect",
"(",
"Func1",
"<",
"Iterable",
"<",
"T",
">",
",",
"R",
">",
"collector",
")",
"{",
"return",
"collector",
".",
"call",
"(",
"this",
")",
";",
"}"
] | Converts the current stream into any value with a given method.
@param collector a method that should be used to return value.
@param <R> a type of value to return.
@return a value that has been returned by the given collecting method. | [
"Converts",
"the",
"current",
"stream",
"into",
"any",
"value",
"with",
"a",
"given",
"method",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L117-L119 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.map | public <R> Stream<R> map(final Func1<? super T, ? extends R> func) {
return new Stream<R>() {
@Override
public Iterator<R> iterator() {
return new ReadOnlyIterator<R>() {
Iterator<T> iterator = Stream.this.iterator();
@Override
... | java | public <R> Stream<R> map(final Func1<? super T, ? extends R> func) {
return new Stream<R>() {
@Override
public Iterator<R> iterator() {
return new ReadOnlyIterator<R>() {
Iterator<T> iterator = Stream.this.iterator();
@Override
... | [
"public",
"<",
"R",
">",
"Stream",
"<",
"R",
">",
"map",
"(",
"final",
"Func1",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"R",
">",
"func",
")",
"{",
"return",
"new",
"Stream",
"<",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterat... | Returns a new stream that contains items that has been returned by a given function for each item in the current stream.
@param func a function that takes an item of the current stream and returns a corresponding value for the new stream.
@param <R> a type of items new stream returns.
@return a new stream that contai... | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"items",
"that",
"has",
"been",
"returned",
"by",
"a",
"given",
"function",
"for",
"each",
"item",
"in",
"the",
"current",
"stream",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L198-L218 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.merge | public Stream<T> merge(final T value) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
boolean completed;
@O... | java | public Stream<T> merge(final T value) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
boolean completed;
@O... | [
"public",
"Stream",
"<",
"T",
">",
"merge",
"(",
"final",
"T",
"value",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"ReadOnlyIt... | Returns a new stream that contains all items of the current stream with addition of a given item.
@param value a value to add.
@return a new stream that contains all items of the current stream with addition of a given item. | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"all",
"items",
"of",
"the",
"current",
"stream",
"with",
"addition",
"of",
"a",
"given",
"item",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L305-L329 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.separate | public Stream<T> separate(final T value) {
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {
return ((it == null) ? (value != null) : !it.equals(value));
}
});
} | java | public Stream<T> separate(final T value) {
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {
return ((it == null) ? (value != null) : !it.equals(value));
}
});
} | [
"public",
"Stream",
"<",
"T",
">",
"separate",
"(",
"final",
"T",
"value",
")",
"{",
"return",
"filter",
"(",
"new",
"Func1",
"<",
"T",
",",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Boolean",
"call",
"(",
"T",
"it",
")",
"{",
"r... | Returns a new stream that contains all items of the current stream except of a given item.
@param value a value to filter out.
@return a new stream that contains all items of the current stream except of a given item. | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"all",
"items",
"of",
"the",
"current",
"stream",
"except",
"of",
"a",
"given",
"item",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L337-L344 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.merge | public Stream<T> merge(final Iterable<? extends T> with) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
Iterator<? extends T> w... | java | public Stream<T> merge(final Iterable<? extends T> with) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
Iterator<? extends T> w... | [
"public",
"Stream",
"<",
"T",
">",
"merge",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"T",
">",
"with",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
... | Adds items from another stream to the end of the current stream.
@param with an {@link Iterable} that should be used to emit items after items in the current stream ran out.
@return a new stream that contains items from both streams. | [
"Adds",
"items",
"from",
"another",
"stream",
"to",
"the",
"end",
"of",
"the",
"current",
"stream",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L352-L373 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.zipWith | public <S, R> Stream<R> zipWith(final Iterable<? extends S> with, final Func2<? super T, ? super S, ? extends R> func) {
return new Stream<R>() {
@Override
public Iterator<R> iterator() {
return new ReadOnlyIterator<R>() {
Iterator<T> iterator = Strea... | java | public <S, R> Stream<R> zipWith(final Iterable<? extends S> with, final Func2<? super T, ? super S, ? extends R> func) {
return new Stream<R>() {
@Override
public Iterator<R> iterator() {
return new ReadOnlyIterator<R>() {
Iterator<T> iterator = Strea... | [
"public",
"<",
"S",
",",
"R",
">",
"Stream",
"<",
"R",
">",
"zipWith",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"S",
">",
"with",
",",
"final",
"Func2",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"S",
",",
"?",
"extends",
"R",
">",
"func"... | Returns a new stream that contains items that has been received by sequentially combining items of the streams into pairs
and then applying given function to each pair of items.
@param with a {@link Stream} to zip current stream with.
@param func a function that takes an item of the current stream and an item of anoth... | [
"Returns",
"a",
"new",
"stream",
"that",
"contains",
"items",
"that",
"has",
"been",
"received",
"by",
"sequentially",
"combining",
"items",
"of",
"the",
"streams",
"into",
"pairs",
"and",
"then",
"applying",
"given",
"function",
"to",
"each",
"pair",
"of",
... | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L387-L408 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.separate | public Stream<T> separate(Iterable<T> from) {
final ArrayList<T> list = ToArrayList.<T>toArrayList().call(from);
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {return !list.contains(it);}
});
} | java | public Stream<T> separate(Iterable<T> from) {
final ArrayList<T> list = ToArrayList.<T>toArrayList().call(from);
return filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T it) {return !list.contains(it);}
});
} | [
"public",
"Stream",
"<",
"T",
">",
"separate",
"(",
"Iterable",
"<",
"T",
">",
"from",
")",
"{",
"final",
"ArrayList",
"<",
"T",
">",
"list",
"=",
"ToArrayList",
".",
"<",
"T",
">",
"toArrayList",
"(",
")",
".",
"call",
"(",
"from",
")",
";",
"re... | Returns a stream that includes only that items of the current stream that do not
exist in a given stream.
@param from a stream of values that should be separated from the current stream.
@return a stream that includes only that items of the current stream that do not
exist in a given stream. | [
"Returns",
"a",
"stream",
"that",
"includes",
"only",
"that",
"items",
"of",
"the",
"current",
"stream",
"that",
"do",
"not",
"exist",
"in",
"a",
"given",
"stream",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L418-L424 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.take | public Stream<T> take(final int count) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
int left = count;
@O... | java | public Stream<T> take(final int count) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
return new ReadOnlyIterator<T>() {
Iterator<T> iterator = Stream.this.iterator();
int left = count;
@O... | [
"public",
"Stream",
"<",
"T",
">",
"take",
"(",
"final",
"int",
"count",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"return",
"new",
"ReadOnlyI... | Creates a new stream that contains only the first given amount of items of the current stream.
@param count a number of items to take.
@return a new stream that contains only the first given amount of items of the current stream. | [
"Creates",
"a",
"new",
"stream",
"that",
"contains",
"only",
"the",
"first",
"given",
"amount",
"of",
"items",
"of",
"the",
"current",
"stream",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L432-L454 | train |
konmik/solid | streams/src/main/java/solid/stream/Stream.java | Stream.skip | public Stream<T> skip(final int count) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
Iterator<T> iterator = Stream.this.iterator();
for (int skip = count; skip > 0 && iterator.hasNext(); skip--)
iterator.next();
... | java | public Stream<T> skip(final int count) {
return new Stream<T>() {
@Override
public Iterator<T> iterator() {
Iterator<T> iterator = Stream.this.iterator();
for (int skip = count; skip > 0 && iterator.hasNext(); skip--)
iterator.next();
... | [
"public",
"Stream",
"<",
"T",
">",
"skip",
"(",
"final",
"int",
"count",
")",
"{",
"return",
"new",
"Stream",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"Iterator",
"<",
"T",
">"... | Creates a new stream that contains elements of the current stream with a given number of them skipped from the beginning.
@param count a number items to skip.
@return a new stream that contains elements of the current stream with a given number of them skipped from the beginning. | [
"Creates",
"a",
"new",
"stream",
"that",
"contains",
"elements",
"of",
"the",
"current",
"stream",
"with",
"a",
"given",
"number",
"of",
"them",
"skipped",
"from",
"the",
"beginning",
"."
] | 3d6c452ef3219fd843547f3590b3d2e1ad3f1d17 | https://github.com/konmik/solid/blob/3d6c452ef3219fd843547f3590b3d2e1ad3f1d17/streams/src/main/java/solid/stream/Stream.java#L462-L472 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.