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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java | OptionsHandler.getPreparedClassOption | public Object getPreparedClassOption(ClassOption opt) {
if (this.classOptionNamesToPreparedObjects == null) {
this.prepareForUse();
}
return this.classOptionNamesToPreparedObjects.get(opt.getName());
} | java | public Object getPreparedClassOption(ClassOption opt) {
if (this.classOptionNamesToPreparedObjects == null) {
this.prepareForUse();
}
return this.classOptionNamesToPreparedObjects.get(opt.getName());
} | [
"public",
"Object",
"getPreparedClassOption",
"(",
"ClassOption",
"opt",
")",
"{",
"if",
"(",
"this",
".",
"classOptionNamesToPreparedObjects",
"==",
"null",
")",
"{",
"this",
".",
"prepareForUse",
"(",
")",
";",
"}",
"return",
"this",
".",
"classOptionNamesToPr... | Gets a prepared option of this class.
@param opt the class option to get
@return an option stored in the dictionary | [
"Gets",
"a",
"prepared",
"option",
"of",
"this",
"class",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/moa/options/OptionsHandler.java#L190-L195 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/LocalEntranceProcessingItem.java | LocalEntranceProcessingItem.injectNextEvent | public boolean injectNextEvent() {
if (this.getProcessor().hasNext()) {
ContentEvent event = this.getProcessor().nextEvent();
this.getOutputStream().put(event);
return true;
}
return false;
} | java | public boolean injectNextEvent() {
if (this.getProcessor().hasNext()) {
ContentEvent event = this.getProcessor().nextEvent();
this.getOutputStream().put(event);
return true;
}
return false;
} | [
"public",
"boolean",
"injectNextEvent",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getProcessor",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"ContentEvent",
"event",
"=",
"this",
".",
"getProcessor",
"(",
")",
".",
"nextEvent",
"(",
")",
";",
"this",
... | If there are available events, first event in the queue will be
sent out on the output stream.
@return true if there is (at least) one available event and it was sent out
false otherwise | [
"If",
"there",
"are",
"available",
"events",
"first",
"event",
"in",
"the",
"queue",
"will",
"be",
"sent",
"out",
"on",
"the",
"output",
"stream",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/LocalEntranceProcessingItem.java#L43-L50 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/simple/ClusteringDistributorProcessor.java | ClusteringDistributorProcessor.process | public boolean process(ContentEvent event) {
// distinguish between ClusteringContentEvent and ClusteringEvaluationContentEvent
if (event instanceof ClusteringContentEvent) {
ClusteringContentEvent cce = (ClusteringContentEvent) event;
outputStream.put(event);
if (cce... | java | public boolean process(ContentEvent event) {
// distinguish between ClusteringContentEvent and ClusteringEvaluationContentEvent
if (event instanceof ClusteringContentEvent) {
ClusteringContentEvent cce = (ClusteringContentEvent) event;
outputStream.put(event);
if (cce... | [
"public",
"boolean",
"process",
"(",
"ContentEvent",
"event",
")",
"{",
"// distinguish between ClusteringContentEvent and ClusteringEvaluationContentEvent",
"if",
"(",
"event",
"instanceof",
"ClusteringContentEvent",
")",
"{",
"ClusteringContentEvent",
"cce",
"=",
"(",
"Clus... | Process event.
@param event
the event
@return true, if successful | [
"Process",
"event",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/simple/ClusteringDistributorProcessor.java#L66-L78 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/NaiveBayes.java | NaiveBayes.getVotesForInstance | @Override
public double[] getVotesForInstance(Instance inst) {
// Prepare the results array
double[] votes = new double[getNumberOfClasses()];
// Over all classes
for (int classIndex = 0; classIndex < votes.length; classIndex++) {
// Get the prior for this class
votes[classIndex] = Math.log(getPrior(clas... | java | @Override
public double[] getVotesForInstance(Instance inst) {
// Prepare the results array
double[] votes = new double[getNumberOfClasses()];
// Over all classes
for (int classIndex = 0; classIndex < votes.length; classIndex++) {
// Get the prior for this class
votes[classIndex] = Math.log(getPrior(clas... | [
"@",
"Override",
"public",
"double",
"[",
"]",
"getVotesForInstance",
"(",
"Instance",
"inst",
")",
"{",
"// Prepare the results array",
"double",
"[",
"]",
"votes",
"=",
"new",
"double",
"[",
"getNumberOfClasses",
"(",
")",
"]",
";",
"// Over all classes",
"for... | Predicts the class memberships for a given instance. If an instance is
unclassified, the returned array elements will be all zero.
Smoothing is being implemented by the AttributeClassObserver classes. At
the moment, the GaussianNumericProbabilityAttributeClassObserver needs no
smoothing as it processes continuous vari... | [
"Predicts",
"the",
"class",
"memberships",
"for",
"a",
"given",
"instance",
".",
"If",
"an",
"instance",
"is",
"unclassified",
"the",
"returned",
"array",
"elements",
"will",
"be",
"all",
"zero",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/NaiveBayes.java#L123-L166 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/NaiveBayes.java | NaiveBayes.getPrior | private double getPrior(int classIndex) {
// Maximum likelihood
Double currentCount = this.classInstances.get(classIndex);
if (currentCount == null || currentCount == 0)
return 0;
else
return currentCount * 1. / this.instancesSeen;
} | java | private double getPrior(int classIndex) {
// Maximum likelihood
Double currentCount = this.classInstances.get(classIndex);
if (currentCount == null || currentCount == 0)
return 0;
else
return currentCount * 1. / this.instancesSeen;
} | [
"private",
"double",
"getPrior",
"(",
"int",
"classIndex",
")",
"{",
"// Maximum likelihood",
"Double",
"currentCount",
"=",
"this",
".",
"classInstances",
".",
"get",
"(",
"classIndex",
")",
";",
"if",
"(",
"currentCount",
"==",
"null",
"||",
"currentCount",
... | Compute the prior for the given classIndex.
Implemented by maximum likelihood at the moment.
@param classIndex
Id of the class for which we want to compute the prior.
@return Prior probability for the requested class | [
"Compute",
"the",
"prior",
"for",
"the",
"given",
"classIndex",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/NaiveBayes.java#L177-L184 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java | StreamSourceProcessor.setStreamSource | public void setStreamSource(InstanceStream stream) {
this.streamSource = new StreamSource(stream);
firstInstance = streamSource.nextInstance().getData();
} | java | public void setStreamSource(InstanceStream stream) {
this.streamSource = new StreamSource(stream);
firstInstance = streamSource.nextInstance().getData();
} | [
"public",
"void",
"setStreamSource",
"(",
"InstanceStream",
"stream",
")",
"{",
"this",
".",
"streamSource",
"=",
"new",
"StreamSource",
"(",
"stream",
")",
";",
"firstInstance",
"=",
"streamSource",
".",
"nextInstance",
"(",
")",
".",
"getData",
"(",
")",
"... | Sets the stream source.
@param stream the new stream source | [
"Sets",
"the",
"stream",
"source",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java#L69-L72 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java | StreamSourceProcessor.sendInstances | public void sendInstances(Stream inputStream,
int numberInstances, boolean isTraining, boolean isTesting) {
int numberSamples = 0;
while (streamSource.hasMoreInstances()
&& numberSamples < numberInstances) {
numberSamples++;
numberInstancesSent++;
InstanceContentEvent instanceContent... | java | public void sendInstances(Stream inputStream,
int numberInstances, boolean isTraining, boolean isTesting) {
int numberSamples = 0;
while (streamSource.hasMoreInstances()
&& numberSamples < numberInstances) {
numberSamples++;
numberInstancesSent++;
InstanceContentEvent instanceContent... | [
"public",
"void",
"sendInstances",
"(",
"Stream",
"inputStream",
",",
"int",
"numberInstances",
",",
"boolean",
"isTraining",
",",
"boolean",
"isTesting",
")",
"{",
"int",
"numberSamples",
"=",
"0",
";",
"while",
"(",
"streamSource",
".",
"hasMoreInstances",
"("... | Send instances.
@param inputStream the input stream
@param numberInstances the number instances
@param isTraining the is training | [
"Send",
"instances",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java#L83-L103 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java | StreamSourceProcessor.sendEndEvaluationInstance | public void sendEndEvaluationInstance(Stream inputStream) {
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(-1, firstInstance,false, true);
inputStream.put(instanceContentEvent);
} | java | public void sendEndEvaluationInstance(Stream inputStream) {
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(-1, firstInstance,false, true);
inputStream.put(instanceContentEvent);
} | [
"public",
"void",
"sendEndEvaluationInstance",
"(",
"Stream",
"inputStream",
")",
"{",
"InstanceContentEvent",
"instanceContentEvent",
"=",
"new",
"InstanceContentEvent",
"(",
"-",
"1",
",",
"firstInstance",
",",
"false",
",",
"true",
")",
";",
"inputStream",
".",
... | Send end evaluation instance.
@param inputStream the input stream | [
"Send",
"end",
"evaluation",
"instance",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/streams/StreamSourceProcessor.java#L110-L113 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java | ModelAggregatorProcessor.processInstanceContentEvent | private void processInstanceContentEvent(InstancesContentEvent instContentEvent){
this.numBatches++;
this.contentEventList.add(instContentEvent);
if (this.numBatches == 1 || this.numBatches > 4){
this.processInstances(this.contentEventList.remove(0));
}
... | java | private void processInstanceContentEvent(InstancesContentEvent instContentEvent){
this.numBatches++;
this.contentEventList.add(instContentEvent);
if (this.numBatches == 1 || this.numBatches > 4){
this.processInstances(this.contentEventList.remove(0));
}
... | [
"private",
"void",
"processInstanceContentEvent",
"(",
"InstancesContentEvent",
"instContentEvent",
")",
"{",
"this",
".",
"numBatches",
"++",
";",
"this",
".",
"contentEventList",
".",
"add",
"(",
"instContentEvent",
")",
";",
"if",
"(",
"this",
".",
"numBatches"... | Helper method to process the InstanceContentEvent
@param instContentEvent | [
"Helper",
"method",
"to",
"process",
"the",
"InstanceContentEvent"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L281-L295 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java | ModelAggregatorProcessor.trainOnInstanceImpl | private void trainOnInstanceImpl(Instance inst) {
if(this.treeRoot == null){
this.treeRoot = newLearningNode(this.parallelismHint);
this.activeLeafNodeCount = 1;
}
FoundNode foundNode = this.treeRoot.filterInstanceToLeaf(inst, null, -1);
trainOnInstanceImpl(foundNode... | java | private void trainOnInstanceImpl(Instance inst) {
if(this.treeRoot == null){
this.treeRoot = newLearningNode(this.parallelismHint);
this.activeLeafNodeCount = 1;
}
FoundNode foundNode = this.treeRoot.filterInstanceToLeaf(inst, null, -1);
trainOnInstanceImpl(foundNode... | [
"private",
"void",
"trainOnInstanceImpl",
"(",
"Instance",
"inst",
")",
"{",
"if",
"(",
"this",
".",
"treeRoot",
"==",
"null",
")",
"{",
"this",
".",
"treeRoot",
"=",
"newLearningNode",
"(",
"this",
".",
"parallelismHint",
")",
";",
"this",
".",
"activeLea... | Helper method that represent training of an instance. Since it is decision tree,
this method routes the incoming instance into the correct leaf and then update the
statistic on the found leaf.
@param inst | [
"Helper",
"method",
"that",
"represent",
"training",
"of",
"an",
"instance",
".",
"Since",
"it",
"is",
"decision",
"tree",
"this",
"method",
"routes",
"the",
"incoming",
"instance",
"into",
"the",
"correct",
"leaf",
"and",
"then",
"update",
"the",
"statistic",... | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L425-L433 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java | ModelAggregatorProcessor.attemptToSplit | private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
//Increment the split ID
this.splitId++;
//Schedule time-out thread
ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes),
this.timeOut, ... | java | private void attemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
//Increment the split ID
this.splitId++;
//Schedule time-out thread
ScheduledFuture<?> timeOutHandler = this.executor.schedule(new AggregationTimeOutHandler(this.splitId, this.timedOutSplittingNodes),
this.timeOut, ... | [
"private",
"void",
"attemptToSplit",
"(",
"ActiveLearningNode",
"activeLearningNode",
",",
"FoundNode",
"foundNode",
")",
"{",
"//Increment the split ID",
"this",
".",
"splitId",
"++",
";",
"//Schedule time-out thread",
"ScheduledFuture",
"<",
"?",
">",
"timeOutHandler",
... | Helper method to represent a split attempt
@param activeLearningNode The corresponding active learning node which will be split
@param foundNode The data structure to represents the filtering of the instance using the
tree model. | [
"Helper",
"method",
"to",
"represent",
"a",
"split",
"attempt"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L461-L476 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java | ModelAggregatorProcessor.continueAttemptToSplit | private void continueAttemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
AttributeSplitSuggestion bestSuggestion = activeLearningNode.getDistributedBestSuggestion();
AttributeSplitSuggestion secondBestSuggestion = activeLearningNode.getDistributedSecondBestSuggestion();
//compare with n... | java | private void continueAttemptToSplit(ActiveLearningNode activeLearningNode, FoundNode foundNode){
AttributeSplitSuggestion bestSuggestion = activeLearningNode.getDistributedBestSuggestion();
AttributeSplitSuggestion secondBestSuggestion = activeLearningNode.getDistributedSecondBestSuggestion();
//compare with n... | [
"private",
"void",
"continueAttemptToSplit",
"(",
"ActiveLearningNode",
"activeLearningNode",
",",
"FoundNode",
"foundNode",
")",
"{",
"AttributeSplitSuggestion",
"bestSuggestion",
"=",
"activeLearningNode",
".",
"getDistributedBestSuggestion",
"(",
")",
";",
"AttributeSplitS... | Helper method to continue the attempt to split once all local calculation results are received.
@param activeLearningNode The corresponding active learning node which will be split
@param foundNode The data structure to represents the filtering of the instance using the
tree model. | [
"Helper",
"method",
"to",
"continue",
"the",
"attempt",
"to",
"split",
"once",
"all",
"local",
"calculation",
"results",
"are",
"received",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L485-L552 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java | ModelAggregatorProcessor.setModelContext | private void setModelContext(InstancesHeader ih){
//TODO possibly refactored
if ((ih != null) && (ih.classIndex() < 0)) {
throw new IllegalArgumentException(
"Context for a classifier must include a class to learn");
}
//TODO: check flag for checking whether tra... | java | private void setModelContext(InstancesHeader ih){
//TODO possibly refactored
if ((ih != null) && (ih.classIndex() < 0)) {
throw new IllegalArgumentException(
"Context for a classifier must include a class to learn");
}
//TODO: check flag for checking whether tra... | [
"private",
"void",
"setModelContext",
"(",
"InstancesHeader",
"ih",
")",
"{",
"//TODO possibly refactored",
"if",
"(",
"(",
"ih",
"!=",
"null",
")",
"&&",
"(",
"ih",
".",
"classIndex",
"(",
")",
"<",
"0",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExce... | Helper method to set the model context, i.e. how many attributes they are and what is the class index
@param ih | [
"Helper",
"method",
"to",
"set",
"the",
"model",
"context",
"i",
".",
"e",
".",
"how",
"many",
"attributes",
"they",
"are",
"and",
"what",
"is",
"the",
"class",
"index"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/ModelAggregatorProcessor.java#L586-L596 | train |
YahooArchive/samoa | samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java | SamzaConfigFactory.getMapConfigsForTopology | public List<MapConfig> getMapConfigsForTopology(SamzaTopology topology) throws Exception {
List<MapConfig> configs = new ArrayList<MapConfig>();
List<Map<String,String>> maps = this.getMapsForTopology(topology);
for(Map<String,String> map:maps) {
configs.add(new MapConfig(map));
}
return configs;
} | java | public List<MapConfig> getMapConfigsForTopology(SamzaTopology topology) throws Exception {
List<MapConfig> configs = new ArrayList<MapConfig>();
List<Map<String,String>> maps = this.getMapsForTopology(topology);
for(Map<String,String> map:maps) {
configs.add(new MapConfig(map));
}
return configs;
} | [
"public",
"List",
"<",
"MapConfig",
">",
"getMapConfigsForTopology",
"(",
"SamzaTopology",
"topology",
")",
"throws",
"Exception",
"{",
"List",
"<",
"MapConfig",
">",
"configs",
"=",
"new",
"ArrayList",
"<",
"MapConfig",
">",
"(",
")",
";",
"List",
"<",
"Map... | Construct a list of MapConfigs for a Topology
@return the list of MapConfigs
@throws Exception | [
"Construct",
"a",
"list",
"of",
"MapConfigs",
"for",
"a",
"Topology"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java#L358-L365 | train |
YahooArchive/samoa | samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java | SamzaConfigFactory.setValue | private static void setValue(Map<String,String> map, String key, String value) {
map.put(key,value);
} | java | private static void setValue(Map<String,String> map, String key, String value) {
map.put(key,value);
} | [
"private",
"static",
"void",
"setValue",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"map",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"}"
] | Set custom properties | [
"Set",
"custom",
"properties"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-samza/src/main/java/com/yahoo/labs/samoa/utils/SamzaConfigFactory.java#L480-L482 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/HorizontalAMRulesRegressor.java | HorizontalAMRulesRegressor.init | @Override
public void init(TopologyBuilder topologyBuilder, Instances dataset, int parallelism) {
// Create MODEL PIs
this.model = new AMRRuleSetProcessor.Builder(dataset)
.noAnomalyDetection(noAnomalyDetectionOption.isSet())
.multivariateAnomalyProbabilityThreshold(multivariateAnomalyProbabilityThresholdOp... | java | @Override
public void init(TopologyBuilder topologyBuilder, Instances dataset, int parallelism) {
// Create MODEL PIs
this.model = new AMRRuleSetProcessor.Builder(dataset)
.noAnomalyDetection(noAnomalyDetectionOption.isSet())
.multivariateAnomalyProbabilityThreshold(multivariateAnomalyProbabilityThresholdOp... | [
"@",
"Override",
"public",
"void",
"init",
"(",
"TopologyBuilder",
"topologyBuilder",
",",
"Instances",
"dataset",
",",
"int",
"parallelism",
")",
"{",
"// Create MODEL PIs",
"this",
".",
"model",
"=",
"new",
"AMRRuleSetProcessor",
".",
"Builder",
"(",
"dataset",
... | private Stream resultStream; | [
"private",
"Stream",
"resultStream",
";"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/HorizontalAMRulesRegressor.java#L155-L227 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/SplitNode.java | SplitNode.setChild | void setChild(int index, Node child){
if ((this.splitTest.maxBranches() >= 0)
&& (index >= this.splitTest.maxBranches())) {
throw new IndexOutOfBoundsException();
}
this.children.set(index, child);
} | java | void setChild(int index, Node child){
if ((this.splitTest.maxBranches() >= 0)
&& (index >= this.splitTest.maxBranches())) {
throw new IndexOutOfBoundsException();
}
this.children.set(index, child);
} | [
"void",
"setChild",
"(",
"int",
"index",
",",
"Node",
"child",
")",
"{",
"if",
"(",
"(",
"this",
".",
"splitTest",
".",
"maxBranches",
"(",
")",
">=",
"0",
")",
"&&",
"(",
"index",
">=",
"this",
".",
"splitTest",
".",
"maxBranches",
"(",
")",
")",
... | Method to set the children in a specific index of the SplitNode with the appropriate child
@param index Index of the child in the SplitNode
@param child The child node | [
"Method",
"to",
"set",
"the",
"children",
"in",
"a",
"specific",
"index",
"of",
"the",
"SplitNode",
"with",
"the",
"appropriate",
"child"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/trees/SplitNode.java#L83-L89 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java | TopologyBuilder.initTopology | public void initTopology(String topologyName, int delay) {
if (this.topology != null) {
// TODO: possible refactor this code later
System.out.println("Topology has been initialized before!");
return;
}
this.topology = componentFactory.createTopology(topologyNa... | java | public void initTopology(String topologyName, int delay) {
if (this.topology != null) {
// TODO: possible refactor this code later
System.out.println("Topology has been initialized before!");
return;
}
this.topology = componentFactory.createTopology(topologyNa... | [
"public",
"void",
"initTopology",
"(",
"String",
"topologyName",
",",
"int",
"delay",
")",
"{",
"if",
"(",
"this",
".",
"topology",
"!=",
"null",
")",
"{",
"// TODO: possible refactor this code later",
"System",
".",
"out",
".",
"println",
"(",
"\"Topology has b... | Initiates topology with a specific name and a delay between consecutive instances.
@param topologyName
@param delay
delay between injections of two instances from source (in milliseconds) | [
"Initiates",
"topology",
"with",
"a",
"specific",
"name",
"and",
"a",
"delay",
"between",
"consecutive",
"instances",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L76-L83 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java | TopologyBuilder.createPi | private ProcessingItem createPi(Processor processor, int parallelism) {
ProcessingItem pi = this.componentFactory.createPi(processor, parallelism);
this.topology.addProcessingItem(pi, parallelism);
return pi;
} | java | private ProcessingItem createPi(Processor processor, int parallelism) {
ProcessingItem pi = this.componentFactory.createPi(processor, parallelism);
this.topology.addProcessingItem(pi, parallelism);
return pi;
} | [
"private",
"ProcessingItem",
"createPi",
"(",
"Processor",
"processor",
",",
"int",
"parallelism",
")",
"{",
"ProcessingItem",
"pi",
"=",
"this",
".",
"componentFactory",
".",
"createPi",
"(",
"processor",
",",
"parallelism",
")",
";",
"this",
".",
"topology",
... | Creates a processing item with a specific processor and paralellism level.
@param processor
@param parallelism
@return ProcessingItem | [
"Creates",
"a",
"processing",
"item",
"with",
"a",
"specific",
"processor",
"and",
"paralellism",
"level",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L190-L194 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java | TopologyBuilder.createEntrancePi | private EntranceProcessingItem createEntrancePi(EntranceProcessor processor) {
EntranceProcessingItem epi = this.componentFactory.createEntrancePi(processor);
this.topology.addEntranceProcessingItem(epi);
if (this.mapProcessorToProcessingItem == null)
this.mapProcessorToProcessingIte... | java | private EntranceProcessingItem createEntrancePi(EntranceProcessor processor) {
EntranceProcessingItem epi = this.componentFactory.createEntrancePi(processor);
this.topology.addEntranceProcessingItem(epi);
if (this.mapProcessorToProcessingItem == null)
this.mapProcessorToProcessingIte... | [
"private",
"EntranceProcessingItem",
"createEntrancePi",
"(",
"EntranceProcessor",
"processor",
")",
"{",
"EntranceProcessingItem",
"epi",
"=",
"this",
".",
"componentFactory",
".",
"createEntrancePi",
"(",
"processor",
")",
";",
"this",
".",
"topology",
".",
"addEntr... | Creates a platform specific entrance processing item.
@param processor
@return | [
"Creates",
"a",
"platform",
"specific",
"entrance",
"processing",
"item",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L202-L209 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java | TopologyBuilder.createStream | private Stream createStream(IProcessingItem sourcePi) {
Stream stream = this.componentFactory.createStream(sourcePi);
this.topology.addStream(stream);
return stream;
} | java | private Stream createStream(IProcessingItem sourcePi) {
Stream stream = this.componentFactory.createStream(sourcePi);
this.topology.addStream(stream);
return stream;
} | [
"private",
"Stream",
"createStream",
"(",
"IProcessingItem",
"sourcePi",
")",
"{",
"Stream",
"stream",
"=",
"this",
".",
"componentFactory",
".",
"createStream",
"(",
"sourcePi",
")",
";",
"this",
".",
"topology",
".",
"addStream",
"(",
"stream",
")",
";",
"... | Creates a platform specific stream.
@param sourcePi
source processing item.
@return | [
"Creates",
"a",
"platform",
"specific",
"stream",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/TopologyBuilder.java#L218-L222 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/simple/DistributedClusterer.java | DistributedClusterer.init | @Override
public void init(TopologyBuilder builder, Instances dataset, int parallelism) {
this.builder = builder;
this.dataset = dataset;
// this.parallelism = parallelism;
this.setLayout();
} | java | @Override
public void init(TopologyBuilder builder, Instances dataset, int parallelism) {
this.builder = builder;
this.dataset = dataset;
// this.parallelism = parallelism;
this.setLayout();
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"TopologyBuilder",
"builder",
",",
"Instances",
"dataset",
",",
"int",
"parallelism",
")",
"{",
"this",
".",
"builder",
"=",
"builder",
";",
"this",
".",
"dataset",
"=",
"dataset",
";",
"// this.parallelis... | private int parallelism; | [
"private",
"int",
"parallelism",
";"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/clusterers/simple/DistributedClusterer.java#L69-L75 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/topology/AbstractEntranceProcessingItem.java | AbstractEntranceProcessingItem.setOutputStream | public EntranceProcessingItem setOutputStream(Stream outputStream) {
if (this.outputStream != null && this.outputStream != outputStream) {
throw new IllegalStateException("Cannot overwrite output stream of EntranceProcessingItem");
} else
this.outputStream = outputStream;
return this;
} | java | public EntranceProcessingItem setOutputStream(Stream outputStream) {
if (this.outputStream != null && this.outputStream != outputStream) {
throw new IllegalStateException("Cannot overwrite output stream of EntranceProcessingItem");
} else
this.outputStream = outputStream;
return this;
} | [
"public",
"EntranceProcessingItem",
"setOutputStream",
"(",
"Stream",
"outputStream",
")",
"{",
"if",
"(",
"this",
".",
"outputStream",
"!=",
"null",
"&&",
"this",
".",
"outputStream",
"!=",
"outputStream",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
... | Set the output stream of this EntranceProcessingItem.
An EntranceProcessingItem should have only 1 single output stream and
should not be re-assigned.
@return this EntranceProcessingItem | [
"Set",
"the",
"output",
"stream",
"of",
"this",
"EntranceProcessingItem",
".",
"An",
"EntranceProcessingItem",
"should",
"have",
"only",
"1",
"single",
"output",
"stream",
"and",
"should",
"not",
"be",
"re",
"-",
"assigned",
"."
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/topology/AbstractEntranceProcessingItem.java#L93-L99 | train |
YahooArchive/samoa | samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/centralized/AMRulesRegressorProcessor.java | AMRulesRegressorProcessor.getVotesForInstance | private double[] getVotesForInstance(Instance instance) {
ErrorWeightedVote errorWeightedVote=newErrorWeightedVote();
int numberOfRulesCovering = 0;
for (ActiveRule rule: ruleSet) {
if (rule.isCovering(instance) == true){
numberOfRulesCovering++;
double [] vote=rule.getPrediction(instance);
dou... | java | private double[] getVotesForInstance(Instance instance) {
ErrorWeightedVote errorWeightedVote=newErrorWeightedVote();
int numberOfRulesCovering = 0;
for (ActiveRule rule: ruleSet) {
if (rule.isCovering(instance) == true){
numberOfRulesCovering++;
double [] vote=rule.getPrediction(instance);
dou... | [
"private",
"double",
"[",
"]",
"getVotesForInstance",
"(",
"Instance",
"instance",
")",
"{",
"ErrorWeightedVote",
"errorWeightedVote",
"=",
"newErrorWeightedVote",
"(",
")",
";",
"int",
"numberOfRulesCovering",
"=",
"0",
";",
"for",
"(",
"ActiveRule",
"rule",
":",... | getVotesForInstance extension of the instance method getVotesForInstance
in moa.classifier.java
returns the prediction of the instance.
Called in EvaluateModelRegression | [
"getVotesForInstance",
"extension",
"of",
"the",
"instance",
"method",
"getVotesForInstance",
"in",
"moa",
".",
"classifier",
".",
"java",
"returns",
"the",
"prediction",
"of",
"the",
"instance",
".",
"Called",
"in",
"EvaluateModelRegression"
] | 540a2c30167ac85c432b593baabd5ca97e7e8a0f | https://github.com/YahooArchive/samoa/blob/540a2c30167ac85c432b593baabd5ca97e7e8a0f/samoa-api/src/main/java/com/yahoo/labs/samoa/learners/classifiers/rules/centralized/AMRulesRegressorProcessor.java#L161-L185 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Transaction.java | Transaction.finish | public void finish() {
if (mSuccessful) {
mDb.setTransactionSuccessful();
}
mDb.endTransaction();
if (mSuccessful) {
for (OnTransactionCommittedListener listener : mOnTransactionCommittedListeners) {
listener.onTransactionCommitted();
}
}
} | java | public void finish() {
if (mSuccessful) {
mDb.setTransactionSuccessful();
}
mDb.endTransaction();
if (mSuccessful) {
for (OnTransactionCommittedListener listener : mOnTransactionCommittedListeners) {
listener.onTransactionCommitted();
}
}
} | [
"public",
"void",
"finish",
"(",
")",
"{",
"if",
"(",
"mSuccessful",
")",
"{",
"mDb",
".",
"setTransactionSuccessful",
"(",
")",
";",
"}",
"mDb",
".",
"endTransaction",
"(",
")",
";",
"if",
"(",
"mSuccessful",
")",
"{",
"for",
"(",
"OnTransactionCommitte... | Finish the transaction.
This will commit or rollback the transaction depending on whether is was marked as successful or not | [
"Finish",
"the",
"transaction",
".",
"This",
"will",
"commit",
"or",
"rollback",
"the",
"transaction",
"depending",
"on",
"whether",
"is",
"was",
"marked",
"as",
"successful",
"or",
"not"
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Transaction.java#L50-L61 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/SupportCursorLoader.java | SupportCursorLoader.onStartLoading | @Override
protected void onStartLoading() {
if (mCursor != null) {
deliverResult(mCursor);
}
if (takeContentChanged() || mCursor == null) {
forceLoad();
}
} | java | @Override
protected void onStartLoading() {
if (mCursor != null) {
deliverResult(mCursor);
}
if (takeContentChanged() || mCursor == null) {
forceLoad();
}
} | [
"@",
"Override",
"protected",
"void",
"onStartLoading",
"(",
")",
"{",
"if",
"(",
"mCursor",
"!=",
"null",
")",
"{",
"deliverResult",
"(",
"mCursor",
")",
";",
"}",
"if",
"(",
"takeContentChanged",
"(",
")",
"||",
"mCursor",
"==",
"null",
")",
"{",
"fo... | Starts an asynchronous load of the contacts list data. When the result is
ready the callbacks will be called on the UI thread. If a previous load
has been completed and is still valid the result may be passed to the
callbacks immediately.
Must be called from the UI thread | [
"Starts",
"an",
"asynchronous",
"load",
"of",
"the",
"contacts",
"list",
"data",
".",
"When",
"the",
"result",
"is",
"ready",
"the",
"callbacks",
"will",
"be",
"called",
"on",
"the",
"UI",
"thread",
".",
"If",
"a",
"previous",
"load",
"has",
"been",
"com... | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/SupportCursorLoader.java#L76-L84 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Model.java | Model.exists | final public boolean exists() {
final Model m = Query.one(
getClass(),
String.format("SELECT * FROM %s WHERE %s LIMIT 1",
Utils.getTableName(getClass()),
Utils.getWhereStatement(this))).get();
return m != null;
} | java | final public boolean exists() {
final Model m = Query.one(
getClass(),
String.format("SELECT * FROM %s WHERE %s LIMIT 1",
Utils.getTableName(getClass()),
Utils.getWhereStatement(this))).get();
return m != null;
} | [
"final",
"public",
"boolean",
"exists",
"(",
")",
"{",
"final",
"Model",
"m",
"=",
"Query",
".",
"one",
"(",
"getClass",
"(",
")",
",",
"String",
".",
"format",
"(",
"\"SELECT * FROM %s WHERE %s LIMIT 1\"",
",",
"Utils",
".",
"getTableName",
"(",
"getClass",... | Check whether this model exists in the database
@return true if this model is currently saved in the database (could be an older version) | [
"Check",
"whether",
"this",
"model",
"exists",
"in",
"the",
"database"
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Model.java#L60-L67 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Model.java | Model.delete | final public void delete() {
Transaction t = new Transaction();
try {
delete(t);
t.setSuccessful(true);
} finally {
t.finish();
}
} | java | final public void delete() {
Transaction t = new Transaction();
try {
delete(t);
t.setSuccessful(true);
} finally {
t.finish();
}
} | [
"final",
"public",
"void",
"delete",
"(",
")",
"{",
"Transaction",
"t",
"=",
"new",
"Transaction",
"(",
")",
";",
"try",
"{",
"delete",
"(",
"t",
")",
";",
"t",
".",
"setSuccessful",
"(",
"true",
")",
";",
"}",
"finally",
"{",
"t",
".",
"finish",
... | Delete this model | [
"Delete",
"this",
"model"
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Model.java#L178-L186 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Model.java | Model.delete | final public void delete(Transaction t) {
t.delete(Utils.getTableName(getClass()), Utils.getWhereStatement(this));
t.addOnTransactionCommittedListener(new OnTransactionCommittedListener() {
@Override
public void onTransactionCommitted() {
Sprinkles.sInstance.mContext.g... | java | final public void delete(Transaction t) {
t.delete(Utils.getTableName(getClass()), Utils.getWhereStatement(this));
t.addOnTransactionCommittedListener(new OnTransactionCommittedListener() {
@Override
public void onTransactionCommitted() {
Sprinkles.sInstance.mContext.g... | [
"final",
"public",
"void",
"delete",
"(",
"Transaction",
"t",
")",
"{",
"t",
".",
"delete",
"(",
"Utils",
".",
"getTableName",
"(",
"getClass",
"(",
")",
")",
",",
"Utils",
".",
"getWhereStatement",
"(",
"this",
")",
")",
";",
"t",
".",
"addOnTransacti... | Delete this model within the given transaction
@param t
The transaction to delete this model in | [
"Delete",
"this",
"model",
"within",
"the",
"given",
"transaction"
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Model.java#L194-L205 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Query.java | Query.all | public static <T extends Model> ManyQuery<T> all(Class<T> clazz) {
return many(clazz, "SELECT * FROM " + Utils.getTableName(clazz));
} | java | public static <T extends Model> ManyQuery<T> all(Class<T> clazz) {
return many(clazz, "SELECT * FROM " + Utils.getTableName(clazz));
} | [
"public",
"static",
"<",
"T",
"extends",
"Model",
">",
"ManyQuery",
"<",
"T",
">",
"all",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"many",
"(",
"clazz",
",",
"\"SELECT * FROM \"",
"+",
"Utils",
".",
"getTableName",
"(",
"clazz",
")",
... | Start a query for the entire list of instance of type T
@param clazz
The class representing the type of the list you want returned
@param <T>
The type of the list you want returned
@return the query to execute | [
"Start",
"a",
"query",
"for",
"the",
"entire",
"list",
"of",
"instance",
"of",
"type",
"T"
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Query.java#L124-L126 | train |
emilsjolander/sprinkles | library/src/main/java/se/emilsjolander/sprinkles/Sprinkles.java | Sprinkles.getDatabase | static synchronized SQLiteDatabase getDatabase() {
if(sInstance == null) {
throw new SprinklesNotInitializedException();
}
if(sDatabase == null) {
DbOpenHelper dbOpenHelper = new DbOpenHelper(sInstance.mContext, sInstance.databaseName, sInstance.initialDatabaseVersion);
... | java | static synchronized SQLiteDatabase getDatabase() {
if(sInstance == null) {
throw new SprinklesNotInitializedException();
}
if(sDatabase == null) {
DbOpenHelper dbOpenHelper = new DbOpenHelper(sInstance.mContext, sInstance.databaseName, sInstance.initialDatabaseVersion);
... | [
"static",
"synchronized",
"SQLiteDatabase",
"getDatabase",
"(",
")",
"{",
"if",
"(",
"sInstance",
"==",
"null",
")",
"{",
"throw",
"new",
"SprinklesNotInitializedException",
"(",
")",
";",
"}",
"if",
"(",
"sDatabase",
"==",
"null",
")",
"{",
"DbOpenHelper",
... | Throws SprinklesNotInitializedException if you try to access the database before initializing Sprinkles.
@return the SQL Database used by Sprinkles. | [
"Throws",
"SprinklesNotInitializedException",
"if",
"you",
"try",
"to",
"access",
"the",
"database",
"before",
"initializing",
"Sprinkles",
"."
] | 3a666f18ee5158db6fe3b4f4346b470481559606 | https://github.com/emilsjolander/sprinkles/blob/3a666f18ee5158db6fe3b4f4346b470481559606/library/src/main/java/se/emilsjolander/sprinkles/Sprinkles.java#L113-L124 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/CycloneDxSchema.java | CycloneDxSchema.getXmlSchema | public Schema getXmlSchema(CycloneDxSchema.Version schemaVersion) throws SAXException {
if (CycloneDxSchema.Version.VERSION_10 == schemaVersion) {
return getXmlSchema10();
} else {
return getXmlSchema11();
}
} | java | public Schema getXmlSchema(CycloneDxSchema.Version schemaVersion) throws SAXException {
if (CycloneDxSchema.Version.VERSION_10 == schemaVersion) {
return getXmlSchema10();
} else {
return getXmlSchema11();
}
} | [
"public",
"Schema",
"getXmlSchema",
"(",
"CycloneDxSchema",
".",
"Version",
"schemaVersion",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"CycloneDxSchema",
".",
"Version",
".",
"VERSION_10",
"==",
"schemaVersion",
")",
"{",
"return",
"getXmlSchema10",
"(",
")",... | Returns the CycloneDX XML Schema for the specified schema version.
@param schemaVersion The version to return the schema for
@return a Schema
@throws SAXException a SAXException
@since 2.0.0 | [
"Returns",
"the",
"CycloneDX",
"XML",
"Schema",
"for",
"the",
"specified",
"schema",
"version",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/CycloneDxSchema.java#L58-L64 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/CycloneDxSchema.java | CycloneDxSchema.getXmlSchema10 | private Schema getXmlSchema10() throws SAXException {
final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// Use local copies of schemas rather than resolving from the net. It's faster, and less prone to errors.
final Source[] schemaFiles = {
... | java | private Schema getXmlSchema10() throws SAXException {
final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
// Use local copies of schemas rather than resolving from the net. It's faster, and less prone to errors.
final Source[] schemaFiles = {
... | [
"private",
"Schema",
"getXmlSchema10",
"(",
")",
"throws",
"SAXException",
"{",
"final",
"SchemaFactory",
"schemaFactory",
"=",
"SchemaFactory",
".",
"newInstance",
"(",
"XMLConstants",
".",
"W3C_XML_SCHEMA_NS_URI",
")",
";",
"// Use local copies of schemas rather than reso... | Returns the CycloneDX XML Schema from the specifications XSD.
@return a Schema
@throws SAXException a SAXException
@since 1.1.0 | [
"Returns",
"the",
"CycloneDX",
"XML",
"Schema",
"from",
"the",
"specifications",
"XSD",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/CycloneDxSchema.java#L71-L79 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.resolve | public static LicenseChoice resolve(String licenseString) {
try {
return resolveSpdxLicenseString(licenseString);
} catch (InvalidLicenseStringException e1) {
final LicenseChoice licenseChoice = resolveViaAlternativeMapping(licenseString);
if (licenseChoice != null) {... | java | public static LicenseChoice resolve(String licenseString) {
try {
return resolveSpdxLicenseString(licenseString);
} catch (InvalidLicenseStringException e1) {
final LicenseChoice licenseChoice = resolveViaAlternativeMapping(licenseString);
if (licenseChoice != null) {... | [
"public",
"static",
"LicenseChoice",
"resolve",
"(",
"String",
"licenseString",
")",
"{",
"try",
"{",
"return",
"resolveSpdxLicenseString",
"(",
"licenseString",
")",
";",
"}",
"catch",
"(",
"InvalidLicenseStringException",
"e1",
")",
"{",
"final",
"LicenseChoice",
... | Attempts to resolve the specified license string via SPDX license identifier and expression
parsing first. If SPDX resolution is not successful, the method will attempt fuzzy matching.
@param licenseString the license string to resolve
@return a LicenseChoice object if resolution was successful, or null if unresolved | [
"Attempts",
"to",
"resolve",
"the",
"specified",
"license",
"string",
"via",
"SPDX",
"license",
"identifier",
"and",
"expression",
"parsing",
"first",
".",
"If",
"SPDX",
"resolution",
"is",
"not",
"successful",
"the",
"method",
"will",
"attempt",
"fuzzy",
"match... | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L83-L102 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.resolveSpdxLicenseId | public static LicenseChoice resolveSpdxLicenseId(String licenseId) throws InvalidSPDXAnalysisException {
final SpdxListedLicense spdxLicense = LicenseInfoFactory.getListedLicenseById(licenseId);
final LicenseChoice choice = new LicenseChoice();
choice.addLicense(createLicenseObject(spdxLicense))... | java | public static LicenseChoice resolveSpdxLicenseId(String licenseId) throws InvalidSPDXAnalysisException {
final SpdxListedLicense spdxLicense = LicenseInfoFactory.getListedLicenseById(licenseId);
final LicenseChoice choice = new LicenseChoice();
choice.addLicense(createLicenseObject(spdxLicense))... | [
"public",
"static",
"LicenseChoice",
"resolveSpdxLicenseId",
"(",
"String",
"licenseId",
")",
"throws",
"InvalidSPDXAnalysisException",
"{",
"final",
"SpdxListedLicense",
"spdxLicense",
"=",
"LicenseInfoFactory",
".",
"getListedLicenseById",
"(",
"licenseId",
")",
";",
"f... | Given a valid SPDX license ID, this method will return a LicenseChoice object.
@param licenseId a valid SPDX license ID
@return a LicenseChoice object
@throws InvalidSPDXAnalysisException an exception while parsing the license ID | [
"Given",
"a",
"valid",
"SPDX",
"license",
"ID",
"this",
"method",
"will",
"return",
"a",
"LicenseChoice",
"object",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L139-L144 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.parseLicenseByUrl | public static License parseLicenseByUrl(String licenseUrl) throws InvalidLicenseStringException {
final String protocolExcludedUrl = licenseUrl.replace("http://", "").replace("https://", "");
final ListedLicenses ll = ListedLicenses.getListedLicenses();
// Check cache. If hit, return, otherwise ... | java | public static License parseLicenseByUrl(String licenseUrl) throws InvalidLicenseStringException {
final String protocolExcludedUrl = licenseUrl.replace("http://", "").replace("https://", "");
final ListedLicenses ll = ListedLicenses.getListedLicenses();
// Check cache. If hit, return, otherwise ... | [
"public",
"static",
"License",
"parseLicenseByUrl",
"(",
"String",
"licenseUrl",
")",
"throws",
"InvalidLicenseStringException",
"{",
"final",
"String",
"protocolExcludedUrl",
"=",
"licenseUrl",
".",
"replace",
"(",
"\"http://\"",
",",
"\"\"",
")",
".",
"replace",
"... | Given a URL, this method will attempt to resolve the SPDX license. This method will
not retrieve the URL, rather, it will interrogate it's internal list of SPDX licenses
and the URLs defined for each. This method may impact performance for URLs that are
not associated with an SPDX license or otherwise have not been que... | [
"Given",
"a",
"URL",
"this",
"method",
"will",
"attempt",
"to",
"resolve",
"the",
"SPDX",
"license",
".",
"This",
"method",
"will",
"not",
"retrieve",
"the",
"URL",
"rather",
"it",
"will",
"interrogate",
"it",
"s",
"internal",
"list",
"of",
"SPDX",
"licens... | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L157-L183 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.createLicenseObject | private static License createLicenseObject(SpdxListedLicense spdxListedLicense) {
final License license = new License();
license.setId(spdxListedLicense.getLicenseId());
license.setName(spdxListedLicense.getName());
if (spdxListedLicense.getSeeAlso() != null && spdxListedLicense.getSeeAl... | java | private static License createLicenseObject(SpdxListedLicense spdxListedLicense) {
final License license = new License();
license.setId(spdxListedLicense.getLicenseId());
license.setName(spdxListedLicense.getName());
if (spdxListedLicense.getSeeAlso() != null && spdxListedLicense.getSeeAl... | [
"private",
"static",
"License",
"createLicenseObject",
"(",
"SpdxListedLicense",
"spdxListedLicense",
")",
"{",
"final",
"License",
"license",
"=",
"new",
"License",
"(",
")",
";",
"license",
".",
"setId",
"(",
"spdxListedLicense",
".",
"getLicenseId",
"(",
")",
... | Creates a License object from the specified SpdxListedLicense object.
@param spdxListedLicense the object to convert
@return a CycloneDX License object | [
"Creates",
"a",
"License",
"object",
"from",
"the",
"specified",
"SpdxListedLicense",
"object",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L190-L205 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/LicenseResolver.java | LicenseResolver.resolveViaAlternativeMapping | private static LicenseChoice resolveViaAlternativeMapping(String licenseString) {
if (licenseString == null) {
return null;
}
try {
for (final Map.Entry<String, List<String>> mapping : mappings.entrySet()) {
final List<String> names = mapping.getValue();
... | java | private static LicenseChoice resolveViaAlternativeMapping(String licenseString) {
if (licenseString == null) {
return null;
}
try {
for (final Map.Entry<String, List<String>> mapping : mappings.entrySet()) {
final List<String> names = mapping.getValue();
... | [
"private",
"static",
"LicenseChoice",
"resolveViaAlternativeMapping",
"(",
"String",
"licenseString",
")",
"{",
"if",
"(",
"licenseString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String... | Attempts to perform high-confidence license resolution with unstructured text as input.
@param licenseString the license string (not the actual license text)
@return a LicenseChoice object if resolved, otherwise null | [
"Attempts",
"to",
"perform",
"high",
"-",
"confidence",
"license",
"resolution",
"with",
"unstructured",
"text",
"as",
"input",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/LicenseResolver.java#L212-L231 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/AbstractBomGenerator.java | AbstractBomGenerator.toXmlString | public String toXmlString() throws TransformerException {
if (doc == null) {
return null;
}
final DOMSource domSource = new DOMSource(doc);
final StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
final TransformerF... | java | public String toXmlString() throws TransformerException {
if (doc == null) {
return null;
}
final DOMSource domSource = new DOMSource(doc);
final StringWriter writer = new StringWriter();
final StreamResult result = new StreamResult(writer);
final TransformerF... | [
"public",
"String",
"toXmlString",
"(",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"doc",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"DOMSource",
"domSource",
"=",
"new",
"DOMSource",
"(",
"doc",
")",
";",
"final",
"StringWrit... | Creates a text representation of a CycloneDX BoM Document.
@return a String of the BoM
@throws TransformerException an TransformerException
@since 1.1.0 | [
"Creates",
"a",
"text",
"representation",
"of",
"a",
"CycloneDX",
"BoM",
"Document",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/AbstractBomGenerator.java#L128-L145 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/BomParser.java | BomParser.parse | private Bom parse(StreamSource streamSource) throws ParseException {
try {
final Schema schema = getXmlSchema(CycloneDxSchema.Version.VERSION_11);
final XmlMapper mapper = new XmlMapper();
// Prevent XML External Entity Injection
final XMLInputFactory xif = XMLIn... | java | private Bom parse(StreamSource streamSource) throws ParseException {
try {
final Schema schema = getXmlSchema(CycloneDxSchema.Version.VERSION_11);
final XmlMapper mapper = new XmlMapper();
// Prevent XML External Entity Injection
final XMLInputFactory xif = XMLIn... | [
"private",
"Bom",
"parse",
"(",
"StreamSource",
"streamSource",
")",
"throws",
"ParseException",
"{",
"try",
"{",
"final",
"Schema",
"schema",
"=",
"getXmlSchema",
"(",
"CycloneDxSchema",
".",
"Version",
".",
"VERSION_11",
")",
";",
"final",
"XmlMapper",
"mapper... | Parses a CycloneDX BOM.
@param streamSource the BOM
@return an Bom object
@throws ParseException when errors are encountered
@since 1.1.0 | [
"Parses",
"a",
"CycloneDX",
"BOM",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomParser.java#L77-L94 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/BomParser.java | BomParser.validate | public List<SAXParseException> validate(File file) {
return validate(file, CycloneDxSchema.Version.VERSION_11);
} | java | public List<SAXParseException> validate(File file) {
return validate(file, CycloneDxSchema.Version.VERSION_11);
} | [
"public",
"List",
"<",
"SAXParseException",
">",
"validate",
"(",
"File",
"file",
")",
"{",
"return",
"validate",
"(",
"file",
",",
"CycloneDxSchema",
".",
"Version",
".",
"VERSION_11",
")",
";",
"}"
] | Verifies a CycloneDX BoM conforms to the latest version of the specification
through XML validation.
@param file the CycloneDX BoM file to validate
@return a List of SAXParseExceptions. If the size of the list is 0, validation was successful
@since 1.1.0 | [
"Verifies",
"a",
"CycloneDX",
"BoM",
"conforms",
"to",
"the",
"latest",
"version",
"of",
"the",
"specification",
"through",
"XML",
"validation",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/BomParser.java#L103-L105 | train |
CycloneDX/cyclonedx-core-java | src/main/java/org/cyclonedx/util/BomUtils.java | BomUtils.calculateHashes | public static List<Hash> calculateHashes(File file) throws IOException {
if (file == null || !file.exists() || !file.canRead()) {
return null;
}
final List<Hash> hashes = new ArrayList<>();
try (InputStream fis = Files.newInputStream(file.toPath())) {
hashes.add(n... | java | public static List<Hash> calculateHashes(File file) throws IOException {
if (file == null || !file.exists() || !file.canRead()) {
return null;
}
final List<Hash> hashes = new ArrayList<>();
try (InputStream fis = Files.newInputStream(file.toPath())) {
hashes.add(n... | [
"public",
"static",
"List",
"<",
"Hash",
">",
"calculateHashes",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
"||",
"!",
"file",
".",
"exists",
"(",
")",
"||",
"!",
"file",
".",
"canRead",
"(",
")",
")",
... | Calculates the hashes of the specified file.
@param file the File to calculate hashes on
@return a List of Hash objets
@throws IOException an IOException
@since 1.0.0 | [
"Calculates",
"the",
"hashes",
"of",
"the",
"specified",
"file",
"."
] | 45f8f55a7f308f41280b834f179b48ea852b8c20 | https://github.com/CycloneDX/cyclonedx-core-java/blob/45f8f55a7f308f41280b834f179b48ea852b8c20/src/main/java/org/cyclonedx/util/BomUtils.java#L41-L62 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteSimpleContentProvider.java | OrmLiteSimpleContentProvider.getSortOrderStringForQuery | protected String getSortOrderStringForQuery(MatcherPattern target, QueryParameters parameter) {
String result = "";
if (parameter.getSortOrder() != null && parameter.getSortOrder().length() >= 1) {
result = parameter.getSortOrder();
} else {
result = target.getTableInfo()... | java | protected String getSortOrderStringForQuery(MatcherPattern target, QueryParameters parameter) {
String result = "";
if (parameter.getSortOrder() != null && parameter.getSortOrder().length() >= 1) {
result = parameter.getSortOrder();
} else {
result = target.getTableInfo()... | [
"protected",
"String",
"getSortOrderStringForQuery",
"(",
"MatcherPattern",
"target",
",",
"QueryParameters",
"parameter",
")",
"{",
"String",
"result",
"=",
"\"\"",
";",
"if",
"(",
"parameter",
".",
"getSortOrder",
"(",
")",
"!=",
"null",
"&&",
"parameter",
"."... | This method gets the appropriate sort order.
@param target
Arguments passed to the onQuery() method.
@param parameter
Arguments passed to the onQuery() method.
@return return an sort order string.
@since 1.0.4 | [
"This",
"method",
"gets",
"the",
"appropriate",
"sort",
"order",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteSimpleContentProvider.java#L180-L188 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | java | public MatcherController add(Class<?> tableClassType, SubType subType, String pattern, int patternCode) {
this.addTableClass(tableClassType);
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | [
"public",
"MatcherController",
"add",
"(",
"Class",
"<",
"?",
">",
"tableClassType",
",",
"SubType",
"subType",
",",
"String",
"pattern",
",",
"int",
"patternCode",
")",
"{",
"this",
".",
"addTableClass",
"(",
"tableClassType",
")",
";",
"this",
".",
"addMat... | Register a class for table. And registers a pattern for UriMatcher.
@param tableClassType
Register a class for table.
@param subType
Contents to be registered in the pattern, specify single or multiple. This is used
in the MIME types. * ITEM : If the URI pattern is for a single row :
vnd.android.cursor.item/ * DIRECTOR... | [
"Register",
"a",
"class",
"for",
"table",
".",
"And",
"registers",
"a",
"pattern",
"for",
"UriMatcher",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L86-L90 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(SubType subType, String pattern, int patternCode) {
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | java | public MatcherController add(SubType subType, String pattern, int patternCode) {
this.addMatcherPattern(subType, pattern, patternCode);
return this;
} | [
"public",
"MatcherController",
"add",
"(",
"SubType",
"subType",
",",
"String",
"pattern",
",",
"int",
"patternCode",
")",
"{",
"this",
".",
"addMatcherPattern",
"(",
"subType",
",",
"pattern",
",",
"patternCode",
")",
";",
"return",
"this",
";",
"}"
] | Registers a pattern for UriMatcher. It refer to the class that was last registered from add
method.
@param subType
Contents to be registered in the pattern, specify single or multiple. This is used
in the MIME types. * ITEM : If the URI pattern is for a single row :
vnd.android.cursor.item/ * DIRECTORY : If the URI pat... | [
"Registers",
"a",
"pattern",
"for",
"UriMatcher",
".",
"It",
"refer",
"to",
"the",
"class",
"that",
"was",
"last",
"registered",
"from",
"add",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L109-L112 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.add | public MatcherController add(MatcherPattern matcherPattern) {
int patternCode = matcherPattern.getPatternCode();
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
if (findMatcherPattern(patternCode... | java | public MatcherController add(MatcherPattern matcherPattern) {
int patternCode = matcherPattern.getPatternCode();
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
if (findMatcherPattern(patternCode... | [
"public",
"MatcherController",
"add",
"(",
"MatcherPattern",
"matcherPattern",
")",
"{",
"int",
"patternCode",
"=",
"matcherPattern",
".",
"getPatternCode",
"(",
")",
";",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"Ill... | Registers a pattern for UriMatcher. To register you have to create an instance of
MatcherPattern.
@param matcherPattern
register MatcherPattern.
@return Instance of the MatcherController class. | [
"Registers",
"a",
"pattern",
"for",
"UriMatcher",
".",
"To",
"register",
"you",
"have",
"to",
"create",
"an",
"instance",
"of",
"MatcherPattern",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L121-L134 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.setDefaultContentUri | public MatcherController setDefaultContentUri(String authority, String path) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, p... | java | public MatcherController setDefaultContentUri(String authority, String path) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentUriInfo(new ContentUriInfo(authority, p... | [
"public",
"MatcherController",
"setDefaultContentUri",
"(",
"String",
"authority",
",",
"String",
"path",
")",
"{",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is a problem with the order o... | Set the DefaultContentUri. If you did not use the DefaultContentUri annotation, you must call
this method.
@see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentUri
@param authority
@param path
@return Instance of the MatcherController class. | [
"Set",
"the",
"DefaultContentUri",
".",
"If",
"you",
"did",
"not",
"use",
"the",
"DefaultContentUri",
"annotation",
"you",
"must",
"call",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L144-L150 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.setDefaultContentMimeTypeVnd | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeV... | java | public MatcherController setDefaultContentMimeTypeVnd(String name, String type) {
if (this.lastAddTableInfo == null) {
throw new IllegalStateException("There is a problem with the order of function call.");
}
this.lastAddTableInfo.setDefaultContentMimeTypeVndInfo(new ContentMimeTypeV... | [
"public",
"MatcherController",
"setDefaultContentMimeTypeVnd",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"if",
"(",
"this",
".",
"lastAddTableInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"There is a problem with the orde... | Set the DefaultContentMimeTypeVnd. If you did not use the DefaultContentMimeTypeVnd
annotation, you must call this method.
@see com.tojc.ormlite.android.annotation.AdditionalAnnotation.DefaultContentMimeTypeVnd
@param name
@param type
@return Instance of the MatcherController class. | [
"Set",
"the",
"DefaultContentMimeTypeVnd",
".",
"If",
"you",
"did",
"not",
"use",
"the",
"DefaultContentMimeTypeVnd",
"annotation",
"you",
"must",
"call",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L160-L166 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.initialize | public MatcherController initialize() {
this.lastAddTableInfo = null;
for (Map.Entry<Class<?>, TableInfo> entry : this.tables.entrySet()) {
entry.getValue().isValid(true);
}
for (MatcherPattern entry : matcherPatterns) {
entry.isValid(true);
this.mat... | java | public MatcherController initialize() {
this.lastAddTableInfo = null;
for (Map.Entry<Class<?>, TableInfo> entry : this.tables.entrySet()) {
entry.getValue().isValid(true);
}
for (MatcherPattern entry : matcherPatterns) {
entry.isValid(true);
this.mat... | [
"public",
"MatcherController",
"initialize",
"(",
")",
"{",
"this",
".",
"lastAddTableInfo",
"=",
"null",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Class",
"<",
"?",
">",
",",
"TableInfo",
">",
"entry",
":",
"this",
".",
"tables",
".",
"entrySet",
"(... | initialized with the contents that are registered by the add method. This method checks the
registration details.
@return Instance of the MatcherController class. | [
"initialized",
"with",
"the",
"contents",
"that",
"are",
"registered",
"by",
"the",
"add",
"method",
".",
"This",
"method",
"checks",
"the",
"registration",
"details",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L173-L188 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java | MatcherController.findMatcherPattern | public MatcherPattern findMatcherPattern(int patternCode) {
MatcherPattern result = null;
for (MatcherPattern entry : this.matcherPatterns) {
if (entry.getPatternCode() == patternCode) {
result = entry;
break;
}
}
return result;
... | java | public MatcherPattern findMatcherPattern(int patternCode) {
MatcherPattern result = null;
for (MatcherPattern entry : this.matcherPatterns) {
if (entry.getPatternCode() == patternCode) {
result = entry;
break;
}
}
return result;
... | [
"public",
"MatcherPattern",
"findMatcherPattern",
"(",
"int",
"patternCode",
")",
"{",
"MatcherPattern",
"result",
"=",
"null",
";",
"for",
"(",
"MatcherPattern",
"entry",
":",
"this",
".",
"matcherPatterns",
")",
"{",
"if",
"(",
"entry",
".",
"getPatternCode",
... | This will search the MatcherPattern that are registered based on the return code UriMatcher.
@param patternCode
UriMatcher code is returned
@return Instance of the MatcherPattern class. if no match is found will return null. | [
"This",
"will",
"search",
"the",
"MatcherPattern",
"that",
"are",
"registered",
"based",
"on",
"the",
"return",
"code",
"UriMatcher",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/framework/MatcherController.java#L196-L205 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onQueryCompleted | protected void onQueryCompleted(Cursor result, Uri uri, MatcherPattern target, QueryParameters parameter) {
result.setNotificationUri(this.getContext().getContentResolver(), uri);
} | java | protected void onQueryCompleted(Cursor result, Uri uri, MatcherPattern target, QueryParameters parameter) {
result.setNotificationUri(this.getContext().getContentResolver(), uri);
} | [
"protected",
"void",
"onQueryCompleted",
"(",
"Cursor",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"QueryParameters",
"parameter",
")",
"{",
"result",
".",
"setNotificationUri",
"(",
"this",
".",
"getContext",
"(",
")",
".",
"getContentRe... | This method is called after the onQuery processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onQuery method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onQuery method.
It is MatcherPattern objects that match ... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onQuery",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L191-L193 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onInsertCompleted | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
this.getContext().getContentResolver().notifyChange(result, null);
} | java | protected void onInsertCompleted(Uri result, Uri uri, MatcherPattern target, InsertParameters parameter) {
this.getContext().getContentResolver().notifyChange(result, null);
} | [
"protected",
"void",
"onInsertCompleted",
"(",
"Uri",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"InsertParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onInsert processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onInsert method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onInsert method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onInsert",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L238-L240 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onDeleteCompleted | protected void onDeleteCompleted(int result, Uri uri, MatcherPattern target, DeleteParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | java | protected void onDeleteCompleted(int result, Uri uri, MatcherPattern target, DeleteParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | [
"protected",
"void",
"onDeleteCompleted",
"(",
"int",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"DeleteParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onDelete processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onDelete method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onDelete method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onDelete",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L286-L288 | train |
jakenjarvis/Android-OrmLiteContentProvider | ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java | OrmLiteDefaultContentProvider.onUpdateCompleted | protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | java | protected void onUpdateCompleted(int result, Uri uri, MatcherPattern target, UpdateParameters parameter) {
this.getContext().getContentResolver().notifyChange(uri, null);
} | [
"protected",
"void",
"onUpdateCompleted",
"(",
"int",
"result",
",",
"Uri",
"uri",
",",
"MatcherPattern",
"target",
",",
"UpdateParameters",
"parameter",
")",
"{",
"this",
".",
"getContext",
"(",
")",
".",
"getContentResolver",
"(",
")",
".",
"notifyChange",
"... | This method is called after the onUpdate processing has been handled. If you're a need,
you can override this method.
@param result
This is the return value of onUpdate method.
@param uri
This is the Uri of target.
@param target
This is identical to the argument of onUpdate method.
It is MatcherPattern objects that mat... | [
"This",
"method",
"is",
"called",
"after",
"the",
"onUpdate",
"processing",
"has",
"been",
"handled",
".",
"If",
"you",
"re",
"a",
"need",
"you",
"can",
"override",
"this",
"method",
"."
] | 8f102f0743b308c9f58d43639e98f832fd951985 | https://github.com/jakenjarvis/Android-OrmLiteContentProvider/blob/8f102f0743b308c9f58d43639e98f832fd951985/ormlite-content-provider-library/src/com/tojc/ormlite/android/OrmLiteDefaultContentProvider.java#L334-L336 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java | LibGmp.__gmpz_import | public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer);
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, b... | java | public static void __gmpz_import(mpz_t rop, int count, int order, int size, int endian, int nails,
Pointer buffer) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_import(rop, count, order, size, endian, nails, buffer);
} else {
SizeT8.__gmpz_import(rop, count, order, size, endian, nails, b... | [
"public",
"static",
"void",
"__gmpz_import",
"(",
"mpz_t",
"rop",
",",
"int",
"count",
",",
"int",
"order",
",",
"int",
"size",
",",
"int",
"endian",
",",
"int",
"nails",
",",
"Pointer",
"buffer",
")",
"{",
"if",
"(",
"SIZE_T_CLASS",
"==",
"SizeT4",
".... | Set rop from an array of word data at op.
The parameters specify the format of the data. count many words are read, each size bytes.
order can be 1 for most significant word first or -1 for least significant first. Within each
word endian can be 1 for most significant byte first, -1 for least significant first, or 0 f... | [
"Set",
"rop",
"from",
"an",
"array",
"of",
"word",
"data",
"at",
"op",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java#L200-L207 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java | LibGmp.__gmpz_export | public static void __gmpz_export(Pointer rop, Pointer countp, int order, int size, int endian,
int nails, mpz_t op) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_export(rop, countp, order, size, endian, nails, op);
} else {
SizeT8.__gmpz_export(rop, countp, order, size, endian, nails, op... | java | public static void __gmpz_export(Pointer rop, Pointer countp, int order, int size, int endian,
int nails, mpz_t op) {
if (SIZE_T_CLASS == SizeT4.class) {
SizeT4.__gmpz_export(rop, countp, order, size, endian, nails, op);
} else {
SizeT8.__gmpz_export(rop, countp, order, size, endian, nails, op... | [
"public",
"static",
"void",
"__gmpz_export",
"(",
"Pointer",
"rop",
",",
"Pointer",
"countp",
",",
"int",
"order",
",",
"int",
"size",
",",
"int",
"endian",
",",
"int",
"nails",
",",
"mpz_t",
"op",
")",
"{",
"if",
"(",
"SIZE_T_CLASS",
"==",
"SizeT4",
"... | Fill rop with word data from op.
The parameters specify the format of the data produced. Each word will be size bytes and order
can be 1 for most significant word first or -1 for least significant first. Within each word
endian can be 1 for most significant byte first, -1 for least significant first, or 0 for the
nati... | [
"Fill",
"rop",
"with",
"word",
"data",
"from",
"op",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/LibGmp.java#L243-L250 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.checkLoaded | public static void checkLoaded() {
if (LOAD_ERROR != null) {
throw LOAD_ERROR;
}
// Make a test call, sometimes the error won't occur until you try the native method.
// 2 ^ 3 = 8, 8 mod 5 = 3
BigInteger two = BigInteger.valueOf(2);
BigInteger three = BigInteger.valueOf(3);
BigInteger ... | java | public static void checkLoaded() {
if (LOAD_ERROR != null) {
throw LOAD_ERROR;
}
// Make a test call, sometimes the error won't occur until you try the native method.
// 2 ^ 3 = 8, 8 mod 5 = 3
BigInteger two = BigInteger.valueOf(2);
BigInteger three = BigInteger.valueOf(3);
BigInteger ... | [
"public",
"static",
"void",
"checkLoaded",
"(",
")",
"{",
"if",
"(",
"LOAD_ERROR",
"!=",
"null",
")",
"{",
"throw",
"LOAD_ERROR",
";",
"}",
"// Make a test call, sometimes the error won't occur until you try the native method.",
"// 2 ^ 3 = 8, 8 mod 5 = 3",
"BigInteger",
"t... | Verifies this library is loaded properly.
@throws UnsatisfiedLinkError if the library failed to load properly. | [
"Verifies",
"this",
"library",
"is",
"loaded",
"properly",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L61-L87 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.kronecker | public static int kronecker(BigInteger a, BigInteger p) {
return INSTANCE.get().kroneckerImpl(a, p);
} | java | public static int kronecker(BigInteger a, BigInteger p) {
return INSTANCE.get().kroneckerImpl(a, p);
} | [
"public",
"static",
"int",
"kronecker",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"p",
")",
"{",
"return",
"INSTANCE",
".",
"get",
"(",
")",
".",
"kroneckerImpl",
"(",
"a",
",",
"p",
")",
";",
"}"
] | Calculate kronecker symbol a|p. Generalization of legendre and jacobi.
@param a an integer
@param p the modulus
@return a|p | [
"Calculate",
"kronecker",
"symbol",
"a|p",
".",
"Generalization",
"of",
"legendre",
"and",
"jacobi",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L96-L98 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.modInverse | public static BigInteger modInverse(BigInteger val, BigInteger modulus) {
if (modulus.signum() <= 0) {
throw new ArithmeticException("modulus must be positive");
}
return INSTANCE.get().modInverseImpl(val, modulus);
} | java | public static BigInteger modInverse(BigInteger val, BigInteger modulus) {
if (modulus.signum() <= 0) {
throw new ArithmeticException("modulus must be positive");
}
return INSTANCE.get().modInverseImpl(val, modulus);
} | [
"public",
"static",
"BigInteger",
"modInverse",
"(",
"BigInteger",
"val",
",",
"BigInteger",
"modulus",
")",
"{",
"if",
"(",
"modulus",
".",
"signum",
"(",
")",
"<=",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"modulus must be positive\"",
")... | Calculate val^-1 % modulus.
@param val must be positive
@param modulus the modulus
@return val^-1 % modulus
@throws ArithmeticException if modulus is non-positive or val is not invertible | [
"Calculate",
"val^",
"-",
"1",
"%",
"modulus",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L150-L155 | train |
square/jna-gmp | jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java | Gmp.exactDivide | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | java | public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) {
if (divisor.signum() == 0) {
throw new ArithmeticException("BigInteger divide by zero");
}
return INSTANCE.get().exactDivImpl(dividend, divisor);
} | [
"public",
"static",
"BigInteger",
"exactDivide",
"(",
"BigInteger",
"dividend",
",",
"BigInteger",
"divisor",
")",
"{",
"if",
"(",
"divisor",
".",
"signum",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"BigInteger divide by zero\"... | Divide dividend by divisor. This method only returns correct answers when the division produces
no remainder. Correct answers should not be expected when the divison would result in a
remainder.
@return dividend / divisor
@throws ArithmeticException if divisor is zero | [
"Divide",
"dividend",
"by",
"divisor",
".",
"This",
"method",
"only",
"returns",
"correct",
"answers",
"when",
"the",
"division",
"produces",
"no",
"remainder",
".",
"Correct",
"answers",
"should",
"not",
"be",
"expected",
"when",
"the",
"divison",
"would",
"r... | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/jnagmp/src/main/java/com/squareup/jnagmp/Gmp.java#L165-L170 | train |
square/jna-gmp | bc-rsa/src/main/java/com/squareup/crypto/rsa/NativeRSAEngine.java | NativeRSAEngine.processBlock | public byte[] processBlock(
byte[] in,
int inOff,
int inLen)
{
if (core == null)
{
throw new IllegalStateException("RSA engine not initialised");
}
return core.convertOutput(core.processBlock(core.convertInput(in, inOff, inLen)));
} | java | public byte[] processBlock(
byte[] in,
int inOff,
int inLen)
{
if (core == null)
{
throw new IllegalStateException("RSA engine not initialised");
}
return core.convertOutput(core.processBlock(core.convertInput(in, inOff, inLen)));
} | [
"public",
"byte",
"[",
"]",
"processBlock",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"inOff",
",",
"int",
"inLen",
")",
"{",
"if",
"(",
"core",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"RSA engine not initialised\"",
")",
"... | Process a single block using the basic RSA algorithm.
@param in the input array.
@param inOff the offset into the input buffer where the data starts.
@param inLen the length of the data to be processed.
@return the result of the RSA process.
@exception DataLengthException the input block is too large. | [
"Process",
"a",
"single",
"block",
"using",
"the",
"basic",
"RSA",
"algorithm",
"."
] | 192d26d97d6773bc3c68ccfa97450f4257d54838 | https://github.com/square/jna-gmp/blob/192d26d97d6773bc3c68ccfa97450f4257d54838/bc-rsa/src/main/java/com/squareup/crypto/rsa/NativeRSAEngine.java#L70-L81 | train |
dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.transform | public byte[] transform(byte[] classfileBuffer, Configuration configuration) {
InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration);
if (!instrumentationActions.includeClass) {
return classfileBuffer;
}
return transform(classfileBuffer, instrumenta... | java | public byte[] transform(byte[] classfileBuffer, Configuration configuration) {
InstrumentationActions instrumentationActions = calculateTransformationParameters(classfileBuffer, configuration);
if (!instrumentationActions.includeClass) {
return classfileBuffer;
}
return transform(classfileBuffer, instrumenta... | [
"public",
"byte",
"[",
"]",
"transform",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"Configuration",
"configuration",
")",
"{",
"InstrumentationActions",
"instrumentationActions",
"=",
"calculateTransformationParameters",
"(",
"classfileBuffer",
",",
"configuration",
... | Instrument the given class based on the configuration.
@param classfileBuffer class to be instrumented
@param configuration configuration settings
@return instrumented class | [
"Instrument",
"the",
"given",
"class",
"based",
"on",
"the",
"configuration",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L25-L31 | train |
dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.calculateTransformationParameters | private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) {
DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration);
new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0);
return discoveryClassVisitor.getTransfo... | java | private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) {
DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration);
new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0);
return discoveryClassVisitor.getTransfo... | [
"private",
"InstrumentationActions",
"calculateTransformationParameters",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"Configuration",
"configuration",
")",
"{",
"DiscoveryClassVisitor",
"discoveryClassVisitor",
"=",
"new",
"DiscoveryClassVisitor",
"(",
"configuration",
")... | Based on the structure of the class and the supplied configuration, determine
the concrete instrumentation actions for the class.
@param classfileBuffer class to be analyzed
@param configuration configuration settings
@return instrumentation actions to be applied | [
"Based",
"on",
"the",
"structure",
"of",
"the",
"class",
"and",
"the",
"supplied",
"configuration",
"determine",
"the",
"concrete",
"instrumentation",
"actions",
"for",
"the",
"class",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L40-L44 | train |
dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java | ScottClassTransformer.transform | private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
ClassReader classReader = new ClassReader(classfileBuffer);
ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTracki... | java | private byte[] transform(byte[] classfileBuffer, InstrumentationActions instrumentationActions) {
ClassReader classReader = new ClassReader(classfileBuffer);
ClassWriter classWriter = new ClassWriter(classReader, ClassWriter.COMPUTE_FRAMES);
ClassVisitor localVariableStateEmitterTestClassVisitor = new StateTracki... | [
"private",
"byte",
"[",
"]",
"transform",
"(",
"byte",
"[",
"]",
"classfileBuffer",
",",
"InstrumentationActions",
"instrumentationActions",
")",
"{",
"ClassReader",
"classReader",
"=",
"new",
"ClassReader",
"(",
"classfileBuffer",
")",
";",
"ClassWriter",
"classWri... | Perform the given instrumentation actions on a class.
@param classfileBuffer class to be transformed
@param instrumentationActions instrumentation actions to be applied
@return instrumented class | [
"Perform",
"the",
"given",
"instrumentation",
"actions",
"on",
"a",
"class",
"."
] | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L52-L59 | train |
dodie/scott | scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java | ScopeExtractorMethodVisitor.calculateScope | private LocalVariableScope calculateScope(LocalVariableScopeData scope) {
final TryCatchBlockLabels enclosingTry = getEnclosingTry(scope);
final Label start = scope.labels.start;
final Label end = getTryFixedEndLabel(scope, enclosingTry);
int startIndex = getIndex(start);
int endIndex = getIndex(end);
... | java | private LocalVariableScope calculateScope(LocalVariableScopeData scope) {
final TryCatchBlockLabels enclosingTry = getEnclosingTry(scope);
final Label start = scope.labels.start;
final Label end = getTryFixedEndLabel(scope, enclosingTry);
int startIndex = getIndex(start);
int endIndex = getIndex(end);
... | [
"private",
"LocalVariableScope",
"calculateScope",
"(",
"LocalVariableScopeData",
"scope",
")",
"{",
"final",
"TryCatchBlockLabels",
"enclosingTry",
"=",
"getEnclosingTry",
"(",
"scope",
")",
";",
"final",
"Label",
"start",
"=",
"scope",
".",
"labels",
".",
"start",... | Calculate the start and end line numbers for variable scopes. If the
LocalVariableScope start line is 0, then it is an input parameter, as
it's scope start label appeared before the method body. | [
"Calculate",
"the",
"start",
"and",
"end",
"line",
"numbers",
"for",
"variable",
"scopes",
".",
"If",
"the",
"LocalVariableScope",
"start",
"line",
"is",
"0",
"then",
"it",
"is",
"an",
"input",
"parameter",
"as",
"it",
"s",
"scope",
"start",
"label",
"appe... | fd6b492584d3ae7e072871ff2b094cce6041fc99 | https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScopeExtractorMethodVisitor.java#L149-L160 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.parse | public static IBAN parse(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input is null or empty string.");
}
if (!isLetterOrDigit(input.charAt(0)) || !isLetterOrDigit(input.charAt(input.length() - 1))) {
throw new IllegalArg... | java | public static IBAN parse(String input) {
if (input == null || input.length() == 0) {
throw new IllegalArgumentException("Input is null or empty string.");
}
if (!isLetterOrDigit(input.charAt(0)) || !isLetterOrDigit(input.charAt(input.length() - 1))) {
throw new IllegalArg... | [
"public",
"static",
"IBAN",
"parse",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input is null or empty string.\"",
")",
... | Parses the given string into an IBAN object and confirms the check digits.
@param input the input, which can be either plain ("CC11ABCD123...") or formatted with (ASCII 0x20) space characters ("CC11 ABCD 123. ..").
@return the parsed and validated IBAN object, never null.
@throws IllegalArgumentException if the input i... | [
"Parses",
"the",
"given",
"string",
"into",
"an",
"IBAN",
"object",
"and",
"confirms",
"the",
"check",
"digits",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L103-L111 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.toPlain | public static String toPlain(String input) {
Matcher matcher = SPACE_PATTERN.matcher(input);
if (matcher.find()) {
return matcher.replaceAll("");
} else {
return input;
}
} | java | public static String toPlain(String input) {
Matcher matcher = SPACE_PATTERN.matcher(input);
if (matcher.find()) {
return matcher.replaceAll("");
} else {
return input;
}
} | [
"public",
"static",
"String",
"toPlain",
"(",
"String",
"input",
")",
"{",
"Matcher",
"matcher",
"=",
"SPACE_PATTERN",
".",
"matcher",
"(",
"input",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"return",
"matcher",
".",
"replaceAll",
... | Removes any spaces contained in the String thereby converting the input into a plain IBAN
@param input
possibly pretty printed IBAN
@return plain IBAN | [
"Removes",
"any",
"spaces",
"contained",
"in",
"the",
"String",
"thereby",
"converting",
"the",
"input",
"into",
"a",
"plain",
"IBAN"
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L214-L221 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/IBAN.java | IBAN.addSpaces | private static String addSpaces(String value) {
final int length = value.length();
final int lastPossibleBlock = length - 4;
final StringBuilder sb = new StringBuilder(length + (length - 1) / 4);
int i;
for (i = 0; i < lastPossibleBlock; i += 4) {
sb.append(value, i, ... | java | private static String addSpaces(String value) {
final int length = value.length();
final int lastPossibleBlock = length - 4;
final StringBuilder sb = new StringBuilder(length + (length - 1) / 4);
int i;
for (i = 0; i < lastPossibleBlock; i += 4) {
sb.append(value, i, ... | [
"private",
"static",
"String",
"addSpaces",
"(",
"String",
"value",
")",
"{",
"final",
"int",
"length",
"=",
"value",
".",
"length",
"(",
")",
";",
"final",
"int",
"lastPossibleBlock",
"=",
"length",
"-",
"4",
";",
"final",
"StringBuilder",
"sb",
"=",
"n... | Converts a plain to a pretty printed IBAN
@param value
plain iban
@return pretty printed IBAN | [
"Converts",
"a",
"plain",
"to",
"a",
"pretty",
"printed",
"IBAN"
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/IBAN.java#L242-L253 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/Modulo97.java | Modulo97.calculateCheckDigits | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 ... | java | public static int calculateCheckDigits(CharSequence input) {
if (input == null || input.length() < 5 || input.charAt(2) != '0' || input.charAt(3) != '0') {
throw new IllegalArgumentException("The input must be non-null, have a minimum length of five characters, and the characters at indices 2 and 3 ... | [
"public",
"static",
"int",
"calculateCheckDigits",
"(",
"CharSequence",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
".",
"length",
"(",
")",
"<",
"5",
"||",
"input",
".",
"charAt",
"(",
"2",
")",
"!=",
"'",
"'",
"||",
"input",... | Calculates the check digits to be used in a MOD97 checked string.
@param input the input; the characters at indices 2 and 3 <strong>must</strong> be {@code '0'}. The input must
also satisfy the criteria defined in {@link #checksum(CharSequence)}.
@return the check digits to be used at indices 2 and 3 to make the input ... | [
"Calculates",
"the",
"check",
"digits",
"to",
"be",
"used",
"in",
"a",
"MOD97",
"checked",
"string",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/Modulo97.java#L70-L75 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.getLengthForCountryCode | public static int getLengthForCountryCode(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return CountryCodes.COUNTRY_IBAN_LENGTHS[index] & REMOVE_SEPA_MASK;
}
return -1;
} | java | public static int getLengthForCountryCode(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return CountryCodes.COUNTRY_IBAN_LENGTHS[index] & REMOVE_SEPA_MASK;
}
return -1;
} | [
"public",
"static",
"int",
"getLengthForCountryCode",
"(",
"String",
"countryCode",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"countryCode",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"CountryCodes",
".",
"COUNTRY_IBAN_LENGTHS",
"[... | Returns the IBAN length for a given country code.
@param countryCode a non-null, uppercase, two-character country code.
@return the IBAN length for the given country, or -1 if the input is not a known, two-character country code.
@throws NullPointerException if the input is null. | [
"Returns",
"the",
"IBAN",
"length",
"for",
"a",
"given",
"country",
"code",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L264-L270 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.isSEPACountry | public static boolean isSEPACountry(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return (CountryCodes.COUNTRY_IBAN_LENGTHS[index] & SEPA) == SEPA;
}
return false;
} | java | public static boolean isSEPACountry(String countryCode) {
int index = indexOf(countryCode);
if (index > -1) {
return (CountryCodes.COUNTRY_IBAN_LENGTHS[index] & SEPA) == SEPA;
}
return false;
} | [
"public",
"static",
"boolean",
"isSEPACountry",
"(",
"String",
"countryCode",
")",
"{",
"int",
"index",
"=",
"indexOf",
"(",
"countryCode",
")",
";",
"if",
"(",
"index",
">",
"-",
"1",
")",
"{",
"return",
"(",
"CountryCodes",
".",
"COUNTRY_IBAN_LENGTHS",
"... | Returns whether the given country code is in SEPA.
@param countryCode a non-null, uppercase, two-character country code.
@return true if SEPA, false if not.
@throws NullPointerException if the input is null. | [
"Returns",
"whether",
"the",
"given",
"country",
"code",
"is",
"in",
"SEPA",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L278-L284 | train |
barend/java-iban | src/main/java/nl/garvelink/iban/CountryCodes.java | CountryCodes.isKnownCountryCode | public static boolean isKnownCountryCode(String aCountryCode) {
if (aCountryCode == null || aCountryCode.length() != 2) {
return false;
}
return indexOf(aCountryCode) >= 0;
} | java | public static boolean isKnownCountryCode(String aCountryCode) {
if (aCountryCode == null || aCountryCode.length() != 2) {
return false;
}
return indexOf(aCountryCode) >= 0;
} | [
"public",
"static",
"boolean",
"isKnownCountryCode",
"(",
"String",
"aCountryCode",
")",
"{",
"if",
"(",
"aCountryCode",
"==",
"null",
"||",
"aCountryCode",
".",
"length",
"(",
")",
"!=",
"2",
")",
"{",
"return",
"false",
";",
"}",
"return",
"indexOf",
"("... | Returns whether the given string is a known country code.
@param aCountryCode the string to evaluate.
@return {@code true} if {@code aCountryCode} is a two-letter, uppercase String present in {@link #getKnownCountryCodes()}. | [
"Returns",
"whether",
"the",
"given",
"string",
"is",
"a",
"known",
"country",
"code",
"."
] | 88150c21885f9be01016c004a6e02783c11f3b3c | https://github.com/barend/java-iban/blob/88150c21885f9be01016c004a6e02783c11f3b3c/src/main/java/nl/garvelink/iban/CountryCodes.java#L299-L304 | train |
taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java | GPSdEndpoint.stop | public void stop() {
try {
if (this.socket != null) {
this.socket.close();
}
} catch (final IOException e1) {
GPSdEndpoint.LOG.debug("Close forced: " + e1.getMessage());
}
this.listeners.clear();
if (this.listenThread != null) {
this.listenThread.halt();
}
this.listenThread = n... | java | public void stop() {
try {
if (this.socket != null) {
this.socket.close();
}
} catch (final IOException e1) {
GPSdEndpoint.LOG.debug("Close forced: " + e1.getMessage());
}
this.listeners.clear();
if (this.listenThread != null) {
this.listenThread.halt();
}
this.listenThread = n... | [
"public",
"void",
"stop",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"socket",
"!=",
"null",
")",
"{",
"this",
".",
"socket",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"IOException",
"e1",
")",
"{",
"GPSdEndpoint",
"."... | Stops the endpoint. | [
"Stops",
"the",
"endpoint",
"."
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java#L148-L165 | train |
taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java | GPSdEndpoint.handleDisconnected | void handleDisconnected() throws IOException {
synchronized (this.asyncMutex) {
if (socket != null) {
socket.close();
}
this.socket = new Socket(server, port);
this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
this.out = new BufferedWriter(new OutputStreamWriter(thi... | java | void handleDisconnected() throws IOException {
synchronized (this.asyncMutex) {
if (socket != null) {
socket.close();
}
this.socket = new Socket(server, port);
this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
this.out = new BufferedWriter(new OutputStreamWriter(thi... | [
"void",
"handleDisconnected",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
".",
"asyncMutex",
")",
"{",
"if",
"(",
"socket",
"!=",
"null",
")",
"{",
"socket",
".",
"close",
"(",
")",
";",
"}",
"this",
".",
"socket",
"=",
"new",
... | Our socket thread got disconnect and is exiting. | [
"Our",
"socket",
"thread",
"got",
"disconnect",
"and",
"is",
"exiting",
"."
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/GPSdEndpoint.java#L347-L363 | train |
taimos/GPSd4Java | src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java | AbstractResultParser.parseObjectArray | @SuppressWarnings({"unchecked", "unused"})
protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array, final Class<T> type) throws ParseException {
try {
if (array == null) {
return new ArrayList<T>(10);
}
final List<T> objects = new ArrayList<T>(10);
for (int i = 0; i < array.le... | java | @SuppressWarnings({"unchecked", "unused"})
protected <T extends IGPSObject> List<T> parseObjectArray(final JSONArray array, final Class<T> type) throws ParseException {
try {
if (array == null) {
return new ArrayList<T>(10);
}
final List<T> objects = new ArrayList<T>(10);
for (int i = 0; i < array.le... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"unused\"",
"}",
")",
"protected",
"<",
"T",
"extends",
"IGPSObject",
">",
"List",
"<",
"T",
">",
"parseObjectArray",
"(",
"final",
"JSONArray",
"array",
",",
"final",
"Class",
"<",
"T",
">",
"type... | parse a whole JSONArray into a list of IGPSObjects | [
"parse",
"a",
"whole",
"JSONArray",
"into",
"a",
"list",
"of",
"IGPSObjects"
] | f3bdfcc5eed628417ea72bf20d108519f24d105b | https://github.com/taimos/GPSd4Java/blob/f3bdfcc5eed628417ea72bf20d108519f24d105b/src/main/java/de/taimos/gpsd4java/backend/AbstractResultParser.java#L82-L96 | train |
statefulj/statefulj | statefulj-fsm/src/main/java/org/statefulj/fsm/FSM.java | FSM.onEvent | public State<T> onEvent(T stateful, String event, Object ... args) throws TooBusyException {
int attempts = 0;
while(this.retryAttempts == -1 || attempts < this.retryAttempts) {
try {
State<T> current = this.getCurrentState(stateful);
// Fetch the transition for this event from the current state
/... | java | public State<T> onEvent(T stateful, String event, Object ... args) throws TooBusyException {
int attempts = 0;
while(this.retryAttempts == -1 || attempts < this.retryAttempts) {
try {
State<T> current = this.getCurrentState(stateful);
// Fetch the transition for this event from the current state
/... | [
"public",
"State",
"<",
"T",
">",
"onEvent",
"(",
"T",
"stateful",
",",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"throws",
"TooBusyException",
"{",
"int",
"attempts",
"=",
"0",
";",
"while",
"(",
"this",
".",
"retryAttempts",
"==",
"-",
"1... | Process event. Will handle all retry attempts. If attempts exceed maximum retries,
it will throw a TooBusyException.
@param stateful The Stateful Entity
@param event The Event
@param args Optional parameters to pass into the Action
@return The current State
@throws TooBusyException Exception indicating that we've ex... | [
"Process",
"event",
".",
"Will",
"handle",
"all",
"retry",
"attempts",
".",
"If",
"attempts",
"exceed",
"maximum",
"retries",
"it",
"will",
"throw",
"a",
"TooBusyException",
"."
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-fsm/src/main/java/org/statefulj/fsm/FSM.java#L109-L165 | train |
statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java | ReflectionUtils.getField | public static Field getField(final Class<?> clazz, final String fieldName) {
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; curren... | java | public static Field getField(final Class<?> clazz, final String fieldName) {
//Define return type
//
Field
field = null;
//For each class in the hierarchy starting with the current class, try to find the declared field
//
for (Class<?> current = clazz; curren... | [
"public",
"static",
"Field",
"getField",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
",",
"final",
"String",
"fieldName",
")",
"{",
"//Define return type",
"//",
"Field",
"field",
"=",
"null",
";",
"//For each class in the hierarchy starting with the current class,... | Climb the class hierarchy starting with the clazz provided, looking for the field with fieldName
@param clazz starting class to search at
@param fieldName name of the field we are looking for
@return Field which was found, or null if nothing was found | [
"Climb",
"the",
"class",
"hierarchy",
"starting",
"with",
"the",
"clazz",
"provided",
"looking",
"for",
"the",
"field",
"with",
"fieldName"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/ReflectionUtils.java#L187-L215 | train |
statefulj/statefulj | statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-springmvc/src/main/java/org/statefulj/framework/binders/springmvc/SpringMVCBinder.java | SpringMVCBinder.createParameterAnnotations | @Override
protected Annotation[] createParameterAnnotations(
String parmName,
MethodInfo methodInfo,
java.lang.annotation.Annotation[] annotations,
ConstPool parameterConstPool) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
List<Annotation> ctParmAnnotations = new L... | java | @Override
protected Annotation[] createParameterAnnotations(
String parmName,
MethodInfo methodInfo,
java.lang.annotation.Annotation[] annotations,
ConstPool parameterConstPool) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
List<Annotation> ctParmAnnotations = new L... | [
"@",
"Override",
"protected",
"Annotation",
"[",
"]",
"createParameterAnnotations",
"(",
"String",
"parmName",
",",
"MethodInfo",
"methodInfo",
",",
"java",
".",
"lang",
".",
"annotation",
".",
"Annotation",
"[",
"]",
"annotations",
",",
"ConstPool",
"parameterCon... | Clone all the parameter Annotations from the StatefulController to the Proxy
@param methodInfo
@param parmName
@param parameterConstPool
@param annotations
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Clone",
"all",
"the",
"parameter",
"Annotations",
"from",
"the",
"StatefulController",
"to",
"the",
"Proxy"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-springmvc/src/main/java/org/statefulj/framework/binders/springmvc/SpringMVCBinder.java#L135-L160 | train |
statefulj/statefulj | statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java | MongoCascadeSupport.onAfterSave | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | java | @Override
public void onAfterSave(Object source, DBObject dbo) {
this.persister.onAfterSave(source, dbo);
} | [
"@",
"Override",
"public",
"void",
"onAfterSave",
"(",
"Object",
"source",
",",
"DBObject",
"dbo",
")",
"{",
"this",
".",
"persister",
".",
"onAfterSave",
"(",
"source",
",",
"dbo",
")",
";",
"}"
] | Pass the Save event to the MongoPersister to cascade to the StateDocument
(non-Javadoc)
@see org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener#onBeforeConvert(java.lang.Object) | [
"Pass",
"the",
"Save",
"event",
"to",
"the",
"MongoPersister",
"to",
"cascade",
"to",
"the",
"StateDocument"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-persistence/statefulj-persistence-mongo/src/main/java/org/statefulj/persistence/mongo/MongoCascadeSupport.java#L40-L43 | train |
statefulj/statefulj | statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/StatefulFactory.java | StatefulFactory.mapControllerAndEntityClasses | private void mapControllerAndEntityClasses(
BeanDefinitionRegistry reg,
Map<String, Class<?>> controllerToEntityMapping,
Map<Class<?>, String> entityToRepositoryMapping,
Map<Class<?>, Set<String>> entityToControllerMappings) throws ClassNotFoundException {
// Loop thru the bean registry
//
for(String... | java | private void mapControllerAndEntityClasses(
BeanDefinitionRegistry reg,
Map<String, Class<?>> controllerToEntityMapping,
Map<Class<?>, String> entityToRepositoryMapping,
Map<Class<?>, Set<String>> entityToControllerMappings) throws ClassNotFoundException {
// Loop thru the bean registry
//
for(String... | [
"private",
"void",
"mapControllerAndEntityClasses",
"(",
"BeanDefinitionRegistry",
"reg",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
">",
">",
"controllerToEntityMapping",
",",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"String",
">",
"entityToRepositoryMa... | Iterate thru all beans and fetch the StatefulControllers
@param reg
@return
@throws ClassNotFoundException | [
"Iterate",
"thru",
"all",
"beans",
"and",
"fetch",
"the",
"StatefulControllers"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-core/src/main/java/org/statefulj/framework/core/StatefulFactory.java#L333-L370 | train |
statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java | FieldAccessor.getValue | public V getValue(T object) {
try {
if (this.getMethod != null) {
return (V)this.getMethod.invoke(object);
} else {
return (V)this.field.get(object);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
... | java | public V getValue(T object) {
try {
if (this.getMethod != null) {
return (V)this.getMethod.invoke(object);
} else {
return (V)this.field.get(object);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
... | [
"public",
"V",
"getValue",
"(",
"T",
"object",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"getMethod",
"!=",
"null",
")",
"{",
"return",
"(",
"V",
")",
"this",
".",
"getMethod",
".",
"invoke",
"(",
"object",
")",
";",
"}",
"else",
"{",
"return... | Return the value of the object
@param object
@return | [
"Return",
"the",
"value",
"of",
"the",
"object"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java#L47-L59 | train |
statefulj/statefulj | statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java | FieldAccessor.setValue | public void setValue(T object, V value) {
try {
if (this.setMethod != null) {
this.setMethod.invoke(object, value);
} else {
this.field.set(object, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e)... | java | public void setValue(T object, V value) {
try {
if (this.setMethod != null) {
this.setMethod.invoke(object, value);
} else {
this.field.set(object, value);
}
} catch (IllegalAccessException e) {
throw new RuntimeException(e)... | [
"public",
"void",
"setValue",
"(",
"T",
"object",
",",
"V",
"value",
")",
"{",
"try",
"{",
"if",
"(",
"this",
".",
"setMethod",
"!=",
"null",
")",
"{",
"this",
".",
"setMethod",
".",
"invoke",
"(",
"object",
",",
"value",
")",
";",
"}",
"else",
"... | Set's the value of the object
@param object
@param value | [
"Set",
"s",
"the",
"value",
"of",
"the",
"object"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-common/src/main/java/org/statefulj/common/utils/FieldAccessor.java#L67-L79 | train |
statefulj/statefulj | statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java | JavassistUtils.cloneAnnotation | public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = annotation.annotationType();
Annotation annot = new Annotation(clazz.getName(), constPool);
for(Method me... | java | public static Annotation cloneAnnotation(ConstPool constPool, java.lang.annotation.Annotation annotation) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> clazz = annotation.annotationType();
Annotation annot = new Annotation(clazz.getName(), constPool);
for(Method me... | [
"public",
"static",
"Annotation",
"cloneAnnotation",
"(",
"ConstPool",
"constPool",
",",
"java",
".",
"lang",
".",
"annotation",
".",
"Annotation",
"annotation",
")",
"throws",
"IllegalArgumentException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
... | Clone an annotation and all of it's methods
@param constPool
@param annotation
@return
@throws IllegalArgumentException
@throws IllegalAccessException
@throws InvocationTargetException | [
"Clone",
"an",
"annotation",
"and",
"all",
"of",
"it",
"s",
"methods"
] | d3459b3cb12bd508643027743401484a231e5fa1 | https://github.com/statefulj/statefulj/blob/d3459b3cb12bd508643027743401484a231e5fa1/statefulj-framework/statefulj-framework-binders/statefulj-framework-binders-common/src/main/java/org/statefulj/framework/binders/common/utils/JavassistUtils.java#L94-L114 | train |
chemouna/Decor | decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java | AutofitDecorator.refitText | private void refitText() {
if (!mSizeToFit) {
return;
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return;
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextVi... | java | private void refitText() {
if (!mSizeToFit) {
return;
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return;
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextVi... | [
"private",
"void",
"refitText",
"(",
")",
"{",
"if",
"(",
"!",
"mSizeToFit",
")",
"{",
"return",
";",
"}",
"if",
"(",
"mMaxLines",
"<=",
"0",
")",
"{",
"// Don't auto-size since there's no limit on lines.",
"return",
";",
"}",
"String",
"text",
"=",
"mTextVi... | Re size the font so the specified text fits in the text box assuming the text box is the
specified width. | [
"Re",
"size",
"the",
"font",
"so",
"the",
"specified",
"text",
"fits",
"in",
"the",
"text",
"box",
"assuming",
"the",
"text",
"box",
"is",
"the",
"specified",
"width",
"."
] | 82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca | https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decorators/src/main/java/com/mounacheikhna/decorators/AutofitDecorator.java#L133-L174 | train |
chemouna/Decor | decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java | DecorLayoutInflater.onCreateView | @Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base
// classes, if this fails its pretty certain the app will fail at this point.
View view = null;
... | java | @Override
protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base
// classes, if this fails its pretty certain the app will fail at this point.
View view = null;
... | [
"@",
"Override",
"protected",
"View",
"onCreateView",
"(",
"String",
"name",
",",
"AttributeSet",
"attrs",
")",
"throws",
"ClassNotFoundException",
"{",
"// This mimics the {@code PhoneLayoutInflater} in the way it tries to inflate the base",
"// classes, if this fails its pretty cer... | The LayoutInflater onCreateView is the fourth port of call for LayoutInflation.
BUT only for none CustomViews.
Basically if this method doesn't inflate the View nothing probably will. | [
"The",
"LayoutInflater",
"onCreateView",
"is",
"the",
"fourth",
"port",
"of",
"call",
"for",
"LayoutInflation",
".",
"BUT",
"only",
"for",
"none",
"CustomViews",
".",
"Basically",
"if",
"this",
"method",
"doesn",
"t",
"inflate",
"the",
"View",
"nothing",
"prob... | 82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca | https://github.com/chemouna/Decor/blob/82b1c1be3c7769e0b63c6eb16f0c01055fb3e4ca/decor/src/main/java/com/mounacheikhna/decor/DecorLayoutInflater.java#L130-L146 | train |
nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Parser.java | Parser.parse | public RECORD parse(final String value)
throws DissectionFailure, InvalidDissectorException, MissingDissectorsException {
assembleDissectors();
final Parsable<RECORD> parsable = createParsable();
if (parsable == null) {
return null;
}
parsable.setRootDissectio... | java | public RECORD parse(final String value)
throws DissectionFailure, InvalidDissectorException, MissingDissectorsException {
assembleDissectors();
final Parsable<RECORD> parsable = createParsable();
if (parsable == null) {
return null;
}
parsable.setRootDissectio... | [
"public",
"RECORD",
"parse",
"(",
"final",
"String",
"value",
")",
"throws",
"DissectionFailure",
",",
"InvalidDissectorException",
",",
"MissingDissectorsException",
"{",
"assembleDissectors",
"(",
")",
";",
"final",
"Parsable",
"<",
"RECORD",
">",
"parsable",
"=",... | Parse the value and return a new instance of RECORD.
For this method to work the RECORD class may NOT be an inner class. | [
"Parse",
"the",
"value",
"and",
"return",
"a",
"new",
"instance",
"of",
"RECORD",
".",
"For",
"this",
"method",
"to",
"work",
"the",
"RECORD",
"class",
"may",
"NOT",
"be",
"an",
"inner",
"class",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L700-L709 | train |
nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Parser.java | Parser.getPossiblePaths | public List<String> getPossiblePaths(int maxDepth) {
if (allDissectors.isEmpty()) {
return Collections.emptyList(); // nothing to do.
}
try {
assembleDissectors();
} catch (MissingDissectorsException | InvalidDissectorException e) {
// Simply swallow ... | java | public List<String> getPossiblePaths(int maxDepth) {
if (allDissectors.isEmpty()) {
return Collections.emptyList(); // nothing to do.
}
try {
assembleDissectors();
} catch (MissingDissectorsException | InvalidDissectorException e) {
// Simply swallow ... | [
"public",
"List",
"<",
"String",
">",
"getPossiblePaths",
"(",
"int",
"maxDepth",
")",
"{",
"if",
"(",
"allDissectors",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"// nothing to do.",
"}",
"try",
"{",
"a... | This method is for use by the developer to query the parser about
the possible paths that may be extracted.
@param maxDepth The maximum recursion depth
@return A list of all possible paths that could be determined automatically. | [
"This",
"method",
"is",
"for",
"use",
"by",
"the",
"developer",
"to",
"query",
"the",
"parser",
"about",
"the",
"possible",
"paths",
"that",
"may",
"be",
"extracted",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Parser.java#L914-L965 | train |
nielsbasjes/logparser | httpdlog/httpdlog-parser/src/main/java/nl/basjes/parse/httpdlog/Utils.java | Utils.resilientUrlDecode | public static String resilientUrlDecode(String input) {
String cookedInput = input;
if (cookedInput.indexOf('%') > -1) {
// Transform all existing UTF-8 standard into UTF-16 standard.
cookedInput = VALID_STANDARD.matcher(cookedInput).replaceAll("%00%$1");
// Discard... | java | public static String resilientUrlDecode(String input) {
String cookedInput = input;
if (cookedInput.indexOf('%') > -1) {
// Transform all existing UTF-8 standard into UTF-16 standard.
cookedInput = VALID_STANDARD.matcher(cookedInput).replaceAll("%00%$1");
// Discard... | [
"public",
"static",
"String",
"resilientUrlDecode",
"(",
"String",
"input",
")",
"{",
"String",
"cookedInput",
"=",
"input",
";",
"if",
"(",
"cookedInput",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"-",
"1",
")",
"{",
"// Transform all existing UTF-8 standard i... | The main goal of the resilientUrlDecode is to have a UrlDecode that keeps working
even if the input is seriously flawed or even uses a rejected standard.
@param input the UrlEncoded input string
@return Url decoded result string | [
"The",
"main",
"goal",
"of",
"the",
"resilientUrlDecode",
"is",
"to",
"have",
"a",
"UrlDecode",
"that",
"keeps",
"working",
"even",
"if",
"the",
"input",
"is",
"seriously",
"flawed",
"or",
"even",
"uses",
"a",
"rejected",
"standard",
"."
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/httpdlog/httpdlog-parser/src/main/java/nl/basjes/parse/httpdlog/Utils.java#L38-L65 | train |
nielsbasjes/logparser | parser-core/src/main/java/nl/basjes/parse/core/Dissector.java | Dissector.getNewInstance | public Dissector getNewInstance() {
try {
Constructor<? extends Dissector> co = this.getClass().getConstructor();
Dissector newInstance = co.newInstance();
initializeNewInstance(newInstance);
return newInstance;
} catch (Exception e) {
LOG.erro... | java | public Dissector getNewInstance() {
try {
Constructor<? extends Dissector> co = this.getClass().getConstructor();
Dissector newInstance = co.newInstance();
initializeNewInstance(newInstance);
return newInstance;
} catch (Exception e) {
LOG.erro... | [
"public",
"Dissector",
"getNewInstance",
"(",
")",
"{",
"try",
"{",
"Constructor",
"<",
"?",
"extends",
"Dissector",
">",
"co",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getConstructor",
"(",
")",
";",
"Dissector",
"newInstance",
"=",
"co",
".",
"new... | Create an additional instance of this dissector.
This is needed because in the parse tree we may need the same dissector multiple times.
In order to optimize per node we need separate instances.
@return New instance of this Dissector | [
"Create",
"an",
"additional",
"instance",
"of",
"this",
"dissector",
".",
"This",
"is",
"needed",
"because",
"in",
"the",
"parse",
"tree",
"we",
"may",
"need",
"the",
"same",
"dissector",
"multiple",
"times",
".",
"In",
"order",
"to",
"optimize",
"per",
"n... | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/parser-core/src/main/java/nl/basjes/parse/core/Dissector.java#L135-L145 | train |
nielsbasjes/logparser | httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ParsedRecord.java | ParsedRecord.declareRequestedFieldname | public void declareRequestedFieldname(String name) {
if (name.endsWith(".*")) {
stringSetValues.put(name, new HashMap<>());
stringSetPrefixes.put(name.substring(0, name.length() - 1), name);
}
} | java | public void declareRequestedFieldname(String name) {
if (name.endsWith(".*")) {
stringSetValues.put(name, new HashMap<>());
stringSetPrefixes.put(name.substring(0, name.length() - 1), name);
}
} | [
"public",
"void",
"declareRequestedFieldname",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"endsWith",
"(",
"\".*\"",
")",
")",
"{",
"stringSetValues",
".",
"put",
"(",
"name",
",",
"new",
"HashMap",
"<>",
"(",
")",
")",
";",
"stringSetPrefi... | For multivalue things we need to know what the name is we are expecting.
For those patterns we match the values we get against
@param name the name of the requested multivalue | [
"For",
"multivalue",
"things",
"we",
"need",
"to",
"know",
"what",
"the",
"name",
"is",
"we",
"are",
"expecting",
".",
"For",
"those",
"patterns",
"we",
"match",
"the",
"values",
"we",
"get",
"against"
] | 236d5bf91926addab82b20387262bb35da8512cd | https://github.com/nielsbasjes/logparser/blob/236d5bf91926addab82b20387262bb35da8512cd/httpdlog/httpdlog-inputformat/src/main/java/nl/basjes/hadoop/input/ParsedRecord.java#L178-L183 | train |
Patreon/patreon-java | src/main/java/com/patreon/PatreonAPI.java | PatreonAPI.fetchUser | public JSONAPIDocument<User> fetchUser(Collection<User.UserField> optionalFields) throws IOException {
URIBuilder pathBuilder = new URIBuilder()
.setPath("current_user")
.addParameter("include", "pledges");
if (optionalFields != null) {
Set<User.UserField> optionalA... | java | public JSONAPIDocument<User> fetchUser(Collection<User.UserField> optionalFields) throws IOException {
URIBuilder pathBuilder = new URIBuilder()
.setPath("current_user")
.addParameter("include", "pledges");
if (optionalFields != null) {
Set<User.UserField> optionalA... | [
"public",
"JSONAPIDocument",
"<",
"User",
">",
"fetchUser",
"(",
"Collection",
"<",
"User",
".",
"UserField",
">",
"optionalFields",
")",
"throws",
"IOException",
"{",
"URIBuilder",
"pathBuilder",
"=",
"new",
"URIBuilder",
"(",
")",
".",
"setPath",
"(",
"\"cur... | Get the user object of the creator
@param optionalFields A list of optional fields to request, or null. See {@link User.UserField}
@return the current user
@throws IOException Thrown when the GET request failed | [
"Get",
"the",
"user",
"object",
"of",
"the",
"creator"
] | 669104b3389f19635ffab75c593db9c022334092 | https://github.com/Patreon/patreon-java/blob/669104b3389f19635ffab75c593db9c022334092/src/main/java/com/patreon/PatreonAPI.java#L84-L98 | train |
beders/Resty | src/main/java/us/monoid/web/XPathQuery.java | XPathQuery.eval | public <T> T eval(XMLResource resource, Class<T>aReturnType) throws Exception {
T retVal = (T) xPathExpression.evaluate(resource.doc(), getConstant(aReturnType));
return retVal;
} | java | public <T> T eval(XMLResource resource, Class<T>aReturnType) throws Exception {
T retVal = (T) xPathExpression.evaluate(resource.doc(), getConstant(aReturnType));
return retVal;
} | [
"public",
"<",
"T",
">",
"T",
"eval",
"(",
"XMLResource",
"resource",
",",
"Class",
"<",
"T",
">",
"aReturnType",
")",
"throws",
"Exception",
"{",
"T",
"retVal",
"=",
"(",
"T",
")",
"xPathExpression",
".",
"evaluate",
"(",
"resource",
".",
"doc",
"(",
... | Evaluate the XPath on an XMLResource and convert the result into aReturnType.
@param <T> the expected type of the result
@param resource
@param aReturnType
@return
@throws Exception | [
"Evaluate",
"the",
"XPath",
"on",
"an",
"XMLResource",
"and",
"convert",
"the",
"result",
"into",
"aReturnType",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/XPathQuery.java#L60-L63 | train |
beders/Resty | src/main/java/us/monoid/web/JSONResource.java | JSONResource.unmarshal | protected Object unmarshal() throws IOException, JSONException {
json = new JSONTokener(new InputStreamReader(inputStream, "UTF-8")).nextValue();
inputStream.close();
return json;
} | java | protected Object unmarshal() throws IOException, JSONException {
json = new JSONTokener(new InputStreamReader(inputStream, "UTF-8")).nextValue();
inputStream.close();
return json;
} | [
"protected",
"Object",
"unmarshal",
"(",
")",
"throws",
"IOException",
",",
"JSONException",
"{",
"json",
"=",
"new",
"JSONTokener",
"(",
"new",
"InputStreamReader",
"(",
"inputStream",
",",
"\"UTF-8\"",
")",
")",
".",
"nextValue",
"(",
")",
";",
"inputStream"... | Transforming the JSON on the fly | [
"Transforming",
"the",
"JSON",
"on",
"the",
"fly"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/JSONResource.java#L59-L63 | train |
beders/Resty | src/main/java/us/monoid/web/JSONResource.java | JSONResource.json | public JSONResource json(JSONPathQuery path) throws Exception {
Object jsonValue = path.eval(this);
return json(jsonValue.toString());
} | java | public JSONResource json(JSONPathQuery path) throws Exception {
Object jsonValue = path.eval(this);
return json(jsonValue.toString());
} | [
"public",
"JSONResource",
"json",
"(",
"JSONPathQuery",
"path",
")",
"throws",
"Exception",
"{",
"Object",
"jsonValue",
"=",
"path",
".",
"eval",
"(",
"this",
")",
";",
"return",
"json",
"(",
"jsonValue",
".",
"toString",
"(",
")",
")",
";",
"}"
] | Execute the given path query on the json GET the returned URI expecting JSON
@param path path to the URI to follow
@return a new resource, as a result of getting it from the server in JSON format
@throws Exception
@throws JSONException | [
"Execute",
"the",
"given",
"path",
"query",
"on",
"the",
"json",
"GET",
"the",
"returned",
"URI",
"expecting",
"JSON"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/JSONResource.java#L72-L75 | train |
beders/Resty | src/main/java/us/monoid/web/Content.java | Content.addContent | @Override
protected void addContent(URLConnection con) throws IOException {
con.setDoOutput(true);
con.addRequestProperty("Content-Type", mime);
con.addRequestProperty("Content-Length", String.valueOf(content.length));
OutputStream os = con.getOutputStream();
writeContent(os);
os.close();
} | java | @Override
protected void addContent(URLConnection con) throws IOException {
con.setDoOutput(true);
con.addRequestProperty("Content-Type", mime);
con.addRequestProperty("Content-Length", String.valueOf(content.length));
OutputStream os = con.getOutputStream();
writeContent(os);
os.close();
} | [
"@",
"Override",
"protected",
"void",
"addContent",
"(",
"URLConnection",
"con",
")",
"throws",
"IOException",
"{",
"con",
".",
"setDoOutput",
"(",
"true",
")",
";",
"con",
".",
"addRequestProperty",
"(",
"\"Content-Type\"",
",",
"mime",
")",
";",
"con",
"."... | Add the content to the URLConnection used.
@param con the connection to use
@throws IOException if writing to stream fails | [
"Add",
"the",
"content",
"to",
"the",
"URLConnection",
"used",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Content.java#L38-L46 | train |
beders/Resty | src/main/java/us/monoid/web/Content.java | Content.writeHeader | @Override
public void writeHeader(OutputStream os) throws IOException {
os.write(ascii("Content-Type: " + mime + "\r\n"));
os.write(ascii("Content-Length: " + String.valueOf(content.length) + "\r\n"));
} | java | @Override
public void writeHeader(OutputStream os) throws IOException {
os.write(ascii("Content-Type: " + mime + "\r\n"));
os.write(ascii("Content-Length: " + String.valueOf(content.length) + "\r\n"));
} | [
"@",
"Override",
"public",
"void",
"writeHeader",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"os",
".",
"write",
"(",
"ascii",
"(",
"\"Content-Type: \"",
"+",
"mime",
"+",
"\"\\r\\n\"",
")",
")",
";",
"os",
".",
"write",
"(",
"ascii",
... | Used as a mime part, writing content headers | [
"Used",
"as",
"a",
"mime",
"part",
"writing",
"content",
"headers"
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/web/Content.java#L54-L58 | train |
beders/Resty | src/main/java/us/monoid/json/JSONObject.java | JSONObject.getNames | public static String[] getNames(Object object) {
if (object == null) {
return null;
}
Class<? extends Object> klass = object.getClass();
Field[] fields = klass.getFields();
int length = fields.length;
if (length == 0) {
return null;
}
String[] names = new String[length];
for (int i = 0; i < leng... | java | public static String[] getNames(Object object) {
if (object == null) {
return null;
}
Class<? extends Object> klass = object.getClass();
Field[] fields = klass.getFields();
int length = fields.length;
if (length == 0) {
return null;
}
String[] names = new String[length];
for (int i = 0; i < leng... | [
"public",
"static",
"String",
"[",
"]",
"getNames",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
"extends",
"Object",
">",
"klass",
"=",
"object",
".",
"getClass",
"(",... | Get an array of field names from an Object.
@return An array of field names, or null if there are no names. | [
"Get",
"an",
"array",
"of",
"field",
"names",
"from",
"an",
"Object",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/json/JSONObject.java#L653-L668 | train |
beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeIfNecessary | public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) {
if (hasToBeEncoded(text, usedCharacters))
return encodeEncodedWord(text, usage, usedCharacters);
else
return text;
} | java | public static String encodeIfNecessary(String text, Usage usage, int usedCharacters) {
if (hasToBeEncoded(text, usedCharacters))
return encodeEncodedWord(text, usage, usedCharacters);
else
return text;
} | [
"public",
"static",
"String",
"encodeIfNecessary",
"(",
"String",
"text",
",",
"Usage",
"usage",
",",
"int",
"usedCharacters",
")",
"{",
"if",
"(",
"hasToBeEncoded",
"(",
"text",
",",
"usedCharacters",
")",
")",
"return",
"encodeEncodedWord",
"(",
"text",
",",... | Shortcut method that encodes the specified text into an encoded-word if the
text has to be encoded.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC 822).
@param usedCharacters
number of characters already used up (
<code>0 <= usedCharact... | [
"Shortcut",
"method",
"that",
"encodes",
"the",
"specified",
"text",
"into",
"an",
"encoded",
"-",
"word",
"if",
"the",
"text",
"has",
"to",
"be",
"encoded",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L190-L195 | train |
beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeEncodedWord | public static String encodeEncodedWord(String text, Usage usage, int usedCharacters,
Charset charset, Encoding encoding) {
if (text == null)
throw new IllegalArgumentException();
if (usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS)
throw new IllegalArgumentException();
if (charset == null)
... | java | public static String encodeEncodedWord(String text, Usage usage, int usedCharacters,
Charset charset, Encoding encoding) {
if (text == null)
throw new IllegalArgumentException();
if (usedCharacters < 0 || usedCharacters > MAX_USED_CHARACTERS)
throw new IllegalArgumentException();
if (charset == null)
... | [
"public",
"static",
"String",
"encodeEncodedWord",
"(",
"String",
"text",
",",
"Usage",
"usage",
",",
"int",
"usedCharacters",
",",
"Charset",
"charset",
",",
"Encoding",
"encoding",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"throw",
"new",
"IllegalArg... | Encodes the specified text into an encoded word or a sequence of encoded
words separated by space. The text is separated into a sequence of encoded
words if it does not fit in a single one.
@param text
text to encode.
@param usage
whether the encoded-word is to be used to replace a text token or
a word entity (see RFC... | [
"Encodes",
"the",
"specified",
"text",
"into",
"an",
"encoded",
"word",
"or",
"a",
"sequence",
"of",
"encoded",
"words",
"separated",
"by",
"space",
".",
"The",
"text",
"is",
"separated",
"into",
"a",
"sequence",
"of",
"encoded",
"words",
"if",
"it",
"does... | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L317-L345 | train |
beders/Resty | src/main/java/us/monoid/util/EncoderUtil.java | EncoderUtil.encodeB | public static String encodeB(byte[] bytes) {
StringBuilder sb = new StringBuilder();
int idx = 0;
final int end = bytes.length;
for (; idx < end - 2; idx += 3) {
int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8 | bytes[idx + 2] & 0xff;
sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);... | java | public static String encodeB(byte[] bytes) {
StringBuilder sb = new StringBuilder();
int idx = 0;
final int end = bytes.length;
for (; idx < end - 2; idx += 3) {
int data = (bytes[idx] & 0xff) << 16 | (bytes[idx + 1] & 0xff) << 8 | bytes[idx + 2] & 0xff;
sb.append((char) BASE64_TABLE[data >> 18 & 0x3f]);... | [
"public",
"static",
"String",
"encodeB",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"idx",
"=",
"0",
";",
"final",
"int",
"end",
"=",
"bytes",
".",
"length",
";",
"for",
"(",
... | Encodes the specified byte array using the B encoding defined in RFC 2047.
@param bytes
byte array to encode.
@return encoded string. | [
"Encodes",
"the",
"specified",
"byte",
"array",
"using",
"the",
"B",
"encoding",
"defined",
"in",
"RFC",
"2047",
"."
] | 4493603e9689c942cc3e53b9c5018010e414a364 | https://github.com/beders/Resty/blob/4493603e9689c942cc3e53b9c5018010e414a364/src/main/java/us/monoid/util/EncoderUtil.java#L354-L383 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.