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
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/Projection.java
Projection.addToArray
private void addToArray(JsonNode j) { if (j instanceof ArrayNode) { for (Iterator<JsonNode> itr = ((ArrayNode) j).elements(); itr.hasNext();) { addToArray(itr.next()); } } else { ((ArrayNode) node).add(j); } }
java
private void addToArray(JsonNode j) { if (j instanceof ArrayNode) { for (Iterator<JsonNode> itr = ((ArrayNode) j).elements(); itr.hasNext();) { addToArray(itr.next()); } } else { ((ArrayNode) node).add(j); } }
[ "private", "void", "addToArray", "(", "JsonNode", "j", ")", "{", "if", "(", "j", "instanceof", "ArrayNode", ")", "{", "for", "(", "Iterator", "<", "JsonNode", ">", "itr", "=", "(", "(", "ArrayNode", ")", "j", ")", ".", "elements", "(", ")", ";", "i...
Adds p into this array projection
[ "Adds", "p", "into", "this", "array", "projection" ]
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/Projection.java#L211-L219
train
OpenCompare/OpenCompare
org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java
PCMMetadata.getFeaturePosition
public int getFeaturePosition(AbstractFeature feature) { AbstractFeature result = feature; if (!featurePositions.containsKey(feature)) { if (feature instanceof FeatureGroup) { FeatureGroup featureGroup = (FeatureGroup) feature; List<Feature> features = featureGroup.getConcreteFeatures(); if (!features.isEmpty()) { Collections.sort(features, new Comparator<Feature>() { @Override public int compare(Feature feat1, Feature feat2) { return getFeaturePosition(feat1) - getFeaturePosition(feat2); } }); result = features.get(0); } } } return featurePositions.getOrDefault(result, 0); }
java
public int getFeaturePosition(AbstractFeature feature) { AbstractFeature result = feature; if (!featurePositions.containsKey(feature)) { if (feature instanceof FeatureGroup) { FeatureGroup featureGroup = (FeatureGroup) feature; List<Feature> features = featureGroup.getConcreteFeatures(); if (!features.isEmpty()) { Collections.sort(features, new Comparator<Feature>() { @Override public int compare(Feature feat1, Feature feat2) { return getFeaturePosition(feat1) - getFeaturePosition(feat2); } }); result = features.get(0); } } } return featurePositions.getOrDefault(result, 0); }
[ "public", "int", "getFeaturePosition", "(", "AbstractFeature", "feature", ")", "{", "AbstractFeature", "result", "=", "feature", ";", "if", "(", "!", "featurePositions", ".", "containsKey", "(", "feature", ")", ")", "{", "if", "(", "feature", "instanceof", "Fe...
Returns the absolute position of the feature or create if not exists @param feature @return the absolution position of 'feature' or -1 if it is not specified
[ "Returns", "the", "absolute", "position", "of", "the", "feature", "or", "create", "if", "not", "exists" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java#L68-L86
train
OpenCompare/OpenCompare
org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java
PCMMetadata.getSortedProducts
public List<Product> getSortedProducts() { ArrayList<Product> result = new ArrayList<>(pcm.getProducts()); Collections.sort(result, new Comparator<Product>() { @Override public int compare(Product o1, Product o2) { Integer op1 = getProductPosition(o1); Integer op2 = getProductPosition(o2); return op1.compareTo(op2); } }); return result; }
java
public List<Product> getSortedProducts() { ArrayList<Product> result = new ArrayList<>(pcm.getProducts()); Collections.sort(result, new Comparator<Product>() { @Override public int compare(Product o1, Product o2) { Integer op1 = getProductPosition(o1); Integer op2 = getProductPosition(o2); return op1.compareTo(op2); } }); return result; }
[ "public", "List", "<", "Product", ">", "getSortedProducts", "(", ")", "{", "ArrayList", "<", "Product", ">", "result", "=", "new", "ArrayList", "<>", "(", "pcm", ".", "getProducts", "(", ")", ")", ";", "Collections", ".", "sort", "(", "result", ",", "n...
Return the sorted products concordingly with metadata @return an ordered list of products
[ "Return", "the", "sorted", "products", "concordingly", "with", "metadata" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java#L101-L113
train
OpenCompare/OpenCompare
org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java
PCMMetadata.getSortedFeatures
public List<Feature> getSortedFeatures() { ArrayList<Feature> result = new ArrayList<>(pcm.getConcreteFeatures()); Collections.sort(result, new Comparator<Feature>() { @Override public int compare(Feature f1, Feature f2) { Integer fp1 = getFeaturePosition(f1); Integer fp2 = getFeaturePosition(f2); return fp1.compareTo(fp2); } }); return result; }
java
public List<Feature> getSortedFeatures() { ArrayList<Feature> result = new ArrayList<>(pcm.getConcreteFeatures()); Collections.sort(result, new Comparator<Feature>() { @Override public int compare(Feature f1, Feature f2) { Integer fp1 = getFeaturePosition(f1); Integer fp2 = getFeaturePosition(f2); return fp1.compareTo(fp2); } }); return result; }
[ "public", "List", "<", "Feature", ">", "getSortedFeatures", "(", ")", "{", "ArrayList", "<", "Feature", ">", "result", "=", "new", "ArrayList", "<>", "(", "pcm", ".", "getConcreteFeatures", "(", ")", ")", ";", "Collections", ".", "sort", "(", "result", "...
Return the sorted features concordingly with metadata @return an ordered list of features
[ "Return", "the", "sorted", "features", "concordingly", "with", "metadata" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/api-java/src/main/java/org/opencompare/api/java/PCMMetadata.java#L119-L130
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetBuilder.java
FacetBuilder.setItemsList
public FacetBuilder setItemsList(Map<String, String> items) { ArrayList<FacetWidgetItem> facetWidgetItems = new ArrayList<FacetWidgetItem>(); for (String key : items.keySet()){ String label = items.get(key); FacetWidgetItem facetWidgetItem = new FacetWidgetItem(key, label); facetWidgetItems.add(facetWidgetItem); } this.listItems = facetWidgetItems; return this; }
java
public FacetBuilder setItemsList(Map<String, String> items) { ArrayList<FacetWidgetItem> facetWidgetItems = new ArrayList<FacetWidgetItem>(); for (String key : items.keySet()){ String label = items.get(key); FacetWidgetItem facetWidgetItem = new FacetWidgetItem(key, label); facetWidgetItems.add(facetWidgetItem); } this.listItems = facetWidgetItems; return this; }
[ "public", "FacetBuilder", "setItemsList", "(", "Map", "<", "String", ",", "String", ">", "items", ")", "{", "ArrayList", "<", "FacetWidgetItem", ">", "facetWidgetItems", "=", "new", "ArrayList", "<", "FacetWidgetItem", ">", "(", ")", ";", "for", "(", "String...
Takes a map of value to labels and the unique name of the list @param items map of value to labels @return a Builder instance to allow chaining
[ "Takes", "a", "map", "of", "value", "to", "labels", "and", "the", "unique", "name", "of", "the", "list" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetBuilder.java#L113-L123
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java
ValidationRule.updateRuleBasicInfo
public void updateRuleBasicInfo(ValidationRule rule) { this.orderIdx = rule.orderIdx; this.parentDependency = rule.parentDependency; this.standardValueType = rule.standardValueType; this.validationCheck = rule.validationCheck; this.overlapBanRuleName = rule.overlapBanRuleName; this.assistType = rule.assistType; }
java
public void updateRuleBasicInfo(ValidationRule rule) { this.orderIdx = rule.orderIdx; this.parentDependency = rule.parentDependency; this.standardValueType = rule.standardValueType; this.validationCheck = rule.validationCheck; this.overlapBanRuleName = rule.overlapBanRuleName; this.assistType = rule.assistType; }
[ "public", "void", "updateRuleBasicInfo", "(", "ValidationRule", "rule", ")", "{", "this", ".", "orderIdx", "=", "rule", ".", "orderIdx", ";", "this", ".", "parentDependency", "=", "rule", ".", "parentDependency", ";", "this", ".", "standardValueType", "=", "ru...
Update rule basic info. @param rule the rule
[ "Update", "rule", "basic", "info", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java#L66-L73
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java
ValidationRule.isUse
public boolean isUse() { if (!this.use) { return this.use; } return !(this.standardValueType != null && !this.standardValueType.equals(StandardValueType.NONE) && this.standardValue == null); }
java
public boolean isUse() { if (!this.use) { return this.use; } return !(this.standardValueType != null && !this.standardValueType.equals(StandardValueType.NONE) && this.standardValue == null); }
[ "public", "boolean", "isUse", "(", ")", "{", "if", "(", "!", "this", ".", "use", ")", "{", "return", "this", ".", "use", ";", "}", "return", "!", "(", "this", ".", "standardValueType", "!=", "null", "&&", "!", "this", ".", "standardValueType", ".", ...
Is use boolean. @return the boolean
[ "Is", "use", "boolean", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java#L80-L86
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java
ValidationRule.isUsedMyRule
public boolean isUsedMyRule(ValidationData item) { List<ValidationRule> usedRules = item.getValidationRules(); if (usedRules == null || usedRules.isEmpty()) { return false; } return usedRules.stream().filter(ur -> ur.getRuleName().equals(this.ruleName) && ur.isUse()).findAny().orElse(null) != null; }
java
public boolean isUsedMyRule(ValidationData item) { List<ValidationRule> usedRules = item.getValidationRules(); if (usedRules == null || usedRules.isEmpty()) { return false; } return usedRules.stream().filter(ur -> ur.getRuleName().equals(this.ruleName) && ur.isUse()).findAny().orElse(null) != null; }
[ "public", "boolean", "isUsedMyRule", "(", "ValidationData", "item", ")", "{", "List", "<", "ValidationRule", ">", "usedRules", "=", "item", ".", "getValidationRules", "(", ")", ";", "if", "(", "usedRules", "==", "null", "||", "usedRules", ".", "isEmpty", "("...
Is used my rule boolean. @param item the item @return the boolean
[ "Is", "used", "my", "rule", "boolean", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java#L152-L158
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java
ValidationRule.filter
public List<ValidationData> filter(List<ValidationData> allList) { return allList.stream().filter(vd -> this.isUsedMyRule(vd)).collect(Collectors.toList()); }
java
public List<ValidationData> filter(List<ValidationData> allList) { return allList.stream().filter(vd -> this.isUsedMyRule(vd)).collect(Collectors.toList()); }
[ "public", "List", "<", "ValidationData", ">", "filter", "(", "List", "<", "ValidationData", ">", "allList", ")", "{", "return", "allList", ".", "stream", "(", ")", ".", "filter", "(", "vd", "->", "this", ".", "isUsedMyRule", "(", "vd", ")", ")", ".", ...
Filter list. @param allList the all list @return the list
[ "Filter", "list", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/component/validationRule/rule/ValidationRule.java#L166-L168
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/msg/MethodSyncor.java
MethodSyncor.updateMethodKey
public void updateMethodKey() { Arrays.stream(ParamType.values()).forEach(paramType -> this.syncMethodKey(paramType)); this.validationDataRepository.flush(); this.validationStore.refresh(); log.info("[METHOD_KEY_SYNC] Complete"); }
java
public void updateMethodKey() { Arrays.stream(ParamType.values()).forEach(paramType -> this.syncMethodKey(paramType)); this.validationDataRepository.flush(); this.validationStore.refresh(); log.info("[METHOD_KEY_SYNC] Complete"); }
[ "public", "void", "updateMethodKey", "(", ")", "{", "Arrays", ".", "stream", "(", "ParamType", ".", "values", "(", ")", ")", ".", "forEach", "(", "paramType", "->", "this", ".", "syncMethodKey", "(", "paramType", ")", ")", ";", "this", ".", "validationDa...
Update method key.
[ "Update", "method", "key", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/msg/MethodSyncor.java#L46-L52
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetListBoxWidget.java
FacetListBoxWidget.setSelected
public void setSelected(String s) { for (int i = 0; i < listBox.getItemCount(); i++) { if (listBox.getItemText(i).equals(s)) listBox.setSelectedIndex(i); } }
java
public void setSelected(String s) { for (int i = 0; i < listBox.getItemCount(); i++) { if (listBox.getItemText(i).equals(s)) listBox.setSelectedIndex(i); } }
[ "public", "void", "setSelected", "(", "String", "s", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listBox", ".", "getItemCount", "(", ")", ";", "i", "++", ")", "{", "if", "(", "listBox", ".", "getItemText", "(", "i", ")", ".", "e...
Given a string will find an item in the list box with matching text and select it.
[ "Given", "a", "string", "will", "find", "an", "item", "in", "the", "list", "box", "with", "matching", "text", "and", "select", "it", "." ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/facet/FacetListBoxWidget.java#L319-L326
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/template/TemplateBasedViewBuilder.java
TemplateBasedViewBuilder.draw
public Panel draw(TemplateViewNodesConfig config, RecordList recordList){ // setup basic layout // has a reference to builders from plot to do rest of the plots final TemplateViewNodesConfig.TemplateNode rootTemplateNode = config.getRootTemplateNode(); if(rootTemplateNode == null){ throw new IllegalArgumentException("RootTemplate node is empty"); } Panel panel = draw(rootTemplateNode, recordList); return panel; }
java
public Panel draw(TemplateViewNodesConfig config, RecordList recordList){ // setup basic layout // has a reference to builders from plot to do rest of the plots final TemplateViewNodesConfig.TemplateNode rootTemplateNode = config.getRootTemplateNode(); if(rootTemplateNode == null){ throw new IllegalArgumentException("RootTemplate node is empty"); } Panel panel = draw(rootTemplateNode, recordList); return panel; }
[ "public", "Panel", "draw", "(", "TemplateViewNodesConfig", "config", ",", "RecordList", "recordList", ")", "{", "// setup basic layout", "// has a reference to builders from plot to do rest of the plots", "final", "TemplateViewNodesConfig", ".", "TemplateNode", "rootTemplateNode", ...
call this with config to initialize the view
[ "call", "this", "with", "config", "to", "initialize", "the", "view" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/template/TemplateBasedViewBuilder.java#L75-L84
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/template/TemplateBasedViewBuilder.java
TemplateBasedViewBuilder.fixedWidthAndHeightPanel
private VerticalPanel fixedWidthAndHeightPanel() { final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHeight("300px"); verticalPanel.setWidth("500px"); return verticalPanel; }
java
private VerticalPanel fixedWidthAndHeightPanel() { final VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHeight("300px"); verticalPanel.setWidth("500px"); return verticalPanel; }
[ "private", "VerticalPanel", "fixedWidthAndHeightPanel", "(", ")", "{", "final", "VerticalPanel", "verticalPanel", "=", "new", "VerticalPanel", "(", ")", ";", "verticalPanel", ".", "setHeight", "(", "\"300px\"", ")", ";", "verticalPanel", ".", "setWidth", "(", "\"5...
Need fix width and height to ensure info widget panel is drawn correctly @return
[ "Need", "fix", "width", "and", "height", "to", "ensure", "info", "widget", "panel", "is", "drawn", "correctly" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/template/TemplateBasedViewBuilder.java#L90-L95
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java
FileChangeMonitor.initNewThread
protected void initNewThread(Path monitoredFile, CountDownLatch start, CountDownLatch stop) throws IOException { final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, start, stop); final Thread thread = new Thread(watcher); thread.setDaemon(false); thread.start(); }
java
protected void initNewThread(Path monitoredFile, CountDownLatch start, CountDownLatch stop) throws IOException { final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, start, stop); final Thread thread = new Thread(watcher); thread.setDaemon(false); thread.start(); }
[ "protected", "void", "initNewThread", "(", "Path", "monitoredFile", ",", "CountDownLatch", "start", ",", "CountDownLatch", "stop", ")", "throws", "IOException", "{", "final", "Runnable", "watcher", "=", "initializeWatcherWithDirectory", "(", "monitoredFile", ",", "sta...
Added countdown latches as a synchronization aid to allow better unit testing Allows one or more threads to wait until a set of operations being performed in other threads completes, @param monitoredFile @param start calling start.await() waits till file listner is active and ready @param stop calling stop.await() allows calling code to wait until a fileChangedEvent is processed @throws IOException
[ "Added", "countdown", "latches", "as", "a", "synchronization", "aid", "to", "allow", "better", "unit", "testing", "Allows", "one", "or", "more", "threads", "to", "wait", "until", "a", "set", "of", "operations", "being", "performed", "in", "other", "threads", ...
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java#L101-L106
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java
FileChangeMonitor.initSynchronous
public void initSynchronous(Path monitoredFile) throws IOException { final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, new CountDownLatch(1), new CountDownLatch(1)); watcher.run(); }
java
public void initSynchronous(Path monitoredFile) throws IOException { final Runnable watcher = initializeWatcherWithDirectory(monitoredFile, new CountDownLatch(1), new CountDownLatch(1)); watcher.run(); }
[ "public", "void", "initSynchronous", "(", "Path", "monitoredFile", ")", "throws", "IOException", "{", "final", "Runnable", "watcher", "=", "initializeWatcherWithDirectory", "(", "monitoredFile", ",", "new", "CountDownLatch", "(", "1", ")", ",", "new", "CountDownLatc...
A blocking method to start begin the monitoring of a directory, only exists on thread interrupt @param monitoredFile @throws IOException
[ "A", "blocking", "method", "to", "start", "begin", "the", "monitoring", "of", "a", "directory", "only", "exists", "on", "thread", "interrupt" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/server/core/FileChangeMonitor.java#L113-L116
train
lightblue-platform/lightblue-client
hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java
ServoGraphiteSetup.registerGraphiteMetricObserver
protected static void registerGraphiteMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("GraphiteMetricObserver not configured, missing environment variable: {}", ENV_GRAPHITE_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PORT, port); if (prefix == null) { if (System.getenv("OPENSHIFT_APP_NAME") != null) { // try to get name from openshift. assume it's scaleable app. // format: <app name>. <namespace>.<gear dns> prefix = String.format( "%s.%s.%s", System.getenv("OPENSHIFT_APP_NAME"), System.getenv("OPENSHIFT_NAMESPACE"), System.getenv("OPENSHIFT_GEAR_DNS") ); } else { //default prefix = System.getenv("HOSTNAME"); LOGGER.debug("using HOSTNAME as default prefix" + prefix); } } int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 2004; //default graphite port LOGGER.debug("Using default port: " + iport); } String addr = host + ":" + iport; LOGGER.debug("GraphiteMetricObserver prefix: " + prefix); LOGGER.debug("GraphiteMetricObserver address: " + addr); observers.add(new GraphiteMetricObserver(prefix, addr)); }
java
protected static void registerGraphiteMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("GraphiteMetricObserver not configured, missing environment variable: {}", ENV_GRAPHITE_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_GRAPHITE_PORT, port); if (prefix == null) { if (System.getenv("OPENSHIFT_APP_NAME") != null) { // try to get name from openshift. assume it's scaleable app. // format: <app name>. <namespace>.<gear dns> prefix = String.format( "%s.%s.%s", System.getenv("OPENSHIFT_APP_NAME"), System.getenv("OPENSHIFT_NAMESPACE"), System.getenv("OPENSHIFT_GEAR_DNS") ); } else { //default prefix = System.getenv("HOSTNAME"); LOGGER.debug("using HOSTNAME as default prefix" + prefix); } } int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 2004; //default graphite port LOGGER.debug("Using default port: " + iport); } String addr = host + ":" + iport; LOGGER.debug("GraphiteMetricObserver prefix: " + prefix); LOGGER.debug("GraphiteMetricObserver address: " + addr); observers.add(new GraphiteMetricObserver(prefix, addr)); }
[ "protected", "static", "void", "registerGraphiteMetricObserver", "(", "List", "<", "MetricObserver", ">", "observers", ",", "String", "prefix", ",", "String", "host", ",", "String", "port", ")", "{", "// verify at least hostname is set, else cannot configure this observer",...
If there is sufficient configuration, register a Graphite observer to publish metrics. Requires at a minimum a host. Optionally can set prefix as well as port. The prefix defaults to the host and port defaults to '2004'. @param observers the list of observers to add any new observer to @param prefix the graphite prefix @param host the graphite host @param port the graphite port
[ "If", "there", "is", "sufficient", "configuration", "register", "a", "Graphite", "observer", "to", "publish", "metrics", ".", "Requires", "at", "a", "minimum", "a", "host", ".", "Optionally", "can", "set", "prefix", "as", "well", "as", "port", ".", "The", ...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java#L102-L151
train
lightblue-platform/lightblue-client
hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java
ServoGraphiteSetup.registerStatsdMetricObserver
protected static void registerStatsdMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("StatdsMetricObserver not configured, missing environment variable: {}", ENV_STATSD_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PORT, port); int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 8125; //default statsd port LOGGER.debug("Using default port: " + port); } LOGGER.debug("StatsdMetricObserver prefix: " + prefix); LOGGER.debug("StatsdMetricObserver host: " + host); LOGGER.debug("StatsdMetricObserver port: " + iport); observers.add(new StatsdMetricObserver(prefix, host, iport)); }
java
protected static void registerStatsdMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("StatdsMetricObserver not configured, missing environment variable: {}", ENV_STATSD_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PORT, port); int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 8125; //default statsd port LOGGER.debug("Using default port: " + port); } LOGGER.debug("StatsdMetricObserver prefix: " + prefix); LOGGER.debug("StatsdMetricObserver host: " + host); LOGGER.debug("StatsdMetricObserver port: " + iport); observers.add(new StatsdMetricObserver(prefix, host, iport)); }
[ "protected", "static", "void", "registerStatsdMetricObserver", "(", "List", "<", "MetricObserver", ">", "observers", ",", "String", "prefix", ",", "String", "host", ",", "String", "port", ")", "{", "// verify at least hostname is set, else cannot configure this observer", ...
If there is sufficient configuration, register a StatsD metric observer to publish metrics. Requires at a minimum a host. Optionally can set prefix as well as port. The prefix defaults to an empty string and port defaults to '8125'.
[ "If", "there", "is", "sufficient", "configuration", "register", "a", "StatsD", "metric", "observer", "to", "publish", "metrics", ".", "Requires", "at", "a", "minimum", "a", "host", ".", "Optionally", "can", "set", "prefix", "as", "well", "as", "port", ".", ...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java#L159-L190
train
lightblue-platform/lightblue-client
hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java
ServoGraphiteSetup.findVariable
private static String findVariable(String key) { String value = System.getProperty(key); if (value == null) { return System.getenv(key); } return value; }
java
private static String findVariable(String key) { String value = System.getProperty(key); if (value == null) { return System.getenv(key); } return value; }
[ "private", "static", "String", "findVariable", "(", "String", "key", ")", "{", "String", "value", "=", "System", ".", "getProperty", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "System", ".", "getenv", "(", "key", ")", ...
Looks for the value of the key as a key firstly as a JVM argument, and if not found, to an environment variable. If still not found, then null is returned. @param key @return
[ "Looks", "for", "the", "value", "of", "the", "key", "as", "a", "key", "firstly", "as", "a", "JVM", "argument", "and", "if", "not", "found", "to", "an", "environment", "variable", ".", "If", "still", "not", "found", "then", "null", "is", "returned", "."...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java#L247-L253
train
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java
ParameterOverrideInfoLookup.addOverrideMap
public void addOverrideMap(Map<String, String> overrideMap) { if (sealed) { throw new IllegalStateException("Instance is sealed."); } for (Map.Entry<String, String> entry : overrideMap.entrySet()) { try { ParameterOverrideInfo info = new ParameterOverrideInfo(entry.getKey()); if (info.isOverrideSystemDefault()) { putMapIfNotExsits(overrideSystemDefaultMap, info.getParameterName(), entry.getValue()); } else if (StringUtils.isNotEmpty(info.getConfigurationId())) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(info.getConfigurationId()); if (overrideForceScopeMapEntry == null) { overrideForceScopeMapEntry = new HashMap<>(); overrideForceScopeMap.put(info.getConfigurationId(), overrideForceScopeMapEntry); } putMapIfNotExsits(overrideForceScopeMapEntry, info.getParameterName(), entry.getValue()); if (info.isLocked()) { Set<String> lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap.get(info.getConfigurationId()); if (lockedParameterNamesScopeMapEntry == null) { lockedParameterNamesScopeMapEntry = new HashSet<>(); lockedParameterNamesScopeMap.put(info.getConfigurationId(), lockedParameterNamesScopeMapEntry); } putSetIfNotExsits(lockedParameterNamesScopeMapEntry, info.getParameterName()); } } else { putMapIfNotExsits(overrideForceMap, info.getParameterName(), entry.getValue()); if (info.isLocked()) { putSetIfNotExsits(lockedParameterNamesSet, info.getParameterName()); } } } catch (IllegalArgumentException ex) { log.warn("Ignoring invalid parameter override definition:\n" + ex.getMessage()); } } }
java
public void addOverrideMap(Map<String, String> overrideMap) { if (sealed) { throw new IllegalStateException("Instance is sealed."); } for (Map.Entry<String, String> entry : overrideMap.entrySet()) { try { ParameterOverrideInfo info = new ParameterOverrideInfo(entry.getKey()); if (info.isOverrideSystemDefault()) { putMapIfNotExsits(overrideSystemDefaultMap, info.getParameterName(), entry.getValue()); } else if (StringUtils.isNotEmpty(info.getConfigurationId())) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(info.getConfigurationId()); if (overrideForceScopeMapEntry == null) { overrideForceScopeMapEntry = new HashMap<>(); overrideForceScopeMap.put(info.getConfigurationId(), overrideForceScopeMapEntry); } putMapIfNotExsits(overrideForceScopeMapEntry, info.getParameterName(), entry.getValue()); if (info.isLocked()) { Set<String> lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap.get(info.getConfigurationId()); if (lockedParameterNamesScopeMapEntry == null) { lockedParameterNamesScopeMapEntry = new HashSet<>(); lockedParameterNamesScopeMap.put(info.getConfigurationId(), lockedParameterNamesScopeMapEntry); } putSetIfNotExsits(lockedParameterNamesScopeMapEntry, info.getParameterName()); } } else { putMapIfNotExsits(overrideForceMap, info.getParameterName(), entry.getValue()); if (info.isLocked()) { putSetIfNotExsits(lockedParameterNamesSet, info.getParameterName()); } } } catch (IllegalArgumentException ex) { log.warn("Ignoring invalid parameter override definition:\n" + ex.getMessage()); } } }
[ "public", "void", "addOverrideMap", "(", "Map", "<", "String", ",", "String", ">", "overrideMap", ")", "{", "if", "(", "sealed", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Instance is sealed.\"", ")", ";", "}", "for", "(", "Map", ".", "Entr...
Adds map containing parameter override definitions. Can be called multiple times. New calls do not override settings from previous calls, only add new settings. Thus maps with highest priority should be added first. @param overrideMap Override map
[ "Adds", "map", "containing", "parameter", "override", "definitions", ".", "Can", "be", "called", "multiple", "times", ".", "New", "calls", "do", "not", "override", "settings", "from", "previous", "calls", "only", "add", "new", "settings", ".", "Thus", "maps", ...
9a03d72a4314163a171c7ef815fb6a1eba181828
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java#L56-L93
train
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java
ParameterOverrideInfoLookup.seal
public void seal() { lockedParameterNamesSet = ImmutableSet.copyOf(lockedParameterNamesSet); lockedParameterNamesScopeMap = ImmutableMap.copyOf(Maps.transformValues(lockedParameterNamesScopeMap, new Function<Set<String>, Set<String>>() { @Override public Set<String> apply(Set<String> input) { return ImmutableSet.copyOf(input); } })); sealed = true; }
java
public void seal() { lockedParameterNamesSet = ImmutableSet.copyOf(lockedParameterNamesSet); lockedParameterNamesScopeMap = ImmutableMap.copyOf(Maps.transformValues(lockedParameterNamesScopeMap, new Function<Set<String>, Set<String>>() { @Override public Set<String> apply(Set<String> input) { return ImmutableSet.copyOf(input); } })); sealed = true; }
[ "public", "void", "seal", "(", ")", "{", "lockedParameterNamesSet", "=", "ImmutableSet", ".", "copyOf", "(", "lockedParameterNamesSet", ")", ";", "lockedParameterNamesScopeMap", "=", "ImmutableMap", ".", "copyOf", "(", "Maps", ".", "transformValues", "(", "lockedPar...
Make all maps and sets immutable.
[ "Make", "all", "maps", "and", "sets", "immutable", "." ]
9a03d72a4314163a171c7ef815fb6a1eba181828
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java#L98-L107
train
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java
ParameterOverrideInfoLookup.getOverrideForce
public String getOverrideForce(String configurationId, String parameterName) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(configurationId); if (overrideForceScopeMapEntry != null) { return overrideForceScopeMapEntry.get(parameterName); } return null; }
java
public String getOverrideForce(String configurationId, String parameterName) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(configurationId); if (overrideForceScopeMapEntry != null) { return overrideForceScopeMapEntry.get(parameterName); } return null; }
[ "public", "String", "getOverrideForce", "(", "String", "configurationId", ",", "String", "parameterName", ")", "{", "Map", "<", "String", ",", "String", ">", "overrideForceScopeMapEntry", "=", "overrideForceScopeMap", ".", "get", "(", "configurationId", ")", ";", ...
Lookup force override for given configuration Id. @param parameterName Parameter name @return Override value or null
[ "Lookup", "force", "override", "for", "given", "configuration", "Id", "." ]
9a03d72a4314163a171c7ef815fb6a1eba181828
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java#L144-L150
train
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java
ParameterOverrideInfoLookup.getLockedParameterNames
public Set<String> getLockedParameterNames(String configurationId) { Set<String> lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap.get(configurationId); if (lockedParameterNamesScopeMapEntry != null) { return lockedParameterNamesScopeMapEntry; } else { return ImmutableSet.of(); } }
java
public Set<String> getLockedParameterNames(String configurationId) { Set<String> lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap.get(configurationId); if (lockedParameterNamesScopeMapEntry != null) { return lockedParameterNamesScopeMapEntry; } else { return ImmutableSet.of(); } }
[ "public", "Set", "<", "String", ">", "getLockedParameterNames", "(", "String", "configurationId", ")", "{", "Set", "<", "String", ">", "lockedParameterNamesScopeMapEntry", "=", "lockedParameterNamesScopeMap", ".", "get", "(", "configurationId", ")", ";", "if", "(", ...
Get locked parameter names for specific configuration Id. @param configurationId Configuration Id @return Parameter names
[ "Get", "locked", "parameter", "names", "for", "specific", "configuration", "Id", "." ]
9a03d72a4314163a171c7ef815fb6a1eba181828
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java#L165-L173
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.downloadApiJsonAll
@GetMapping("/setting/download/api/json/all") public void downloadApiJsonAll(HttpServletRequest req, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); List<ValidationData> list = this.msgSettingService.getAllValidationData(); ValidationFileUtil.sendFileToHttpServiceResponse("validation.json", list, res); }
java
@GetMapping("/setting/download/api/json/all") public void downloadApiJsonAll(HttpServletRequest req, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); List<ValidationData> list = this.msgSettingService.getAllValidationData(); ValidationFileUtil.sendFileToHttpServiceResponse("validation.json", list, res); }
[ "@", "GetMapping", "(", "\"/setting/download/api/json/all\"", ")", "public", "void", "downloadApiJsonAll", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", ")", "...
Download api json all. @param req the req @param res the res
[ "Download", "api", "json", "all", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L74-L79
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.downloadApiJson
@GetMapping("/setting/download/api/json") public void downloadApiJson(HttpServletRequest req, @RequestParam("method") String method, @RequestParam("url") String url, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); url = new String(Base64.getDecoder().decode(url)); List<ValidationData> list = this.msgSettingService.getValidationData(method, url); ValidationFileUtil.sendFileToHttpServiceResponse(method + url.replaceAll("/", "-") + ".json", list, res); }
java
@GetMapping("/setting/download/api/json") public void downloadApiJson(HttpServletRequest req, @RequestParam("method") String method, @RequestParam("url") String url, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); url = new String(Base64.getDecoder().decode(url)); List<ValidationData> list = this.msgSettingService.getValidationData(method, url); ValidationFileUtil.sendFileToHttpServiceResponse(method + url.replaceAll("/", "-") + ".json", list, res); }
[ "@", "GetMapping", "(", "\"/setting/download/api/json\"", ")", "public", "void", "downloadApiJson", "(", "HttpServletRequest", "req", ",", "@", "RequestParam", "(", "\"method\"", ")", "String", "method", ",", "@", "RequestParam", "(", "\"url\"", ")", "String", "ur...
Download api json. @param req the req @param method the method @param url the url @param res the res
[ "Download", "api", "json", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L89-L95
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.downloadApiAll
@GetMapping("/setting/download/api/excel/all") public void downloadApiAll(HttpServletRequest req, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); PoiWorkBook workBook = this.msgExcelService.getAllExcels(); workBook.writeFile("ValidationApis_" + System.currentTimeMillis(), res); }
java
@GetMapping("/setting/download/api/excel/all") public void downloadApiAll(HttpServletRequest req, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); PoiWorkBook workBook = this.msgExcelService.getAllExcels(); workBook.writeFile("ValidationApis_" + System.currentTimeMillis(), res); }
[ "@", "GetMapping", "(", "\"/setting/download/api/excel/all\"", ")", "public", "void", "downloadApiAll", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", ")", ";",...
Download api all. @param req the req @param res the res
[ "Download", "api", "all", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L103-L108
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.downloadApi
@GetMapping("/setting/download/api/excel") public void downloadApi(HttpServletRequest req, @RequestParam("method") String method, @RequestParam("url") String url, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); url = new String(Base64.getDecoder().decode(url)); PoiWorkBook workBook = this.msgExcelService.getExcel(method, url); workBook.writeFile("ValidationApis_" + System.currentTimeMillis(), res); }
java
@GetMapping("/setting/download/api/excel") public void downloadApi(HttpServletRequest req, @RequestParam("method") String method, @RequestParam("url") String url, HttpServletResponse res) { this.validationSessionComponent.sessionCheck(req); url = new String(Base64.getDecoder().decode(url)); PoiWorkBook workBook = this.msgExcelService.getExcel(method, url); workBook.writeFile("ValidationApis_" + System.currentTimeMillis(), res); }
[ "@", "GetMapping", "(", "\"/setting/download/api/excel\"", ")", "public", "void", "downloadApi", "(", "HttpServletRequest", "req", ",", "@", "RequestParam", "(", "\"method\"", ")", "String", "method", ",", "@", "RequestParam", "(", "\"url\"", ")", "String", "url",...
Download api. @param req the req @param method the method @param url the url @param res the res
[ "Download", "api", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L118-L124
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.uploadSetting
@PostMapping("/setting/upload/json") public void uploadSetting(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); this.msgSettingService.updateValidationData((MultipartHttpServletRequest) req); }
java
@PostMapping("/setting/upload/json") public void uploadSetting(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); this.msgSettingService.updateValidationData((MultipartHttpServletRequest) req); }
[ "@", "PostMapping", "(", "\"/setting/upload/json\"", ")", "public", "void", "uploadSetting", "(", "HttpServletRequest", "req", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", ")", ";", "this", ".", "msgSettingService", ".", "u...
Upload setting. @param req the req
[ "Upload", "setting", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L131-L135
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.reqUrlAllList
@GetMapping("/setting/url/list/all") public List<ReqUrl> reqUrlAllList(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); return this.msgSettingService.getAllUrlList(); }
java
@GetMapping("/setting/url/list/all") public List<ReqUrl> reqUrlAllList(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); return this.msgSettingService.getAllUrlList(); }
[ "@", "GetMapping", "(", "\"/setting/url/list/all\"", ")", "public", "List", "<", "ReqUrl", ">", "reqUrlAllList", "(", "HttpServletRequest", "req", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", ")", ";", "return", "this", "...
Req url all list list. @param req the req @return the list
[ "Req", "url", "all", "list", "list", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L144-L148
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java
MsgSettingController.getValidationDataLists
@GetMapping("/setting/param/from/url") public List<ValidationData> getValidationDataLists(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); ValidationData data = ParameterMapper.requestParamaterToObject(req, ValidationData.class, "UTF-8"); return this.msgSettingService.getValidationData(data.getParamType(), data.getMethod(), data.getUrl()); }
java
@GetMapping("/setting/param/from/url") public List<ValidationData> getValidationDataLists(HttpServletRequest req) { this.validationSessionComponent.sessionCheck(req); ValidationData data = ParameterMapper.requestParamaterToObject(req, ValidationData.class, "UTF-8"); return this.msgSettingService.getValidationData(data.getParamType(), data.getMethod(), data.getUrl()); }
[ "@", "GetMapping", "(", "\"/setting/param/from/url\"", ")", "public", "List", "<", "ValidationData", ">", "getValidationDataLists", "(", "HttpServletRequest", "req", ")", "{", "this", ".", "validationSessionComponent", ".", "sessionCheck", "(", "req", ")", ";", "Val...
Gets validation data lists. @param req the req @return the validation data lists
[ "Gets", "validation", "data", "lists", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/controller/MsgSettingController.java#L156-L161
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.transactionToIndex
private int transactionToIndex(T t) { Integer r = allTransactions.absoluteIndexOf(t); return r == null ? -1 : r.intValue(); }
java
private int transactionToIndex(T t) { Integer r = allTransactions.absoluteIndexOf(t); return r == null ? -1 : r.intValue(); }
[ "private", "int", "transactionToIndex", "(", "T", "t", ")", "{", "Integer", "r", "=", "allTransactions", ".", "absoluteIndexOf", "(", "t", ")", ";", "return", "r", "==", "null", "?", "-", "1", ":", "r", ".", "intValue", "(", ")", ";", "}" ]
maps a transaction to its index and returns -1 if not found
[ "maps", "a", "transaction", "to", "its", "index", "and", "returns", "-", "1", "if", "not", "found" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L77-L80
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.itemToIndex
private int itemToIndex(I i) { Integer r = allItems.absoluteIndexOf(i); return r == null ? -1 : r.intValue(); }
java
private int itemToIndex(I i) { Integer r = allItems.absoluteIndexOf(i); return r == null ? -1 : r.intValue(); }
[ "private", "int", "itemToIndex", "(", "I", "i", ")", "{", "Integer", "r", "=", "allItems", ".", "absoluteIndexOf", "(", "i", ")", ";", "return", "r", "==", "null", "?", "-", "1", ":", "r", ".", "intValue", "(", ")", ";", "}" ]
maps an item to its index and returns -1 if not found
[ "maps", "an", "item", "to", "its", "index", "and", "returns", "-", "1", "if", "not", "found" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L83-L86
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.add
public boolean add(T transaction, I item) { return matrix.add(transactionToIndex(transaction), itemToIndex(item)); }
java
public boolean add(T transaction, I item) { return matrix.add(transactionToIndex(transaction), itemToIndex(item)); }
[ "public", "boolean", "add", "(", "T", "transaction", ",", "I", "item", ")", "{", "return", "matrix", ".", "add", "(", "transactionToIndex", "(", "transaction", ")", ",", "itemToIndex", "(", "item", ")", ")", ";", "}" ]
Adds a single transaction-item pair @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the set has been changed
[ "Adds", "a", "single", "transaction", "-", "item", "pair" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L295-L297
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.contains
public boolean contains(T transaction, I item) { int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
java
public boolean contains(T transaction, I item) { int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
[ "public", "boolean", "contains", "(", "T", "transaction", ",", "I", "item", ")", "{", "int", "t", "=", "transactionToIndex", "(", "transaction", ")", ";", "if", "(", "t", "<", "0", ")", "return", "false", ";", "int", "i", "=", "itemToIndex", "(", "it...
Checks if the given transaction-item pair is contained within the set @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the given transaction-item pair is contained within the set
[ "Checks", "if", "the", "given", "transaction", "-", "item", "pair", "is", "contained", "within", "the", "set" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L384-L392
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.remove
public boolean remove(T transaction, I item) { return matrix.remove(transactionToIndex(transaction), itemToIndex(item)); }
java
public boolean remove(T transaction, I item) { return matrix.remove(transactionToIndex(transaction), itemToIndex(item)); }
[ "public", "boolean", "remove", "(", "T", "transaction", ",", "I", "item", ")", "{", "return", "matrix", ".", "remove", "(", "transactionToIndex", "(", "transaction", ")", ",", "itemToIndex", "(", "item", ")", ")", ";", "}" ]
Removes a single transaction-item pair @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the pair set has been changed
[ "Removes", "a", "single", "transaction", "-", "item", "pair" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L524-L526
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.removeAll
public boolean removeAll(Collection<T> trans, Collection<I> items) { if (trans == null || trans.isEmpty() || items == null || items.isEmpty()) return false; return matrix.removeAll(allTransactions.convert(trans).indices(), allItems.convert(items).indices()); }
java
public boolean removeAll(Collection<T> trans, Collection<I> items) { if (trans == null || trans.isEmpty() || items == null || items.isEmpty()) return false; return matrix.removeAll(allTransactions.convert(trans).indices(), allItems.convert(items).indices()); }
[ "public", "boolean", "removeAll", "(", "Collection", "<", "T", ">", "trans", ",", "Collection", "<", "I", ">", "items", ")", "{", "if", "(", "trans", "==", "null", "||", "trans", ".", "isEmpty", "(", ")", "||", "items", "==", "null", "||", "items", ...
Removes the pairs obtained from the Cartesian product of transactions and items @param trans collection of transactions @param items collection of items @return <code>true</code> if the set set has been changed
[ "Removes", "the", "pairs", "obtained", "from", "the", "Cartesian", "product", "of", "transactions", "and", "items" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L554-L558
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.retainAll
public boolean retainAll(Collection<T> trans, I item) { if (isEmpty()) return false; if (trans == null || trans.isEmpty() || item == null) { clear(); return true; } return matrix.retainAll(allTransactions.convert(trans).indices(), itemToIndex(item)); }
java
public boolean retainAll(Collection<T> trans, I item) { if (isEmpty()) return false; if (trans == null || trans.isEmpty() || item == null) { clear(); return true; } return matrix.retainAll(allTransactions.convert(trans).indices(), itemToIndex(item)); }
[ "public", "boolean", "retainAll", "(", "Collection", "<", "T", ">", "trans", ",", "I", "item", ")", "{", "if", "(", "isEmpty", "(", ")", ")", "return", "false", ";", "if", "(", "trans", "==", "null", "||", "trans", ".", "isEmpty", "(", ")", "||", ...
Retains the pairs obtained from the Cartesian product of transactions and items @param trans collection of transactions @param item the item @return <code>true</code> if the set set has been changed
[ "Retains", "the", "pairs", "obtained", "from", "the", "Cartesian", "product", "of", "transactions", "and", "items" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L642-L650
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.itemsOf
public IndexedSet<I> itemsOf(T transaction) { IndexedSet<I> res = allItems.empty(); res.indices().addAll(matrix.getRow(transactionToIndex(transaction))); return res; }
java
public IndexedSet<I> itemsOf(T transaction) { IndexedSet<I> res = allItems.empty(); res.indices().addAll(matrix.getRow(transactionToIndex(transaction))); return res; }
[ "public", "IndexedSet", "<", "I", ">", "itemsOf", "(", "T", "transaction", ")", "{", "IndexedSet", "<", "I", ">", "res", "=", "allItems", ".", "empty", "(", ")", ";", "res", ".", "indices", "(", ")", ".", "addAll", "(", "matrix", ".", "getRow", "("...
Lists all items contained within a given transaction @param transaction the given transaction @return items contained within the given transaction
[ "Lists", "all", "items", "contained", "within", "a", "given", "transaction" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L710-L714
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.transactionsOf
public IndexedSet<T> transactionsOf(I item) { IndexedSet<T> res = allTransactions.empty(); res.indices().addAll(matrix.getCol(itemToIndex(item))); return res; }
java
public IndexedSet<T> transactionsOf(I item) { IndexedSet<T> res = allTransactions.empty(); res.indices().addAll(matrix.getCol(itemToIndex(item))); return res; }
[ "public", "IndexedSet", "<", "T", ">", "transactionsOf", "(", "I", "item", ")", "{", "IndexedSet", "<", "T", ">", "res", "=", "allTransactions", ".", "empty", "(", ")", ";", "res", ".", "indices", "(", ")", ".", "addAll", "(", "matrix", ".", "getCol"...
Lists all transactions involved with a specified item @param item the given item @return transactions involved with a specified item
[ "Lists", "all", "transactions", "involved", "with", "a", "specified", "item" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L723-L727
train
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java
OFFDumpRetriever.unTar
private List<File> unTar(final File inputFile, final File outputDir) throws FileNotFoundException, IOException, ArchiveException { _log.info(String.format("Untaring %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath())); final List<File> untaredFiles = new LinkedList<File>(); final InputStream is = new FileInputStream(inputFile); final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is); TarArchiveEntry entry = null; while ((entry = (TarArchiveEntry)debInputStream.getNextEntry()) != null) { final File outputFile = new File(outputDir, entry.getName()); if (entry.isDirectory()) { _log.info(String.format("Attempting to write output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.exists()) { _log.info(String.format("Attempting to create output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.mkdirs()) { throw new IllegalStateException(String.format("Couldn't create directory %s.", outputFile.getAbsolutePath())); } } } else { _log.info(String.format("Creating output file %s.", outputFile.getAbsolutePath())); final OutputStream outputFileStream = new FileOutputStream(outputFile); IOUtils.copy(debInputStream, outputFileStream); outputFileStream.close(); } untaredFiles.add(outputFile); } debInputStream.close(); return untaredFiles; }
java
private List<File> unTar(final File inputFile, final File outputDir) throws FileNotFoundException, IOException, ArchiveException { _log.info(String.format("Untaring %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath())); final List<File> untaredFiles = new LinkedList<File>(); final InputStream is = new FileInputStream(inputFile); final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is); TarArchiveEntry entry = null; while ((entry = (TarArchiveEntry)debInputStream.getNextEntry()) != null) { final File outputFile = new File(outputDir, entry.getName()); if (entry.isDirectory()) { _log.info(String.format("Attempting to write output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.exists()) { _log.info(String.format("Attempting to create output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.mkdirs()) { throw new IllegalStateException(String.format("Couldn't create directory %s.", outputFile.getAbsolutePath())); } } } else { _log.info(String.format("Creating output file %s.", outputFile.getAbsolutePath())); final OutputStream outputFileStream = new FileOutputStream(outputFile); IOUtils.copy(debInputStream, outputFileStream); outputFileStream.close(); } untaredFiles.add(outputFile); } debInputStream.close(); return untaredFiles; }
[ "private", "List", "<", "File", ">", "unTar", "(", "final", "File", "inputFile", ",", "final", "File", "outputDir", ")", "throws", "FileNotFoundException", ",", "IOException", ",", "ArchiveException", "{", "_log", ".", "info", "(", "String", ".", "format", "...
Untar an input file into an output file. The output file is created in the output folder, having the same name as the input file, minus the '.tar' extension. @param inputFile the input .tar file @param outputDir the output directory file. @throws IOException @throws FileNotFoundException @return The {@link List} of {@link File}s with the untared content. @throws ArchiveException
[ "Untar", "an", "input", "file", "into", "an", "output", "file", "." ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java#L56-L85
train
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/ParameterOverrideImpl.java
ParameterOverrideImpl.updateLoockup
private void updateLoockup() { synchronized (parameterOverrideProviders) { ParameterOverrideInfoLookup newLookup = new ParameterOverrideInfoLookup(); for (ParameterOverrideProvider provider : parameterOverrideProviders) { newLookup.addOverrideMap(provider.getOverrideMap()); } newLookup.seal(); lookup = newLookup; } }
java
private void updateLoockup() { synchronized (parameterOverrideProviders) { ParameterOverrideInfoLookup newLookup = new ParameterOverrideInfoLookup(); for (ParameterOverrideProvider provider : parameterOverrideProviders) { newLookup.addOverrideMap(provider.getOverrideMap()); } newLookup.seal(); lookup = newLookup; } }
[ "private", "void", "updateLoockup", "(", ")", "{", "synchronized", "(", "parameterOverrideProviders", ")", "{", "ParameterOverrideInfoLookup", "newLookup", "=", "new", "ParameterOverrideInfoLookup", "(", ")", ";", "for", "(", "ParameterOverrideProvider", "provider", ":"...
Update lookup maps with override maps from all override providers.
[ "Update", "lookup", "maps", "with", "override", "maps", "from", "all", "override", "providers", "." ]
9a03d72a4314163a171c7ef815fb6a1eba181828
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/ParameterOverrideImpl.java#L106-L115
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
gwt-localforage/src/main/java/org/wwarn/localforage/client/LocalForage.java
LocalForage.load
public static void load() { if (!isLoaded()) { ScriptInjector.fromString(LocalForageResources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); } }
java
public static void load() { if (!isLoaded()) { ScriptInjector.fromString(LocalForageResources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); } }
[ "public", "static", "void", "load", "(", ")", "{", "if", "(", "!", "isLoaded", "(", ")", ")", "{", "ScriptInjector", ".", "fromString", "(", "LocalForageResources", ".", "INSTANCE", ".", "js", "(", ")", ".", "getText", "(", ")", ")", ".", "setWindow", ...
Loads the offline library. You normally never have to do this manually
[ "Loads", "the", "offline", "library", ".", "You", "normally", "never", "have", "to", "do", "this", "manually" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/gwt-localforage/src/main/java/org/wwarn/localforage/client/LocalForage.java#L176-L180
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/utilities/IntSetStatistics.java
IntSetStatistics.resetCounters
public static void resetCounters() { unionCount = intersectionCount = differenceCount = symmetricDifferenceCount = complementCount = unionSizeCount = intersectionSizeCount = differenceSizeCount = symmetricDifferenceSizeCount = complementSizeCount = equalsCount = hashCodeCount = containsAllCount = containsAnyCount = containsAtLeastCount = 0; }
java
public static void resetCounters() { unionCount = intersectionCount = differenceCount = symmetricDifferenceCount = complementCount = unionSizeCount = intersectionSizeCount = differenceSizeCount = symmetricDifferenceSizeCount = complementSizeCount = equalsCount = hashCodeCount = containsAllCount = containsAnyCount = containsAtLeastCount = 0; }
[ "public", "static", "void", "resetCounters", "(", ")", "{", "unionCount", "=", "intersectionCount", "=", "differenceCount", "=", "symmetricDifferenceCount", "=", "complementCount", "=", "unionSizeCount", "=", "intersectionSizeCount", "=", "differenceSizeCount", "=", "sy...
Resets all counters
[ "Resets", "all", "counters" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/utilities/IntSetStatistics.java#L177-L181
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/GenericMapWidget.java
GenericMapWidget.setMarkers
public void setMarkers(List<GenericMarker> m){ this.markers = m; for (GenericMarker marker : m) { marker.setMap(this); } //setup any clustering options clusterMarkers(); }
java
public void setMarkers(List<GenericMarker> m){ this.markers = m; for (GenericMarker marker : m) { marker.setMap(this); } //setup any clustering options clusterMarkers(); }
[ "public", "void", "setMarkers", "(", "List", "<", "GenericMarker", ">", "m", ")", "{", "this", ".", "markers", "=", "m", ";", "for", "(", "GenericMarker", "marker", ":", "m", ")", "{", "marker", ".", "setMap", "(", "this", ")", ";", "}", "//setup any...
Set markers would be a better description of this method behaviour, effectively replaces the references to all markers @param m
[ "Set", "markers", "would", "be", "a", "better", "description", "of", "this", "method", "behaviour", "effectively", "replaces", "the", "references", "to", "all", "markers" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/GenericMapWidget.java#L74-L81
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/OfflineMapWidget.java
OfflineMapWidget.load
public static void load() { if (!isLoaded()) { // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.proj4js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.supercluster().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); StyleInjector.injectStylesheetAtStart(OpenLayersV3Resources.INSTANCE.css().getText()); } }
java
public static void load() { if (!isLoaded()) { // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.proj4js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.supercluster().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); StyleInjector.injectStylesheetAtStart(OpenLayersV3Resources.INSTANCE.css().getText()); } }
[ "public", "static", "void", "load", "(", ")", "{", "if", "(", "!", "isLoaded", "(", ")", ")", "{", "// ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.proj4js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject();", "// ScriptInjector.fromString(Op...
Loads the offline library.
[ "Loads", "the", "offline", "library", "." ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/OfflineMapWidget.java#L95-L102
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/SurveyorAppController.java
SurveyorAppController.display
protected void display() { new FilterPresenter(new FilterViewUI()).go(layout); resultPresenter = new ResultPresenter(getResultView()); loadStatusListener.registerObserver(resultPresenter); resultPresenter.go(layout); }
java
protected void display() { new FilterPresenter(new FilterViewUI()).go(layout); resultPresenter = new ResultPresenter(getResultView()); loadStatusListener.registerObserver(resultPresenter); resultPresenter.go(layout); }
[ "protected", "void", "display", "(", ")", "{", "new", "FilterPresenter", "(", "new", "FilterViewUI", "(", ")", ")", ".", "go", "(", "layout", ")", ";", "resultPresenter", "=", "new", "ResultPresenter", "(", "getResultView", "(", ")", ")", ";", "loadStatusL...
Display home screen
[ "Display", "home", "screen" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/SurveyorAppController.java#L117-L123
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/store/ValidationRuleStore.java
ValidationRuleStore.getValidationChecker
public BaseValidationCheck getValidationChecker(ValidationRule rule) { ValidationRule existRule = this.rules.stream().filter(r -> r.getRuleName().equals(rule.getRuleName())).findFirst().orElse(null); if (existRule == null) { throw new ValidationLibException("rulename : " + rule.getRuleName() + "checker is notfound ", HttpStatus.INTERNAL_SERVER_ERROR); } return existRule.getValidationCheck(); }
java
public BaseValidationCheck getValidationChecker(ValidationRule rule) { ValidationRule existRule = this.rules.stream().filter(r -> r.getRuleName().equals(rule.getRuleName())).findFirst().orElse(null); if (existRule == null) { throw new ValidationLibException("rulename : " + rule.getRuleName() + "checker is notfound ", HttpStatus.INTERNAL_SERVER_ERROR); } return existRule.getValidationCheck(); }
[ "public", "BaseValidationCheck", "getValidationChecker", "(", "ValidationRule", "rule", ")", "{", "ValidationRule", "existRule", "=", "this", ".", "rules", ".", "stream", "(", ")", ".", "filter", "(", "r", "->", "r", ".", "getRuleName", "(", ")", ".", "equal...
Gets validation checker. @param rule the rule @return the validation checker
[ "Gets", "validation", "checker", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/store/ValidationRuleStore.java#L58-L64
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/store/ValidationRuleStore.java
ValidationRuleStore.addRule
public synchronized ValidationRuleStore addRule(ValidationRule rule) { rule.setOrderIdx(this.rules.size()); this.rules.add(rule); this.checkHashMap.put(rule.getRuleName(), rule.getValidationCheck()); return this; }
java
public synchronized ValidationRuleStore addRule(ValidationRule rule) { rule.setOrderIdx(this.rules.size()); this.rules.add(rule); this.checkHashMap.put(rule.getRuleName(), rule.getValidationCheck()); return this; }
[ "public", "synchronized", "ValidationRuleStore", "addRule", "(", "ValidationRule", "rule", ")", "{", "rule", ".", "setOrderIdx", "(", "this", ".", "rules", ".", "size", "(", ")", ")", ";", "this", ".", "rules", ".", "add", "(", "rule", ")", ";", "this", ...
Add rule validation rule store. @param rule the rule @return the validation rule store
[ "Add", "rule", "validation", "rule", "store", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/store/ValidationRuleStore.java#L85-L90
train
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java
PCMMutate.clear_ligne
private static PCM clear_ligne(PCM pcm, PCM pcm_return){ List<Product> pdts = pcm.getProducts(); List<Cell> cells = new ArrayList<Cell>() ; for (Product pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les lignes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la ligne !"); pcm_return.addProduct(pr); } } } return pcm_return; }
java
private static PCM clear_ligne(PCM pcm, PCM pcm_return){ List<Product> pdts = pcm.getProducts(); List<Cell> cells = new ArrayList<Cell>() ; for (Product pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les lignes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la ligne !"); pcm_return.addProduct(pr); } } } return pcm_return; }
[ "private", "static", "PCM", "clear_ligne", "(", "PCM", "pcm", ",", "PCM", "pcm_return", ")", "{", "List", "<", "Product", ">", "pdts", "=", "pcm", ".", "getProducts", "(", ")", ";", "List", "<", "Cell", ">", "cells", "=", "new", "ArrayList", "<", "Ce...
Enlever les lignes inutiles @param pcm : Le pcm @return Le pcm avec les lignes inutiles en moins
[ "Enlever", "les", "lignes", "inutiles" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java#L53-L80
train
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java
PCMMutate.clear_colonne
private static PCM clear_colonne(PCM pcm, PCM pcm_return){ List<Feature> pdts = pcm.getConcreteFeatures(); List<Cell> cells = new ArrayList<Cell>() ; for (Feature pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les colonnes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la colonne !"); pcm_return.addFeature(pr);; } } } return pcm_return; }
java
private static PCM clear_colonne(PCM pcm, PCM pcm_return){ List<Feature> pdts = pcm.getConcreteFeatures(); List<Cell> cells = new ArrayList<Cell>() ; for (Feature pr : pdts) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr.getCells(); // On traite les infos des cellules for(Cell c : cells){ if(c.getContent().isEmpty()){ nbCellsEmpty ++ ; } } if(cells.size() != 0){ System.out.println("Dans les colonnes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells.size()); System.out.println("Valeur du if : " + nbCellsEmpty/cells.size()); if(!((nbCellsEmpty/cells.size()) > RATIO_EMPTY_CELL)){ System.out.println("on ajoute la colonne !"); pcm_return.addFeature(pr);; } } } return pcm_return; }
[ "private", "static", "PCM", "clear_colonne", "(", "PCM", "pcm", ",", "PCM", "pcm_return", ")", "{", "List", "<", "Feature", ">", "pdts", "=", "pcm", ".", "getConcreteFeatures", "(", ")", ";", "List", "<", "Cell", ">", "cells", "=", "new", "ArrayList", ...
Enlever les colonnes inutiles @param pcmic : Le pcm info container du pcm @param pcm : Le pcm @return Le pcm avec les colonnes inutiles en moins
[ "Enlever", "les", "colonnes", "inutiles" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/pcm_Filter/mutate/PCMMutate.java#L88-L112
train
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/JSONformating/model/JFeature.java
JFeature.sameFeature
public boolean sameFeature(JFeature f){ return this.name.equals(f.name) && this.type.equals(f.type); }
java
public boolean sameFeature(JFeature f){ return this.name.equals(f.name) && this.type.equals(f.type); }
[ "public", "boolean", "sameFeature", "(", "JFeature", "f", ")", "{", "return", "this", ".", "name", ".", "equals", "(", "f", ".", "name", ")", "&&", "this", ".", "type", ".", "equals", "(", "f", ".", "type", ")", ";", "}" ]
Compares the name and type of the 2 features @param f the feature to compare @return true if name and type are the same, omits id
[ "Compares", "the", "name", "and", "type", "of", "the", "2", "features" ]
6cd776466b375cb8ecca08fcd94e573d65e20b14
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/JSONformating/model/JFeature.java#L35-L37
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/utils/XMLUtils.java
XMLUtils.nodeWalker
public static void nodeWalker(NodeList childNodes, NodeElementParser parser) throws ParseException { for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); String node = item.getNodeName(); if(item.getNodeType() == Node.ELEMENT_NODE){ parser.parse(item); } nodeWalker(item.getChildNodes(), parser); } }
java
public static void nodeWalker(NodeList childNodes, NodeElementParser parser) throws ParseException { for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); String node = item.getNodeName(); if(item.getNodeType() == Node.ELEMENT_NODE){ parser.parse(item); } nodeWalker(item.getChildNodes(), parser); } }
[ "public", "static", "void", "nodeWalker", "(", "NodeList", "childNodes", ",", "NodeElementParser", "parser", ")", "throws", "ParseException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childNodes", ".", "getLength", "(", ")", ";", "i", "++", ...
nodeWalker walker implementation, simple depth first recursive implementation @param childNodes take a node list to iterate @param parser an observer which parses a node element @throws ParseException
[ "nodeWalker", "walker", "implementation", "simple", "depth", "first", "recursive", "implementation" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/utils/XMLUtils.java#L56-L65
train
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/serialization/json/JsonObjectSerdes.java
JsonObjectSerdes.isObject
protected boolean isObject(String text) { final String trim = text.trim(); return trim.startsWith("{") && trim.endsWith("}"); }
java
protected boolean isObject(String text) { final String trim = text.trim(); return trim.startsWith("{") && trim.endsWith("}"); }
[ "protected", "boolean", "isObject", "(", "String", "text", ")", "{", "final", "String", "trim", "=", "text", ".", "trim", "(", ")", ";", "return", "trim", ".", "startsWith", "(", "\"{\"", ")", "&&", "trim", ".", "endsWith", "(", "\"}\"", ")", ";", "}...
Checks if the serialized content is a JSON Object. @param text Serialized response @return {@code true} if argument is a JSON object, {@code false} otherwise
[ "Checks", "if", "the", "serialized", "content", "is", "a", "JSON", "Object", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/serialization/json/JsonObjectSerdes.java#L119-L122
train
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/RequestDispatcher.java
RequestDispatcher.evalResponse
@SuppressWarnings("unchecked") protected <D> void evalResponse(Request request, Deferred<D> deferred, Class<D> resolveType, Class<?> parametrizedType, RawResponse response) { if (parametrizedType != null) { processor.process(request, response, parametrizedType, (Class<Collection>) resolveType, (Deferred<Collection>) deferred); } else { processor.process(request, response, resolveType, deferred); } }
java
@SuppressWarnings("unchecked") protected <D> void evalResponse(Request request, Deferred<D> deferred, Class<D> resolveType, Class<?> parametrizedType, RawResponse response) { if (parametrizedType != null) { processor.process(request, response, parametrizedType, (Class<Collection>) resolveType, (Deferred<Collection>) deferred); } else { processor.process(request, response, resolveType, deferred); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "D", ">", "void", "evalResponse", "(", "Request", "request", ",", "Deferred", "<", "D", ">", "deferred", ",", "Class", "<", "D", ">", "resolveType", ",", "Class", "<", "?", ">", "param...
Evaluates the response and resolves the deferred. This method must be called by implementations after the response is received. @param request Dispatched request @param deferred Promise to be resolved @param resolveType Class of the expected type in the promise @param parametrizedType Class of the parametrized type if the promise expects a collection @param response The response received from the request @param <D> Type of the deferred
[ "Evaluates", "the", "response", "and", "resolves", "the", "deferred", ".", "This", "method", "must", "be", "called", "by", "implementations", "after", "the", "response", "is", "received", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/RequestDispatcher.java#L109-L118
train
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/uri/UriBuilderImpl.java
UriBuilderImpl.assertNotNull
private void assertNotNull(Object value, String message) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException(message); } }
java
private void assertNotNull(Object value, String message) throws IllegalArgumentException { if (value == null) { throw new IllegalArgumentException(message); } }
[ "private", "void", "assertNotNull", "(", "Object", "value", ",", "String", "message", ")", "throws", "IllegalArgumentException", "{", "if", "(", "value", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the value is not null. @param value the value @param message the message to include with any exceptions @throws IllegalArgumentException if value is null
[ "Assert", "that", "the", "value", "is", "not", "null", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/uri/UriBuilderImpl.java#L317-L321
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java
ValidationDataIndexMap.getUrlList
public List<ReqUrl> getUrlList() { List<ReqUrl> reqUrls = new ArrayList<>(); for (String key : this.methodAndUrlIndex.getMap().keySet()) { List<ValidationData> datas = this.methodAndUrlIndex.getMap().get(key); if (!datas.isEmpty()) { reqUrls.add(new ReqUrl(datas.get(0).getMethod(), datas.get(0).getUrl())); } } return reqUrls; }
java
public List<ReqUrl> getUrlList() { List<ReqUrl> reqUrls = new ArrayList<>(); for (String key : this.methodAndUrlIndex.getMap().keySet()) { List<ValidationData> datas = this.methodAndUrlIndex.getMap().get(key); if (!datas.isEmpty()) { reqUrls.add(new ReqUrl(datas.get(0).getMethod(), datas.get(0).getUrl())); } } return reqUrls; }
[ "public", "List", "<", "ReqUrl", ">", "getUrlList", "(", ")", "{", "List", "<", "ReqUrl", ">", "reqUrls", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "key", ":", "this", ".", "methodAndUrlIndex", ".", "getMap", "(", ")", ".", ...
Gets url list. @return the url list
[ "Gets", "url", "list", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java#L29-L38
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java
ValidationDataIndexMap.findById
public ValidationData findById(Long id) { List<ValidationData> datas = this.idIndex.get(ValidationIndexUtil.makeKey(String.valueOf(id))); if (datas.isEmpty()) { return null; } return datas.get(0); }
java
public ValidationData findById(Long id) { List<ValidationData> datas = this.idIndex.get(ValidationIndexUtil.makeKey(String.valueOf(id))); if (datas.isEmpty()) { return null; } return datas.get(0); }
[ "public", "ValidationData", "findById", "(", "Long", "id", ")", "{", "List", "<", "ValidationData", ">", "datas", "=", "this", ".", "idIndex", ".", "get", "(", "ValidationIndexUtil", ".", "makeKey", "(", "String", ".", "valueOf", "(", "id", ")", ")", ")"...
Find by id validation data. @param id the id @return the validation data
[ "Find", "by", "id", "validation", "data", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java#L46-L52
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java
ValidationDataIndexMap.addIndex
public void addIndex(ValidationData data) { for (ValidationDataIndex idx : this.idxs) { ValidationIndexUtil.addIndexData(data, idx); } }
java
public void addIndex(ValidationData data) { for (ValidationDataIndex idx : this.idxs) { ValidationIndexUtil.addIndexData(data, idx); } }
[ "public", "void", "addIndex", "(", "ValidationData", "data", ")", "{", "for", "(", "ValidationDataIndex", "idx", ":", "this", ".", "idxs", ")", "{", "ValidationIndexUtil", ".", "addIndexData", "(", "data", ",", "idx", ")", ";", "}", "}" ]
Add index. @param data the data
[ "Add", "index", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java#L70-L74
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java
ValidationDataIndexMap.removeIndex
public void removeIndex(ValidationData data) { for (ValidationDataIndex idx : this.idxs) { ValidationIndexUtil.removeIndexData(data, idx); } }
java
public void removeIndex(ValidationData data) { for (ValidationDataIndex idx : this.idxs) { ValidationIndexUtil.removeIndexData(data, idx); } }
[ "public", "void", "removeIndex", "(", "ValidationData", "data", ")", "{", "for", "(", "ValidationDataIndex", "idx", ":", "this", ".", "idxs", ")", "{", "ValidationIndexUtil", ".", "removeIndexData", "(", "data", ",", "idx", ")", ";", "}", "}" ]
Remove index. @param data the data
[ "Remove", "index", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/repository/index/map/ValidationDataIndexMap.java#L81-L85
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/setting/service/MsgSettingServiceImpl.java
MsgSettingServiceImpl.updateFromFile
public void updateFromFile(MultipartFile file) { ObjectMapper objectMapper = ValidationObjUtil.getDefaultObjectMapper(); try { String jsonStr = new String(file.getBytes(), "UTF-8"); List<ValidationData> list = objectMapper.readValue(jsonStr, objectMapper.getTypeFactory().constructCollectionType(List.class, ValidationData.class)); List<ReqUrl> reqUrls = ValidationReqUrlUtil.getUrlListFromValidationDatas(list); reqUrls.forEach(reqUrl -> { this.deleteValidationData(reqUrl); }); Map<Long, Long> idsMap = new HashMap<>(); List<ValidationData> saveList = new ArrayList<>(); list.forEach(data -> { long oldId = data.getId(); data.setId(null); data = this.validationDataRepository.save(data); idsMap.put(oldId, data.getId()); saveList.add(data); }); saveList.forEach(data -> { if (data.getParentId() != null) { data.setParentId(idsMap.get(data.getParentId())); this.validationDataRepository.save(data); } }); } catch (IOException e) { log.info("file io exception : " + e.getMessage()); } }
java
public void updateFromFile(MultipartFile file) { ObjectMapper objectMapper = ValidationObjUtil.getDefaultObjectMapper(); try { String jsonStr = new String(file.getBytes(), "UTF-8"); List<ValidationData> list = objectMapper.readValue(jsonStr, objectMapper.getTypeFactory().constructCollectionType(List.class, ValidationData.class)); List<ReqUrl> reqUrls = ValidationReqUrlUtil.getUrlListFromValidationDatas(list); reqUrls.forEach(reqUrl -> { this.deleteValidationData(reqUrl); }); Map<Long, Long> idsMap = new HashMap<>(); List<ValidationData> saveList = new ArrayList<>(); list.forEach(data -> { long oldId = data.getId(); data.setId(null); data = this.validationDataRepository.save(data); idsMap.put(oldId, data.getId()); saveList.add(data); }); saveList.forEach(data -> { if (data.getParentId() != null) { data.setParentId(idsMap.get(data.getParentId())); this.validationDataRepository.save(data); } }); } catch (IOException e) { log.info("file io exception : " + e.getMessage()); } }
[ "public", "void", "updateFromFile", "(", "MultipartFile", "file", ")", "{", "ObjectMapper", "objectMapper", "=", "ValidationObjUtil", ".", "getDefaultObjectMapper", "(", ")", ";", "try", "{", "String", "jsonStr", "=", "new", "String", "(", "file", ".", "getBytes...
Update from file. @param file the file
[ "Update", "from", "file", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/setting/service/MsgSettingServiceImpl.java#L73-L104
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java
TypeCheckUtil.isNotScanClass
public static boolean isNotScanClass(String className) { String block = BASIC_PACKAGE_PREFIX_LIST.stream().filter(prefix -> className.startsWith(prefix)).findAny().orElse(null); return block != null; }
java
public static boolean isNotScanClass(String className) { String block = BASIC_PACKAGE_PREFIX_LIST.stream().filter(prefix -> className.startsWith(prefix)).findAny().orElse(null); return block != null; }
[ "public", "static", "boolean", "isNotScanClass", "(", "String", "className", ")", "{", "String", "block", "=", "BASIC_PACKAGE_PREFIX_LIST", ".", "stream", "(", ")", ".", "filter", "(", "prefix", "->", "className", ".", "startsWith", "(", "prefix", ")", ")", ...
Is not scan class boolean. @param className the class name @return the boolean
[ "Is", "not", "scan", "class", "boolean", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java#L70-L73
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java
TypeCheckUtil.isObjClass
public static boolean isObjClass(Class<?> type) { if (type.isPrimitive() || type.isEnum() || type.isArray()) { return false; } String block = BASIC_PACKAGE_PREFIX_LIST.stream().filter(prefix -> type.getName().startsWith(prefix)).findAny().orElse(null); if (block != null) { return false; } return !PRIMITIVE_CLASS_LIST.contains(type); }
java
public static boolean isObjClass(Class<?> type) { if (type.isPrimitive() || type.isEnum() || type.isArray()) { return false; } String block = BASIC_PACKAGE_PREFIX_LIST.stream().filter(prefix -> type.getName().startsWith(prefix)).findAny().orElse(null); if (block != null) { return false; } return !PRIMITIVE_CLASS_LIST.contains(type); }
[ "public", "static", "boolean", "isObjClass", "(", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "type", ".", "isPrimitive", "(", ")", "||", "type", ".", "isEnum", "(", ")", "||", "type", ".", "isArray", "(", ")", ")", "{", "return", "false",...
Is obj class boolean. @param type the type @return the boolean
[ "Is", "obj", "class", "boolean", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java#L81-L92
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java
TypeCheckUtil.isListClass
public static boolean isListClass(Class<?> type) { if (type.isPrimitive() || type.isEnum()) { return false; } return type.equals(List.class); }
java
public static boolean isListClass(Class<?> type) { if (type.isPrimitive() || type.isEnum()) { return false; } return type.equals(List.class); }
[ "public", "static", "boolean", "isListClass", "(", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "type", ".", "isPrimitive", "(", ")", "||", "type", ".", "isEnum", "(", ")", ")", "{", "return", "false", ";", "}", "return", "type", ".", "equa...
Is list class boolean. @param type the type @return the boolean
[ "Is", "list", "class", "boolean", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/TypeCheckUtil.java#L100-L105
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/AnnotationScanner.java
AnnotationScanner.initBeans
public void initBeans(Object[] beans) { this.controllers = Arrays.stream(beans).filter(bean -> this.getController(bean) != null).map(bean -> this.getController(bean)).collect(Collectors.toList()); }
java
public void initBeans(Object[] beans) { this.controllers = Arrays.stream(beans).filter(bean -> this.getController(bean) != null).map(bean -> this.getController(bean)).collect(Collectors.toList()); }
[ "public", "void", "initBeans", "(", "Object", "[", "]", "beans", ")", "{", "this", ".", "controllers", "=", "Arrays", ".", "stream", "(", "beans", ")", ".", "filter", "(", "bean", "->", "this", ".", "getController", "(", "bean", ")", "!=", "null", ")...
Init beans. @param beans the beans
[ "Init", "beans", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/AnnotationScanner.java#L44-L46
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/AnnotationScanner.java
AnnotationScanner.getParameterFromMethodWithAnnotation
public List<DetailParam> getParameterFromMethodWithAnnotation(Class<?> parentClass, Method method, Class<?> annotationClass) { List<DetailParam> params = new ArrayList<>(); if (method.getParameterCount() < 1) { return params; } for (Parameter param : method.getParameters()) { Annotation[] annotations = param.getAnnotations(); for (Annotation annotation : annotations) { if (annotation.annotationType().equals(annotationClass)) { params.add(new DetailParam(param.getType(), method, parentClass)); break; } } } return params; }
java
public List<DetailParam> getParameterFromMethodWithAnnotation(Class<?> parentClass, Method method, Class<?> annotationClass) { List<DetailParam> params = new ArrayList<>(); if (method.getParameterCount() < 1) { return params; } for (Parameter param : method.getParameters()) { Annotation[] annotations = param.getAnnotations(); for (Annotation annotation : annotations) { if (annotation.annotationType().equals(annotationClass)) { params.add(new DetailParam(param.getType(), method, parentClass)); break; } } } return params; }
[ "public", "List", "<", "DetailParam", ">", "getParameterFromMethodWithAnnotation", "(", "Class", "<", "?", ">", "parentClass", ",", "Method", "method", ",", "Class", "<", "?", ">", "annotationClass", ")", "{", "List", "<", "DetailParam", ">", "params", "=", ...
Gets parameter from method with annotation. @param parentClass the parent class @param method the method @param annotationClass the annotation class @return the parameter from method with annotation
[ "Gets", "parameter", "from", "method", "with", "annotation", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/AnnotationScanner.java#L56-L74
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/AnnotationScanner.java
AnnotationScanner.getParameterFromClassWithAnnotation
public List<DetailParam> getParameterFromClassWithAnnotation(Class<?> baseClass, Class<?> annotationClass) { List<DetailParam> params = new ArrayList<>(); Arrays.stream(baseClass.getDeclaredMethods()).forEach(method -> params.addAll(this.getParameterFromMethodWithAnnotation(baseClass, method, annotationClass))); return params; }
java
public List<DetailParam> getParameterFromClassWithAnnotation(Class<?> baseClass, Class<?> annotationClass) { List<DetailParam> params = new ArrayList<>(); Arrays.stream(baseClass.getDeclaredMethods()).forEach(method -> params.addAll(this.getParameterFromMethodWithAnnotation(baseClass, method, annotationClass))); return params; }
[ "public", "List", "<", "DetailParam", ">", "getParameterFromClassWithAnnotation", "(", "Class", "<", "?", ">", "baseClass", ",", "Class", "<", "?", ">", "annotationClass", ")", "{", "List", "<", "DetailParam", ">", "params", "=", "new", "ArrayList", "<>", "(...
Gets parameter from class with annotation. @param baseClass the base class @param annotationClass the annotation class @return the parameter from class with annotation
[ "Gets", "parameter", "from", "class", "with", "annotation", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/AnnotationScanner.java#L83-L87
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/AnnotationScanner.java
AnnotationScanner.getParameterWithAnnotation
public List<DetailParam> getParameterWithAnnotation(Class<?> annotation) { List<DetailParam> params = new ArrayList<>(); this.controllers.stream().forEach(cla -> params.addAll(this.getParameterFromClassWithAnnotation(cla, annotation))); return params; }
java
public List<DetailParam> getParameterWithAnnotation(Class<?> annotation) { List<DetailParam> params = new ArrayList<>(); this.controllers.stream().forEach(cla -> params.addAll(this.getParameterFromClassWithAnnotation(cla, annotation))); return params; }
[ "public", "List", "<", "DetailParam", ">", "getParameterWithAnnotation", "(", "Class", "<", "?", ">", "annotation", ")", "{", "List", "<", "DetailParam", ">", "params", "=", "new", "ArrayList", "<>", "(", ")", ";", "this", ".", "controllers", ".", "stream"...
Gets parameter with annotation. @param annotation the annotation @return the parameter with annotation
[ "Gets", "parameter", "with", "annotation", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/AnnotationScanner.java#L95-L100
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.nextRow
public Row nextRow(int cnt) { Row lastrow = null; for (int i = 0; i < cnt; i++) { lastrow = this.nextRow(); } return lastrow; }
java
public Row nextRow(int cnt) { Row lastrow = null; for (int i = 0; i < cnt; i++) { lastrow = this.nextRow(); } return lastrow; }
[ "public", "Row", "nextRow", "(", "int", "cnt", ")", "{", "Row", "lastrow", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "lastrow", "=", "this", ".", "nextRow", "(", ")", ";", "}", "return...
Next row row. @param cnt the cnt @return the row
[ "Next", "row", "row", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L50-L56
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createTitleCells
public List<Cell> createTitleCells(String... strs) { List<Cell> cells = new ArrayList<>(); for (String s : strs) { Cell cell = this.createTitleCell(s, DEFAULT_WIDTH); cells.add(cell); } return cells; }
java
public List<Cell> createTitleCells(String... strs) { List<Cell> cells = new ArrayList<>(); for (String s : strs) { Cell cell = this.createTitleCell(s, DEFAULT_WIDTH); cells.add(cell); } return cells; }
[ "public", "List", "<", "Cell", ">", "createTitleCells", "(", "String", "...", "strs", ")", "{", "List", "<", "Cell", ">", "cells", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "s", ":", "strs", ")", "{", "Cell", "cell", "=", ...
Create title cells list. @param strs the strs @return the list
[ "Create", "title", "cells", "list", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L105-L113
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createTitleCells
public void createTitleCells(double width, String... strs) { for (String s : strs) { this.createTitleCell(s, width); } }
java
public void createTitleCells(double width, String... strs) { for (String s : strs) { this.createTitleCell(s, width); } }
[ "public", "void", "createTitleCells", "(", "double", "width", ",", "String", "...", "strs", ")", "{", "for", "(", "String", "s", ":", "strs", ")", "{", "this", ".", "createTitleCell", "(", "s", ",", "width", ")", ";", "}", "}" ]
Create title cells. @param width the width @param strs the strs
[ "Create", "title", "cells", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L121-L125
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createTitleCell
public Cell createTitleCell(String str, double width) { int cellCnt = this.getCellCnt(); Cell cell = this.getLastRow().createCell(cellCnt); cell.setCellValue(str); cell.setCellType(CellType.STRING); cell.setCellStyle(this.style.getStringCs()); sheet.setColumnWidth(cellCnt, (int) (sheet.getColumnWidth(cellCnt) * width)); return cell; }
java
public Cell createTitleCell(String str, double width) { int cellCnt = this.getCellCnt(); Cell cell = this.getLastRow().createCell(cellCnt); cell.setCellValue(str); cell.setCellType(CellType.STRING); cell.setCellStyle(this.style.getStringCs()); sheet.setColumnWidth(cellCnt, (int) (sheet.getColumnWidth(cellCnt) * width)); return cell; }
[ "public", "Cell", "createTitleCell", "(", "String", "str", ",", "double", "width", ")", "{", "int", "cellCnt", "=", "this", ".", "getCellCnt", "(", ")", ";", "Cell", "cell", "=", "this", ".", "getLastRow", "(", ")", ".", "createCell", "(", "cellCnt", "...
Create title cell cell. @param str the str @param width the width @return the cell
[ "Create", "title", "cell", "cell", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L134-L146
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createValueCells
public void createValueCells(Object... values) { for (Object value : values) { if (value == null) { this.createCell(""); continue; } if (value instanceof String) { this.createCell((String) value); } else if (value instanceof Date) { this.createCell((Date) value); } else if (ValidationObjUtil.isIntType(value.getClass())) { long longValue = Long.valueOf(value + ""); this.createCell(longValue); } else if (ValidationObjUtil.isDoubleType(value.getClass())) { double doubleValue = Double.valueOf(value + ""); this.createCell(doubleValue); } else { this.createCell(value); } } }
java
public void createValueCells(Object... values) { for (Object value : values) { if (value == null) { this.createCell(""); continue; } if (value instanceof String) { this.createCell((String) value); } else if (value instanceof Date) { this.createCell((Date) value); } else if (ValidationObjUtil.isIntType(value.getClass())) { long longValue = Long.valueOf(value + ""); this.createCell(longValue); } else if (ValidationObjUtil.isDoubleType(value.getClass())) { double doubleValue = Double.valueOf(value + ""); this.createCell(doubleValue); } else { this.createCell(value); } } }
[ "public", "void", "createValueCells", "(", "Object", "...", "values", ")", "{", "for", "(", "Object", "value", ":", "values", ")", "{", "if", "(", "value", "==", "null", ")", "{", "this", ".", "createCell", "(", "\"\"", ")", ";", "continue", ";", "}"...
Create value cells. @param values the values
[ "Create", "value", "cells", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L154-L175
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/util/SurveyorUncaughtExceptionHandler.java
SurveyorUncaughtExceptionHandler.printStackTrace
private String printStackTrace(Object[] stackTrace) { StringBuilder output = new StringBuilder(); for (Object line : stackTrace) { output.append(line); output.append(newline); } return output.toString(); }
java
private String printStackTrace(Object[] stackTrace) { StringBuilder output = new StringBuilder(); for (Object line : stackTrace) { output.append(line); output.append(newline); } return output.toString(); }
[ "private", "String", "printStackTrace", "(", "Object", "[", "]", "stackTrace", ")", "{", "StringBuilder", "output", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Object", "line", ":", "stackTrace", ")", "{", "output", ".", "append", "(", "line",...
Given a stack trace, turn it into a HTML formatted string - to improve its display @param stackTrace - stack trace to convert to string @return String with stack trace formatted with HTML line breaks
[ "Given", "a", "stack", "trace", "turn", "it", "into", "a", "HTML", "formatted", "string", "-", "to", "improve", "its", "display" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/util/SurveyorUncaughtExceptionHandler.java#L110-L117
train
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/IndexedSet.java
IndexedSet.universe
public IndexedSet<T> universe() { IntSet allItems = indices.empty(); allItems.fill(0, indexToItem.length - 1); return createFromIndices(allItems); }
java
public IndexedSet<T> universe() { IntSet allItems = indices.empty(); allItems.fill(0, indexToItem.length - 1); return createFromIndices(allItems); }
[ "public", "IndexedSet", "<", "T", ">", "universe", "(", ")", "{", "IntSet", "allItems", "=", "indices", ".", "empty", "(", ")", ";", "allItems", ".", "fill", "(", "0", ",", "indexToItem", ".", "length", "-", "1", ")", ";", "return", "createFromIndices"...
Returns the collection of all possible elements @return the collection of all possible elements
[ "Returns", "the", "collection", "of", "all", "possible", "elements" ]
0f77c28057fac9c1bd6d79fbe5425b8efe5742a8
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/IndexedSet.java#L452-L456
train
reinert/requestor
requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/Auth.java
Auth.expiringSoon
boolean expiringSoon(TokenInfo info) { // TODO(jasonhall): Consider varying the definition of "soon" based on the // original expires_in value (e.g., "soon" = 1/10th of the total time before // it's expired). return Double.valueOf(info.getExpires()) < (clock.now() + TEN_MINUTES); }
java
boolean expiringSoon(TokenInfo info) { // TODO(jasonhall): Consider varying the definition of "soon" based on the // original expires_in value (e.g., "soon" = 1/10th of the total time before // it's expired). return Double.valueOf(info.getExpires()) < (clock.now() + TEN_MINUTES); }
[ "boolean", "expiringSoon", "(", "TokenInfo", "info", ")", "{", "// TODO(jasonhall): Consider varying the definition of \"soon\" based on the", "// original expires_in value (e.g., \"soon\" = 1/10th of the total time before", "// it's expired).", "return", "Double", ".", "valueOf", "(", ...
Returns whether or not the token will be expiring within the next ten minutes.
[ "Returns", "whether", "or", "not", "the", "token", "will", "be", "expiring", "within", "the", "next", "ten", "minutes", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/Auth.java#L101-L106
train
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java
DataBulkRequest.insertBefore
public DataBulkRequest insertBefore(CRUDRequest request, CRUDRequest before) { this.requests.add(requests.indexOf(before), request); return this; }
java
public DataBulkRequest insertBefore(CRUDRequest request, CRUDRequest before) { this.requests.add(requests.indexOf(before), request); return this; }
[ "public", "DataBulkRequest", "insertBefore", "(", "CRUDRequest", "request", ",", "CRUDRequest", "before", ")", "{", "this", ".", "requests", ".", "add", "(", "requests", ".", "indexOf", "(", "before", ")", ",", "request", ")", ";", "return", "this", ";", "...
Inserts a request before another specified request. This guarantees that the first request parameter will be executed, sequentially, before the second request parameter. It does not guarantee consecutive execution. @param request @param before @return
[ "Inserts", "a", "request", "before", "another", "specified", "request", ".", "This", "guarantees", "that", "the", "first", "request", "parameter", "will", "be", "executed", "sequentially", "before", "the", "second", "request", "parameter", ".", "It", "does", "no...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java#L85-L88
train
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java
DataBulkRequest.insertAfter
public DataBulkRequest insertAfter(CRUDRequest request, CRUDRequest after) { this.requests.add(requests.indexOf(after) + 1, request); return this; }
java
public DataBulkRequest insertAfter(CRUDRequest request, CRUDRequest after) { this.requests.add(requests.indexOf(after) + 1, request); return this; }
[ "public", "DataBulkRequest", "insertAfter", "(", "CRUDRequest", "request", ",", "CRUDRequest", "after", ")", "{", "this", ".", "requests", ".", "add", "(", "requests", ".", "indexOf", "(", "after", ")", "+", "1", ",", "request", ")", ";", "return", "this",...
Inserts a request after another specified request. This guarantees that the first request parameter will be executed, sequentially, after the second request parameter. It does not guarantee consecutive execution. @param request @param after @return
[ "Inserts", "a", "request", "after", "another", "specified", "request", ".", "This", "guarantees", "that", "the", "first", "request", "parameter", "will", "be", "executed", "sequentially", "after", "the", "second", "request", "parameter", ".", "It", "does", "not"...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/request/DataBulkRequest.java#L99-L102
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.readFileToString
public static String readFileToString(File file, final Charset charset) throws IOException { String line = null; BufferedReader reader = getBufferReader(file, charset); StringBuffer strBuffer = new StringBuffer(); while ((line = reader.readLine()) != null) { strBuffer.append(line); } return strBuffer.toString(); }
java
public static String readFileToString(File file, final Charset charset) throws IOException { String line = null; BufferedReader reader = getBufferReader(file, charset); StringBuffer strBuffer = new StringBuffer(); while ((line = reader.readLine()) != null) { strBuffer.append(line); } return strBuffer.toString(); }
[ "public", "static", "String", "readFileToString", "(", "File", "file", ",", "final", "Charset", "charset", ")", "throws", "IOException", "{", "String", "line", "=", "null", ";", "BufferedReader", "reader", "=", "getBufferReader", "(", "file", ",", "charset", "...
Read file to string string. @param file the file @param charset the charset @return the string @throws IOException the io exception
[ "Read", "file", "to", "string", "string", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L37-L46
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.writeStringToFile
public static void writeStringToFile(File file, String content) throws IOException { OutputStream outputStream = getOutputStream(file); outputStream.write(content.getBytes()); }
java
public static void writeStringToFile(File file, String content) throws IOException { OutputStream outputStream = getOutputStream(file); outputStream.write(content.getBytes()); }
[ "public", "static", "void", "writeStringToFile", "(", "File", "file", ",", "String", "content", ")", "throws", "IOException", "{", "OutputStream", "outputStream", "=", "getOutputStream", "(", "file", ")", ";", "outputStream", ".", "write", "(", "content", ".", ...
Write string to file. @param file the file @param content the content @throws IOException the io exception
[ "Write", "string", "to", "file", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L63-L66
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.getEncodingFileName
public static String getEncodingFileName(String fn) { try { return URLEncoder.encode(fn, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new ValidationLibException("unSupported fiel encoding : " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
java
public static String getEncodingFileName(String fn) { try { return URLEncoder.encode(fn, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new ValidationLibException("unSupported fiel encoding : " + e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
[ "public", "static", "String", "getEncodingFileName", "(", "String", "fn", ")", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "fn", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", ...
Gets encoding file name. @param fn the fn @return the encoding file name
[ "Gets", "encoding", "file", "name", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L74-L80
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationFileUtil.java
ValidationFileUtil.initFileSendHeader
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
java
public static void initFileSendHeader(HttpServletResponse res, String filename, String contentType) { filename = getEncodingFileName(filename); if (contentType != null) { res.setContentType(contentType); } else { res.setContentType("applicaiton/download;charset=utf-8"); } res.setHeader("Content-Disposition", "attachment; filename=\"" + filename + "\";"); res.setHeader("Content-Transfer-Encoding", "binary"); res.setHeader("file-name", filename); }
[ "public", "static", "void", "initFileSendHeader", "(", "HttpServletResponse", "res", ",", "String", "filename", ",", "String", "contentType", ")", "{", "filename", "=", "getEncodingFileName", "(", "filename", ")", ";", "if", "(", "contentType", "!=", "null", ")"...
Init file send header. @param res the res @param filename the filename @param contentType the content type
[ "Init", "file", "send", "header", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationFileUtil.java#L89-L101
train
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/model/DataError.java
DataError.fromJson
public static DataError fromJson(ObjectNode node) { DataError error = new DataError(); JsonNode x = node.get("data"); if (x != null) { error.entityData = x; } x = node.get("errors"); if (x instanceof ArrayNode) { error.errors = new ArrayList<>(); for (Iterator<JsonNode> itr = ((ArrayNode) x).elements(); itr.hasNext();) { error.errors.add(Error.fromJson(itr.next())); } } return error; }
java
public static DataError fromJson(ObjectNode node) { DataError error = new DataError(); JsonNode x = node.get("data"); if (x != null) { error.entityData = x; } x = node.get("errors"); if (x instanceof ArrayNode) { error.errors = new ArrayList<>(); for (Iterator<JsonNode> itr = ((ArrayNode) x).elements(); itr.hasNext();) { error.errors.add(Error.fromJson(itr.next())); } } return error; }
[ "public", "static", "DataError", "fromJson", "(", "ObjectNode", "node", ")", "{", "DataError", "error", "=", "new", "DataError", "(", ")", ";", "JsonNode", "x", "=", "node", ".", "get", "(", "\"data\"", ")", ";", "if", "(", "x", "!=", "null", ")", "{...
Parses a Json object node and returns the DataError corresponding to it. It is up to the client to make sure that the object node is a DataError representation. Any unrecognized elements are ignored.
[ "Parses", "a", "Json", "object", "node", "and", "returns", "the", "DataError", "corresponding", "to", "it", ".", "It", "is", "up", "to", "the", "client", "to", "make", "sure", "that", "the", "object", "node", "is", "a", "DataError", "representation", ".", ...
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/model/DataError.java#L72-L87
train
lightblue-platform/lightblue-client
core/src/main/java/com/redhat/lightblue/client/model/DataError.java
DataError.findErrorForDoc
public static DataError findErrorForDoc(List<DataError> list, JsonNode node) { for (DataError x : list) { if (x.entityData == node) { return x; } } return null; }
java
public static DataError findErrorForDoc(List<DataError> list, JsonNode node) { for (DataError x : list) { if (x.entityData == node) { return x; } } return null; }
[ "public", "static", "DataError", "findErrorForDoc", "(", "List", "<", "DataError", ">", "list", ",", "JsonNode", "node", ")", "{", "for", "(", "DataError", "x", ":", "list", ")", "{", "if", "(", "x", ".", "entityData", "==", "node", ")", "{", "return",...
Returns the data error for the given json doc in the list
[ "Returns", "the", "data", "error", "for", "the", "given", "json", "doc", "in", "the", "list" ]
03790aff34e90d3889f60fd6c603c21a21dc1a40
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/core/src/main/java/com/redhat/lightblue/client/model/DataError.java#L92-L99
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/map/MapViewComposite.java
MapViewComposite.setMarkers
public void setMarkers(QueryResult queryResult){ mapWidget.clearMarkers(); RecordList recordList = queryResult.getRecordList(); List<RecordList.Record> records = recordList.getRecords(); List<GenericMarker> markers = new ArrayList<GenericMarker>(); final MarkerCoordinateSource markerCoordinateSource1 = getMarkerCoordinateSource(); final MarkerDisplayFilter markerFilter = getMarkerDisplayFilter(); markerFilter.init(); for (final RecordList.Record record : records) { MapMarkerBuilder markerBuilder = new MapMarkerBuilder(); final MarkerCoordinateSource.LatitudeLongitude latitudeLongitude = markerCoordinateSource1.process(record); double lat = latitudeLongitude.getLatitude(); double lon = latitudeLongitude.getLongitude(); if(markerFilter.filter(record)){ GenericMarker<RecordList.Record> marker = markerBuilder.setMarkerLat(lat).setMarkerLon(lon).setMarkerIconPathBuilder(getMarkerIconPathBuilder()).createMarker(record, mapWidget); marker.setupMarkerHoverLabel(getMarkerHoverLabelBuilder()); marker.setupMarkerClickInfoWindow(getMarkerClickInfoWindow()); marker.addClickHandler(new GenericMarker.MarkerCallBackEventHandler<GenericMarker>() { @Override public void run(GenericMarker sourceElement) { clientFactory.getEventBus().fireEvent(new MarkerClickEvent(record)); } }); markers.add(marker); } } mapWidget.setMarkers(markers); }
java
public void setMarkers(QueryResult queryResult){ mapWidget.clearMarkers(); RecordList recordList = queryResult.getRecordList(); List<RecordList.Record> records = recordList.getRecords(); List<GenericMarker> markers = new ArrayList<GenericMarker>(); final MarkerCoordinateSource markerCoordinateSource1 = getMarkerCoordinateSource(); final MarkerDisplayFilter markerFilter = getMarkerDisplayFilter(); markerFilter.init(); for (final RecordList.Record record : records) { MapMarkerBuilder markerBuilder = new MapMarkerBuilder(); final MarkerCoordinateSource.LatitudeLongitude latitudeLongitude = markerCoordinateSource1.process(record); double lat = latitudeLongitude.getLatitude(); double lon = latitudeLongitude.getLongitude(); if(markerFilter.filter(record)){ GenericMarker<RecordList.Record> marker = markerBuilder.setMarkerLat(lat).setMarkerLon(lon).setMarkerIconPathBuilder(getMarkerIconPathBuilder()).createMarker(record, mapWidget); marker.setupMarkerHoverLabel(getMarkerHoverLabelBuilder()); marker.setupMarkerClickInfoWindow(getMarkerClickInfoWindow()); marker.addClickHandler(new GenericMarker.MarkerCallBackEventHandler<GenericMarker>() { @Override public void run(GenericMarker sourceElement) { clientFactory.getEventBus().fireEvent(new MarkerClickEvent(record)); } }); markers.add(marker); } } mapWidget.setMarkers(markers); }
[ "public", "void", "setMarkers", "(", "QueryResult", "queryResult", ")", "{", "mapWidget", ".", "clearMarkers", "(", ")", ";", "RecordList", "recordList", "=", "queryResult", ".", "getRecordList", "(", ")", ";", "List", "<", "RecordList", ".", "Record", ">", ...
Contain logic for getting records, building marker from results Called on start and when filters are changed @param queryResult records from query
[ "Contain", "logic", "for", "getting", "records", "building", "marker", "from", "results", "Called", "on", "start", "and", "when", "filters", "are", "changed" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/map/MapViewComposite.java#L144-L173
train
reinert/requestor
requestor/core/requestor-api/src/main/java/io/reinert/requestor/WebTarget.java
WebTarget.getUri
public Uri getUri() { if (uri == null) { try { uri = uriBuilder.build(); } catch (Exception e) { throw new IllegalStateException("Could not build the URI.", e); } } return uri; }
java
public Uri getUri() { if (uri == null) { try { uri = uriBuilder.build(); } catch (Exception e) { throw new IllegalStateException("Could not build the URI.", e); } } return uri; }
[ "public", "Uri", "getUri", "(", ")", "{", "if", "(", "uri", "==", "null", ")", "{", "try", "{", "uri", "=", "uriBuilder", ".", "build", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"C...
Get the URI identifying the resource. @return the resource URI. @throws IllegalStateException if the URI could not be built from the current state of the resource target.
[ "Get", "the", "URI", "identifying", "the", "resource", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/core/requestor-api/src/main/java/io/reinert/requestor/WebTarget.java#L112-L121
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/GoogleV3Marker.java
GoogleV3Marker.setupMarkerFixedNoRepeatHack
private <T> void setupMarkerFixedNoRepeatHack(GoogleV3Marker<T> genericMarker) { final Marker marker1 = genericMarker.getMarker(); final LatLng[] initialPosition = new LatLng[1]; marker1.addDragStartHandler(new DragStartMapHandler() { @Override public void onEvent(DragStartMapEvent dragStartMapEvent) { initialPosition[0] = marker1.getPosition(); } }); marker1.addDragEndHandler(new DragEndMapHandler() { @Override public void onEvent(DragEndMapEvent dragEndMapEvent) { marker1.setPosition(initialPosition[0]); } }); }
java
private <T> void setupMarkerFixedNoRepeatHack(GoogleV3Marker<T> genericMarker) { final Marker marker1 = genericMarker.getMarker(); final LatLng[] initialPosition = new LatLng[1]; marker1.addDragStartHandler(new DragStartMapHandler() { @Override public void onEvent(DragStartMapEvent dragStartMapEvent) { initialPosition[0] = marker1.getPosition(); } }); marker1.addDragEndHandler(new DragEndMapHandler() { @Override public void onEvent(DragEndMapEvent dragEndMapEvent) { marker1.setPosition(initialPosition[0]); } }); }
[ "private", "<", "T", ">", "void", "setupMarkerFixedNoRepeatHack", "(", "GoogleV3Marker", "<", "T", ">", "genericMarker", ")", "{", "final", "Marker", "marker1", "=", "genericMarker", ".", "getMarker", "(", ")", ";", "final", "LatLng", "[", "]", "initialPositio...
Prevent marker from repeating horizontally by setting marker drag and adjusting drag behaviour to reset @param genericMarker @param <T>
[ "Prevent", "marker", "from", "repeating", "horizontally", "by", "setting", "marker", "drag", "and", "adjusting", "drag", "behaviour", "to", "reset" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/GoogleV3Marker.java#L545-L561
train
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java
SortedCellTable.setComparator
public void setComparator(Column<T, ?> column, Comparator<T> comparator) { columnSortHandler.setComparator(column, comparator); }
java
public void setComparator(Column<T, ?> column, Comparator<T> comparator) { columnSortHandler.setComparator(column, comparator); }
[ "public", "void", "setComparator", "(", "Column", "<", "T", ",", "?", ">", "column", ",", "Comparator", "<", "T", ">", "comparator", ")", "{", "columnSortHandler", ".", "setComparator", "(", "column", ",", "comparator", ")", ";", "}" ]
Sets a comparator to use when sorting the given column @param column @param comparator
[ "Sets", "a", "comparator", "to", "use", "when", "sorting", "the", "given", "column" ]
224280bcd6e8045bda6b673584caf0aea5e4c841
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/core/SortedCellTable.java#L174-L176
train
reinert/requestor
requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/AuthRequest.java
AuthRequest.toUrl
String toUrl(Auth.UrlCodex urlCodex) { return new StringBuilder(authUrl) .append(authUrl.contains("?") ? "&" : "?") .append("client_id").append("=").append(urlCodex.encode(clientId)) .append("&").append("response_type").append("=").append("token") .append("&").append("scope").append("=").append(scopesToString(urlCodex)) .toString(); }
java
String toUrl(Auth.UrlCodex urlCodex) { return new StringBuilder(authUrl) .append(authUrl.contains("?") ? "&" : "?") .append("client_id").append("=").append(urlCodex.encode(clientId)) .append("&").append("response_type").append("=").append("token") .append("&").append("scope").append("=").append(scopesToString(urlCodex)) .toString(); }
[ "String", "toUrl", "(", "Auth", ".", "UrlCodex", "urlCodex", ")", "{", "return", "new", "StringBuilder", "(", "authUrl", ")", ".", "append", "(", "authUrl", ".", "contains", "(", "\"?\"", ")", "?", "\"&\"", ":", "\"?\"", ")", ".", "append", "(", "\"cli...
Returns a URL representation of this request, appending the client ID and scopes to the original authUrl.
[ "Returns", "a", "URL", "representation", "of", "this", "request", "appending", "the", "client", "ID", "and", "scopes", "to", "the", "original", "authUrl", "." ]
40163a75cd17815d5089935d0dd97b8d652ad6d4
https://github.com/reinert/requestor/blob/40163a75cd17815d5089935d0dd97b8d652ad6d4/requestor/ext/requestor-oauth2/src/main/java/io/reinert/requestor/oauth2/AuthRequest.java#L61-L68
train
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/core/component/ComponentMap.java
ComponentMap.get
public synchronized static <T> T get(Class<T> cType) { if( map.get(cType) != null){ return cType.cast(map.get(cType)); } try { Object obj = cType.newInstance(); log.debug("[CREATE INSTANCE] : " + cType.getSimpleName()); map.put(cType, obj); return cType.cast(obj); } catch (InstantiationException | IllegalAccessException e) { log.debug(e.getMessage()); } return null; }
java
public synchronized static <T> T get(Class<T> cType) { if( map.get(cType) != null){ return cType.cast(map.get(cType)); } try { Object obj = cType.newInstance(); log.debug("[CREATE INSTANCE] : " + cType.getSimpleName()); map.put(cType, obj); return cType.cast(obj); } catch (InstantiationException | IllegalAccessException e) { log.debug(e.getMessage()); } return null; }
[ "public", "synchronized", "static", "<", "T", ">", "T", "get", "(", "Class", "<", "T", ">", "cType", ")", "{", "if", "(", "map", ".", "get", "(", "cType", ")", "!=", "null", ")", "{", "return", "cType", ".", "cast", "(", "map", ".", "get", "(",...
Get t. @param <T> the type parameter @param cType the c type @return the t
[ "Get", "t", "." ]
2c2b1a87a88485d49ea6afa34acdf16ef4134f19
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/core/component/ComponentMap.java#L23-L38
train
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/VfsStringWriter.java
VfsStringWriter.openWrite
public WriteStreamOld openWrite() { if (_cb != null) _cb.clear(); else _cb = CharBuffer.allocate(); if (_ws == null) _ws = new WriteStreamOld(this); else _ws.init(this); try { _ws.setEncoding("utf-8"); } catch (UnsupportedEncodingException e) { } return _ws; }
java
public WriteStreamOld openWrite() { if (_cb != null) _cb.clear(); else _cb = CharBuffer.allocate(); if (_ws == null) _ws = new WriteStreamOld(this); else _ws.init(this); try { _ws.setEncoding("utf-8"); } catch (UnsupportedEncodingException e) { } return _ws; }
[ "public", "WriteStreamOld", "openWrite", "(", ")", "{", "if", "(", "_cb", "!=", "null", ")", "_cb", ".", "clear", "(", ")", ";", "else", "_cb", "=", "CharBuffer", ".", "allocate", "(", ")", ";", "if", "(", "_ws", "==", "null", ")", "_ws", "=", "n...
Opens a write stream using this StringWriter as the resulting string
[ "Opens", "a", "write", "stream", "using", "this", "StringWriter", "as", "the", "resulting", "string" ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsStringWriter.java#L55-L73
train
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/VfsStringWriter.java
VfsStringWriter.write
@Override public void write(byte []buf, int offset, int length, boolean isEnd) throws IOException { int end = offset + length; while (offset < end) { int ch1 = buf[offset++] & 0xff; if (ch1 < 0x80) _cb.append((char) ch1); else if ((ch1 & 0xe0) == 0xc0) { if (offset >= end) throw new EOFException("unexpected end of file in utf8 character"); int ch2 = buf[offset++] & 0xff; if ((ch2 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); _cb.append((char) (((ch1 & 0x1f) << 6) + (ch2 & 0x3f))); } else if ((ch1 & 0xf0) == 0xe0) { if (offset + 1 >= end) throw new EOFException("unexpected end of file in utf8 character"); int ch2 = buf[offset++] & 0xff; int ch3 = buf[offset++] & 0xff; if ((ch2 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); if ((ch3 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); _cb.append((char) (((ch1 & 0x1f) << 12) + ((ch2 & 0x3f) << 6) + (ch3 & 0x3f))); } else throw new CharConversionException("illegal utf8 encoding at (" + (int) ch1 + ")"); } }
java
@Override public void write(byte []buf, int offset, int length, boolean isEnd) throws IOException { int end = offset + length; while (offset < end) { int ch1 = buf[offset++] & 0xff; if (ch1 < 0x80) _cb.append((char) ch1); else if ((ch1 & 0xe0) == 0xc0) { if (offset >= end) throw new EOFException("unexpected end of file in utf8 character"); int ch2 = buf[offset++] & 0xff; if ((ch2 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); _cb.append((char) (((ch1 & 0x1f) << 6) + (ch2 & 0x3f))); } else if ((ch1 & 0xf0) == 0xe0) { if (offset + 1 >= end) throw new EOFException("unexpected end of file in utf8 character"); int ch2 = buf[offset++] & 0xff; int ch3 = buf[offset++] & 0xff; if ((ch2 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); if ((ch3 & 0xc0) != 0x80) throw new CharConversionException("illegal utf8 encoding"); _cb.append((char) (((ch1 & 0x1f) << 12) + ((ch2 & 0x3f) << 6) + (ch3 & 0x3f))); } else throw new CharConversionException("illegal utf8 encoding at (" + (int) ch1 + ")"); } }
[ "@", "Override", "public", "void", "write", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ",", "boolean", "isEnd", ")", "throws", "IOException", "{", "int", "end", "=", "offset", "+", "length", ";", "while", "(", "offset", ...
Writes a utf-8 encoded buffer to the underlying string. @param buf byte buffer containing the bytes @param offset offset where to start writing @param length number of bytes to write @param isEnd true when the write is flushing a close.
[ "Writes", "a", "utf", "-", "8", "encoded", "buffer", "to", "the", "underlying", "string", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/VfsStringWriter.java#L105-L144
train
SeaCloudsEU/SeaCloudsPlatform
deployer/src/main/java/eu/seaclouds/policy/SeaCloudsManagementPolicy.java
SeaCloudsManagementPolicy.extractMetricNames
public List<String> extractMetricNames() { List<String> result = new ArrayList<>(); for (MonitoringRule rule : monitoringRules.getMonitoringRules()) { for (Action action : rule.getActions().getActions()) { if (action.getName().equalsIgnoreCase("OutputMetric")) { for (Parameter parameter : action.getParameters()) { if (parameter.getName().equalsIgnoreCase("metric")) { result.add(parameter.getValue()); } } } } } return result; }
java
public List<String> extractMetricNames() { List<String> result = new ArrayList<>(); for (MonitoringRule rule : monitoringRules.getMonitoringRules()) { for (Action action : rule.getActions().getActions()) { if (action.getName().equalsIgnoreCase("OutputMetric")) { for (Parameter parameter : action.getParameters()) { if (parameter.getName().equalsIgnoreCase("metric")) { result.add(parameter.getValue()); } } } } } return result; }
[ "public", "List", "<", "String", ">", "extractMetricNames", "(", ")", "{", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "MonitoringRule", "rule", ":", "monitoringRules", ".", "getMonitoringRules", "(", ")"...
Helper method to extract metric names from Monitoring Rules
[ "Helper", "method", "to", "extract", "metric", "names", "from", "Monitoring", "Rules" ]
b199fe6de2c63b808cb248d3aca947d802375df8
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/deployer/src/main/java/eu/seaclouds/policy/SeaCloudsManagementPolicy.java#L153-L168
train
baratine/baratine
framework/src/main/java/com/caucho/v5/util/Html.java
Html.escapeHtml
public static String escapeHtml(String s) { if (s == null) return null; StringBuilder cb = new StringBuilder(); int lineCharacter = 0; boolean startsWithSpace = false; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); lineCharacter++; if (ch == '<') cb.append("&lt;"); else if (ch == '&') cb.append("&amp;"); else if (ch == '\n' || ch == '\r') { lineCharacter = 0; cb.append(ch); startsWithSpace = false; } else if (lineCharacter > 70 && ch == ' ' && ! startsWithSpace) { lineCharacter = 0; cb.append('\n'); for (; i + 1 < s.length() && s.charAt(i + 1) == ' '; i++) { } } else if (lineCharacter == 1 && (ch == ' ' || ch == '\t')) { cb.append((char) ch); startsWithSpace = true; } else cb.append(ch); } return cb.toString(); }
java
public static String escapeHtml(String s) { if (s == null) return null; StringBuilder cb = new StringBuilder(); int lineCharacter = 0; boolean startsWithSpace = false; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); lineCharacter++; if (ch == '<') cb.append("&lt;"); else if (ch == '&') cb.append("&amp;"); else if (ch == '\n' || ch == '\r') { lineCharacter = 0; cb.append(ch); startsWithSpace = false; } else if (lineCharacter > 70 && ch == ' ' && ! startsWithSpace) { lineCharacter = 0; cb.append('\n'); for (; i + 1 < s.length() && s.charAt(i + 1) == ' '; i++) { } } else if (lineCharacter == 1 && (ch == ' ' || ch == '\t')) { cb.append((char) ch); startsWithSpace = true; } else cb.append(ch); } return cb.toString(); }
[ "public", "static", "String", "escapeHtml", "(", "String", "s", ")", "{", "if", "(", "s", "==", "null", ")", "return", "null", ";", "StringBuilder", "cb", "=", "new", "StringBuilder", "(", ")", ";", "int", "lineCharacter", "=", "0", ";", "boolean", "st...
Escapes special symbols in a string. For example '<' becomes '&lt;'
[ "Escapes", "special", "symbols", "in", "a", "string", ".", "For", "example", "<", "becomes", "&lt", ";" ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/util/Html.java#L40-L78
train
Dissem/Jabit
core/src/main/java/ch/dissem/bitmessage/utils/Bytes.java
Bytes.inc
public static void inc(byte[] nonce, byte value) { int i = nonce.length - 1; nonce[i] += value; if (value > 0 && (nonce[i] < 0 || nonce[i] >= value)) return; if (value < 0 && (nonce[i] < 0 && nonce[i] >= value)) return; for (i = i - 1; i >= 0; i--) { nonce[i]++; if (nonce[i] != 0) break; } }
java
public static void inc(byte[] nonce, byte value) { int i = nonce.length - 1; nonce[i] += value; if (value > 0 && (nonce[i] < 0 || nonce[i] >= value)) return; if (value < 0 && (nonce[i] < 0 && nonce[i] >= value)) return; for (i = i - 1; i >= 0; i--) { nonce[i]++; if (nonce[i] != 0) break; } }
[ "public", "static", "void", "inc", "(", "byte", "[", "]", "nonce", ",", "byte", "value", ")", "{", "int", "i", "=", "nonce", ".", "length", "-", "1", ";", "nonce", "[", "i", "]", "+=", "value", ";", "if", "(", "value", ">", "0", "&&", "(", "n...
Increases nonce by value, which is used as an unsigned byte value. @param nonce an unsigned number @param value to be added to nonce
[ "Increases", "nonce", "by", "value", "which", "is", "used", "as", "an", "unsigned", "byte", "value", "." ]
64ee41aee81c537aa27818e93e6afcd2ca1b7844
https://github.com/Dissem/Jabit/blob/64ee41aee81c537aa27818e93e6afcd2ca1b7844/core/src/main/java/ch/dissem/bitmessage/utils/Bytes.java#L41-L53
train
baratine/baratine
core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java
ServicesAmpImpl.run
@Override public <T> T run(long timeout, TimeUnit unit, Consumer<Result<T>> task) { try (OutboxAmp outbox = OutboxAmp.currentOrCreate(this)) { ResultFuture<T> future = new ResultFuture<>(); task.accept(future); return future.get(timeout, unit); } }
java
@Override public <T> T run(long timeout, TimeUnit unit, Consumer<Result<T>> task) { try (OutboxAmp outbox = OutboxAmp.currentOrCreate(this)) { ResultFuture<T> future = new ResultFuture<>(); task.accept(future); return future.get(timeout, unit); } }
[ "@", "Override", "public", "<", "T", ">", "T", "run", "(", "long", "timeout", ",", "TimeUnit", "unit", ",", "Consumer", "<", "Result", "<", "T", ">", ">", "task", ")", "{", "try", "(", "OutboxAmp", "outbox", "=", "OutboxAmp", ".", "currentOrCreate", ...
Run a task that returns a future in an outbox context.
[ "Run", "a", "task", "that", "returns", "a", "future", "in", "an", "outbox", "context", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java#L357-L368
train
baratine/baratine
core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java
ServicesAmpImpl.address
@Override public String address(Class<?> api, String address) { Objects.requireNonNull(address); if (address.isEmpty()) { address = addressDefault(api); } int slash = address.indexOf("/"); //int colon = address.indexOf(":"); if (address.endsWith(":") && slash < 0) { address += "//"; } int p = address.indexOf("://"); int q = -1; if (p > 0) { q = address.indexOf('/', p + 3); } if (address.indexOf('{') > 0) { return addressBraces(api, address); } boolean isPrefix = address.startsWith("session:") || address.startsWith("pod:"); if (address.isEmpty() || p > 0 && q < 0 && isPrefix) { if (Vault.class.isAssignableFrom(api)) { TypeRef itemRef = TypeRef.of(api).to(Vault.class).param("T"); Class<?> assetClass = itemRef.rawClass(); address = address + "/" + apiAddress(assetClass); } else { address = address + "/" + apiAddress(api); } } return address; }
java
@Override public String address(Class<?> api, String address) { Objects.requireNonNull(address); if (address.isEmpty()) { address = addressDefault(api); } int slash = address.indexOf("/"); //int colon = address.indexOf(":"); if (address.endsWith(":") && slash < 0) { address += "//"; } int p = address.indexOf("://"); int q = -1; if (p > 0) { q = address.indexOf('/', p + 3); } if (address.indexOf('{') > 0) { return addressBraces(api, address); } boolean isPrefix = address.startsWith("session:") || address.startsWith("pod:"); if (address.isEmpty() || p > 0 && q < 0 && isPrefix) { if (Vault.class.isAssignableFrom(api)) { TypeRef itemRef = TypeRef.of(api).to(Vault.class).param("T"); Class<?> assetClass = itemRef.rawClass(); address = address + "/" + apiAddress(assetClass); } else { address = address + "/" + apiAddress(api); } } return address; }
[ "@", "Override", "public", "String", "address", "(", "Class", "<", "?", ">", "api", ",", "String", "address", ")", "{", "Objects", ".", "requireNonNull", "(", "address", ")", ";", "if", "(", "address", ".", "isEmpty", "(", ")", ")", "{", "address", "...
Calculate address from an API with an address default
[ "Calculate", "address", "from", "an", "API", "with", "an", "address", "default" ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java#L516-L561
train
baratine/baratine
core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java
ServicesAmpImpl.bind
@Override public ServiceRefAmp bind(ServiceRefAmp service, String address) { if (log.isLoggable(Level.FINEST)) { log.finest(L.l("bind {0} for {1} in {2}", address, service.api().getType(), this)); } address = toCanonical(address); registry().bind(address, service); return service; }
java
@Override public ServiceRefAmp bind(ServiceRefAmp service, String address) { if (log.isLoggable(Level.FINEST)) { log.finest(L.l("bind {0} for {1} in {2}", address, service.api().getType(), this)); } address = toCanonical(address); registry().bind(address, service); return service; }
[ "@", "Override", "public", "ServiceRefAmp", "bind", "(", "ServiceRefAmp", "service", ",", "String", "address", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ".", "FINEST", ")", ")", "{", "log", ".", "finest", "(", "L", ".", "l", "(", "...
Publish, reusing the mailbox for an existing service.
[ "Publish", "reusing", "the", "mailbox", "for", "an", "existing", "service", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/core/src/main/java/com/caucho/v5/amp/manager/ServicesAmpImpl.java#L765-L778
train
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.isSeedHeartbeatValid
private boolean isSeedHeartbeatValid() { boolean isSeed = false; for (ServerHeartbeat server : _serverSelf.getCluster().getSeedServers()) { if (server.port() > 0) { isSeed = true; if (server.isUp()) { return true; } } } return ! isSeed; }
java
private boolean isSeedHeartbeatValid() { boolean isSeed = false; for (ServerHeartbeat server : _serverSelf.getCluster().getSeedServers()) { if (server.port() > 0) { isSeed = true; if (server.isUp()) { return true; } } } return ! isSeed; }
[ "private", "boolean", "isSeedHeartbeatValid", "(", ")", "{", "boolean", "isSeed", "=", "false", ";", "for", "(", "ServerHeartbeat", "server", ":", "_serverSelf", ".", "getCluster", "(", ")", ".", "getSeedServers", "(", ")", ")", "{", "if", "(", "server", "...
Returns true if one of the cluster seeds is an active server.
[ "Returns", "true", "if", "one", "of", "the", "cluster", "seeds", "is", "an", "active", "server", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L265-L280
train
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.join
public UpdateRackHeartbeat join(String extAddress, int extPort, String clusterId, String address, int port, int portBartender, String displayName, String serverHash, int seedIndex) { Objects.requireNonNull(extAddress); Objects.requireNonNull(address); ClusterHeartbeat cluster = _root.findCluster(clusterId); if (cluster == null) { cluster = _root.createCluster(clusterId); log.fine("Heartbeat create new cluster " + clusterId); //System.out.println("Unknown cluster for heartbeat join: " + cluster + " " + clusterId); //throw new IllegalStateException("UNKNOWN_CLUSTER: " + cluster + " " + clusterId); } boolean isSSL = false; ServerHeartbeat server = cluster.createDynamicServer(address, port, isSSL); //server.setDisplayName(displayName); ClusterTarget clusterTarget = null; // boolean isJoinCluster = false; RackHeartbeat rack = server.getRack(); if (rack == null) { rack = getRack(cluster, address); server = rack.createServer(address, port, isSSL); //server.setDisplayName(displayName); log.fine("join-server" + " int=" + address + ":" + port + ";" + portBartender + " " + displayName + " hash=" + serverHash + " ext=" + extAddress + ":" + extPort + " (" + _serverSelf.getDisplayName() + ")"); } if (cluster != _serverSelf.getCluster()) { server.toKnown(); clusterTarget = createClusterTarget(cluster); if (clusterTarget.addServer(server)) { // isJoinCluster = true; } } server.setPortBartender(portBartender); if (extAddress != null) { // && ! extAddress.startsWith("127")) { _serverSelf.setSeedIndex(seedIndex); _serverSelf.setLastSeedTime(CurrentTime.currentTime()); _serverSelf.update(); } if (server.isSelf()) { joinSelf(server, extAddress, extPort, address, port, serverHash); } // clear the fail time, since the server is now up server.clearConnectionFailTime(); server.update(); updateHeartbeats(); if (server.isSelf()) { // join to self return null; } else if (clusterId.equals(_serverSelf.getClusterId())) { // join to own cluster return server.getRack().getUpdate(); } else { // join to foreign cluster return _serverSelf.getRack().getUpdate(); } }
java
public UpdateRackHeartbeat join(String extAddress, int extPort, String clusterId, String address, int port, int portBartender, String displayName, String serverHash, int seedIndex) { Objects.requireNonNull(extAddress); Objects.requireNonNull(address); ClusterHeartbeat cluster = _root.findCluster(clusterId); if (cluster == null) { cluster = _root.createCluster(clusterId); log.fine("Heartbeat create new cluster " + clusterId); //System.out.println("Unknown cluster for heartbeat join: " + cluster + " " + clusterId); //throw new IllegalStateException("UNKNOWN_CLUSTER: " + cluster + " " + clusterId); } boolean isSSL = false; ServerHeartbeat server = cluster.createDynamicServer(address, port, isSSL); //server.setDisplayName(displayName); ClusterTarget clusterTarget = null; // boolean isJoinCluster = false; RackHeartbeat rack = server.getRack(); if (rack == null) { rack = getRack(cluster, address); server = rack.createServer(address, port, isSSL); //server.setDisplayName(displayName); log.fine("join-server" + " int=" + address + ":" + port + ";" + portBartender + " " + displayName + " hash=" + serverHash + " ext=" + extAddress + ":" + extPort + " (" + _serverSelf.getDisplayName() + ")"); } if (cluster != _serverSelf.getCluster()) { server.toKnown(); clusterTarget = createClusterTarget(cluster); if (clusterTarget.addServer(server)) { // isJoinCluster = true; } } server.setPortBartender(portBartender); if (extAddress != null) { // && ! extAddress.startsWith("127")) { _serverSelf.setSeedIndex(seedIndex); _serverSelf.setLastSeedTime(CurrentTime.currentTime()); _serverSelf.update(); } if (server.isSelf()) { joinSelf(server, extAddress, extPort, address, port, serverHash); } // clear the fail time, since the server is now up server.clearConnectionFailTime(); server.update(); updateHeartbeats(); if (server.isSelf()) { // join to self return null; } else if (clusterId.equals(_serverSelf.getClusterId())) { // join to own cluster return server.getRack().getUpdate(); } else { // join to foreign cluster return _serverSelf.getRack().getUpdate(); } }
[ "public", "UpdateRackHeartbeat", "join", "(", "String", "extAddress", ",", "int", "extPort", ",", "String", "clusterId", ",", "String", "address", ",", "int", "port", ",", "int", "portBartender", ",", "String", "displayName", ",", "String", "serverHash", ",", ...
joinServer message to an external configured address from a new server, including SelfServer. External address discovery and dynamic server joins are powered by join server. @param extAddress the configured IP address of the connection @param extPort the configured IP port of the connection @param address the requesting server's IP address @param port the requesting server's IP port @param displayName the requesting server's displayName @param serverHash the requesting server's unique machine hash (MAC + port) @return RackHeartbeat if joining an existing hub; null if self-join.
[ "joinServer", "message", "to", "an", "external", "configured", "address", "from", "a", "new", "server", "including", "SelfServer", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L355-L440
train
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.joinSelf
private void joinSelf(ServerHeartbeat server, String extAddress, int extPort, String address, int port, String serverHash) { if (server != _serverSelf) { throw new IllegalStateException(L.l("Invalid self: {0} vs {1}", server, _serverSelf)); } if (! serverHash.equals(_serverSelf.getMachineHash())) { throw new IllegalStateException(L.l("Invalid server hash {0} against {1}:{2}({3})", _serverSelf, address, port, serverHash)); } if (port != _serverSelf.port()) { throw new IllegalStateException(L.l("Invalid server port {0} against {1}:{2}({3})", _serverSelf, address, port, serverHash)); } boolean isSSL = false; ServerHeartbeat extServer = getCluster().createServer(extAddress, extPort, isSSL); server.setExternalServer(extServer); server.setMachineHash(serverHash); server.getRack().update(server.getUpdate()); heartbeatStart(server); updateHubHeartbeatSelf(); //_podService.updatePodsFromHeartbeat(); log.fine("join self " + server); }
java
private void joinSelf(ServerHeartbeat server, String extAddress, int extPort, String address, int port, String serverHash) { if (server != _serverSelf) { throw new IllegalStateException(L.l("Invalid self: {0} vs {1}", server, _serverSelf)); } if (! serverHash.equals(_serverSelf.getMachineHash())) { throw new IllegalStateException(L.l("Invalid server hash {0} against {1}:{2}({3})", _serverSelf, address, port, serverHash)); } if (port != _serverSelf.port()) { throw new IllegalStateException(L.l("Invalid server port {0} against {1}:{2}({3})", _serverSelf, address, port, serverHash)); } boolean isSSL = false; ServerHeartbeat extServer = getCluster().createServer(extAddress, extPort, isSSL); server.setExternalServer(extServer); server.setMachineHash(serverHash); server.getRack().update(server.getUpdate()); heartbeatStart(server); updateHubHeartbeatSelf(); //_podService.updatePodsFromHeartbeat(); log.fine("join self " + server); }
[ "private", "void", "joinSelf", "(", "ServerHeartbeat", "server", ",", "String", "extAddress", ",", "int", "extPort", ",", "String", "address", ",", "int", "port", ",", "String", "serverHash", ")", "{", "if", "(", "server", "!=", "_serverSelf", ")", "{", "t...
received a join from this server. Used to update external IPs.
[ "received", "a", "join", "from", "this", "server", ".", "Used", "to", "update", "external", "IPs", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L445-L485
train
baratine/baratine
framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java
HeartbeatImpl.hubHeartbeat
public void hubHeartbeat(UpdateServerHeartbeat updateServer, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sourceTime) { RackHeartbeat rack = getCluster().findRack(updateRack.getId()); if (rack == null) { rack = getRack(); } updateRack(updateRack); updateServerStart(updateServer); // XXX: _podService.onUpdateFromPeer(updatePod); // rack.update(); updateTargetServers(); PodHeartbeatService podHeartbeat = getPodHeartbeat(); if (podHeartbeat != null && updatePod != null) { podHeartbeat.updatePodSystem(updatePod); } _joinState = _joinState.onHubHeartbeat(this); // updateHubHeartbeat(); updateHeartbeats(); }
java
public void hubHeartbeat(UpdateServerHeartbeat updateServer, UpdateRackHeartbeat updateRack, UpdatePodSystem updatePod, long sourceTime) { RackHeartbeat rack = getCluster().findRack(updateRack.getId()); if (rack == null) { rack = getRack(); } updateRack(updateRack); updateServerStart(updateServer); // XXX: _podService.onUpdateFromPeer(updatePod); // rack.update(); updateTargetServers(); PodHeartbeatService podHeartbeat = getPodHeartbeat(); if (podHeartbeat != null && updatePod != null) { podHeartbeat.updatePodSystem(updatePod); } _joinState = _joinState.onHubHeartbeat(this); // updateHubHeartbeat(); updateHeartbeats(); }
[ "public", "void", "hubHeartbeat", "(", "UpdateServerHeartbeat", "updateServer", ",", "UpdateRackHeartbeat", "updateRack", ",", "UpdatePodSystem", "updatePod", ",", "long", "sourceTime", ")", "{", "RackHeartbeat", "rack", "=", "getCluster", "(", ")", ".", "findRack", ...
Heartbeat from a hub server includes the heartbeat status of its rack.
[ "Heartbeat", "from", "a", "hub", "server", "includes", "the", "heartbeat", "status", "of", "its", "rack", "." ]
db34b45c03c5a5e930d8142acc72319125569fcf
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/bartender/heartbeat/HeartbeatImpl.java#L504-L536
train