code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
public static streamselector get(nitro_service service, String name) throws Exception{
streamselector obj = new streamselector();
obj.set_name(name);
streamselector response = (streamselector) obj.get_resource(service);
return response;
} | java |
public static appfwglobal_appfwpolicy_binding[] get(nitro_service service) throws Exception{
appfwglobal_appfwpolicy_binding obj = new appfwglobal_appfwpolicy_binding();
appfwglobal_appfwpolicy_binding response[] = (appfwglobal_appfwpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static appfwprofile_fieldconsistency_binding[] get(nitro_service service, String name) throws Exception{
appfwprofile_fieldconsistency_binding obj = new appfwprofile_fieldconsistency_binding();
obj.set_name(name);
appfwprofile_fieldconsistency_binding response[] = (appfwprofile_fieldconsistency_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response update(nitro_service client, dnsparameter resource) throws Exception {
dnsparameter updateresource = new dnsparameter();
updateresource.retries = resource.retries;
updateresource.minttl = resource.minttl;
updateresource.maxttl = resource.maxttl;
updateresource.cacherecords = resource.cacherecords;
updateresource.namelookuppriority = resource.namelookuppriority;
updateresource.recursion = resource.recursion;
updateresource.resolutionorder = resource.resolutionorder;
updateresource.dnssec = resource.dnssec;
updateresource.maxpipeline = resource.maxpipeline;
updateresource.dnsrootreferral = resource.dnsrootreferral;
updateresource.dns64timeout = resource.dns64timeout;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, dnsparameter resource, String[] args) throws Exception{
dnsparameter unsetresource = new dnsparameter();
return unsetresource.unset_resource(client,args);
} | java |
public static dnsparameter get(nitro_service service) throws Exception{
dnsparameter obj = new dnsparameter();
dnsparameter[] response = (dnsparameter[])obj.get_resources(service);
return response[0];
} | java |
private static HashSet<String> stringToStringValues(String stringValue)
throws IOException {
// should be improved to support escaped characters
HashSet<String> stringValues = new HashSet<>();
JSONParser jsonParser = new JSONParser(stringValue);
int event = jsonParser.nextEvent();
if (event == JSONParser.ARRAY_START) {
while ((event = jsonParser.nextEvent()) != JSONParser.ARRAY_END) {
if (jsonParser.getLevel() == 1) {
switch (event) {
case JSONParser.STRING:
stringValues.add(jsonParser.getString());
break;
case JSONParser.BIGNUMBER:
case JSONParser.NUMBER:
case JSONParser.LONG:
stringValues.add(jsonParser.getNumberChars().toString());
break;
case JSONParser.BOOLEAN:
stringValues.add(Boolean.toString(jsonParser.getBoolean()));
break;
default:
// do nothing
break;
}
}
}
} else {
throw new IOException("unsupported json structure");
}
return stringValues;
} | java |
public static systemglobal_binding get(nitro_service service) throws Exception{
systemglobal_binding obj = new systemglobal_binding();
systemglobal_binding response = (systemglobal_binding) obj.get_resource(service);
return response;
} | java |
protected IntDependency intern(IntTaggedWord headTW, IntTaggedWord argTW, boolean leftHeaded, short dist) {
Map<IntDependency,IntDependency> map = expandDependencyMap;
IntDependency internTempDependency = new IntDependency(itwInterner.intern(headTW), itwInterner.intern(argTW), leftHeaded, dist);
IntDependency returnDependency = internTempDependency;
if (map != null) {
returnDependency = map.get(internTempDependency);
if (returnDependency == null) {
map.put(internTempDependency, internTempDependency);
returnDependency = internTempDependency;
}
}
return returnDependency;
} | java |
public static Analyzer getAnalyzer() {
if (analyzer == null ) initAnalyzer();
if (!analyzer.enableGuessing)
System.err.println("Morphologic analyzer has disabled out-of-vocabulary guessing - this will reduce tagging accuracy");
return analyzer;
} | java |
private static void applyLVmorphoanalysis(CoreLabel wi, Collection<String> answerAttributes) {
Word analysis = analyzer.analyze(wi.word());
applyLVmorphoanalysis(wi, analysis, answerAttributes);
} | java |
public static sslpolicy_sslglobal_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_sslglobal_binding obj = new sslpolicy_sslglobal_binding();
obj.set_name(name);
sslpolicy_sslglobal_binding response[] = (sslpolicy_sslglobal_binding[]) obj.get_resources(service);
return response;
} | java |
public MtasDataItemNumberComparator<T> recomputeBoundary(int n)
throws IOException {
if (sortDirection.equals(CodecUtil.SORT_DESC)) {
if (value instanceof Integer) {
return new MtasDataItemNumberComparator(
Math.floorDiv((Integer) value, n), sortDirection);
} else if (value instanceof Long) {
return new MtasDataItemNumberComparator(Math.floorDiv((Long) value, n),
sortDirection);
} else if (value instanceof Float) {
return new MtasDataItemNumberComparator(((Float) value) / n,
sortDirection);
} else if (value instanceof Double) {
return new MtasDataItemNumberComparator(((Double) value) / n,
sortDirection);
} else {
throw new IOException("unknown NumberComparator");
}
} else if (sortDirection.equals(CodecUtil.SORT_ASC)) {
return new MtasDataItemNumberComparator(getValue(), sortDirection);
} else {
throw new IOException("unknown sortDirection " + sortDirection);
}
} | java |
public static authenticationradiuspolicy_binding get(nitro_service service, String name) throws Exception{
authenticationradiuspolicy_binding obj = new authenticationradiuspolicy_binding();
obj.set_name(name);
authenticationradiuspolicy_binding response = (authenticationradiuspolicy_binding) obj.get_resource(service);
return response;
} | java |
public void decimate(Writer trainW, Writer devW, Writer testW) throws IOException {
PrintWriter trainPW = new PrintWriter(trainW, true);
PrintWriter devPW = new PrintWriter(devW, true);
PrintWriter testPW = new PrintWriter(testW, true);
int i = 0;
for (Tree t : this) {
if (i == 8) {
t.pennPrint(devPW);
} else if (i == 9) {
t.pennPrint(testPW);
} else {
t.pennPrint(trainPW);
}
i = (i+1) % 10;
}
} | java |
public static crvserver_cspolicy_binding[] get(nitro_service service, String name) throws Exception{
crvserver_cspolicy_binding obj = new crvserver_cspolicy_binding();
obj.set_name(name);
crvserver_cspolicy_binding response[] = (crvserver_cspolicy_binding[]) obj.get_resources(service);
return response;
} | java |
private String printConfigMappingTypes(
Map<QName, MtasParserType<MtasParserMapping<?>>> types) {
StringBuilder text = new StringBuilder();
for (Entry<QName, MtasParserType<MtasParserMapping<?>>> entry : types
.entrySet()) {
text.append("- " + entry.getKey().getLocalPart() + ": "
+ entry.getValue().items.size() + " mapping(s)\n");
for (int i = 0; i < entry.getValue().items.size(); i++) {
text.append("\t" + entry.getValue().items.get(i) + "\n");
}
}
return text.toString();
} | java |
private Collection<? extends String> recursiveCollect(String refId,
Map<String, SortedSet<String>> relationKeyMap, int maxRecursion) {
Set<String> list = new HashSet<>();
if (maxRecursion > 0 && relationKeyMap.containsKey(refId)) {
SortedSet<String> subList = relationKeyMap.get(refId);
for (String subRefId : subList) {
list.add(subRefId);
list.addAll(
recursiveCollect(subRefId, relationKeyMap, maxRecursion - 1));
}
}
return list;
} | java |
private QName getQName(String key) {
QName qname;
if ((qname = qNames.get(key)) == null) {
qname = new QName(namespaceURI, key);
qNames.put(key, qname);
}
return qname;
} | java |
public void collectAttributes(MtasParserObject currentObject,
XMLStreamReader streamReader) {
String attributeNamespaceURI;
currentObject.objectAttributes.clear();
currentObject.objectId = streamReader.getAttributeValue(namespaceURI_id,
"id");
for (int i = 0; i < streamReader.getAttributeCount(); i++) {
attributeNamespaceURI = streamReader.getAttributeNamespace(i);
if (attributeNamespaceURI == null || attributeNamespaceURI.equals("")) {
attributeNamespaceURI = streamReader.getNamespaceURI();
}
if (namespaceURI == null || attributeNamespaceURI.equals(namespaceURI)) {
currentObject.objectAttributes.put(
streamReader.getAttributeLocalName(i),
streamReader.getAttributeValue(i));
} else {
HashMap<String, String> otherMap;
if(!currentObject.objectOtherAttributes.containsKey(attributeNamespaceURI)) {
otherMap = new HashMap<>();
currentObject.objectOtherAttributes.put(attributeNamespaceURI, otherMap);
} else {
otherMap = currentObject.objectOtherAttributes.get(attributeNamespaceURI);
}
otherMap.put(
streamReader.getAttributeLocalName(i),
streamReader.getAttributeValue(i));
}
}
} | java |
private Set<MtasParserObject> processCRMSentence(
MtasTokenIdFactory mtasTokenIdFactory, String name, String text,
Integer currentOffset,
List<MtasCRMParserFunctionOutput> functionOutputList,
MtasCRMAncestors unknownAncestors,
Map<String, List<MtasParserObject>> currentList,
Map<String, Map<Integer, Set<String>>> updateList,
Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets,
Set<MtasParserObject> previous, Set<MtasParserObject> previousClause)
throws MtasParserException, MtasConfigException {
MtasParserType tmpCurrentType;
MtasParserObject currentObject;
if ((tmpCurrentType = crmSentenceTypes.get(name)) != null) {
String filteredText = text.replaceAll("[^0-9\\-]", "");
currentObject = new MtasParserObject(tmpCurrentType);
currentObject.setUnknownAncestorNumber(unknownAncestors.unknown);
currentObject.setRealOffsetStart(currentOffset);
currentObject.setText(filteredText);
if (!prevalidateObject(currentObject, currentList)) {
return new HashSet<>();
} else {
closePrevious(mtasTokenIdFactory, previousClause, currentOffset,
unknownAncestors, currentList, updateList, idPositions, idOffsets);
closePrevious(mtasTokenIdFactory, previous, currentOffset,
unknownAncestors, currentList, updateList, idPositions, idOffsets);
previous.clear();
currentList.get(MAPPING_TYPE_GROUP).add(currentObject);
unknownAncestors.unknown = 0;
return new HashSet<>(Arrays.asList(currentObject));
}
}
return new HashSet<>();
} | java |
private void closePrevious(MtasTokenIdFactory mtasTokenIdFactory,
Set<MtasParserObject> previous, Integer currentOffset,
MtasCRMAncestors unknownAncestors,
Map<String, List<MtasParserObject>> currentList,
Map<String, Map<Integer, Set<String>>> updateList,
Map<String, Set<Integer>> idPositions, Map<String, Integer[]> idOffsets)
throws MtasParserException, MtasConfigException {
for (MtasParserObject previousObject : previous) {
previousObject.setRealOffsetEnd(currentOffset);
idPositions.put(previousObject.getId(), previousObject.getPositions());
idOffsets.put(previousObject.getId(), previousObject.getOffset());
previousObject.updateMappings(idPositions, idOffsets);
unknownAncestors.unknown = previousObject.getUnknownAncestorNumber();
computeMappingsFromObject(mtasTokenIdFactory, previousObject, currentList,
updateList);
currentList.get(MAPPING_TYPE_GROUP).remove(previousObject);
}
} | java |
private void processFunctions(String name, String text, String type,
List<MtasCRMParserFunctionOutput> functionOutputList) {
if (functions.containsKey(type) && functions.get(type).containsKey(name)
&& text != null) {
MtasCRMParserFunction function = functions.get(type).get(name);
String[] value;
if (function.split != null) {
value = text.split(Pattern.quote(function.split));
} else {
value = new String[] { text };
}
for (int c = 0; c < value.length; c++) {
boolean checkedEmpty = false;
if (value[c].equals("")) {
checkedEmpty = true;
}
if (function.output.containsKey(value[c])) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output
.get(value[c]);
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c]));
}
}
if (!checkedEmpty && function.output.containsKey("")) {
ArrayList<MtasCRMParserFunctionOutput> list = function.output.get("");
for (MtasCRMParserFunctionOutput listItem : list) {
functionOutputList.add(listItem.create(value[c]));
}
}
}
}
} | java |
private String printConfigTypes(
HashMap<?, MtasParserType<MtasParserMapping<?>>> types) {
StringBuilder text = new StringBuilder();
for (Entry<?, MtasParserType<MtasParserMapping<?>>> entry : types
.entrySet()) {
text.append("- " + entry.getKey() + ": " + entry.getValue().items.size()
+ " mapping(s)\n");
for (int i = 0; i < entry.getValue().items.size(); i++) {
text.append("\t" + entry.getValue().items.get(i) + "\n");
}
}
return text.toString();
} | java |
public int getMinStartPosition(int docId, int position) throws IOException {
if (ignoreSpans != null && docId == currentDocId) {
if (position < minimumPosition) {
throw new IOException(
"Unexpected position, should be >= " + minimumPosition + "!");
} else {
computeFullStartPositionMinimum(position);
if (minFullStartPosition.containsKey(position)) {
return minFullStartPosition.get(position);
} else {
return 0;
}
}
} else {
return 0;
}
} | java |
public int getMaxEndPosition(int docId, int position) throws IOException {
if (ignoreSpans != null && docId == currentDocId) {
if (position < minimumPosition) {
throw new IOException(
"Unexpected position, should be >= " + minimumPosition + "!");
}
computeFullEndPositionList(position);
if (maxFullEndPosition.containsKey(position)) {
return maxFullEndPosition.get(position);
} else {
return 0;
}
} else {
return 0;
}
} | java |
public Set<Integer> getFullEndPositionList(int docId, int position)
throws IOException {
if (ignoreSpans != null && docId == currentDocId) {
if (position < minimumPosition) {
throw new IOException(
"Unexpected startPosition, should be >= " + minimumPosition + "!");
} else {
computeFullEndPositionList(position);
return fullEndPositionList.get(position);
}
} else {
return null;
}
} | java |
private void computeFullStartPositionMinimum(int position)
throws IOException {
if (ignoreSpans != null && !minFullStartPosition.containsKey(position)) {
HashSet<Integer> list = baseStartPositionList.get(position);
HashSet<Integer> newList = new HashSet<>();
int minimumStartPosition = position;
while (list != null && !list.isEmpty()) {
newList.clear();
for (int startPosition : list) {
if (minFullStartPosition.containsKey(startPosition)) {
minimumStartPosition = Math.min(minimumStartPosition,
minFullStartPosition.get(startPosition));
} else if (baseStartPositionList.containsKey(startPosition)) {
newList.addAll(baseStartPositionList.get(startPosition));
} else {
if (startPosition < minimumStartPosition) {
minimumStartPosition = startPosition;
}
}
}
list.clear();
list.addAll(newList);
}
minFullStartPosition.put(position, minimumStartPosition);
}
} | java |
private void computeFullEndPositionList(int position) throws IOException {
if (ignoreSpans != null && !fullEndPositionList.containsKey(position)) {
// initial fill
moveTo(position);
HashSet<Integer> list = baseEndPositionList.get(position);
if (list != null && !list.isEmpty()) {
int maxEndPosition = maxBaseEndPosition.get(position);
HashSet<Integer> checkList = new HashSet<>();
HashSet<Integer> subCheckList = new HashSet<>();
checkList.addAll(list);
int depth = 1;
while (!checkList.isEmpty()) {
if (depth > maximumIgnoreLength) {
checkList.clear();
subCheckList.clear();
throw new IOException("too many successive ignores, maximum is "
+ maximumIgnoreLength);
} else {
for (Integer checkItem : checkList) {
if (fullEndPositionList.get(checkItem) != null) {
list.addAll(fullEndPositionList.get(checkItem));
maxEndPosition = Math.max(maxEndPosition,
maxFullEndPosition.get(checkItem));
} else {
moveTo(checkItem);
if (baseEndPositionList.containsKey(checkItem)) {
list.addAll(baseEndPositionList.get(checkItem));
maxEndPosition = Math.max(maxEndPosition,
maxBaseEndPosition.get(checkItem));
subCheckList.addAll(baseEndPositionList.get(checkItem));
} else {
// ready for checkItem
}
}
}
checkList.clear();
checkList.addAll(subCheckList);
subCheckList.clear();
depth++;
}
}
fullEndPositionList.put(position, list);
maxFullEndPosition.put(position, (maxEndPosition - position));
} else {
fullEndPositionList.put(position, null);
maxFullEndPosition.put(position, 0);
}
}
} | java |
private void moveTo(int position) {
while (position >= currentPosition) {
try {
currentPosition = ignoreSpans.nextStartPosition();
if (currentPosition != Spans.NO_MORE_POSITIONS
&& currentPosition >= minimumPosition) {
if (!baseEndPositionList.containsKey(currentPosition)) {
baseEndPositionList.put(currentPosition, new HashSet<Integer>());
maxBaseEndPosition.put(currentPosition, currentPosition);
} else {
maxBaseEndPosition.put(currentPosition,
Math.max(maxBaseEndPosition.get(currentPosition),
ignoreSpans.endPosition()));
}
if (!baseStartPositionList.containsKey(ignoreSpans.endPosition())) {
baseStartPositionList.put(ignoreSpans.endPosition(),
new HashSet<Integer>());
minBaseStartPosition.put(ignoreSpans.endPosition(),
ignoreSpans.endPosition());
} else {
minBaseStartPosition.put(ignoreSpans.endPosition(),
Math.min(minBaseStartPosition.get(ignoreSpans.endPosition()),
currentPosition));
}
baseStartPositionList.get(ignoreSpans.endPosition())
.add(currentPosition);
baseEndPositionList.get(currentPosition)
.add(ignoreSpans.endPosition());
}
} catch (IOException e) {
log.debug(e);
currentPosition = Spans.NO_MORE_POSITIONS;
break;
}
}
} | java |
public void removeBefore(int docId, int position) {
if (ignoreSpans != null && docId == currentDocId) {
baseStartPositionList.entrySet()
.removeIf(entry -> entry.getKey() < position);
baseEndPositionList.entrySet()
.removeIf(entry -> entry.getKey() < position);
fullEndPositionList.entrySet()
.removeIf(entry -> entry.getKey() < position);
minBaseStartPosition.entrySet()
.removeIf(entry -> entry.getKey() < position);
maxBaseEndPosition.entrySet()
.removeIf(entry -> entry.getKey() < position);
minFullStartPosition.entrySet()
.removeIf(entry -> entry.getKey() < position);
maxFullEndPosition.entrySet()
.removeIf(entry -> entry.getKey() < position);
if (minimumPosition < position) {
minimumPosition = position;
}
if (currentPosition < position) {
currentPosition = position;
}
}
} | java |
public static vpnvserver_authenticationlocalpolicy_binding[] get(nitro_service service, String name) throws Exception{
vpnvserver_authenticationlocalpolicy_binding obj = new vpnvserver_authenticationlocalpolicy_binding();
obj.set_name(name);
vpnvserver_authenticationlocalpolicy_binding response[] = (vpnvserver_authenticationlocalpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, gslbvserver resource) throws Exception {
gslbvserver addresource = new gslbvserver();
addresource.name = resource.name;
addresource.servicetype = resource.servicetype;
addresource.iptype = resource.iptype;
addresource.dnsrecordtype = resource.dnsrecordtype;
addresource.lbmethod = resource.lbmethod;
addresource.backupsessiontimeout = resource.backupsessiontimeout;
addresource.backuplbmethod = resource.backuplbmethod;
addresource.netmask = resource.netmask;
addresource.v6netmasklen = resource.v6netmasklen;
addresource.tolerance = resource.tolerance;
addresource.persistencetype = resource.persistencetype;
addresource.persistenceid = resource.persistenceid;
addresource.persistmask = resource.persistmask;
addresource.v6persistmasklen = resource.v6persistmasklen;
addresource.timeout = resource.timeout;
addresource.edr = resource.edr;
addresource.mir = resource.mir;
addresource.disableprimaryondown = resource.disableprimaryondown;
addresource.dynamicweight = resource.dynamicweight;
addresource.state = resource.state;
addresource.considereffectivestate = resource.considereffectivestate;
addresource.comment = resource.comment;
addresource.somethod = resource.somethod;
addresource.sopersistence = resource.sopersistence;
addresource.sopersistencetimeout = resource.sopersistencetimeout;
addresource.sothreshold = resource.sothreshold;
addresource.sobackupaction = resource.sobackupaction;
addresource.appflowlog = resource.appflowlog;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, gslbvserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
gslbvserver addresources[] = new gslbvserver[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new gslbvserver();
addresources[i].name = resources[i].name;
addresources[i].servicetype = resources[i].servicetype;
addresources[i].iptype = resources[i].iptype;
addresources[i].dnsrecordtype = resources[i].dnsrecordtype;
addresources[i].lbmethod = resources[i].lbmethod;
addresources[i].backupsessiontimeout = resources[i].backupsessiontimeout;
addresources[i].backuplbmethod = resources[i].backuplbmethod;
addresources[i].netmask = resources[i].netmask;
addresources[i].v6netmasklen = resources[i].v6netmasklen;
addresources[i].tolerance = resources[i].tolerance;
addresources[i].persistencetype = resources[i].persistencetype;
addresources[i].persistenceid = resources[i].persistenceid;
addresources[i].persistmask = resources[i].persistmask;
addresources[i].v6persistmasklen = resources[i].v6persistmasklen;
addresources[i].timeout = resources[i].timeout;
addresources[i].edr = resources[i].edr;
addresources[i].mir = resources[i].mir;
addresources[i].disableprimaryondown = resources[i].disableprimaryondown;
addresources[i].dynamicweight = resources[i].dynamicweight;
addresources[i].state = resources[i].state;
addresources[i].considereffectivestate = resources[i].considereffectivestate;
addresources[i].comment = resources[i].comment;
addresources[i].somethod = resources[i].somethod;
addresources[i].sopersistence = resources[i].sopersistence;
addresources[i].sopersistencetimeout = resources[i].sopersistencetimeout;
addresources[i].sothreshold = resources[i].sothreshold;
addresources[i].sobackupaction = resources[i].sobackupaction;
addresources[i].appflowlog = resources[i].appflowlog;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response update(nitro_service client, gslbvserver resource) throws Exception {
gslbvserver updateresource = new gslbvserver();
updateresource.name = resource.name;
updateresource.iptype = resource.iptype;
updateresource.dnsrecordtype = resource.dnsrecordtype;
updateresource.backupvserver = resource.backupvserver;
updateresource.backupsessiontimeout = resource.backupsessiontimeout;
updateresource.lbmethod = resource.lbmethod;
updateresource.backuplbmethod = resource.backuplbmethod;
updateresource.netmask = resource.netmask;
updateresource.v6netmasklen = resource.v6netmasklen;
updateresource.tolerance = resource.tolerance;
updateresource.persistencetype = resource.persistencetype;
updateresource.persistenceid = resource.persistenceid;
updateresource.persistmask = resource.persistmask;
updateresource.v6persistmasklen = resource.v6persistmasklen;
updateresource.timeout = resource.timeout;
updateresource.edr = resource.edr;
updateresource.mir = resource.mir;
updateresource.disableprimaryondown = resource.disableprimaryondown;
updateresource.dynamicweight = resource.dynamicweight;
updateresource.considereffectivestate = resource.considereffectivestate;
updateresource.somethod = resource.somethod;
updateresource.sopersistence = resource.sopersistence;
updateresource.sopersistencetimeout = resource.sopersistencetimeout;
updateresource.sothreshold = resource.sothreshold;
updateresource.sobackupaction = resource.sobackupaction;
updateresource.servicename = resource.servicename;
updateresource.weight = resource.weight;
updateresource.domainname = resource.domainname;
updateresource.ttl = resource.ttl;
updateresource.backupip = resource.backupip;
updateresource.cookie_domain = resource.cookie_domain;
updateresource.cookietimeout = resource.cookietimeout;
updateresource.sitedomainttl = resource.sitedomainttl;
updateresource.comment = resource.comment;
updateresource.appflowlog = resource.appflowlog;
return updateresource.update_resource(client);
} | java |
public static base_responses disable(nitro_service client, String name[]) throws Exception {
base_responses result = null;
if (name != null && name.length > 0) {
gslbvserver disableresources[] = new gslbvserver[name.length];
for (int i=0;i<name.length;i++){
disableresources[i] = new gslbvserver();
disableresources[i].name = name[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} | java |
public static gslbvserver[] get(nitro_service service) throws Exception{
gslbvserver obj = new gslbvserver();
gslbvserver[] response = (gslbvserver[])obj.get_resources(service);
return response;
} | java |
public static gslbvserver get(nitro_service service, String name) throws Exception{
gslbvserver obj = new gslbvserver();
obj.set_name(name);
gslbvserver response = (gslbvserver) obj.get_resource(service);
return response;
} | java |
public static base_response add(nitro_service client, transformprofile resource) throws Exception {
transformprofile addresource = new transformprofile();
addresource.name = resource.name;
addresource.type = resource.type;
return addresource.add_resource(client);
} | java |
public static base_response update(nitro_service client, transformprofile resource) throws Exception {
transformprofile updateresource = new transformprofile();
updateresource.name = resource.name;
updateresource.type = resource.type;
updateresource.onlytransformabsurlinbody = resource.onlytransformabsurlinbody;
updateresource.comment = resource.comment;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, transformprofile resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
transformprofile updateresources[] = new transformprofile[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new transformprofile();
updateresources[i].name = resources[i].name;
updateresources[i].type = resources[i].type;
updateresources[i].onlytransformabsurlinbody = resources[i].onlytransformabsurlinbody;
updateresources[i].comment = resources[i].comment;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static transformprofile[] get(nitro_service service) throws Exception{
transformprofile obj = new transformprofile();
transformprofile[] response = (transformprofile[])obj.get_resources(service);
return response;
} | java |
public static transformprofile get(nitro_service service, String name) throws Exception{
transformprofile obj = new transformprofile();
obj.set_name(name);
transformprofile response = (transformprofile) obj.get_resource(service);
return response;
} | java |
public static appfwpolicy_appfwpolicylabel_binding[] get(nitro_service service, String name) throws Exception{
appfwpolicy_appfwpolicylabel_binding obj = new appfwpolicy_appfwpolicylabel_binding();
obj.set_name(name);
appfwpolicy_appfwpolicylabel_binding response[] = (appfwpolicy_appfwpolicylabel_binding[]) obj.get_resources(service);
return response;
} | java |
public static nsversion get(nitro_service service) throws Exception{
nsversion obj = new nsversion();
nsversion[] response = (nsversion[])obj.get_resources(service);
return response[0];
} | java |
public static sc_stats get(nitro_service service) throws Exception{
sc_stats obj = new sc_stats();
sc_stats[] response = (sc_stats[])obj.stat_resources(service);
return response[0];
} | java |
public static base_response create(nitro_service client, sslwrapkey resource) throws Exception {
sslwrapkey createresource = new sslwrapkey();
createresource.wrapkeyname = resource.wrapkeyname;
createresource.password = resource.password;
createresource.salt = resource.salt;
return createresource.perform_operation(client,"create");
} | java |
public static base_responses create(nitro_service client, sslwrapkey resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslwrapkey createresources[] = new sslwrapkey[resources.length];
for (int i=0;i<resources.length;i++){
createresources[i] = new sslwrapkey();
createresources[i].wrapkeyname = resources[i].wrapkeyname;
createresources[i].password = resources[i].password;
createresources[i].salt = resources[i].salt;
}
result = perform_operation_bulk_request(client, createresources,"create");
}
return result;
} | java |
public static base_response delete(nitro_service client, String wrapkeyname) throws Exception {
sslwrapkey deleteresource = new sslwrapkey();
deleteresource.wrapkeyname = wrapkeyname;
return deleteresource.delete_resource(client);
} | java |
public static base_responses delete(nitro_service client, String wrapkeyname[]) throws Exception {
base_responses result = null;
if (wrapkeyname != null && wrapkeyname.length > 0) {
sslwrapkey deleteresources[] = new sslwrapkey[wrapkeyname.length];
for (int i=0;i<wrapkeyname.length;i++){
deleteresources[i] = new sslwrapkey();
deleteresources[i].wrapkeyname = wrapkeyname[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static sslwrapkey[] get(nitro_service service) throws Exception{
sslwrapkey obj = new sslwrapkey();
sslwrapkey[] response = (sslwrapkey[])obj.get_resources(service);
return response;
} | java |
public static int min(int a, int b, int c) {
int mi;
mi = a;
if (b < mi) {
mi = b;
}
if (c < mi) {
mi = c;
}
return mi;
} | java |
public static double exactBinomial(int k, int n, double p) {
double total = 0.0;
for (int m = k; m <= n; m++) {
double nChooseM = 1.0;
for (int r = 1; r <= m; r++) {
nChooseM *= (n - r) + 1;
nChooseM /= r;
}
// System.out.println(n + " choose " + m + " is " + nChooseM);
// System.out.println("prob contribution is " +
// (nChooseM * Math.pow(p, m) * Math.pow(1.0-p, n - m)));
total += nChooseM * Math.pow(p, m) * Math.pow(1.0 - p, n - m);
}
return total;
} | java |
public static double factorial(int x) {
double result = 1.0;
for (int i=x; i>1; i--) {
result *= i;
}
return result;
} | java |
public static base_response add(nitro_service client, dnsaction64 resource) throws Exception {
dnsaction64 addresource = new dnsaction64();
addresource.actionname = resource.actionname;
addresource.prefix = resource.prefix;
addresource.mappedrule = resource.mappedrule;
addresource.excluderule = resource.excluderule;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, dnsaction64 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction64 addresources[] = new dnsaction64[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnsaction64();
addresources[i].actionname = resources[i].actionname;
addresources[i].prefix = resources[i].prefix;
addresources[i].mappedrule = resources[i].mappedrule;
addresources[i].excluderule = resources[i].excluderule;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, String actionname) throws Exception {
dnsaction64 deleteresource = new dnsaction64();
deleteresource.actionname = actionname;
return deleteresource.delete_resource(client);
} | java |
public static base_response update(nitro_service client, dnsaction64 resource) throws Exception {
dnsaction64 updateresource = new dnsaction64();
updateresource.actionname = resource.actionname;
updateresource.prefix = resource.prefix;
updateresource.mappedrule = resource.mappedrule;
updateresource.excluderule = resource.excluderule;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, dnsaction64 resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction64 updateresources[] = new dnsaction64[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnsaction64();
updateresources[i].actionname = resources[i].actionname;
updateresources[i].prefix = resources[i].prefix;
updateresources[i].mappedrule = resources[i].mappedrule;
updateresources[i].excluderule = resources[i].excluderule;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static base_responses unset(nitro_service client, dnsaction64 resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnsaction64 unsetresources[] = new dnsaction64[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new dnsaction64();
unsetresources[i].actionname = resources[i].actionname;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java |
public static dnsaction64[] get(nitro_service service) throws Exception{
dnsaction64 obj = new dnsaction64();
dnsaction64[] response = (dnsaction64[])obj.get_resources(service);
return response;
} | java |
public static dnsaction64 get(nitro_service service, String actionname) throws Exception{
dnsaction64 obj = new dnsaction64();
obj.set_actionname(actionname);
dnsaction64 response = (dnsaction64) obj.get_resource(service);
return response;
} | java |
public static dnsaction64[] get(nitro_service service, String actionname[]) throws Exception{
if (actionname !=null && actionname.length>0) {
dnsaction64 response[] = new dnsaction64[actionname.length];
dnsaction64 obj[] = new dnsaction64[actionname.length];
for (int i=0;i<actionname.length;i++) {
obj[i] = new dnsaction64();
obj[i].set_actionname(actionname[i]);
response[i] = (dnsaction64) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static vpnsessionpolicy_aaagroup_binding[] get(nitro_service service, String name) throws Exception{
vpnsessionpolicy_aaagroup_binding obj = new vpnsessionpolicy_aaagroup_binding();
obj.set_name(name);
vpnsessionpolicy_aaagroup_binding response[] = (vpnsessionpolicy_aaagroup_binding[]) obj.get_resources(service);
return response;
} | java |
public TreeReaderFactory treeReaderFactory() {
return new TreeReaderFactory() {
public TreeReader newTreeReader(Reader in) {
return new PennTreeReader(in, new LabeledScoredTreeFactory(), new NPTmpRetainingTreeNormalizer(englishTrain.splitTMP, englishTrain.splitSGapped == 5, englishTrain.leaveItAll, englishTrain.splitNPADV >= 1, headFinder()));
}
};
} | java |
private static String deduceTag(String w) {
String word = w.toLowerCase();
if (word.endsWith("ing")) {
return "VBG";
} else if (word.endsWith("d") || word.endsWith("t")) {
return "VBN";
} else if (word.endsWith("s")) {
return "VBZ";
} else if (word.equals("to")) {
return "TO";
} else {
return "VB";
}
} | java |
private boolean collectAndCheckLastSpans(int nextSpans1StartPosition,
int nextSpans1EndPosition) throws IOException {
// check next
if (nextSpans1StartPosition == nextSpans2StartPosition
&& nextSpans1EndPosition == nextSpans2EndPosition) {
return false;
}
// check last
if (nextSpans1StartPosition == lastSpans2StartPosition
&& (nextSpans1EndPosition == lastSpans2EndPosition
|| lastSpans2EndPositions.contains(nextSpans1EndPosition))) {
return false;
}
// collect
if (nextSpans1StartPosition == nextSpans2StartPosition) {
// reset
if (nextSpans2StartPosition != lastSpans2StartPosition) {
lastSpans2StartPosition = nextSpans2StartPosition;
lastSpans2EndPosition = -1;
lastSpans2EndPositions.clear();
}
while (nextSpans1StartPosition == nextSpans2StartPosition) {
if (lastSpans2EndPosition > -1) {
lastSpans2EndPositions.add(lastSpans2EndPosition);
}
lastSpans2EndPosition = nextSpans2EndPosition;
nextSpans2StartPosition = spans2.spans.nextStartPosition();
nextSpans2EndPosition = spans2.spans.endPosition();
if (nextSpans1StartPosition == nextSpans2StartPosition
&& nextSpans1EndPosition == nextSpans2EndPosition) {
return false;
}
}
}
return true;
} | java |
public static base_response add(nitro_service client, vpnnexthopserver resource) throws Exception {
vpnnexthopserver addresource = new vpnnexthopserver();
addresource.name = resource.name;
addresource.nexthopip = resource.nexthopip;
addresource.nexthopport = resource.nexthopport;
addresource.secure = resource.secure;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, vpnnexthopserver resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnnexthopserver addresources[] = new vpnnexthopserver[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new vpnnexthopserver();
addresources[i].name = resources[i].name;
addresources[i].nexthopip = resources[i].nexthopip;
addresources[i].nexthopport = resources[i].nexthopport;
addresources[i].secure = resources[i].secure;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static vpnnexthopserver[] get(nitro_service service) throws Exception{
vpnnexthopserver obj = new vpnnexthopserver();
vpnnexthopserver[] response = (vpnnexthopserver[])obj.get_resources(service);
return response;
} | java |
public static vpnnexthopserver get(nitro_service service, String name) throws Exception{
vpnnexthopserver obj = new vpnnexthopserver();
obj.set_name(name);
vpnnexthopserver response = (vpnnexthopserver) obj.get_resource(service);
return response;
} | java |
public static lbvserver_csvserver_binding[] get(nitro_service service, String name) throws Exception{
lbvserver_csvserver_binding obj = new lbvserver_csvserver_binding();
obj.set_name(name);
lbvserver_csvserver_binding response[] = (lbvserver_csvserver_binding[]) obj.get_resources(service);
return response;
} | java |
public static nstrafficdomain_vlan_binding[] get(nitro_service service, Long td) throws Exception{
nstrafficdomain_vlan_binding obj = new nstrafficdomain_vlan_binding();
obj.set_td(td);
nstrafficdomain_vlan_binding response[] = (nstrafficdomain_vlan_binding[]) obj.get_resources(service);
return response;
} | java |
private Entry<E> getEntry(int index) {
Entry<E> entry = indexToEntry.get(index);
return entry;
} | java |
public boolean add(E key, double priority) {
// System.err.println("Adding " + key + " with priority " + priority);
if (add(key)) {
relaxPriority(key, priority);
return true;
}
return false;
} | java |
public boolean relaxPriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) <= 0) {
return false;
}
entry.priority = priority;
heapifyUp(entry);
return true;
} | java |
public boolean decreasePriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) >= 0) {
return false;
}
entry.priority = priority;
heapifyDown(entry);
return true;
} | java |
public boolean changePriority(E key, double priority) {
Entry<E> entry = getEntry(key);
if (entry == null) {
entry = makeEntry(key);
}
if (compare(priority, entry.priority) == 0) {
return false;
}
entry.priority = priority;
heapify(entry);
return true;
} | java |
public static base_response add(nitro_service client, location resource) throws Exception {
location addresource = new location();
addresource.ipfrom = resource.ipfrom;
addresource.ipto = resource.ipto;
addresource.preferredlocation = resource.preferredlocation;
addresource.longitude = resource.longitude;
addresource.latitude = resource.latitude;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, location resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
location addresources[] = new location[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new location();
addresources[i].ipfrom = resources[i].ipfrom;
addresources[i].ipto = resources[i].ipto;
addresources[i].preferredlocation = resources[i].preferredlocation;
addresources[i].longitude = resources[i].longitude;
addresources[i].latitude = resources[i].latitude;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, String ipfrom) throws Exception {
location deleteresource = new location();
deleteresource.ipfrom = ipfrom;
return deleteresource.delete_resource(client);
} | java |
public static base_response delete(nitro_service client, location resource) throws Exception {
location deleteresource = new location();
deleteresource.ipfrom = resource.ipfrom;
deleteresource.ipto = resource.ipto;
return deleteresource.delete_resource(client);
} | java |
public static base_responses delete(nitro_service client, String ipfrom[]) throws Exception {
base_responses result = null;
if (ipfrom != null && ipfrom.length > 0) {
location deleteresources[] = new location[ipfrom.length];
for (int i=0;i<ipfrom.length;i++){
deleteresources[i] = new location();
deleteresources[i].ipfrom = ipfrom[i];
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static base_responses delete(nitro_service client, location resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
location deleteresources[] = new location[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new location();
deleteresources[i].ipfrom = resources[i].ipfrom;
deleteresources[i].ipto = resources[i].ipto;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java |
public static location[] get(nitro_service service) throws Exception{
location obj = new location();
location[] response = (location[])obj.get_resources(service);
return response;
} | java |
public static location get(nitro_service service, String ipfrom) throws Exception{
location obj = new location();
obj.set_ipfrom(ipfrom);
location response = (location) obj.get_resource(service);
return response;
} | java |
public static location[] get(nitro_service service, String ipfrom[]) throws Exception{
if (ipfrom !=null && ipfrom.length>0) {
location response[] = new location[ipfrom.length];
location obj[] = new location[ipfrom.length];
for (int i=0;i<ipfrom.length;i++) {
obj[i] = new location();
obj[i].set_ipfrom(ipfrom[i]);
response[i] = (location) obj[i].get_resource(service);
}
return response;
}
return null;
} | java |
public static location[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception{
location obj = new location();
options option = new options();
option.set_filter(filter);
location[] response = (location[]) obj.getfiltered(service, option);
return response;
} | java |
@SuppressWarnings("unchecked")
private void mergeNamedList(ShardRequest sreq, NamedList<Object> mtasResponse, String key,
Integer preferredPurpose) {
// create new response for key
NamedList<Object> mtasListResponse;
Object o = mtasResponse.get(key);
if (o instanceof NamedList) {
mtasListResponse = (NamedList<Object>) o;
} else {
mtasListResponse = new SimpleOrderedMap<>();
mtasResponse.removeAll(key);
mtasResponse.add(key, mtasListResponse);
}
// collect responses for each shard
HashMap<String, NamedList<Object>> mtasListShardResponses = new HashMap<>();
for (ShardResponse response : sreq.responses) {
// only continue if new shard or preferred purpose
if (mtasListShardResponses.containsKey(response.getShard())
&& ((preferredPurpose == null) || (sreq.purpose != preferredPurpose))) {
break;
}
// update
try {
NamedList<Object> result = response.getSolrResponse().getResponse();
NamedList<Object> data = (NamedList<Object>) result.findRecursive("mtas", key);
if (data != null) {
mtasListShardResponses.put(response.getShard(), MtasSolrResultUtil.decode(data));
}
} catch (ClassCastException e) {
log.debug(e);
}
}
try {
for (NamedList<Object> mtasListShardResponse : mtasListShardResponses.values()) {
mergeResponsesNamedList(mtasListResponse, mtasListShardResponse);
}
} catch (IOException e) {
log.error(e);
}
} | java |
@SuppressWarnings("unchecked")
private void mergeArrayList(ShardRequest sreq, NamedList<Object> mtasResponse, String key, Integer preferredPurpose,
boolean mergeAllShardResponses) {
// create new response for key
ArrayList<Object> mtasListResponse;
Object o = mtasResponse.get(key);
if (o instanceof ArrayList) {
mtasListResponse = (ArrayList<Object>) o;
} else {
mtasListResponse = new ArrayList<>();
mtasResponse.removeAll(key);
mtasResponse.add(key, mtasListResponse);
}
// collect responses for each shard
HashMap<String, ArrayList<Object>> mtasListShardResponses = new HashMap<>();
ArrayList<ArrayList<Object>> mtasListShardResponsesExtra = new ArrayList<>();
for (ShardResponse response : sreq.responses) {
// only continue if new shard or preferred purpose
if (mtasListShardResponses.containsKey(response.getShard())
&& ((preferredPurpose == null) || (sreq.purpose != preferredPurpose))) {
break;
}
// update
try {
NamedList<Object> result = response.getSolrResponse().getResponse();
ArrayList<Object> data = (ArrayList<Object>) result.findRecursive("mtas", key);
if (data != null) {
if (mtasListShardResponses.containsKey(response.getShardAddress())) {
if (mergeAllShardResponses) {
mtasListShardResponsesExtra.add(data);
}
} else {
mtasListShardResponses.put(response.getShardAddress(), data);
}
}
} catch (ClassCastException e) {
log.error(e);
}
}
try {
for (ArrayList<Object> mtasListShardResponse : mtasListShardResponses.values()) {
mergeResponsesArrayList(mtasListResponse, mtasListShardResponse);
}
for (ArrayList<Object> mtasListShardResponse : mtasListShardResponsesExtra) {
mergeResponsesArrayList(mtasListResponse, mtasListShardResponse);
}
} catch (IOException e) {
log.error(e);
}
} | java |
private void mergeResponsesSortedSet(SortedSet<Object> originalList, SortedSet<Object> shardList) {
for (Object item : shardList) {
originalList.add(item);
}
} | java |
@SuppressWarnings("unchecked")
private void mergeResponsesArrayList(ArrayList<Object> originalList, ArrayList<Object> shardList)
throws IOException {
// get keys from original
HashMap<String, Object> originalKeyList = new HashMap<>();
for (Object item : originalList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
if ((key != null) && (key instanceof String)) {
originalKeyList.put((String) key, item);
}
}
}
for (Object item : shardList) {
if (item instanceof NamedList<?>) {
NamedList<Object> itemList = (NamedList<Object>) item;
Object key = itemList.get("key");
// item with key
if ((key != null) && (key instanceof String)) {
// merge
if (originalKeyList.containsKey(key)) {
Object originalItem = originalKeyList.get(key);
if (originalItem.getClass().equals(item.getClass())) {
mergeResponsesNamedList((NamedList<Object>) originalItem, (NamedList<Object>) item);
} else {
// ignore?
}
// add
} else {
Object clonedItem = adjustablePartsCloned(item);
originalList.add(clonedItem);
originalKeyList.put((String) key, clonedItem);
}
} else {
originalList.add(item);
}
} else {
originalList.add(item);
}
}
} | java |
@SuppressWarnings({ "rawtypes", "unchecked" })
private void mergeResponsesNamedList(NamedList<Object> mainResponse, NamedList<Object> shardResponse)
throws IOException {
Iterator<Entry<String, Object>> it = shardResponse.iterator();
while (it.hasNext()) {
Entry<String, Object> entry = it.next();
String name = entry.getKey();
Object shardValue = entry.getValue();
int originalId = mainResponse.indexOf(name, 0);
if (originalId < 0) {
mainResponse.add(name, adjustablePartsCloned(shardValue));
} else {
Object original = mainResponse.getVal(originalId);
if (original == null) {
original = adjustablePartsCloned(shardValue);
} else if (shardValue != null && original.getClass().equals(shardValue.getClass())) {
// merge ArrayList
if (original instanceof ArrayList) {
ArrayList originalList = (ArrayList) original;
ArrayList shardList = (ArrayList) shardValue;
mergeResponsesArrayList(originalList, shardList);
// merge Namedlist
} else if (original instanceof NamedList<?>) {
mergeResponsesNamedList((NamedList<Object>) original, (NamedList<Object>) shardValue);
// merge SortedSet
} else if (original instanceof SortedSet<?>) {
mergeResponsesSortedSet((SortedSet<Object>) original, (SortedSet<Object>) shardValue);
} else if (original instanceof MtasSolrMtasResult) {
MtasSolrMtasResult originalComponentResult = (MtasSolrMtasResult) original;
originalComponentResult.merge((MtasSolrMtasResult) shardValue);
} else if (original instanceof MtasSolrCollectionResult) {
MtasSolrCollectionResult originalComponentResult = (MtasSolrCollectionResult) original;
originalComponentResult.merge((MtasSolrCollectionResult) shardValue);
} else if (original instanceof String) {
// ignore?
} else if (original instanceof Integer) {
original = (Integer) original + ((Integer) shardValue);
} else if (original instanceof Long) {
original = (Long) original + ((Long) shardValue);
} else {
// ignore?
}
mainResponse.setVal(originalId, original);
} else {
// ignore?
}
}
}
} | java |
@SuppressWarnings({ "rawtypes", "unchecked" })
private Object adjustablePartsCloned(Object original) {
if (original instanceof NamedList) {
NamedList<Object> newObject = new SimpleOrderedMap();
NamedList<Object> originalObject = (NamedList<Object>) original;
for (int i = 0; i < originalObject.size(); i++) {
newObject.add(originalObject.getName(i), adjustablePartsCloned(originalObject.getVal(i)));
}
return newObject;
} else if (original instanceof ArrayList) {
ArrayList<Object> newObject = new ArrayList<>();
ArrayList<Object> originalObject = (ArrayList<Object>) original;
for (int i = 0; i < originalObject.size(); i++) {
newObject.add(adjustablePartsCloned(originalObject.get(i)));
}
return newObject;
} else if (original instanceof Integer) {
return original;
}
return original;
} | java |
public static sslcertkey_service_binding[] get(nitro_service service, String certkey) throws Exception{
sslcertkey_service_binding obj = new sslcertkey_service_binding();
obj.set_certkey(certkey);
sslcertkey_service_binding response[] = (sslcertkey_service_binding[]) obj.get_resources(service);
return response;
} | java |
public static csvserver_responderpolicy_binding[] get(nitro_service service, String name) throws Exception{
csvserver_responderpolicy_binding obj = new csvserver_responderpolicy_binding();
obj.set_name(name);
csvserver_responderpolicy_binding response[] = (csvserver_responderpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
@SuppressWarnings("unchecked")
public <GR extends GrammaticalRelationAnnotation> boolean addArc(Class<GR> arcLabel, TreeGraphNode node) {
if (node == null) {
return false;
}
if (!treeGraph().equals(node.treeGraph())) {
System.err.println("Warning: you are trying to add an arc from node " + this + " to node " + node + ", but they do not belong to the same TreeGraph!");
}
if (!label.containsKey(arcLabel)) {
label.set(arcLabel, new HashSet<TreeGraphNode>());
}
return ((Collection) label.get(arcLabel)).add(node);
} | java |
public Set<Dependency<Label, Label, Object>> dependencies(Filter<Dependency<Label, Label, Object>> f, HeadFinder hf) {
Set<Dependency<Label, Label, Object>> deps = Generics.newHashSet();
for (Tree t : this) {
TreeGraphNode node = safeCast(t);
if (node == null || node.isLeaf() || node.children().length < 2) {
continue;
}
TreeGraphNode headWordNode;
if (hf != null) {
headWordNode = safeCast(node.headTerminal(hf));
} else {
headWordNode = node.headWordNode();
}
for (Tree k : node.children()) {
TreeGraphNode kid = safeCast(k);
if (kid == null) {
continue;
}
TreeGraphNode kidHeadWordNode;
if (hf != null) {
kidHeadWordNode = safeCast(kid.headTerminal(hf));
} else {
kidHeadWordNode = kid.headWordNode();
}
if (headWordNode != null && headWordNode != kidHeadWordNode && kidHeadWordNode != null) {
int headWordNodeIndex = headWordNode.index();
int kidHeadWordNodeIndex = kidHeadWordNode.index();
// If the two indices are equal, then the leaves haven't been indexed. Just return an ordinary
// UnnamedDependency. This mirrors the implementation of super.dependencies().
Dependency<Label, Label, Object> d = (headWordNodeIndex == kidHeadWordNodeIndex) ?
new UnnamedDependency(headWordNode, kidHeadWordNode) :
new UnnamedConcreteDependency(headWordNode, headWordNodeIndex, kidHeadWordNode, kidHeadWordNodeIndex);
if (f.accept(d)) {
deps.add(d);
}
}
}
}
return deps;
} | java |
public static systemglobal_auditsyslogpolicy_binding[] get(nitro_service service) throws Exception{
systemglobal_auditsyslogpolicy_binding obj = new systemglobal_auditsyslogpolicy_binding();
systemglobal_auditsyslogpolicy_binding response[] = (systemglobal_auditsyslogpolicy_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, streamidentifier resource) throws Exception {
streamidentifier addresource = new streamidentifier();
addresource.name = resource.name;
addresource.selectorname = resource.selectorname;
addresource.interval = resource.interval;
addresource.samplecount = resource.samplecount;
addresource.sort = resource.sort;
return addresource.add_resource(client);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.