_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q11900 | ArrayMath.innerProduct | train | public static double innerProduct(double[] a, double[] b) {
double result = 0.0;
int len = Math.min(a.length, b.length);
for (int i = 0; i < len; i++) {
result += a[i] * b[i];
}
return result;
} | java | {
"resource": ""
} |
q11901 | ArrayMath.normalize | train | public static void normalize(double[] a) {
double total = sum(a);
if (total == 0.0 || Double.isNaN(total)) {
throw new RuntimeException("Can't normalize an array with sum 0.0 or NaN: " + Arrays.toString(a));
}
multiplyInPlace(a, 1.0/total); // divide each value by total
} | java | {
"resource": ""
} |
q11902 | ArrayMath.standardize | train | public static void standardize(double[] a) {
double m = mean(a);
if (Double.isNaN(m))
throw new RuntimeException("Can't standardize array whose mean is NaN");
double s = stdev(a);
if(s == 0.0 || Double.isNaN(s))
throw new RuntimeException("Can't standardize array whose standard deviation is 0.0 or NaN");
addInPlace(a, -m); // subtract mean
multiplyInPlace(a, 1.0/s); // divide by standard deviation
} | java | {
"resource": ""
} |
q11903 | ArrayMath.sampleFromDistribution | train | public static int sampleFromDistribution(double[] d, Random random) {
// sample from the uniform [0,1]
double r = random.nextDouble();
// now compare its value to cumulative values to find what interval it falls in
double total = 0;
for (int i = 0; i < d.length - 1; i++) {
if (Double.isNaN(d[i])) {
throw new RuntimeException("Can't sample from NaN");
}
total += d[i];
if (r < total) {
return i;
}
}
return d.length - 1; // in case the "double-math" didn't total to exactly 1.0
} | java | {
"resource": ""
} |
q11904 | ArrayMath.sampleWithoutReplacement | train | public static void sampleWithoutReplacement(int[] array, int numArgClasses, Random rand) {
int[] temp = new int[numArgClasses];
for (int i = 0; i < temp.length; i++) {
temp[i] = i;
}
shuffle(temp, rand);
System.arraycopy(temp, 0, array, 0, array.length);
} | java | {
"resource": ""
} |
q11905 | ArrayMath.absDiffOfMeans | train | private static double absDiffOfMeans(double[] A, double[] B, boolean randomize) {
Random random = new Random();
double aTotal = 0.0;
double bTotal = 0.0;
for (int i = 0; i < A.length; i++) {
if (randomize && random.nextBoolean()) {
aTotal += B[i];
bTotal += A[i];
} else {
aTotal += A[i];
bTotal += B[i];
}
}
double aMean = aTotal / A.length;
double bMean = bTotal / B.length;
return Math.abs(aMean - bMean);
} | java | {
"resource": ""
} |
q11906 | appfwpolicy_lbvserver_binding.get | train | public static appfwpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
appfwpolicy_lbvserver_binding obj = new appfwpolicy_lbvserver_binding();
obj.set_name(name);
appfwpolicy_lbvserver_binding response[] = (appfwpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11907 | River.getSession | train | public static Session getSession(String wrapper, Object... parameters) {
// This will be the session loaded depending the selected wrapper
org.riverframework.wrapper.Session<?> _session = null;
// Trying to retrieve the session from the map
Session session = map.get(wrapper);
if (session != null && session.isOpen()) {
// There is an open session
if (parameters.length > 0) {
// and the user is trying to open a new one
throw new RiverException("There is already an open session for the wrapper " + wrapper +
". You must close the current before opening a new one.");
}
// If there are no parameters, we just return the current opened session
} else {
// If not exists or is closed, we create it using the factory
Class<?> clazzFactory = null;
try {
clazzFactory = Class.forName(wrapper + ".DefaultFactory");
} catch (ClassNotFoundException e) {
throw new RiverException("The wrapper '" + wrapper + "' can not be loaded. If you are using an non-official wrapper, " +
"check the wrapper name and its design. Check the CLASSPATH.");
}
try {
Method method = clazzFactory.getDeclaredMethod("getInstance");
method.setAccessible(true);
org.riverframework.wrapper.Factory<?> _factory = (org.riverframework.wrapper.Factory<?>) method.invoke(null);
if (_factory == null)
throw new RiverException("The factory could not be loaded.");
if (parameters.length > 0) {
// There are parameters. So, we try to create a new one.
_session = (org.riverframework.wrapper.Session<?>) _factory.getSession(parameters);
} else {
// There are no parameters. We create a closed session.
_session = null;
}
Constructor<?> constructor = DefaultSession.class.getDeclaredConstructor(org.riverframework.wrapper.Session.class);
constructor.setAccessible(true);
session = (DefaultSession) constructor.newInstance(_session);
} catch (Exception e) {
throw new RiverException("There's a problem opening the session. Maybe, you will need to check the parameters.", e);
}
map.put(wrapper, session);
}
return session;
} | java | {
"resource": ""
} |
q11908 | River.closeSession | train | public static void closeSession(String wrapper) {
Session session = map.get(wrapper);
if (session != null) {
Method method;
try {
method = session.getClass().getDeclaredMethod("protectedClose");
method.setAccessible(true);
method.invoke(session);
} catch (InvocationTargetException e) {
throw new RiverException(e.getCause().getMessage(), e);
} catch (Exception e) {
throw new RiverException(e);
}
map.remove(wrapper);
}
} | java | {
"resource": ""
} |
q11909 | ntpparam.update | train | public static base_response update(nitro_service client, ntpparam resource) throws Exception {
ntpparam updateresource = new ntpparam();
updateresource.authentication = resource.authentication;
updateresource.trustedkey = resource.trustedkey;
updateresource.autokeylogsec = resource.autokeylogsec;
updateresource.revokelogsec = resource.revokelogsec;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11910 | ntpparam.unset | train | public static base_response unset(nitro_service client, ntpparam resource, String[] args) throws Exception{
ntpparam unsetresource = new ntpparam();
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11911 | ntpparam.get | train | public static ntpparam get(nitro_service service) throws Exception{
ntpparam obj = new ntpparam();
ntpparam[] response = (ntpparam[])obj.get_resources(service);
return response[0];
} | java | {
"resource": ""
} |
q11912 | snmpengineid.update | train | public static base_response update(nitro_service client, snmpengineid resource) throws Exception {
snmpengineid updateresource = new snmpengineid();
updateresource.engineid = resource.engineid;
updateresource.ownernode = resource.ownernode;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11913 | snmpengineid.update | train | public static base_responses update(nitro_service client, snmpengineid resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
snmpengineid updateresources[] = new snmpengineid[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new snmpengineid();
updateresources[i].engineid = resources[i].engineid;
updateresources[i].ownernode = resources[i].ownernode;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | {
"resource": ""
} |
q11914 | snmpengineid.unset | train | public static base_response unset(nitro_service client, Long ownernode, String args[]) throws Exception {
snmpengineid unsetresource = new snmpengineid();
unsetresource.ownernode = ownernode;
return unsetresource.unset_resource(client, args);
} | java | {
"resource": ""
} |
q11915 | snmpengineid.unset | train | public static base_responses unset(nitro_service client, Long ownernode[], String args[]) throws Exception {
base_responses result = null;
if (ownernode != null && ownernode.length > 0) {
snmpengineid unsetresources[] = new snmpengineid[ownernode.length];
for (int i=0;i<ownernode.length;i++){
unsetresources[i] = new snmpengineid();
unsetresources[i].ownernode = ownernode[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11916 | snmpengineid.get | train | public static snmpengineid[] get(nitro_service service) throws Exception{
snmpengineid obj = new snmpengineid();
snmpengineid[] response = (snmpengineid[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11917 | snmpengineid.get | train | public static snmpengineid get(nitro_service service, Long ownernode) throws Exception{
snmpengineid obj = new snmpengineid();
obj.set_ownernode(ownernode);
snmpengineid response = (snmpengineid) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11918 | snmpengineid.get | train | public static snmpengineid[] get(nitro_service service, Long ownernode[]) throws Exception{
if (ownernode !=null && ownernode.length>0) {
snmpengineid response[] = new snmpengineid[ownernode.length];
snmpengineid obj[] = new snmpengineid[ownernode.length];
for (int i=0;i<ownernode.length;i++) {
obj[i] = new snmpengineid();
obj[i].set_ownernode(ownernode[i]);
response[i] = (snmpengineid) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | {
"resource": ""
} |
q11919 | sslfipssimsource.enable | train | public static base_response enable(nitro_service client, sslfipssimsource resource) throws Exception {
sslfipssimsource enableresource = new sslfipssimsource();
enableresource.targetsecret = resource.targetsecret;
enableresource.sourcesecret = resource.sourcesecret;
return enableresource.perform_operation(client,"enable");
} | java | {
"resource": ""
} |
q11920 | sslfipssimsource.init | train | public static base_response init(nitro_service client, sslfipssimsource resource) throws Exception {
sslfipssimsource initresource = new sslfipssimsource();
initresource.certfile = resource.certfile;
return initresource.perform_operation(client,"init");
} | java | {
"resource": ""
} |
q11921 | nspbrs.renumber | train | public static base_response renumber(nitro_service client) throws Exception {
nspbrs renumberresource = new nspbrs();
return renumberresource.perform_operation(client,"renumber");
} | java | {
"resource": ""
} |
q11922 | nspbrs.clear | train | public static base_response clear(nitro_service client) throws Exception {
nspbrs clearresource = new nspbrs();
return clearresource.perform_operation(client,"clear");
} | java | {
"resource": ""
} |
q11923 | nspbrs.apply | train | public static base_response apply(nitro_service client) throws Exception {
nspbrs applyresource = new nspbrs();
return applyresource.perform_operation(client,"apply");
} | java | {
"resource": ""
} |
q11924 | appflowpolicylabel_appflowpolicy_binding.get | train | public static appflowpolicylabel_appflowpolicy_binding[] get(nitro_service service, String labelname) throws Exception{
appflowpolicylabel_appflowpolicy_binding obj = new appflowpolicylabel_appflowpolicy_binding();
obj.set_labelname(labelname);
appflowpolicylabel_appflowpolicy_binding response[] = (appflowpolicylabel_appflowpolicy_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11925 | MtasSolrComponentPrefix.repairPrefixItems | train | @SuppressWarnings("unchecked")
private void repairPrefixItems(NamedList<Object> mtasResponse) {
// repair prefix lists
try {
ArrayList<NamedList<?>> list = (ArrayList<NamedList<?>>) mtasResponse
.findRecursive(NAME);
// MtasSolrResultUtil.rewrite(list);
if (list != null) {
for (NamedList<?> item : list) {
SortedSet<String> singlePosition = (SortedSet<String>) item
.get("singlePosition");
SortedSet<String> multiplePosition = (SortedSet<String>) item
.get("multiplePosition");
if (singlePosition != null && multiplePosition != null) {
for (String prefix : multiplePosition) {
if (singlePosition.contains(prefix)) {
singlePosition.remove(prefix);
}
}
}
}
}
} catch (ClassCastException e) {
log.debug(e);
}
} | java | {
"resource": ""
} |
q11926 | CodecCollector.collectKnownPrefixes | train | private static Set<String> collectKnownPrefixes(FieldInfo fi)
throws IOException {
if (fi != null) {
HashSet<String> result = new HashSet<>();
String singlePositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SINGLE_POSITION);
String multiplePositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_MULTIPLE_POSITION);
String setPositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SET_POSITION);
if (singlePositionPrefixes != null) {
String[] prefixes = singlePositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
String item = prefixes[i].trim();
if (!item.equals("")) {
result.add(item);
}
}
}
if (multiplePositionPrefixes != null) {
String[] prefixes = multiplePositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
String item = prefixes[i].trim();
if (!item.equals("")) {
result.add(item);
}
}
}
if (setPositionPrefixes != null) {
String[] prefixes = setPositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
String item = prefixes[i].trim();
if (!item.equals("")) {
result.add(item);
}
}
}
return result;
} else {
return Collections.emptySet();
}
} | java | {
"resource": ""
} |
q11927 | CodecCollector.collectIntersectionPrefixes | train | private static Set<String> collectIntersectionPrefixes(FieldInfo fi)
throws IOException {
if (fi != null) {
Set<String> result = new HashSet<>();
String intersectingPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_INTERSECTION);
if (intersectingPrefixes != null) {
String[] prefixes = intersectingPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
String item = prefixes[i].trim();
if (!item.equals("")) {
result.add(item);
}
}
}
return result;
} else {
return Collections.emptySet();
}
} | java | {
"resource": ""
} |
q11928 | CodecCollector.collectPrefixes | train | private static void collectPrefixes(FieldInfos fieldInfos, String field,
ComponentField fieldInfo, Status status) throws IOException {
if (fieldInfo.prefix != null) {
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi != null) {
String singlePositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SINGLE_POSITION);
String multiplePositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_MULTIPLE_POSITION);
String setPositionPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_SET_POSITION);
String intersectingPrefixes = fi.getAttribute(
MtasCodecPostingsFormat.MTAS_FIELDINFO_ATTRIBUTE_PREFIX_INTERSECTION);
if (singlePositionPrefixes != null) {
String[] prefixes = singlePositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
fieldInfo.prefix.addSinglePosition(prefixes[i]);
}
}
if (multiplePositionPrefixes != null) {
String[] prefixes = multiplePositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
fieldInfo.prefix.addMultiplePosition(prefixes[i]);
}
}
if (setPositionPrefixes != null) {
String[] prefixes = setPositionPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
fieldInfo.prefix.addSetPosition(prefixes[i]);
}
}
if (intersectingPrefixes != null) {
String[] prefixes = intersectingPrefixes
.split(Pattern.quote(MtasToken.DELIMITER));
for (int i = 0; i < prefixes.length; i++) {
fieldInfo.prefix.addIntersecting(prefixes[i]);
}
}
}
}
} | java | {
"resource": ""
} |
q11929 | CodecCollector.collectSpansForOccurences | train | private static Map<GroupHit, Spans> collectSpansForOccurences(
Set<GroupHit> occurences, Set<String> prefixes, String field,
IndexSearcher searcher, LeafReaderContext lrc) throws IOException {
Map<GroupHit, Spans> list = new HashMap<>();
IndexReader reader = searcher.getIndexReader();
final float boost = 0;
for (GroupHit hit : occurences) {
MtasSpanQuery queryHit = createQueryFromGroupHit(prefixes, field, hit);
if (queryHit != null) {
MtasSpanQuery queryHitRewritten = queryHit.rewrite(reader);
SpanWeight weight = queryHitRewritten.createWeight(searcher, false,
boost);
Spans spans = weight.getSpans(lrc, SpanWeight.Postings.POSITIONS);
if (spans != null) {
list.put(hit, spans);
}
}
}
return list;
} | java | {
"resource": ""
} |
q11930 | CodecCollector.createQueryFromGroupHit | train | private static MtasSpanQuery createQueryFromGroupHit(Set<String> prefixes,
String field, GroupHit hit) {
// initial check
if (prefixes == null || field == null || hit == null) {
return null;
} else {
MtasSpanQuery query = null;
// check for missing
if (hit.missingLeft != null && hit.missingLeft.length > 0) {
for (int i = 0; i < hit.missingLeft.length; i++) {
if (hit.missingLeft[i].size() != hit.unknownLeft[i].size()) {
return null;
}
}
}
if (hit.missingHit != null && hit.missingHit.length > 0) {
for (int i = 0; i < hit.missingHit.length; i++) {
if (hit.missingHit[i].size() != hit.unknownHit[i].size()) {
return null;
}
}
}
if (hit.missingRight != null && hit.missingRight.length > 0) {
for (int i = 0; i < hit.missingRight.length; i++) {
if (hit.missingRight[i].size() != hit.unknownRight[i].size()) {
return null;
}
}
}
MtasSpanQuery hitQuery = createSubQueryFromGroupHit(hit.dataHit, false,
field);
if (hitQuery != null) {
query = hitQuery;
MtasSpanQuery leftHitQuery = createSubQueryFromGroupHit(hit.dataLeft,
true, field);
MtasSpanQuery rightHitQuery = createSubQueryFromGroupHit(hit.dataRight,
false, field);
if (leftHitQuery != null) {
query = new MtasSpanPrecededByQuery(query, leftHitQuery);
}
if (rightHitQuery != null) {
query = new MtasSpanFollowedByQuery(query, rightHitQuery);
}
}
return query;
}
} | java | {
"resource": ""
} |
q11931 | CodecCollector.createSubQueryFromGroupHit | train | private static MtasSpanQuery createSubQueryFromGroupHit(List<String>[] subHit,
boolean reverse, String field) {
MtasSpanQuery query = null;
if (subHit != null && subHit.length > 0) {
List<MtasSpanSequenceItem> items = new ArrayList<>();
List<String> subHitItem;
for (int i = 0; i < subHit.length; i++) {
MtasSpanQuery item = null;
if (reverse) {
subHitItem = subHit[(subHit.length - i - 1)];
} else {
subHitItem = subHit[i];
}
if (subHitItem.isEmpty()) {
item = new MtasSpanMatchAllQuery(field);
} else if (subHitItem.size() == 1) {
Term term = new Term(field, subHitItem.get(0));
item = new MtasSpanTermQuery(term);
} else {
MtasSpanQuery[] subList = new MtasSpanQuery[subHitItem.size()];
for (int j = 0; j < subHitItem.size(); j++) {
Term term = new Term(field, subHitItem.get(j));
subList[j] = new MtasSpanTermQuery(term);
}
item = new MtasSpanAndQuery(subList);
}
items.add(new MtasSpanSequenceItem(item, false));
}
query = new MtasSpanSequenceQuery(items, null, null);
}
return query;
} | java | {
"resource": ""
} |
q11932 | CodecCollector.computePositions | train | private static Map<Integer, Integer> computePositions(CodecInfo mtasCodecInfo,
LeafReader r, LeafReaderContext lrc, String field, List<Integer> docSet)
throws IOException {
HashMap<Integer, Integer> positionsData;
if (mtasCodecInfo != null) {
// for relatively small numbers, compute only what is needed
if (docSet.size() < Math.log(r.maxDoc())) {
positionsData = new HashMap<>();
for (int docId : docSet) {
positionsData.put(docId,
mtasCodecInfo.getNumberOfPositions(field, (docId - lrc.docBase)));
}
// compute everything, only use what is needed
} else {
positionsData = mtasCodecInfo.getAllNumberOfPositions(field,
lrc.docBase);
for (int docId : docSet) {
if (!positionsData.containsKey(docId)) {
positionsData.put(docId, 0);
}
}
}
} else {
positionsData = new HashMap<>();
for (int docId : docSet) {
positionsData.put(docId, 0);
}
}
return positionsData;
} | java | {
"resource": ""
} |
q11933 | CodecCollector.computeArguments | train | private static Map<Integer, long[]> computeArguments(
Map<MtasSpanQuery, Map<Integer, Integer>> spansNumberData,
MtasSpanQuery[] queries, Integer[] docSet) {
Map<Integer, long[]> args = new HashMap<>();
for (int q = 0; q < queries.length; q++) {
Map<Integer, Integer> tmpData = spansNumberData.get(queries[q]);
long[] tmpList = null;
for (int docId : docSet) {
if (tmpData != null && tmpData.containsKey(docId)) {
if (!args.containsKey(docId)) {
tmpList = new long[queries.length];
} else {
tmpList = args.get(docId);
}
tmpList[q] = tmpData.get(docId);
args.put(docId, tmpList);
} else if (!args.containsKey(docId)) {
tmpList = new long[queries.length];
args.put(docId, tmpList);
}
}
}
return args;
} | java | {
"resource": ""
} |
q11934 | CodecCollector.intersectedDocList | train | private static Integer[] intersectedDocList(int[] facetDocList,
Integer[] docSet) {
if (facetDocList != null && docSet != null) {
Integer[] c = new Integer[Math.min(facetDocList.length, docSet.length)];
int ai = 0;
int bi = 0;
int ci = 0;
while (ai < facetDocList.length && bi < docSet.length) {
if (facetDocList[ai] < docSet[bi]) {
ai++;
} else if (facetDocList[ai] > docSet[bi]) {
bi++;
} else {
if (ci == 0 || facetDocList[ai] != c[ci - 1]) {
c[ci++] = facetDocList[ai];
}
ai++;
bi++;
}
}
return Arrays.copyOfRange(c, 0, ci);
}
return new Integer[] {};
} | java | {
"resource": ""
} |
q11935 | CodecCollector.createPositions | train | private static void createPositions(List<ComponentPosition> statsPositionList,
Map<Integer, Integer> positionsData, List<Integer> docSet)
throws IOException {
if (statsPositionList != null) {
for (ComponentPosition position : statsPositionList) {
position.dataCollector.initNewList(1);
Integer tmpValue;
long[] values = new long[docSet.size()];
int value;
int number = 0;
for (int docId : docSet) {
tmpValue = positionsData.get(docId);
value = tmpValue == null ? 0 : tmpValue.intValue();
if (((position.minimumLong == null)
|| (value >= position.minimumLong))
&& ((position.maximumLong == null)
|| (value <= position.maximumLong))) {
values[number] = value;
number++;
}
}
if (number > 0) {
position.dataCollector.add(values, number);
}
position.dataCollector.closeNewList();
}
}
} | java | {
"resource": ""
} |
q11936 | CodecCollector.createTokens | train | private static void createTokens(List<ComponentToken> statsTokenList,
Map<Integer, Integer> tokensData, List<Integer> docSet)
throws IOException {
if (statsTokenList != null) {
for (ComponentToken token : statsTokenList) {
token.dataCollector.initNewList(1);
Integer tmpValue;
long[] values = new long[docSet.size()];
int value;
int number = 0;
if (tokensData != null) {
for (int docId : docSet) {
tmpValue = tokensData.get(docId);
value = tmpValue == null ? 0 : tmpValue.intValue();
if (((token.minimumLong == null) || (value >= token.minimumLong))
&& ((token.maximumLong == null)
|| (value <= token.maximumLong))) {
values[number] = value;
number++;
}
}
}
if (number > 0) {
token.dataCollector.add(values, number);
}
token.dataCollector.closeNewList();
}
}
} | java | {
"resource": ""
} |
q11937 | CodecCollector.availablePrefixes | train | private static boolean availablePrefixes(ComponentGroup group,
Set<String> knownPrefixes) {
if (knownPrefixes != null) {
for (String prefix : group.prefixes) {
if (knownPrefixes.contains(prefix)) {
return true;
}
}
}
return false;
} | java | {
"resource": ""
} |
q11938 | CodecCollector.intersectionPrefixes | train | private static boolean intersectionPrefixes(ComponentGroup group,
Set<String> intersectionPrefixes) {
if (intersectionPrefixes != null) {
for (String prefix : group.prefixes) {
if (intersectionPrefixes.contains(prefix)) {
return true;
}
}
}
return false;
} | java | {
"resource": ""
} |
q11939 | CodecCollector.createPositionHit | train | private static IntervalTreeNodeData<String> createPositionHit(Match m,
ComponentGroup group) {
Integer start = null;
Integer end = null;
if (group.hitInside != null || group.hitInsideLeft != null
|| group.hitInsideRight != null) {
start = m.startPosition;
end = m.endPosition - 1;
} else {
start = null;
end = null;
}
if (group.hitLeft != null) {
start = m.startPosition;
end = Math.max(m.startPosition + group.hitLeft.length - 1,
m.endPosition - 1);
}
if (group.hitRight != null) {
start = Math.min(m.endPosition - group.hitRight.length, m.startPosition);
end = end == null ? (m.endPosition - 1)
: Math.max(end, (m.endPosition - 1));
}
if (group.left != null) {
start = start == null ? m.startPosition - group.left.length
: Math.min(m.startPosition - group.left.length, start);
end = end == null ? m.startPosition - 1
: Math.max(m.startPosition - 1, end);
}
if (group.right != null) {
start = start == null ? m.endPosition : Math.min(m.endPosition, start);
end = end == null ? m.endPosition + group.right.length - 1
: Math.max(m.endPosition + group.right.length - 1, end);
}
return new IntervalTreeNodeData<>(start, end, m.startPosition,
m.endPosition - 1);
} | java | {
"resource": ""
} |
q11940 | CodecCollector.sortMatchList | train | private static void sortMatchList(List<Match> list) {
if (list != null) {
// light sorting on start position
Collections.sort(list, (Match m1,
Match m2) -> (Integer.compare(m1.startPosition, m2.startPosition)));
}
} | java | {
"resource": ""
} |
q11941 | CodecCollector.groupedKeyName | train | private static String groupedKeyName(String key, Double baseRangeSize,
Double baseRangeBase) {
final double precision = 0.000001;
if (baseRangeSize == null || baseRangeSize <= 0) {
return key;
} else {
Double doubleKey;
Double doubleBase;
Double doubleNumber;
Double doubleStart;
Double doubleEnd;
try {
doubleKey = Double.parseDouble(key);
doubleBase = baseRangeBase != null ? baseRangeBase : 0;
doubleNumber = Math.floor((doubleKey - doubleBase) / baseRangeSize);
doubleStart = doubleBase + doubleNumber * baseRangeSize;
doubleEnd = doubleStart + baseRangeSize;
} catch (NumberFormatException e) {
return key;
}
// integer
if (Math.abs(baseRangeSize - Math.floor(baseRangeSize)) < precision
&& Math.abs(doubleBase - Math.floor(doubleBase)) < precision) {
try {
if (baseRangeSize > 1) {
return String.format("%.0f", doubleStart) + "-"
+ String.format("%.0f", doubleEnd - 1);
} else {
return String.format("%.0f", doubleStart);
}
} catch (NumberFormatException e) {
return key;
}
} else {
return "[" + doubleStart + "," + doubleEnd + ")";
}
}
} | java | {
"resource": ""
} |
q11942 | CodecCollector.mergeDocLists | train | private static Integer[] mergeDocLists(Integer[] a, Integer[] b) {
Integer[] answer = new Integer[a.length + b.length];
int i = 0;
int j = 0;
int k = 0;
Integer tmp;
while (i < a.length && j < b.length) {
tmp = a[i] < b[j] ? a[i++] : b[j++];
for (; i < a.length && a[i].equals(tmp); i++)
;
for (; j < b.length && b[j].equals(tmp); j++)
;
answer[k++] = tmp;
}
while (i < a.length) {
tmp = a[i++];
for (; i < a.length && a[i].equals(tmp); i++)
;
answer[k++] = tmp;
}
while (j < b.length) {
tmp = b[j++];
for (; j < b.length && b[j].equals(tmp); j++)
;
answer[k++] = tmp;
}
return Arrays.copyOf(answer, k);
} | java | {
"resource": ""
} |
q11943 | CodecCollector.createFacet | train | private static void createFacet(List<ComponentFacet> facetList,
Map<Integer, Integer> positionsData,
Map<MtasSpanQuery, Map<Integer, Integer>> spansNumberData,
Map<String, SortedMap<String, int[]>> facetData, List<Integer> docSet)
throws IOException {
if (facetList != null) {
for (ComponentFacet cf : facetList) {
if (cf.baseFields.length > 0) {
createFacetBase(cf, 0, cf.dataCollector, positionsData,
spansNumberData, facetData,
docSet.toArray(new Integer[docSet.size()]));
}
}
}
} | java | {
"resource": ""
} |
q11944 | CodecCollector.validateTermWithStartValue | train | private static boolean validateTermWithStartValue(BytesRef term,
ComponentTermVector termVector) {
if (termVector.startValue == null) {
return true;
} else if (termVector.subComponentFunction.sortType
.equals(CodecUtil.SORT_TERM)) {
if (term.length > termVector.startValue.length) {
byte[] zeroBytes = (new BytesRef("\u0000")).bytes;
int n = (int) (Math
.ceil(((double) (term.length - termVector.startValue.length))
/ zeroBytes.length));
byte[] newBytes = new byte[termVector.startValue.length
+ n * zeroBytes.length];
System.arraycopy(termVector.startValue.bytes, 0, newBytes, 0,
termVector.startValue.length);
for (int i = 0; i < n; i++) {
System.arraycopy(zeroBytes, 0, newBytes,
termVector.startValue.length + i * zeroBytes.length,
zeroBytes.length);
}
termVector.startValue = new BytesRef(newBytes);
}
if ((termVector.subComponentFunction.sortDirection.equals(
CodecUtil.SORT_ASC) && (termVector.startValue.compareTo(term) < 0))
|| (termVector.subComponentFunction.sortDirection
.equals(CodecUtil.SORT_DESC)
&& (termVector.startValue.compareTo(term) > 0))) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q11945 | CodecCollector.validateTermWithDistance | train | private static boolean validateTermWithDistance(BytesRef term,
ComponentTermVector termVector) throws IOException {
if (termVector.distances == null || termVector.distances.isEmpty()) {
return true;
} else {
// first check maximum for all distances
for (SubComponentDistance item : termVector.distances) {
if (item.maximum == null) {
continue;
} else {
if (!item.getDistance().validateMaximum(term)) {
return false;
}
}
}
// then check minimum for all distances
for (SubComponentDistance item : termVector.distances) {
if (item.minimum == null) {
continue;
} else {
if (!item.getDistance().validateMinimum(term)) {
return false;
}
}
}
// try {
// System.out.println("ACCEPT: " + term.utf8ToString()+"
// ("+termVector.distances.size()+")");
// for (SubComponentDistance item : termVector.distances) {
// System.out.println(
// item.hashCode() + "\t" +
// term.utf8ToString()+"\t"+item.getDistance().getClass().getName()+"\t"+item.getDistance().minimum+"\t"+item.getDistance().maximum
// + "\t" +
// item.getDistance().validate(term)+"\t"+item.getDistance().compute(term));
// }
// } catch (Exception e) {
// System.out.println("PROBLEEM: "+e.getMessage());
// }
return true;
}
} | java | {
"resource": ""
} |
q11946 | CodecCollector.needSecondRoundTermvector | train | private static boolean needSecondRoundTermvector(
List<ComponentTermVector> termVectorList) throws IOException {
boolean needSecondRound = false;
for (ComponentTermVector termVector : termVectorList) {
if (!termVector.full && termVector.list == null) {
boolean doCheck;
doCheck = termVector.subComponentFunction.dataCollector.segmentRegistration != null
&& (termVector.subComponentFunction.dataCollector.segmentRegistration
.equals(MtasDataCollector.SEGMENT_SORT_ASC)
|| termVector.subComponentFunction.dataCollector.segmentRegistration
.equals(MtasDataCollector.SEGMENT_SORT_DESC))
&& termVector.number > 0;
doCheck |= termVector.subComponentFunction.dataCollector.segmentRegistration != null
&& (termVector.subComponentFunction.dataCollector.segmentRegistration
.equals(MtasDataCollector.SEGMENT_BOUNDARY_ASC)
|| termVector.subComponentFunction.dataCollector.segmentRegistration
.equals(MtasDataCollector.SEGMENT_BOUNDARY_DESC))
&& termVector.number > 0;
if (doCheck) {
termVector.subComponentFunction.dataCollector.recomputeSegmentKeys();
if (!termVector.subComponentFunction.dataCollector
.checkExistenceNecessaryKeys()) {
needSecondRound = true;
}
termVector.subComponentFunction.dataCollector.reduceToSegmentKeys();
}
}
}
return needSecondRound;
} | java | {
"resource": ""
} |
q11947 | CodecCollector.preliminaryRegisterValue | train | private static boolean preliminaryRegisterValue(BytesRef term,
ComponentTermVector termVector, TermvectorNumberBasic number,
Integer termNumberMaximum, Integer segmentNumber, String[] mutableKey)
throws IOException {
long sortValue = 0;
if (termVector.subComponentFunction.sortDirection
.equals(CodecUtil.SORT_DESC)
&& termVector.subComponentFunction.sortType
.equals(CodecUtil.STATS_TYPE_SUM)) {
sortValue = termVector.subComponentFunction.parserFunction
.getValueLong(number.valueSum, 0);
} else if (termVector.subComponentFunction.sortDirection
.equals(CodecUtil.SORT_DESC)
&& termVector.subComponentFunction.sortType
.equals(CodecUtil.STATS_TYPE_N)) {
sortValue = number.docNumber;
} else {
return true;
}
MtasDataCollector<Long, ?> dataCollector = (MtasDataCollector<Long, ?>) termVector.subComponentFunction.dataCollector;
if (termVector.boundaryRegistration) {
return dataCollector.validateSegmentBoundary(sortValue);
} else {
String segmentStatus = dataCollector.validateSegmentValue(sortValue,
termNumberMaximum, segmentNumber);
if (segmentStatus != null) {
if (segmentStatus.equals(MtasDataCollector.SEGMENT_KEY_OR_NEW)) {
return true;
} else if (segmentStatus
.equals(MtasDataCollector.SEGMENT_POSSIBLE_KEY)) {
mutableKey[0] = MtasToken.getPostfixFromValue(term);
segmentStatus = dataCollector.validateSegmentValue(mutableKey[0],
sortValue, termNumberMaximum, segmentNumber, true);
return segmentStatus != null;
} else {
// should never happen?
return false;
}
} else {
return false;
}
}
} | java | {
"resource": ""
} |
q11948 | CodecCollector.computeTermvectorNumberFull | train | private static TermvectorNumberFull computeTermvectorNumberFull(
List<Integer> docSet, int termDocId, TermsEnum termsEnum,
LeafReaderContext lrc, PostingsEnum postingsEnum,
Map<Integer, Integer> positionsData) throws IOException {
TermvectorNumberFull result = new TermvectorNumberFull(docSet.size());
Iterator<Integer> docIterator = docSet.iterator();
int localTermDocId = termDocId;
postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.FREQS);
while (docIterator.hasNext()) {
int docId = docIterator.next() - lrc.docBase;
if (docId >= localTermDocId && ((docId == localTermDocId)
|| ((localTermDocId = postingsEnum.advance(docId)) == docId))) {
result.args[result.docNumber] = postingsEnum.freq();
result.positions[result.docNumber] = (positionsData == null) ? 0
: positionsData.get(docId + lrc.docBase);
result.docNumber++;
}
}
return result;
} | java | {
"resource": ""
} |
q11949 | ChineseEnglishWordMap.containsKey | train | public boolean containsKey(String key) {
key = key.toLowerCase();
key = key.trim();
return map.containsKey(key);
} | java | {
"resource": ""
} |
q11950 | ChineseEnglishWordMap.getReverseMap | train | public Map<String, Set<String>> getReverseMap() {
Set<Map.Entry<String,Set<String>>> entries = map.entrySet();
Map<String, Set<String>> rMap = new HashMap<String, Set<String>>(entries.size());
for (Map.Entry<String,Set<String>> me : entries) {
String k = me.getKey();
Set<String> transList = me.getValue();
for (String trans : transList) {
Set<String> entry = rMap.get(trans);
if (entry == null) {
// reduce default size as most will be small
Set<String> toAdd = new LinkedHashSet<String>(6);
toAdd.add(k);
rMap.put(trans, toAdd);
} else {
entry.add(k);
}
}
}
return rMap;
} | java | {
"resource": ""
} |
q11951 | ChineseEnglishWordMap.addMap | train | public int addMap(Map<String, Set<String>> addM) {
int newTrans = 0;
for (Map.Entry<String,Set<String>> me : addM.entrySet()) {
String k = me.getKey();
Set<String> addList = me.getValue();
Set<String> origList = map.get(k);
if (origList == null) {
map.put(k, new LinkedHashSet<String>(addList));
Set<String> newList = map.get(k);
if (newList != null && newList.size() != 0) {
newTrans+=addList.size();
}
} else {
for (String toAdd : addList) {
if (!(origList.contains(toAdd))) {
origList.add(toAdd);
newTrans++;
}
}
}
}
return newTrans;
} | java | {
"resource": ""
} |
q11952 | dnssoarec.add | train | public static base_response add(nitro_service client, dnssoarec resource) throws Exception {
dnssoarec addresource = new dnssoarec();
addresource.domain = resource.domain;
addresource.originserver = resource.originserver;
addresource.contact = resource.contact;
addresource.serial = resource.serial;
addresource.refresh = resource.refresh;
addresource.retry = resource.retry;
addresource.expire = resource.expire;
addresource.minimum = resource.minimum;
addresource.ttl = resource.ttl;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11953 | dnssoarec.add | train | public static base_responses add(nitro_service client, dnssoarec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnssoarec addresources[] = new dnssoarec[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new dnssoarec();
addresources[i].domain = resources[i].domain;
addresources[i].originserver = resources[i].originserver;
addresources[i].contact = resources[i].contact;
addresources[i].serial = resources[i].serial;
addresources[i].refresh = resources[i].refresh;
addresources[i].retry = resources[i].retry;
addresources[i].expire = resources[i].expire;
addresources[i].minimum = resources[i].minimum;
addresources[i].ttl = resources[i].ttl;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | {
"resource": ""
} |
q11954 | dnssoarec.delete | train | public static base_responses delete(nitro_service client, dnssoarec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnssoarec deleteresources[] = new dnssoarec[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new dnssoarec();
deleteresources[i].domain = resources[i].domain;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | {
"resource": ""
} |
q11955 | dnssoarec.update | train | public static base_response update(nitro_service client, dnssoarec resource) throws Exception {
dnssoarec updateresource = new dnssoarec();
updateresource.domain = resource.domain;
updateresource.originserver = resource.originserver;
updateresource.contact = resource.contact;
updateresource.serial = resource.serial;
updateresource.refresh = resource.refresh;
updateresource.retry = resource.retry;
updateresource.expire = resource.expire;
updateresource.minimum = resource.minimum;
updateresource.ttl = resource.ttl;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11956 | dnssoarec.update | train | public static base_responses update(nitro_service client, dnssoarec resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
dnssoarec updateresources[] = new dnssoarec[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new dnssoarec();
updateresources[i].domain = resources[i].domain;
updateresources[i].originserver = resources[i].originserver;
updateresources[i].contact = resources[i].contact;
updateresources[i].serial = resources[i].serial;
updateresources[i].refresh = resources[i].refresh;
updateresources[i].retry = resources[i].retry;
updateresources[i].expire = resources[i].expire;
updateresources[i].minimum = resources[i].minimum;
updateresources[i].ttl = resources[i].ttl;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | {
"resource": ""
} |
q11957 | dnssoarec.unset | train | public static base_response unset(nitro_service client, dnssoarec resource, String[] args) throws Exception{
dnssoarec unsetresource = new dnssoarec();
unsetresource.domain = resource.domain;
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11958 | dnssoarec.unset | train | public static base_responses unset(nitro_service client, String domain[], String args[]) throws Exception {
base_responses result = null;
if (domain != null && domain.length > 0) {
dnssoarec unsetresources[] = new dnssoarec[domain.length];
for (int i=0;i<domain.length;i++){
unsetresources[i] = new dnssoarec();
unsetresources[i].domain = domain[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11959 | dnssoarec.get | train | public static dnssoarec[] get(nitro_service service) throws Exception{
dnssoarec obj = new dnssoarec();
dnssoarec[] response = (dnssoarec[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11960 | dnssoarec.get | train | public static dnssoarec[] get(nitro_service service, dnssoarec_args args) throws Exception{
dnssoarec obj = new dnssoarec();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
dnssoarec[] response = (dnssoarec[])obj.get_resources(service, option);
return response;
} | java | {
"resource": ""
} |
q11961 | dnssoarec.get | train | public static dnssoarec get(nitro_service service, String domain) throws Exception{
dnssoarec obj = new dnssoarec();
obj.set_domain(domain);
dnssoarec response = (dnssoarec) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11962 | vpnglobal_domain_binding.get | train | public static vpnglobal_domain_binding[] get(nitro_service service) throws Exception{
vpnglobal_domain_binding obj = new vpnglobal_domain_binding();
vpnglobal_domain_binding response[] = (vpnglobal_domain_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11963 | cachepolicy.add | train | public static base_response add(nitro_service client, cachepolicy resource) throws Exception {
cachepolicy addresource = new cachepolicy();
addresource.policyname = resource.policyname;
addresource.rule = resource.rule;
addresource.action = resource.action;
addresource.storeingroup = resource.storeingroup;
addresource.invalgroups = resource.invalgroups;
addresource.invalobjects = resource.invalobjects;
addresource.undefaction = resource.undefaction;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11964 | cachepolicy.add | train | public static base_responses add(nitro_service client, cachepolicy resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
cachepolicy addresources[] = new cachepolicy[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new cachepolicy();
addresources[i].policyname = resources[i].policyname;
addresources[i].rule = resources[i].rule;
addresources[i].action = resources[i].action;
addresources[i].storeingroup = resources[i].storeingroup;
addresources[i].invalgroups = resources[i].invalgroups;
addresources[i].invalobjects = resources[i].invalobjects;
addresources[i].undefaction = resources[i].undefaction;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | {
"resource": ""
} |
q11965 | cachepolicy.update | train | public static base_response update(nitro_service client, cachepolicy resource) throws Exception {
cachepolicy updateresource = new cachepolicy();
updateresource.policyname = resource.policyname;
updateresource.rule = resource.rule;
updateresource.action = resource.action;
updateresource.storeingroup = resource.storeingroup;
updateresource.invalgroups = resource.invalgroups;
updateresource.invalobjects = resource.invalobjects;
updateresource.undefaction = resource.undefaction;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11966 | cachepolicy.update | train | public static base_responses update(nitro_service client, cachepolicy resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
cachepolicy updateresources[] = new cachepolicy[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new cachepolicy();
updateresources[i].policyname = resources[i].policyname;
updateresources[i].rule = resources[i].rule;
updateresources[i].action = resources[i].action;
updateresources[i].storeingroup = resources[i].storeingroup;
updateresources[i].invalgroups = resources[i].invalgroups;
updateresources[i].invalobjects = resources[i].invalobjects;
updateresources[i].undefaction = resources[i].undefaction;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | {
"resource": ""
} |
q11967 | cachepolicy.unset | train | public static base_responses unset(nitro_service client, String policyname[], String args[]) throws Exception {
base_responses result = null;
if (policyname != null && policyname.length > 0) {
cachepolicy unsetresources[] = new cachepolicy[policyname.length];
for (int i=0;i<policyname.length;i++){
unsetresources[i] = new cachepolicy();
unsetresources[i].policyname = policyname[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11968 | cachepolicy.rename | train | public static base_response rename(nitro_service client, cachepolicy resource, String new_policyname) throws Exception {
cachepolicy renameresource = new cachepolicy();
renameresource.policyname = resource.policyname;
return renameresource.rename_resource(client,new_policyname);
} | java | {
"resource": ""
} |
q11969 | cachepolicy.get | train | public static cachepolicy[] get(nitro_service service) throws Exception{
cachepolicy obj = new cachepolicy();
cachepolicy[] response = (cachepolicy[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11970 | cachepolicy.get | train | public static cachepolicy get(nitro_service service, String policyname) throws Exception{
cachepolicy obj = new cachepolicy();
obj.set_policyname(policyname);
cachepolicy response = (cachepolicy) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11971 | authorizationpolicy_lbvserver_binding.get | train | public static authorizationpolicy_lbvserver_binding[] get(nitro_service service, String name) throws Exception{
authorizationpolicy_lbvserver_binding obj = new authorizationpolicy_lbvserver_binding();
obj.set_name(name);
authorizationpolicy_lbvserver_binding response[] = (authorizationpolicy_lbvserver_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11972 | XMLBeginEndIterator.getNext | train | private String getNext() {
StringBuilder result = new StringBuilder();
try {
XMLUtils.XMLTag tag;
do {
// String text =
XMLUtils.readUntilTag(inputReader);
// there may or may not be text before the next tag, but we discard it
// System.out.println("outside text: " + text );
tag = XMLUtils.readAndParseTag(inputReader);
// System.out.println("outside tag: " + tag);
if (tag == null) {
return null; // couldn't find any more tags, so no more elements
}
} while (!tagNamePattern.matcher(tag.name).matches() ||
tag.isEndTag || tag.isSingleTag);
if (keepDelimitingTags) {
result.append(tag.toString());
}
int depth = 1;
while (true) {
String text = XMLUtils.readUntilTag(inputReader);
if (text != null) {
// if the text isn't null, we append it
// System.out.println("inside text: " + text );
result.append(text);
}
String tagString = XMLUtils.readTag(inputReader);
tag = XMLUtils.parseTag(tagString);
if (tag == null) {
return null; // unexpected end of this element, so no more elements
}
if (tagNamePattern.matcher(tag.name).matches() && tag.isEndTag) {
if ((countDepth && depth == 1) || !countDepth) {
if (keepDelimitingTags) {
result.append(tagString);
}
// this is our end tag so we stop
break;
} else {
--depth;
if (keepInternalTags) {
result.append(tagString);
}
}
} else if (tagNamePattern.matcher(tag.name).matches() && !tag.isEndTag &&
!tag.isSingleTag && countDepth) {
++depth;
if (keepInternalTags) {
result.append(tagString);
}
} else {
// not our end tag, so we optionally append it and keep going
if (keepInternalTags) {
result.append(tagString);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result.toString();
} | java | {
"resource": ""
} |
q11973 | XMLBeginEndIterator.tokenize | train | public List<E> tokenize() {
// System.out.println("tokenize called");
List<E> result = new ArrayList<E>();
while (hasNext()) {
result.add(next());
}
return result;
} | java | {
"resource": ""
} |
q11974 | XMLBeginEndIterator.getFactory | train | public static IteratorFromReaderFactory<String> getFactory(String tag) {
return new XMLBeginEndIterator.XMLBeginEndIteratorFactory<String>(tag, new IdentityFunction<String>(), false, false);
} | java | {
"resource": ""
} |
q11975 | lbvserver_service_binding.get | train | public static lbvserver_service_binding[] get(nitro_service service, String name) throws Exception{
lbvserver_service_binding obj = new lbvserver_service_binding();
obj.set_name(name);
lbvserver_service_binding response[] = (lbvserver_service_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11976 | sslservicegroup.update | train | public static base_response update(nitro_service client, sslservicegroup resource) throws Exception {
sslservicegroup updateresource = new sslservicegroup();
updateresource.servicegroupname = resource.servicegroupname;
updateresource.sessreuse = resource.sessreuse;
updateresource.sesstimeout = resource.sesstimeout;
updateresource.nonfipsciphers = resource.nonfipsciphers;
updateresource.ssl3 = resource.ssl3;
updateresource.tls1 = resource.tls1;
updateresource.serverauth = resource.serverauth;
updateresource.commonname = resource.commonname;
updateresource.sendclosenotify = resource.sendclosenotify;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11977 | sslservicegroup.update | train | public static base_responses update(nitro_service client, sslservicegroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
sslservicegroup updateresources[] = new sslservicegroup[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new sslservicegroup();
updateresources[i].servicegroupname = resources[i].servicegroupname;
updateresources[i].sessreuse = resources[i].sessreuse;
updateresources[i].sesstimeout = resources[i].sesstimeout;
updateresources[i].nonfipsciphers = resources[i].nonfipsciphers;
updateresources[i].ssl3 = resources[i].ssl3;
updateresources[i].tls1 = resources[i].tls1;
updateresources[i].serverauth = resources[i].serverauth;
updateresources[i].commonname = resources[i].commonname;
updateresources[i].sendclosenotify = resources[i].sendclosenotify;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | {
"resource": ""
} |
q11978 | sslservicegroup.unset | train | public static base_response unset(nitro_service client, sslservicegroup resource, String[] args) throws Exception{
sslservicegroup unsetresource = new sslservicegroup();
unsetresource.servicegroupname = resource.servicegroupname;
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11979 | sslservicegroup.unset | train | public static base_responses unset(nitro_service client, String servicegroupname[], String args[]) throws Exception {
base_responses result = null;
if (servicegroupname != null && servicegroupname.length > 0) {
sslservicegroup unsetresources[] = new sslservicegroup[servicegroupname.length];
for (int i=0;i<servicegroupname.length;i++){
unsetresources[i] = new sslservicegroup();
unsetresources[i].servicegroupname = servicegroupname[i];
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11980 | sslservicegroup.get | train | public static sslservicegroup[] get(nitro_service service) throws Exception{
sslservicegroup obj = new sslservicegroup();
sslservicegroup[] response = (sslservicegroup[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11981 | sslservicegroup.get | train | public static sslservicegroup[] get(nitro_service service, sslservicegroup_args args) throws Exception{
sslservicegroup obj = new sslservicegroup();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
sslservicegroup[] response = (sslservicegroup[])obj.get_resources(service, option);
return response;
} | java | {
"resource": ""
} |
q11982 | sslservicegroup.get | train | public static sslservicegroup get(nitro_service service, String servicegroupname) throws Exception{
sslservicegroup obj = new sslservicegroup();
obj.set_servicegroupname(servicegroupname);
sslservicegroup response = (sslservicegroup) obj.get_resource(service);
return response;
} | java | {
"resource": ""
} |
q11983 | authenticationsamlpolicy_authenticationvserver_binding.get | train | public static authenticationsamlpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{
authenticationsamlpolicy_authenticationvserver_binding obj = new authenticationsamlpolicy_authenticationvserver_binding();
obj.set_name(name);
authenticationsamlpolicy_authenticationvserver_binding response[] = (authenticationsamlpolicy_authenticationvserver_binding[]) obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
q11984 | servicegroup.add | train | public static base_response add(nitro_service client, servicegroup resource) throws Exception {
servicegroup addresource = new servicegroup();
addresource.servicegroupname = resource.servicegroupname;
addresource.servicetype = resource.servicetype;
addresource.cachetype = resource.cachetype;
addresource.td = resource.td;
addresource.maxclient = resource.maxclient;
addresource.maxreq = resource.maxreq;
addresource.cacheable = resource.cacheable;
addresource.cip = resource.cip;
addresource.cipheader = resource.cipheader;
addresource.usip = resource.usip;
addresource.pathmonitor = resource.pathmonitor;
addresource.pathmonitorindv = resource.pathmonitorindv;
addresource.useproxyport = resource.useproxyport;
addresource.healthmonitor = resource.healthmonitor;
addresource.sc = resource.sc;
addresource.sp = resource.sp;
addresource.rtspsessionidremap = resource.rtspsessionidremap;
addresource.clttimeout = resource.clttimeout;
addresource.svrtimeout = resource.svrtimeout;
addresource.cka = resource.cka;
addresource.tcpb = resource.tcpb;
addresource.cmp = resource.cmp;
addresource.maxbandwidth = resource.maxbandwidth;
addresource.monthreshold = resource.monthreshold;
addresource.state = resource.state;
addresource.downstateflush = resource.downstateflush;
addresource.tcpprofilename = resource.tcpprofilename;
addresource.httpprofilename = resource.httpprofilename;
addresource.comment = resource.comment;
addresource.appflowlog = resource.appflowlog;
addresource.netprofile = resource.netprofile;
addresource.autoscale = resource.autoscale;
addresource.memberport = resource.memberport;
return addresource.add_resource(client);
} | java | {
"resource": ""
} |
q11985 | servicegroup.delete | train | public static base_response delete(nitro_service client, String servicegroupname) throws Exception {
servicegroup deleteresource = new servicegroup();
deleteresource.servicegroupname = servicegroupname;
return deleteresource.delete_resource(client);
} | java | {
"resource": ""
} |
q11986 | servicegroup.delete | train | public static base_responses delete(nitro_service client, servicegroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
servicegroup deleteresources[] = new servicegroup[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new servicegroup();
deleteresources[i].servicegroupname = resources[i].servicegroupname;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} | java | {
"resource": ""
} |
q11987 | servicegroup.update | train | public static base_response update(nitro_service client, servicegroup resource) throws Exception {
servicegroup updateresource = new servicegroup();
updateresource.servicegroupname = resource.servicegroupname;
updateresource.servername = resource.servername;
updateresource.port = resource.port;
updateresource.weight = resource.weight;
updateresource.customserverid = resource.customserverid;
updateresource.serverid = resource.serverid;
updateresource.hashid = resource.hashid;
updateresource.monitor_name_svc = resource.monitor_name_svc;
updateresource.dup_weight = resource.dup_weight;
updateresource.maxclient = resource.maxclient;
updateresource.maxreq = resource.maxreq;
updateresource.healthmonitor = resource.healthmonitor;
updateresource.cacheable = resource.cacheable;
updateresource.cip = resource.cip;
updateresource.cipheader = resource.cipheader;
updateresource.usip = resource.usip;
updateresource.pathmonitor = resource.pathmonitor;
updateresource.pathmonitorindv = resource.pathmonitorindv;
updateresource.useproxyport = resource.useproxyport;
updateresource.sc = resource.sc;
updateresource.sp = resource.sp;
updateresource.rtspsessionidremap = resource.rtspsessionidremap;
updateresource.clttimeout = resource.clttimeout;
updateresource.svrtimeout = resource.svrtimeout;
updateresource.cka = resource.cka;
updateresource.tcpb = resource.tcpb;
updateresource.cmp = resource.cmp;
updateresource.maxbandwidth = resource.maxbandwidth;
updateresource.monthreshold = resource.monthreshold;
updateresource.downstateflush = resource.downstateflush;
updateresource.tcpprofilename = resource.tcpprofilename;
updateresource.httpprofilename = resource.httpprofilename;
updateresource.comment = resource.comment;
updateresource.appflowlog = resource.appflowlog;
updateresource.netprofile = resource.netprofile;
return updateresource.update_resource(client);
} | java | {
"resource": ""
} |
q11988 | servicegroup.unset | train | public static base_response unset(nitro_service client, servicegroup resource, String[] args) throws Exception{
servicegroup unsetresource = new servicegroup();
unsetresource.servicegroupname = resource.servicegroupname;
unsetresource.servername = resource.servername;
unsetresource.port = resource.port;
unsetresource.weight = resource.weight;
unsetresource.customserverid = resource.customserverid;
unsetresource.serverid = resource.serverid;
unsetresource.hashid = resource.hashid;
return unsetresource.unset_resource(client,args);
} | java | {
"resource": ""
} |
q11989 | servicegroup.unset | train | public static base_responses unset(nitro_service client, servicegroup resources[], String[] args) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
servicegroup unsetresources[] = new servicegroup[resources.length];
for (int i=0;i<resources.length;i++){
unsetresources[i] = new servicegroup();
unsetresources[i].servicegroupname = resources[i].servicegroupname;
unsetresources[i].servername = resources[i].servername;
unsetresources[i].port = resources[i].port;
unsetresources[i].weight = resources[i].weight;
unsetresources[i].customserverid = resources[i].customserverid;
unsetresources[i].serverid = resources[i].serverid;
unsetresources[i].hashid = resources[i].hashid;
}
result = unset_bulk_request(client, unsetresources,args);
}
return result;
} | java | {
"resource": ""
} |
q11990 | servicegroup.enable | train | public static base_response enable(nitro_service client, String servicegroupname) throws Exception {
servicegroup enableresource = new servicegroup();
enableresource.servicegroupname = servicegroupname;
return enableresource.perform_operation(client,"enable");
} | java | {
"resource": ""
} |
q11991 | servicegroup.enable | train | public static base_response enable(nitro_service client, servicegroup resource) throws Exception {
servicegroup enableresource = new servicegroup();
enableresource.servicegroupname = resource.servicegroupname;
enableresource.servername = resource.servername;
enableresource.port = resource.port;
return enableresource.perform_operation(client,"enable");
} | java | {
"resource": ""
} |
q11992 | servicegroup.enable | train | public static base_responses enable(nitro_service client, String servicegroupname[]) throws Exception {
base_responses result = null;
if (servicegroupname != null && servicegroupname.length > 0) {
servicegroup enableresources[] = new servicegroup[servicegroupname.length];
for (int i=0;i<servicegroupname.length;i++){
enableresources[i] = new servicegroup();
enableresources[i].servicegroupname = servicegroupname[i];
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | java | {
"resource": ""
} |
q11993 | servicegroup.enable | train | public static base_responses enable(nitro_service client, servicegroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
servicegroup enableresources[] = new servicegroup[resources.length];
for (int i=0;i<resources.length;i++){
enableresources[i] = new servicegroup();
enableresources[i].servicegroupname = resources[i].servicegroupname;
enableresources[i].servername = resources[i].servername;
enableresources[i].port = resources[i].port;
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | java | {
"resource": ""
} |
q11994 | servicegroup.disable | train | public static base_response disable(nitro_service client, String servicegroupname) throws Exception {
servicegroup disableresource = new servicegroup();
disableresource.servicegroupname = servicegroupname;
return disableresource.perform_operation(client,"disable");
} | java | {
"resource": ""
} |
q11995 | servicegroup.disable | train | public static base_response disable(nitro_service client, servicegroup resource) throws Exception {
servicegroup disableresource = new servicegroup();
disableresource.servicegroupname = resource.servicegroupname;
disableresource.servername = resource.servername;
disableresource.port = resource.port;
disableresource.delay = resource.delay;
disableresource.graceful = resource.graceful;
return disableresource.perform_operation(client,"disable");
} | java | {
"resource": ""
} |
q11996 | servicegroup.disable | train | public static base_responses disable(nitro_service client, String servicegroupname[]) throws Exception {
base_responses result = null;
if (servicegroupname != null && servicegroupname.length > 0) {
servicegroup disableresources[] = new servicegroup[servicegroupname.length];
for (int i=0;i<servicegroupname.length;i++){
disableresources[i] = new servicegroup();
disableresources[i].servicegroupname = servicegroupname[i];
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} | java | {
"resource": ""
} |
q11997 | servicegroup.disable | train | public static base_responses disable(nitro_service client, servicegroup resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
servicegroup disableresources[] = new servicegroup[resources.length];
for (int i=0;i<resources.length;i++){
disableresources[i] = new servicegroup();
disableresources[i].servicegroupname = resources[i].servicegroupname;
disableresources[i].servername = resources[i].servername;
disableresources[i].port = resources[i].port;
disableresources[i].delay = resources[i].delay;
disableresources[i].graceful = resources[i].graceful;
}
result = perform_operation_bulk_request(client, disableresources,"disable");
}
return result;
} | java | {
"resource": ""
} |
q11998 | servicegroup.rename | train | public static base_response rename(nitro_service client, servicegroup resource, String new_servicegroupname) throws Exception {
servicegroup renameresource = new servicegroup();
renameresource.servicegroupname = resource.servicegroupname;
return renameresource.rename_resource(client,new_servicegroupname);
} | java | {
"resource": ""
} |
q11999 | servicegroup.get | train | public static servicegroup[] get(nitro_service service) throws Exception{
servicegroup obj = new servicegroup();
servicegroup[] response = (servicegroup[])obj.get_resources(service);
return response;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.