_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11200 | dnscnamerec.delete | train | public static base_response delete(nitro_service client, String aliasname) throws Exception {
dnscnamerec deleteresource = new dnscnamerec();
deleteresource.aliasname = aliasname;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11201 | dnscnamerec.delete | train | public static base_responses delete(nitro_service client, String aliasname[]) throws Exception {
base_responses result = null;
if (aliasname != null && aliasname.length > 0) {
dnscnamerec deleteresources[] = new dnscnamerec[aliasname.length];
for (int i=0;i<aliasname.length;i++){
deleteresources[i] = new dnscnamerec();
deleteresources[i].aliasname = aliasname[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | {
"resource": ""
} |
q11202 | dnscnamerec.get | train | public static dnscnamerec[] get(nitro_service service) throws Exception{
dnscnamerec obj = new dnscnamerec();
dnscnamerec[] response = (dnscnamerec[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11203 | dnscnamerec.get | train | public static dnscnamerec[] get(nitro_service service, dnscnamerec_args args) throws Exception{
dnscnamerec obj = new dnscnamerec();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
dnscnamerec[] response = (dnscnamerec[])obj.get_resources(service, option);
return response;
} | java | {
"resource": ""
} |
q11204 | dnscnamerec.get | train | public static dnscnamerec get(nitro_service service, String aliasname) throws Exception{
dnscnamerec obj = new dnscnamerec();
obj.set_aliasname(aliasname);
dnscnamerec response = (dnscnamerec) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11205 | dnscnamerec.get | train | public static dnscnamerec[] get(nitro_service service, String aliasname[]) throws Exception{
if (aliasname !=null && aliasname.length>0) {
dnscnamerec response[] = new dnscnamerec[aliasname.length];
dnscnamerec obj[] = new dnscnamerec[aliasname.length];
for (int i=0;i<aliasname.length;i++) {
obj[i] = new dnscnamerec();
obj[i].set_aliasname(aliasname[i]);
response[i] = (dnscnamerec) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | {
"resource": ""
} |
q11206 | nsacl_stats.get | train | public static nsacl_stats[] get(nitro_service service) throws Exception{
nsacl_stats obj = new nsacl_stats();
nsacl_stats[] response = (nsacl_stats[])obj.stat_resources(service);
return response;
} | java | {
"resource": ""
} |
q11207 | nsacl_stats.get | train | public static nsacl_stats get(nitro_service service, String aclname) throws Exception{
nsacl_stats obj = new nsacl_stats();
obj.set_aclname(aclname);
nsacl_stats response = (nsacl_stats) obj.stat_resource(service);
return response;
} | java | {
"resource": ""
} |
q11208 | lbvserver_dnspolicy64_binding.get | train | public static lbvserver_dnspolicy64_binding[] get(nitro_service service, String name) throws Exception{
lbvserver_dnspolicy64_binding obj = new lbvserver_dnspolicy64_binding();
obj.set_name(name);
lbvserver_dnspolicy64_binding response[] = (lbvserver_dnspolicy64_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11209 | crvserver_filterpolicy_binding.get | train | public static crvserver_filterpolicy_binding[] get(nitro_service service, String name) throws Exception{
crvserver_filterpolicy_binding obj = new crvserver_filterpolicy_binding();
obj.set_name(name);
crvserver_filterpolicy_binding response[] = (crvserver_filterpolicy_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11210 | sslpolicy_sslpolicylabel_binding.get | train | public static sslpolicy_sslpolicylabel_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_sslpolicylabel_binding obj = new sslpolicy_sslpolicylabel_binding();
obj.set_name(name);
sslpolicy_sslpolicylabel_binding response[] = (sslpolicy_sslpolicylabel_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11211 | ArrayHeap.extractMin | train | public E extractMin() {
if (isEmpty()) {
throw new NoSuchElementException();
}
HeapEntry<E> minEntry = indexToEntry.get(0);
int lastIndex = size() - 1;
if (lastIndex > 0) {
HeapEntry<E> lastEntry = indexToEntry.get(lastIndex);
swap(lastEntry, minEntry);
removeLast(minEntry);
heapifyDown(lastEntry);
} else {
removeLast(minEntry);
}
return minEntry.object;
} | java | {
"resource": ""
} |
q11212 | ArrayHeap.decreaseKey | train | public int decreaseKey(E o) {
HeapEntry<E> entry = getEntry(o);
if (o != entry.object) {
if (cmp.compare(o, entry.object) < 0) {
entry.object = o;
}
}
return heapifyUp(entry);
} | java | {
"resource": ""
} |
q11213 | MtasBasicParser.createCurrentList | train | protected Map<String, List<MtasParserObject>> createCurrentList() {
Map<String, List<MtasParserObject>> currentList = new HashMap<>();
currentList.put(MAPPING_TYPE_RELATION, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_RELATION_ANNOTATION,
new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_REF, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_GROUP, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_GROUP_ANNOTATION,
new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_WORD, new ArrayList<MtasParserObject>());
currentList.put(MAPPING_TYPE_WORD_ANNOTATION,
new ArrayList<MtasParserObject>());
return currentList;
} | java | {
"resource": ""
} |
q11214 | MtasBasicParser.createUpdateList | train | protected Map<String, Map<Integer, Set<String>>> createUpdateList() {
Map<String, Map<Integer, Set<String>>> updateList = new HashMap<>();
updateList.put(UPDATE_TYPE_OFFSET, new HashMap<>());
updateList.put(UPDATE_TYPE_POSITION, new HashMap<>());
updateList.put(UPDATE_TYPE_LOCAL_REF_POSITION_START, new HashMap<>());
updateList.put(UPDATE_TYPE_LOCAL_REF_POSITION_END, new HashMap<>());
updateList.put(UPDATE_TYPE_LOCAL_REF_OFFSET_START, new HashMap<>());
updateList.put(UPDATE_TYPE_LOCAL_REF_OFFSET_END, new HashMap<>());
updateList.put(UPDATE_TYPE_VARIABLE, new HashMap<>());
return updateList;
} | java | {
"resource": ""
} |
q11215 | MtasBasicParser.computeVariablesFromObject | train | protected void computeVariablesFromObject(MtasParserObject object,
Map<String, List<MtasParserObject>> currentList,
Map<String, Map<String, String>> variables) {
MtasParserType<MtasParserVariable> parserType = object.getType();
String id = object.getId();
if (id != null) {
for (MtasParserVariable variable : parserType.getItems()) {
if (!variables.containsKey(variable.variable)) {
variables.put(variable.variable, new HashMap<String, String>());
}
StringBuilder builder = new StringBuilder();
for (MtasParserVariableValue variableValue : variable.values) {
if (variableValue.type.equals("attribute")) {
String subValue = object.getAttribute(variableValue.name);
if (subValue != null) {
builder.append(subValue);
}
}
}
variables.get(variable.variable).put(id, builder.toString());
}
}
} | java | {
"resource": ""
} |
q11216 | MtasBasicParser.checkForVariables | train | private boolean checkForVariables(List<Map<String, String>> values) {
if (values == null || values.isEmpty()) {
return false;
} else {
for (Map<String, String> list : values) {
if (list.containsKey("type") && list.get("type")
.equals(MtasParserMapping.PARSER_TYPE_VARIABLE)) {
return true;
}
}
}
return false;
} | java | {
"resource": ""
} |
q11217 | MtasBasicParser.computeTypeFromMappingSource | train | private String computeTypeFromMappingSource(String source)
throws MtasParserException {
if (source.equals(MtasParserMapping.SOURCE_OWN)) {
return null;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_GROUP)) {
return MAPPING_TYPE_GROUP;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_GROUP_ANNOTATION)) {
return MAPPING_TYPE_GROUP_ANNOTATION;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_WORD)) {
return MAPPING_TYPE_WORD;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_WORD_ANNOTATION)) {
return MAPPING_TYPE_WORD_ANNOTATION;
} else if (source.equals(MtasParserMapping.SOURCE_ANCESTOR_RELATION)) {
return MAPPING_TYPE_RELATION;
} else if (source
.equals(MtasParserMapping.SOURCE_ANCESTOR_RELATION_ANNOTATION)) {
return MAPPING_TYPE_RELATION_ANNOTATION;
} else {
throw new MtasParserException("unknown source " + source);
}
} | java | {
"resource": ""
} |
q11218 | MtasBasicParser.computeObjectFromMappingValue | train | private MtasParserObject[] computeObjectFromMappingValue(
MtasParserObject object, Map<String, String> mappingValue,
Map<String, List<MtasParserObject>> currentList)
throws MtasParserException {
MtasParserObject[] checkObjects = null;
MtasParserObject checkObject;
Integer ancestorNumber = null;
String ancestorType = null;
// try to get relevant object
if (mappingValue.get(MAPPING_VALUE_SOURCE)
.equals(MtasParserMapping.SOURCE_OWN)) {
checkObjects = new MtasParserObject[] { object };
} else {
ancestorNumber = mappingValue.get(MAPPING_VALUE_ANCESTOR) != null
? Integer.parseInt(mappingValue.get(MAPPING_VALUE_ANCESTOR)) : null;
ancestorType = computeTypeFromMappingSource(
mappingValue.get(MAPPING_VALUE_SOURCE));
// get ancestor object
if (ancestorType != null) {
int s = currentList.get(ancestorType).size();
// check existence ancestor for conditions
if (ancestorNumber != null) {
if ((s > 0) && (ancestorNumber < s) && (checkObject = currentList
.get(ancestorType).get((s - ancestorNumber - 1))) != null) {
checkObjects = new MtasParserObject[] { checkObject };
}
} else {
checkObjects = new MtasParserObject[s];
for (int i = s - 1; i >= 0; i--) {
checkObjects[s - i - 1] = currentList.get(ancestorType).get(i);
}
}
}
}
return checkObjects;
} | java | {
"resource": ""
} |
q11219 | MtasBasicParser.addAndEncodeVariable | train | private String addAndEncodeVariable(String originalValue, String newVariable,
String newVariableName, boolean encode) {
return addAndEncode(originalValue, newVariable, newVariableName, encode);
} | java | {
"resource": ""
} |
q11220 | MtasBasicParser.addAndEncodeValue | train | private String addAndEncodeValue(String originalValue, String newValue,
boolean encode) {
return addAndEncode(originalValue, null, newValue, encode);
} | java | {
"resource": ""
} |
q11221 | MtasBasicParser.addAndEncode | train | private String addAndEncode(String originalValue, String newType,
String newValue, boolean encode) {
if (newValue == null) {
return originalValue;
} else {
String finalNewValue;
if (encode) {
if (newType == null) {
finalNewValue = new String(
enc.encode(newValue.getBytes(StandardCharsets.UTF_8)),
StandardCharsets.UTF_8);
} else {
finalNewValue = new String(
enc.encode(newType.getBytes(StandardCharsets.UTF_8)),
StandardCharsets.UTF_8)
+ ":"
+ new String(
enc.encode(newValue.getBytes(StandardCharsets.UTF_8)),
StandardCharsets.UTF_8);
}
} else {
finalNewValue = newValue;
}
if (originalValue == null || originalValue.isEmpty()) {
return finalNewValue;
} else {
return originalValue + (encode ? " " : "") + finalNewValue;
}
}
} | java | {
"resource": ""
} |
q11222 | MtasBasicParser.computePayloadFromMappingPayload | train | private BytesRef computePayloadFromMappingPayload(MtasParserObject object,
List<Map<String, String>> mappingPayloads,
Map<String, List<MtasParserObject>> currentList)
throws MtasParserException {
BytesRef payload = null;
for (Map<String, String> mappingPayload : mappingPayloads) {
if (mappingPayload.get(MAPPING_VALUE_SOURCE)
.equals(MtasParserMapping.SOURCE_STRING)) {
if (mappingPayload.get(MAPPING_VALUE_TYPE)
.equals(MtasParserMapping.PARSER_TYPE_STRING)
&& mappingPayload.get(MAPPING_VALUE_TEXT) != null) {
BytesRef subpayload = computeMaximumFilteredPayload(
mappingPayload.get(MAPPING_VALUE_TEXT), payload, null);
payload = (subpayload != null) ? subpayload : payload;
}
// from objects
} else {
MtasParserObject[] checkObjects = computeObjectFromMappingValue(object,
mappingPayload, currentList);
// do checks and updates
if (checkObjects != null) {
// payload from attribute
if (mappingPayload.get("type")
.equals(MtasParserMapping.PARSER_TYPE_ATTRIBUTE)) {
BytesRef subpayload = computeMaximumFilteredPayload(
checkObjects[0].getAttribute(mappingPayload.get("name")),
payload, mappingPayload.get(MAPPING_VALUE_FILTER));
payload = (subpayload != null) ? subpayload : payload;
// payload from text
} else if (mappingPayload.get("type")
.equals(MtasParserMapping.PARSER_TYPE_TEXT)) {
BytesRef subpayload = computeMaximumFilteredPayload(
object.getText(), payload,
mappingPayload.get(MAPPING_VALUE_FILTER));
payload = (subpayload != null) ? subpayload : payload;
}
}
}
}
return payload;
} | java | {
"resource": ""
} |
q11223 | MtasBasicParser.prevalidateObject | train | Boolean prevalidateObject(MtasParserObject object,
Map<String, List<MtasParserObject>> currentList) {
MtasParserType objectType = object.getType();
List<MtasParserMapping<?>> mappings = objectType.getItems();
if (mappings.isEmpty()) {
return true;
}
for (MtasParserMapping<?> mapping : mappings) {
try {
precheckMappingConditions(object, mapping.getConditions(), currentList);
return true;
} catch (MtasParserException e) {
log.debug(e);
}
}
return false;
} | java | {
"resource": ""
} |
q11224 | MtasBasicParser.postcheckMappingConditions | train | private void postcheckMappingConditions(MtasParserObject object,
List<Map<String, String>> mappingConditions,
Map<String, List<MtasParserObject>> currentList)
throws MtasParserException {
precheckMappingConditions(object, mappingConditions, currentList);
for (Map<String, String> mappingCondition : mappingConditions) {
// condition on text
if (mappingCondition.get("type")
.equals(MtasParserMapping.PARSER_TYPE_TEXT)) {
MtasParserObject[] checkObjects = computeObjectFromMappingValue(object,
mappingCondition, currentList);
if (checkObjects != null) {
String textCondition = mappingCondition.get(MAPPING_VALUE_CONDITION);
String textValue = object.getText();
Boolean notCondition = false;
if (mappingCondition.get("not") != null) {
notCondition = true;
}
if ((textCondition == null)
&& ((textValue == null) || textValue.isEmpty())) {
if (!notCondition) {
throw new MtasParserException("no text available");
}
} else if ((textCondition != null) && (textValue == null)) {
if (!notCondition) {
throw new MtasParserException("condition " + textCondition
+ " on text not matched (is null)");
}
} else if (textCondition != null) {
if (!notCondition && !textCondition.equals(textValue)) {
throw new MtasParserException("condition " + textCondition
+ " on text not matched (is " + textValue + ")");
} else if (notCondition && textCondition.equals(textValue)) {
throw new MtasParserException("condition NOT " + textCondition
+ " on text not matched (is " + textValue + ")");
}
}
}
}
}
} | java | {
"resource": ""
} |
q11225 | MtasBasicParser.computeFilteredSplitValues | train | private String[] computeFilteredSplitValues(String[] values, String filter)
throws MtasConfigException {
if (filter != null) {
String[] filters = filter.split(",");
boolean[] valuesFilter = new boolean[values.length];
boolean doSplitFilter = false;
for (String item : filters) {
if (item.trim().matches(
"^" + Pattern.quote(MAPPING_FILTER_SPLIT) + "\\([0-9\\-]+\\)$")) {
doSplitFilter = true;
Pattern splitContent = Pattern
.compile("^" + Pattern.quote(MAPPING_FILTER_SPLIT)
+ "\\(([0-9]+)(-([0-9]+))?\\)$");
Matcher splitContentMatcher = splitContent.matcher(item.trim());
while (splitContentMatcher.find()) {
if (splitContentMatcher.group(3) == null) {
int i = Integer.parseInt(splitContentMatcher.group(1));
if (i >= 0 && i < values.length) {
valuesFilter[i] = true;
}
} else {
int i1 = Integer.parseInt(splitContentMatcher.group(1));
int i2 = Integer.parseInt(splitContentMatcher.group(3));
for (int i = Math.max(0, i1); i < Math.min(values.length,
i2); i++) {
valuesFilter[i] = true;
}
}
}
}
}
if (doSplitFilter) {
int number = 0;
for (int i = 0; i < valuesFilter.length; i++) {
if (valuesFilter[i]) {
number++;
}
}
if (number > 0) {
String[] newValues = new String[number];
number = 0;
for (int i = 0; i < valuesFilter.length; i++) {
if (valuesFilter[i]) {
newValues[number] = values[i];
number++;
}
}
return newValues;
} else {
return new String[] {};
}
}
}
return values;
} | java | {
"resource": ""
} |
q11226 | MtasBasicParser.computeFilteredPrefixedValue | train | private String computeFilteredPrefixedValue(String type, String value,
String filter, String prefix) throws MtasConfigException {
String localValue = value;
// do magic with filter
if (filter != null) {
String[] filters = filter.split(",");
for (String item : filters) {
if (item.trim().equals(MAPPING_FILTER_UPPERCASE)) {
localValue = localValue == null ? null : localValue.toUpperCase();
} else if (item.trim().equals(MAPPING_FILTER_LOWERCASE)) {
localValue = localValue == null ? null : localValue.toLowerCase();
} else if (item.trim().equals(MAPPING_FILTER_ASCII)) {
if (localValue != null) {
char[] old = localValue.toCharArray();
char[] ascii = new char[4 * old.length];
ASCIIFoldingFilter.foldToASCII(old, 0, ascii, 0,
localValue.length());
localValue = new String(ascii);
}
} else if (item.trim()
.matches(Pattern.quote(MAPPING_FILTER_SPLIT) + "\\([0-9\\-]+\\)")) {
if (!type.equals(MtasParserMapping.PARSER_TYPE_TEXT_SPLIT)) {
throw new MtasConfigException(
"split filter not allowed for " + type);
}
} else {
throw new MtasConfigException(
"unknown filter " + item + " for value " + localValue);
}
}
}
if (localValue != null && prefix != null) {
localValue = prefix + localValue;
}
return localValue;
} | java | {
"resource": ""
} |
q11227 | MtasBasicParser.computeMaximumFilteredPayload | train | private BytesRef computeMaximumFilteredPayload(String value, BytesRef payload,
String filter) {
// do magic with filter
if (value != null) {
if (payload != null) {
Float payloadFloat = PayloadHelper.decodeFloat(payload.bytes,
payload.offset);
Float valueFloat = Float.parseFloat(value);
return new BytesRef(
PayloadHelper.encodeFloat(Math.max(payloadFloat, valueFloat)));
} else {
return new BytesRef(PayloadHelper.encodeFloat(Float.parseFloat(value)));
}
} else {
return payload;
}
} | java | {
"resource": ""
} |
q11228 | EntityCachingAbstractSequencePrior.otherOccurrences | train | public int[] otherOccurrences(Entity entity){
List<Integer> other = new ArrayList<Integer>();
for (int i = 0; i < doc.size(); i++) {
if (i == entity.startPosition) { continue; }
if (matches(entity, i)) {
other.add(Integer.valueOf(i));
}
}
return toArray(other);
} | java | {
"resource": ""
} |
q11229 | transformpolicylabel_binding.get | train | public static transformpolicylabel_binding get(nitro_service service, String labelname) throws Exception{
transformpolicylabel_binding obj = new transformpolicylabel_binding();
obj.set_labelname(labelname);
transformpolicylabel_binding response = (transformpolicylabel_binding) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11230 | nshttpparam.update | train | public static base_response update(nitro_service client, nshttpparam resource) throws Exception {
nshttpparam updateresource = new nshttpparam();
updateresource.dropinvalreqs = resource.dropinvalreqs;
updateresource.markhttp09inval = resource.markhttp09inval;
updateresource.markconnreqinval = resource.markconnreqinval;
updateresource.insnssrvrhdr = resource.insnssrvrhdr;
updateresource.nssrvrhdr = resource.nssrvrhdr;
updateresource.logerrresp = resource.logerrresp;
updateresource.conmultiplex = resource.conmultiplex;
updateresource.maxreusepool = resource.maxreusepool;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11231 | nshttpparam.unset | train | public static base_response unset(nitro_service client, nshttpparam resource, String[] args) throws Exception{
nshttpparam unsetresource = new nshttpparam();
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11232 | nshttpparam.get | train | public static nshttpparam get(nitro_service service) throws Exception{
nshttpparam obj = new nshttpparam();
nshttpparam[] response = (nshttpparam[])obj.get_resources(service);
return response[0];
} | java | {
"resource": ""
} |
q11233 | IntCounter.getMapFactory | train | public MapFactory<E, MutableInteger> getMapFactory() {
return ErasureUtils.<MapFactory<E,MutableInteger>>uncheckedCast(mapFactory);
} | java | {
"resource": ""
} |
q11234 | IntCounter.remove | train | public double remove(E key) {
totalCount -= getCount(key); // subtract removed count from total (may be 0)
MutableInteger val = map.remove(key);
if (val == null) {
return Double.NaN;
} else {
return val.doubleValue();
}
} | java | {
"resource": ""
} |
q11235 | IntCounter.entrySet | train | public Set<Map.Entry<E,Double>> entrySet() {
return new AbstractSet<Map.Entry<E,Double>>() {
@Override
public Iterator<Entry<E, Double>> iterator() {
return new Iterator<Entry<E,Double>>() {
final Iterator<Entry<E,MutableInteger>> inner = map.entrySet().iterator();
public boolean hasNext() {
return inner.hasNext();
}
public Entry<E, Double> next() {
return new Map.Entry<E,Double>() {
final Entry<E,MutableInteger> e = inner.next();
public E getKey() {
return e.getKey();
}
public Double getValue() {
return e.getValue().doubleValue();
}
public Double setValue(Double value) {
final double old = e.getValue().doubleValue();
e.getValue().set(value.intValue());
totalCount = totalCount - (int)old + value.intValue();
return old;
}
};
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
@Override
public int size() {
return map.size();
}
};
} | java | {
"resource": ""
} |
q11236 | IntCounter.max | train | public int max() {
int max = Integer.MIN_VALUE;
for (E key : map.keySet()) {
max = Math.max(max, getIntCount(key));
}
return max;
} | java | {
"resource": ""
} |
q11237 | IntCounter.min | train | public int min() {
int min = Integer.MAX_VALUE;
for (E key : map.keySet()) {
min = Math.min(min, getIntCount(key));
}
return min;
} | java | {
"resource": ""
} |
q11238 | IntCounter.argmax | train | public E argmax(Comparator<E> tieBreaker) {
int max = Integer.MIN_VALUE;
E argmax = null;
for (E key : keySet()) {
int count = getIntCount(key);
if (argmax == null || count > max || (count == max && tieBreaker.compare(key, argmax) < 0)) {
max = count;
argmax = key;
}
}
return argmax;
} | java | {
"resource": ""
} |
q11239 | IntCounter.argmin | train | public E argmin(Comparator<E> tieBreaker) {
int min = Integer.MAX_VALUE;
E argmin = null;
for (E key : map.keySet()) {
int count = getIntCount(key);
if (argmin == null || count < min || (count == min && tieBreaker.compare(key, argmin) < 0)) {
min = count;
argmin = key;
}
}
return argmin;
} | java | {
"resource": ""
} |
q11240 | systembackup.create | train | public static base_response create(nitro_service client, systembackup resource) throws Exception {
systembackup createresource = new systembackup();
createresource.filename = resource.filename;
createresource.level = resource.level;
createresource.comment = resource.comment;
return createresource.perform_operation(client,"create");
} | java | {
"resource": ""
} |
q11241 | systembackup.create | train | public static base_responses create(nitro_service client, systembackup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
systembackup createresources[] = new systembackup[resources.length];
for (int i=0;i<resources.length;i++){
createresources[i] = new systembackup();
createresources[i].filename = resources[i].filename;
createresources[i].level = resources[i].level;
createresources[i].comment = resources[i].comment;
}
result = perform_operation_bulk_request(client, createresources,"create");
}
return result;
} | java | {
"resource": ""
} |
q11242 | systembackup.restore | train | public static base_response restore(nitro_service client, systembackup resource) throws Exception {
systembackup restoreresource = new systembackup();
restoreresource.filename = resource.filename;
return restoreresource.perform_operation(client,"restore");
} | java | {
"resource": ""
} |
q11243 | systembackup.restore | train | public static base_responses restore(nitro_service client, systembackup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
systembackup restoreresources[] = new systembackup[resources.length];
for (int i=0;i<resources.length;i++){
restoreresources[i] = new systembackup();
restoreresources[i].filename = resources[i].filename;
}
result = perform_operation_bulk_request(client, restoreresources,"restore");
}
return result;
} | java | {
"resource": ""
} |
q11244 | systembackup.delete | train | public static base_response delete(nitro_service client, String filename) throws Exception {
systembackup deleteresource = new systembackup();
deleteresource.filename = filename;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11245 | systembackup.delete | train | public static base_responses delete(nitro_service client, String filename[]) throws Exception {
base_responses result = null;
if (filename != null && filename.length > 0) {
systembackup deleteresources[] = new systembackup[filename.length];
for (int i=0;i<filename.length;i++){
deleteresources[i] = new systembackup();
deleteresources[i].filename = filename[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | {
"resource": ""
} |
q11246 | systembackup.get | train | public static systembackup[] get(nitro_service service, options option) throws Exception{
systembackup obj = new systembackup();
systembackup[] response = (systembackup[])obj.get_resources(service,option);
return response;
} | java | {
"resource": ""
} |
q11247 | systembackup.get | train | public static systembackup get(nitro_service service, String filename) throws Exception{
systembackup obj = new systembackup();
obj.set_filename(filename);
systembackup response = (systembackup) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11248 | systembackup.get | train | public static systembackup[] get(nitro_service service, String filename[]) throws Exception{
if (filename !=null && filename.length>0) {
systembackup response[] = new systembackup[filename.length];
systembackup obj[] = new systembackup[filename.length];
for (int i=0;i<filename.length;i++) {
obj[i] = new systembackup();
obj[i].set_filename(filename[i]);
response[i] = (systembackup) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | {
"resource": ""
} |
q11249 | filterpolicy.add | train | public static base_response add(nitro_service client, filterpolicy resource) throws Exception {
filterpolicy addresource = new filterpolicy();
addresource.name = resource.name;
addresource.rule = resource.rule;
addresource.reqaction = resource.reqaction;
addresource.resaction = resource.resaction;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11250 | filterpolicy.update | train | public static base_response update(nitro_service client, filterpolicy resource) throws Exception {
filterpolicy updateresource = new filterpolicy();
updateresource.name = resource.name;
updateresource.rule = resource.rule;
updateresource.reqaction = resource.reqaction;
updateresource.resaction = resource.resaction;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11251 | filterpolicy.get | train | public static filterpolicy[] get(nitro_service service) throws Exception{
filterpolicy obj = new filterpolicy();
filterpolicy[] response = (filterpolicy[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11252 | filterpolicy.get | train | public static filterpolicy get(nitro_service service, String name) throws Exception{
filterpolicy obj = new filterpolicy();
obj.set_name(name);
filterpolicy response = (filterpolicy) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11253 | filterpolicy.get | train | public static filterpolicy[] get(nitro_service service, String name[]) throws Exception{
if (name !=null && name.length>0) {
filterpolicy response[] = new filterpolicy[name.length];
filterpolicy obj[] = new filterpolicy[name.length];
for (int i=0;i<name.length;i++) {
obj[i] = new filterpolicy();
obj[i].set_name(name[i]);
response[i] = (filterpolicy) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | {
"resource": ""
} |
q11254 | vpnurl.add | train | public static base_response add(nitro_service client, vpnurl resource) throws Exception {
vpnurl addresource = new vpnurl();
addresource.urlname = resource.urlname;
addresource.linkname = resource.linkname;
addresource.actualurl = resource.actualurl;
addresource.clientlessaccess = resource.clientlessaccess;
addresource.comment = resource.comment;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11255 | vpnurl.add | train | public static base_responses add(nitro_service client, vpnurl resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnurl addresources[] = new vpnurl[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new vpnurl();
addresources[i].urlname = resources[i].urlname;
addresources[i].linkname = resources[i].linkname;
addresources[i].actualurl = resources[i].actualurl;
addresources[i].clientlessaccess = resources[i].clientlessaccess;
addresources[i].comment = resources[i].comment;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | {
"resource": ""
} |
q11256 | vpnurl.delete | train | public static base_response delete(nitro_service client, String urlname) throws Exception {
vpnurl deleteresource = new vpnurl();
deleteresource.urlname = urlname;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11257 | vpnurl.update | train | public static base_response update(nitro_service client, vpnurl resource) throws Exception {
vpnurl updateresource = new vpnurl();
updateresource.urlname = resource.urlname;
updateresource.linkname = resource.linkname;
updateresource.actualurl = resource.actualurl;
updateresource.clientlessaccess = resource.clientlessaccess;
updateresource.comment = resource.comment;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11258 | vpnurl.update | train | public static base_responses update(nitro_service client, vpnurl resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnurl updateresources[] = new vpnurl[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new vpnurl();
updateresources[i].urlname = resources[i].urlname;
updateresources[i].linkname = resources[i].linkname;
updateresources[i].actualurl = resources[i].actualurl;
updateresources[i].clientlessaccess = resources[i].clientlessaccess;
updateresources[i].comment = resources[i].comment;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | {
"resource": ""
} |
q11259 | vpnurl.unset | train | public static base_response unset(nitro_service client, vpnurl resource, String[] args) throws Exception{
vpnurl unsetresource = new vpnurl();
unsetresource.urlname = resource.urlname;
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11260 | vpnurl.unset | train | public static base_responses unset(nitro_service client, String urlname[], String args[]) throws Exception {
base_responses result = null;
if (urlname != null && urlname.length > 0) {
vpnurl unsetresources[] = new vpnurl[urlname.length];
for (int i=0;i<urlname.length;i++){
unsetresources[i] = new vpnurl();
unsetresources[i].urlname = urlname[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11261 | vpnurl.get | train | public static vpnurl[] get(nitro_service service) throws Exception{
vpnurl obj = new vpnurl();
vpnurl[] response = (vpnurl[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11262 | vpnurl.get | train | public static vpnurl get(nitro_service service, String urlname) throws Exception{
vpnurl obj = new vpnurl();
obj.set_urlname(urlname);
vpnurl response = (vpnurl) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11263 | vpnurl.get | train | public static vpnurl[] get(nitro_service service, String urlname[]) throws Exception{
if (urlname !=null && urlname.length>0) {
vpnurl response[] = new vpnurl[urlname.length];
vpnurl obj[] = new vpnurl[urlname.length];
for (int i=0;i<urlname.length;i++) {
obj[i] = new vpnurl();
obj[i].set_urlname(urlname[i]);
response[i] = (vpnurl) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | {
"resource": ""
} |
q11264 | BaseLexicon.ruleIteratorByWord | train | public Iterator<IntTaggedWord> ruleIteratorByWord(String word, int loc) {
return ruleIteratorByWord(wordIndex.indexOf(word, true), loc, null);
} | java | {
"resource": ""
} |
q11265 | BaseLexicon.addAll | train | public void addAll(List<TaggedWord> taggedWords, double weight) {
List<IntTaggedWord> tagWords = listToEvents(taggedWords);
} | java | {
"resource": ""
} |
q11266 | BaseLexicon.train | train | public final void train(Collection<Tree> trees, double weight) {
// scan data
for (Tree tree : trees) {
train(tree, weight);
}
} | java | {
"resource": ""
} |
q11267 | BaseLexicon.addTagging | train | protected void addTagging(boolean seen, IntTaggedWord itw, double count) {
if (seen) {
seenCounter.incrementCount(itw, count);
if (itw.tag() == nullTag) {
words.add(itw);
} else if (itw.word() == nullWord) {
tags.add(itw);
} else {
// rules.add(itw);
}
} else {
uwModel.addTagging(seen, itw, count);
// if (itw.tag() == nullTag) {
// sigs.add(itw);
// }
}
} | java | {
"resource": ""
} |
q11268 | BaseLexicon.writeData | train | public void writeData(Writer w) throws IOException {
PrintWriter out = new PrintWriter(w);
for (IntTaggedWord itw : seenCounter.keySet()) {
out.println(itw.toLexicalEntry(wordIndex, tagIndex) + " SEEN " + seenCounter.getCount(itw));
}
for (IntTaggedWord itw : getUnknownWordModel().unSeenCounter().keySet()) {
out.println(itw.toLexicalEntry(wordIndex, tagIndex) + " UNSEEN " + getUnknownWordModel().unSeenCounter().getCount(itw));
}
for (int i = 0; i < smooth.length; i++) {
out.println("smooth[" + i + "] = " + smooth[i]);
}
out.flush();
} | java | {
"resource": ""
} |
q11269 | nd6.add | train | public static base_response add(nitro_service client, nd6 resource) throws Exception {
nd6 addresource = new nd6();
addresource.neighbor = resource.neighbor;
addresource.mac = resource.mac;
addresource.ifnum = resource.ifnum;
addresource.vlan = resource.vlan;
addresource.td = resource.td;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11270 | nd6.add | train | public static base_responses add(nitro_service client, nd6 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nd6 addresources[] = new nd6[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new nd6();
addresources[i].neighbor = resources[i].neighbor;
addresources[i].mac = resources[i].mac;
addresources[i].ifnum = resources[i].ifnum;
addresources[i].vlan = resources[i].vlan;
addresources[i].td = resources[i].td;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | {
"resource": ""
} |
q11271 | nd6.clear | train | public static base_response clear(nitro_service client) throws Exception {
nd6 clearresource = new nd6();
return clearresource.perform_operation(client,"clear");
} | java | {
"resource": ""
} |
q11272 | nd6.delete | train | public static base_response delete(nitro_service client, String neighbor) throws Exception {
nd6 deleteresource = new nd6();
deleteresource.neighbor = neighbor;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11273 | nd6.delete | train | public static base_response delete(nitro_service client, nd6 resource) throws Exception {
nd6 deleteresource = new nd6();
deleteresource.neighbor = resource.neighbor;
deleteresource.vlan = resource.vlan;
deleteresource.td = resource.td;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11274 | nd6.delete | train | public static base_responses delete(nitro_service client, String neighbor[]) throws Exception {
base_responses result = null;
if (neighbor != null && neighbor.length > 0) {
nd6 deleteresources[] = new nd6[neighbor.length];
for (int i=0;i<neighbor.length;i++){
deleteresources[i] = new nd6();
deleteresources[i].neighbor = neighbor[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | {
"resource": ""
} |
q11275 | nd6.get | train | public static nd6[] get(nitro_service service) throws Exception{
nd6 obj = new nd6();
nd6[] response = (nd6[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11276 | csvserver_lbvserver_binding.get | train | public static csvserver_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
csvserver_lbvserver_binding obj = new csvserver_lbvserver_binding();
obj.set_name(name);
csvserver_lbvserver_binding response[] = (csvserver_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11277 | streamidentifier_binding.get | train | public static streamidentifier_binding get(nitro_service service, String name) throws Exception{
streamidentifier_binding obj = new streamidentifier_binding();
obj.set_name(name);
streamidentifier_binding response = (streamidentifier_binding) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11278 | appfwprofile_xmlxss_binding.get | train | public static appfwprofile_xmlxss_binding[] get(nitro_service service, String name) throws Exception{
appfwprofile_xmlxss_binding obj = new appfwprofile_xmlxss_binding();
obj.set_name(name);
appfwprofile_xmlxss_binding response[] = (appfwprofile_xmlxss_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11279 | authenticationlocalpolicy_binding.get | train | public static authenticationlocalpolicy_binding get(nitro_service service, String name) throws Exception{
authenticationlocalpolicy_binding obj = new authenticationlocalpolicy_binding();
obj.set_name(name);
authenticationlocalpolicy_binding response = (authenticationlocalpolicy_binding) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11280 | dnspolicy64_lbvserver_binding.get | train | public static dnspolicy64_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
dnspolicy64_lbvserver_binding obj = new dnspolicy64_lbvserver_binding();
obj.set_name(name);
dnspolicy64_lbvserver_binding response[] = (dnspolicy64_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11281 | Counters.logSum | train | public static <E> double logSum(Counter<E> c) {
return ArrayMath.logSum(ArrayMath.unbox(c.values()));
} | java | {
"resource": ""
} |
q11282 | Counters.max | train | public static <E> double max(Counter<E> c) {
double max = Double.NEGATIVE_INFINITY;
for (double v : c.values()) {
max = Math.max(max, v);
}
return max;
} | java | {
"resource": ""
} |
q11283 | Counters.asCounter | train | public static <E> Counter<E> asCounter(Collection<E> c) {
Counter<E> count = new ClassicCounter<E>();
for (E elem : c) {
count.incrementCount(elem);
}
return count;
} | java | {
"resource": ""
} |
q11284 | Counters.min | train | public static <E> double min(Counter<E> c) {
double min = Double.POSITIVE_INFINITY;
for (double v : c.values()) {
min = Math.min(min, v);
}
return min;
} | java | {
"resource": ""
} |
q11285 | Counters.argmax | train | public static <E> E argmax(Counter<E> c) {
double max = Double.NEGATIVE_INFINITY;
E argmax = null;
for (E key : c.keySet()) {
double count = c.getCount(key);
if (argmax == null || count > max) {// || (count == max &&
// tieBreaker.compare(key, argmax) <
// 0)) {
max = count;
argmax = key;
}
}
return argmax;
} | java | {
"resource": ""
} |
q11286 | Counters.argmin | train | public static <E> E argmin(Counter<E> c) {
double min = Double.POSITIVE_INFINITY;
E argmin = null;
for (E key : c.keySet()) {
double count = c.getCount(key);
if (argmin == null || count < min) {// || (count == min &&
// tieBreaker.compare(key, argmin) <
// 0)) {
min = count;
argmin = key;
}
}
return argmin;
} | java | {
"resource": ""
} |
q11287 | Counters.addInPlace | train | public static <E> void addInPlace(Counter<E> target, double value) {
for (E key : target.keySet()) {
target.incrementCount(key, value);
}
} | java | {
"resource": ""
} |
q11288 | Counters.divideInPlace | train | public static <E> void divideInPlace(Counter<E> target, Counter<E> denominator) {
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) / denominator.getCount(key));
}
} | java | {
"resource": ""
} |
q11289 | Counters.dotProductInPlace | train | public static <E> void dotProductInPlace(Counter<E> target, Counter<E> term) {
for (E key : target.keySet()) {
target.setCount(key, target.getCount(key) * term.getCount(key));
}
} | java | {
"resource": ""
} |
q11290 | Counters.divideInPlace | train | public static <E> Counter<E> divideInPlace(Counter<E> target, double divisor) {
for (Entry<E, Double> entry : target.entrySet()) {
target.setCount(entry.getKey(), entry.getValue() / divisor);
}
return target;
} | java | {
"resource": ""
} |
q11291 | Counters.multiplyInPlace | train | public static <E> Counter<E> multiplyInPlace(Counter<E> target, double multiplier) {
for (Entry<E, Double> entry : target.entrySet()) {
target.setCount(entry.getKey(), entry.getValue() * multiplier);
}
return target;
} | java | {
"resource": ""
} |
q11292 | Counters.deleteOutofRange | train | public static <E> List<E> deleteOutofRange(Counter<E> c, int top, int bottom) {
List<E> purgedItems = new ArrayList<E>();
int numToPurge = top + bottom;
if (numToPurge <= 0) {
return purgedItems;
}
List<E> l = Counters.toSortedList(c);
for (int i = 0; i < top; i++) {
E item = l.get(i);
purgedItems.add(item);
c.remove(item);
}
int size = c.size();
for (int i = c.size() - 1; i >= (size - bottom); i--) {
E item = l.get(i);
purgedItems.add(item);
c.remove(item);
}
return purgedItems;
} | java | {
"resource": ""
} |
q11293 | Counters.retainNonZeros | train | public static <E> Set<E> retainNonZeros(Counter<E> counter) {
Set<E> removed = new HashSet<E>();
for (E key : counter.keySet()) {
if (counter.getCount(key) == 0.0) {
removed.add(key);
}
}
for (E key : removed) {
counter.remove(key);
}
return removed;
} | java | {
"resource": ""
} |
q11294 | Counters.retainAbove | train | public static <E> Set<E> retainAbove(Counter<E> counter, double countThreshold) {
Set<E> removed = new HashSet<E>();
for (E key : counter.keySet()) {
if (counter.getCount(key) < countThreshold) {
removed.add(key);
}
}
for (E key : removed) {
counter.remove(key);
}
return removed;
} | java | {
"resource": ""
} |
q11295 | Counters.retainBelow | train | public static <E> Set<E> retainBelow(Counter<E> counter, double countMaxThreshold) {
Set<E> removed = new HashSet<E>();
for (E key : counter.keySet()) {
if (counter.getCount(key) > countMaxThreshold) {
removed.add(key);
}
}
for (E key : removed) {
counter.remove(key);
}
return removed;
} | java | {
"resource": ""
} |
q11296 | Counters.retainMatchingKeys | train | public static Set<String> retainMatchingKeys(Counter<String> counter, List<Pattern> matchPatterns) {
Set<String> removed = new HashSet<String>();
for (String key : counter.keySet()) {
boolean matched = false;
for (Pattern pattern : matchPatterns) {
if (pattern.matcher(key).matches()) {
matched = true;
break;
}
}
if (!matched) {
removed.add(key);
}
}
for (String key : removed) {
counter.remove(key);
}
return removed;
} | java | {
"resource": ""
} |
q11297 | Counters.retainKeys | train | public static<E> Set<E> retainKeys(Counter<E> counter, Collection<E> matchKeys) {
Set<E> removed = new HashSet<E>();
for (E key : counter.keySet()) {
boolean matched = matchKeys.contains(key);
if (!matched) {
removed.add(key);
}
}
for (E key : removed) {
counter.remove(key);
}
return removed;
} | java | {
"resource": ""
} |
q11298 | Counters.removeKeys | train | public static <E> void removeKeys(Counter<E> counter, Collection<E> removeKeysCollection) {
for (E key : removeKeysCollection)
counter.remove(key);
} | java | {
"resource": ""
} |
q11299 | Counters.transform | train | public static <T1, T2> Counter<T2> transform(Counter<T1> c, Function<T1, T2> f) {
Counter<T2> c2 = new ClassicCounter<T2>();
for (T1 key : c.keySet()) {
c2.setCount(f.apply(key), c.getCount(key));
}
return c2;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.