code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
public static responderaction get(nitro_service service, String name) throws Exception{
responderaction obj = new responderaction();
obj.set_name(name);
responderaction response = (responderaction) obj.get_resource(service);
return response;
} | java |
public static vpnsessionpolicy_binding get(nitro_service service, String name) throws Exception{
vpnsessionpolicy_binding obj = new vpnsessionpolicy_binding();
obj.set_name(name);
vpnsessionpolicy_binding response = (vpnsessionpolicy_binding) obj.get_resource(service);
return response;
} | java |
public static wisite_translationinternalip_binding[] get(nitro_service service, String sitepath) throws Exception{
wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding();
obj.set_sitepath(sitepath);
wisite_translationinternalip_binding response[] = (wisite_translationinternalip_binding[]) obj.get_resources(service);
return response;
} | java |
public static long count(nitro_service service, String sitepath) throws Exception{
wisite_translationinternalip_binding obj = new wisite_translationinternalip_binding();
obj.set_sitepath(sitepath);
options option = new options();
option.set_count(true);
wisite_translationinternalip_binding response[] = (wisite_translationinternalip_binding[]) obj.get_resources(service,option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java |
public static authenticationlocalpolicy_systemglobal_binding[] get(nitro_service service, String name) throws Exception{
authenticationlocalpolicy_systemglobal_binding obj = new authenticationlocalpolicy_systemglobal_binding();
obj.set_name(name);
authenticationlocalpolicy_systemglobal_binding response[] = (authenticationlocalpolicy_systemglobal_binding[]) obj.get_resources(service);
return response;
} | java |
public static appfwprofile_xmlwsiurl_binding[] get(nitro_service service, String name) throws Exception{
appfwprofile_xmlwsiurl_binding obj = new appfwprofile_xmlwsiurl_binding();
obj.set_name(name);
appfwprofile_xmlwsiurl_binding response[] = (appfwprofile_xmlwsiurl_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, snmpgroup resource) throws Exception {
snmpgroup addresource = new snmpgroup();
addresource.name = resource.name;
addresource.securitylevel = resource.securitylevel;
addresource.readviewname = resource.readviewname;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, snmpgroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmpgroup addresources[] = new snmpgroup[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new snmpgroup();
addresources[i].name = resources[i].name;
addresources[i].securitylevel = resources[i].securitylevel;
addresources[i].readviewname = resources[i].readviewname;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static base_response delete(nitro_service client, snmpgroup resource) throws Exception {
snmpgroup deleteresource = new snmpgroup();
deleteresource.name = resource.name;
deleteresource.securitylevel = resource.securitylevel;
return deleteresource.delete_resource(client);
} | java |
public static base_response update(nitro_service client, snmpgroup resource) throws Exception {
snmpgroup updateresource = new snmpgroup();
updateresource.name = resource.name;
updateresource.securitylevel = resource.securitylevel;
updateresource.readviewname = resource.readviewname;
return updateresource.update_resource(client);
} | java |
public static base_responses update(nitro_service client, snmpgroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmpgroup updateresources[] = new snmpgroup[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmpgroup();
updateresources[i].name = resources[i].name;
updateresources[i].securitylevel = resources[i].securitylevel;
updateresources[i].readviewname = resources[i].readviewname;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java |
public static snmpgroup[] get(nitro_service service) throws Exception{
snmpgroup obj = new snmpgroup();
snmpgroup[] response = (snmpgroup[])obj.get_resources(service);
return response;
} | java |
public static base_response update(nitro_service client, lbparameter resource) throws Exception {
lbparameter updateresource = new lbparameter();
updateresource.httponlycookieflag = resource.httponlycookieflag;
updateresource.consolidatedlconn = resource.consolidatedlconn;
updateresource.useportforhashlb = resource.useportforhashlb;
updateresource.preferdirectroute = resource.preferdirectroute;
updateresource.startuprrfactor = resource.startuprrfactor;
updateresource.monitorskipmaxclient = resource.monitorskipmaxclient;
updateresource.monitorconnectionclose = resource.monitorconnectionclose;
updateresource.vserverspecificmac = resource.vserverspecificmac;
return updateresource.update_resource(client);
} | java |
public static base_response unset(nitro_service client, lbparameter resource, String[] args) throws Exception{
lbparameter unsetresource = new lbparameter();
return unsetresource.unset_resource(client,args);
} | java |
public static lbparameter get(nitro_service service) throws Exception{
lbparameter obj = new lbparameter();
lbparameter[] response = (lbparameter[])obj.get_resources(service);
return response[0];
} | java |
public static auditnslogpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
auditnslogpolicy_lbvserver_binding obj = new auditnslogpolicy_lbvserver_binding();
obj.set_name(name);
auditnslogpolicy_lbvserver_binding response[] = (auditnslogpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, policystringmap resource) throws Exception {
policystringmap addresource = new policystringmap();
addresource.name = resource.name;
addresource.comment = resource.comment;
return addresource.add_resource(client);
} | java |
public static base_response update(nitro_service client, policystringmap resource) throws Exception {
policystringmap updateresource = new policystringmap();
updateresource.name = resource.name;
updateresource.comment = resource.comment;
return updateresource.update_resource(client);
} | java |
public static policystringmap[] get(nitro_service service) throws Exception{
policystringmap obj = new policystringmap();
policystringmap[] response = (policystringmap[])obj.get_resources(service);
return response;
} | java |
public static policystringmap get(nitro_service service, String name) throws Exception{
policystringmap obj = new policystringmap();
obj.set_name(name);
policystringmap response = (policystringmap) obj.get_resource(service);
return response;
} | java |
public static rewritepolicylabel_policybinding_binding[] get(nitro_service service, String labelname) throws Exception{
rewritepolicylabel_policybinding_binding obj = new rewritepolicylabel_policybinding_binding();
obj.set_labelname(labelname);
rewritepolicylabel_policybinding_binding response[] = (rewritepolicylabel_policybinding_binding[]) obj.get_resources(service);
return response;
} | java |
private void registerPrefix(String field, String prefix,
IndexOutput outPrefix) throws IOException {
if (!prefixReferenceIndex.containsKey(field)) {
prefixReferenceIndex.put(field, new HashMap<String, Long>());
prefixIdIndex.put(field, new HashMap<String, Integer>());
}
if (!prefixReferenceIndex.get(field).containsKey(prefix)) {
int id = 1 + prefixReferenceIndex.get(field).size();
prefixReferenceIndex.get(field).put(prefix, outPrefix.getFilePointer());
prefixIdIndex.get(field).put(prefix, id);
outPrefix.writeString(prefix);
}
} | java |
private void registerPrefixIntersection(String field, String prefix,
int start, int end,
HashMap<String, HashSet<Integer>> docFieldAdministration) {
if (!intersectingPrefixes.containsKey(field)) {
intersectingPrefixes.put(field, new HashSet<String>());
} else if (intersectingPrefixes.get(field).contains(prefix)) {
return;
}
HashSet<Integer> docFieldPrefixAdministration;
if (!docFieldAdministration.containsKey(prefix)) {
docFieldPrefixAdministration = new HashSet<>();
docFieldAdministration.put(prefix, docFieldPrefixAdministration);
} else {
docFieldPrefixAdministration = docFieldAdministration.get(prefix);
// check
for (int p = start; p <= end; p++) {
if (docFieldPrefixAdministration.contains(p)) {
intersectingPrefixes.get(field).add(prefix);
docFieldAdministration.remove(prefix);
return;
}
}
}
// update
for (int p = start; p <= end; p++) {
docFieldPrefixAdministration.add(p);
}
} | java |
public void registerPrefixStatsSinglePositionValue(String field,
String prefix, IndexOutput outPrefix) throws IOException {
initPrefixStatsField(field);
registerPrefix(field, prefix, outPrefix);
if (!multiplePositionPrefix.get(field).contains(prefix)) {
singlePositionPrefix.get(field).add(prefix);
}
} | java |
public void registerPrefixStatsRangePositionValue(String field, String prefix,
IndexOutput outPrefix) throws IOException {
initPrefixStatsField(field);
registerPrefix(field, prefix, outPrefix);
singlePositionPrefix.get(field).remove(prefix);
multiplePositionPrefix.get(field).add(prefix);
} | java |
private void initPrefixStatsField(String field) {
if (!singlePositionPrefix.containsKey(field)) {
singlePositionPrefix.put(field, new HashSet<String>());
}
if (!multiplePositionPrefix.containsKey(field)) {
multiplePositionPrefix.put(field, new HashSet<String>());
}
if (!setPositionPrefix.containsKey(field)) {
setPositionPrefix.put(field, new HashSet<String>());
}
} | java |
public String getPrefixStatsSinglePositionPrefixAttribute(String field) {
return String.join(MtasToken.DELIMITER, singlePositionPrefix.get(field));
} | java |
public String getPrefixStatsMultiplePositionPrefixAttribute(String field) {
return String.join(MtasToken.DELIMITER, multiplePositionPrefix.get(field));
} | java |
public String getPrefixStatsSetPositionPrefixAttribute(String field) {
return String.join(MtasToken.DELIMITER, setPositionPrefix.get(field));
} | java |
public String getPrefixStatsIntersectionPrefixAttribute(String field) {
if (intersectingPrefixes.containsKey(field)) {
return String.join(MtasToken.DELIMITER, intersectingPrefixes.get(field));
} else {
return "";
}
} | java |
private void tokenStatsAdd(int min, int max) {
tokenStatsNumber++;
if (tokenStatsMinPos == null) {
tokenStatsMinPos = min;
} else {
tokenStatsMinPos = Math.min(tokenStatsMinPos, min);
}
if (tokenStatsMaxPos == null) {
tokenStatsMaxPos = max;
} else {
tokenStatsMaxPos = Math.max(tokenStatsMaxPos, max);
}
} | java |
private void copyObjectAndUpdateStats(int id, IndexInput in, Long inRef,
IndexOutput out) throws IOException {
int mtasId;
int objectFlags;
// read
in.seek(inRef);
mtasId = in.readVInt();
assert id == mtasId : "wrong id detected while copying object";
objectFlags = in.readVInt();
out.writeVInt(mtasId);
out.writeVInt(objectFlags);
if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PARENT) {
out.writeVInt(in.readVInt());
}
if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_RANGE) {
int minPos = in.readVInt();
int maxPos = in.readVInt();
out.writeVInt(minPos);
out.writeVInt(maxPos);
tokenStatsAdd(minPos, maxPos);
} else if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_POSITION_SET) {
int size = in.readVInt();
out.writeVInt(size);
SortedSet<Integer> list = new TreeSet<>();
int previousPosition = 0;
for (int t = 0; t < size; t++) {
int pos = in.readVInt();
out.writeVInt(pos);
previousPosition = (pos + previousPosition);
list.add(previousPosition);
}
assert list.size() == size : "duplicate positions in set are not allowed";
tokenStatsAdd(list.first(), list.last());
} else {
int pos = in.readVInt();
out.writeVInt(pos);
tokenStatsAdd(pos, pos);
}
if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_OFFSET) {
out.writeVInt(in.readVInt());
out.writeVInt(in.readVInt());
}
if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_REALOFFSET) {
out.writeVInt(in.readVInt());
out.writeVInt(in.readVInt());
}
if ((objectFlags
& MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) == MtasCodecPostingsFormat.MTAS_OBJECT_HAS_PAYLOAD) {
int length = in.readVInt();
out.writeVInt(length);
byte[] payload = new byte[length];
in.readBytes(payload, 0, length);
out.writeBytes(payload, payload.length);
}
out.writeVLong(in.readVLong());
} | java |
public static aaagroup_vpnintranetapplication_binding[] get(nitro_service service, String groupname) throws Exception{
aaagroup_vpnintranetapplication_binding obj = new aaagroup_vpnintranetapplication_binding();
obj.set_groupname(groupname);
aaagroup_vpnintranetapplication_binding response[] = (aaagroup_vpnintranetapplication_binding[]) obj.get_resources(service);
return response;
} | java |
public void load(Reader r, String id) {
try {
// could throw an IO exception?
TreeReader tr = treeReaderFactory().newTreeReader(r);
int sentIndex = 0;
for (Tree pt; (pt = tr.readTree()) != null; ) {
if (pt.label() instanceof HasIndex) { // so we can trace where this tree came from
HasIndex hi = (HasIndex) pt.label();
if (id != null) {
hi.setDocID(id);
}
hi.setSentIndex(sentIndex);
}
parseTrees.add(pt);
sentIndex++;
}
} catch (IOException e) {
System.err.println("load IO Exception: " + e);
}
} | java |
@Override
public void apply(TreeVisitor tp) {
for (int i = 0, size = parseTrees.size(); i < size; i++) {
tp.visitTree(parseTrees.get(i));
}
// or could do as Iterator but slower
// Iterator iter = parseTrees.iterator();
// while (iter.hasNext()) {
// tp.visitTree((Tree) iter.next());
// }
} | java |
public static aaauser_vpnurl_binding[] get(nitro_service service, String username) throws Exception{
aaauser_vpnurl_binding obj = new aaauser_vpnurl_binding();
obj.set_username(username);
aaauser_vpnurl_binding response[] = (aaauser_vpnurl_binding[]) obj.get_resources(service);
return response;
} | java |
public static base_response add(nitro_service client, iptunnel resource) throws Exception {
iptunnel addresource = new iptunnel();
addresource.name = resource.name;
addresource.remote = resource.remote;
addresource.remotesubnetmask = resource.remotesubnetmask;
addresource.local = resource.local;
addresource.protocol = resource.protocol;
addresource.ipsecprofilename = resource.ipsecprofilename;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, iptunnel resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
iptunnel addresources[] = new iptunnel[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new iptunnel();
addresources[i].name = resources[i].name;
addresources[i].remote = resources[i].remote;
addresources[i].remotesubnetmask = resources[i].remotesubnetmask;
addresources[i].local = resources[i].local;
addresources[i].protocol = resources[i].protocol;
addresources[i].ipsecprofilename = resources[i].ipsecprofilename;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
public static iptunnel[] get(nitro_service service) throws Exception{
iptunnel obj = new iptunnel();
iptunnel[] response = (iptunnel[])obj.get_resources(service);
return response;
} | java |
public static iptunnel[] get(nitro_service service, iptunnel_args args) throws Exception{
iptunnel obj = new iptunnel();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
iptunnel[] response = (iptunnel[])obj.get_resources(service, option);
return response;
} | java |
public static iptunnel get(nitro_service service, String name) throws Exception{
iptunnel obj = new iptunnel();
obj.set_name(name);
iptunnel response = (iptunnel) obj.get_resource(service);
return response;
} | java |
public static base_response add(nitro_service client, dnscnamerec resource) throws Exception {
dnscnamerec addresource = new dnscnamerec();
addresource.aliasname = resource.aliasname;
addresource.canonicalname = resource.canonicalname;
addresource.ttl = resource.ttl;
return addresource.add_resource(client);
} | java |
public static base_responses add(nitro_service client, dnscnamerec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnscnamerec addresources[] = new dnscnamerec[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnscnamerec();
addresources[i].aliasname = resources[i].aliasname;
addresources[i].canonicalname = resources[i].canonicalname;
addresources[i].ttl = resources[i].ttl;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java |
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 |
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 |
public static dnscnamerec[] get(nitro_service service) throws Exception{
dnscnamerec obj = new dnscnamerec();
dnscnamerec[] response = (dnscnamerec[])obj.get_resources(service);
return response;
} | java |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
private String addAndEncodeVariable(String originalValue, String newVariable,
String newVariableName, boolean encode) {
return addAndEncode(originalValue, newVariable, newVariableName, encode);
} | java |
private String addAndEncodeValue(String originalValue, String newValue,
boolean encode) {
return addAndEncode(originalValue, null, newValue, encode);
} | java |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
public static nshttpparam get(nitro_service service) throws Exception{
nshttpparam obj = new nshttpparam();
nshttpparam[] response = (nshttpparam[])obj.get_resources(service);
return response[0];
} | java |
public MapFactory<E, MutableInteger> getMapFactory() {
return ErasureUtils.<MapFactory<E,MutableInteger>>uncheckedCast(mapFactory);
} | java |
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 |
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 |
public int max() {
int max = Integer.MIN_VALUE;
for (E key : map.keySet()) {
max = Math.max(max, getIntCount(key));
}
return max;
} | java |
public int min() {
int min = Integer.MAX_VALUE;
for (E key : map.keySet()) {
min = Math.min(min, getIntCount(key));
}
return min;
} | java |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
public static filterpolicy[] get(nitro_service service) throws Exception{
filterpolicy obj = new filterpolicy();
filterpolicy[] response = (filterpolicy[])obj.get_resources(service);
return response;
} | java |
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 |
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 |
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 |
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 |
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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.