repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/tunnel/tunnelglobal_tunneltrafficpolicy_binding.java
tunnelglobal_tunneltrafficpolicy_binding.get
public static tunnelglobal_tunneltrafficpolicy_binding[] get(nitro_service service) throws Exception{ tunnelglobal_tunneltrafficpolicy_binding obj = new tunnelglobal_tunneltrafficpolicy_binding(); tunnelglobal_tunneltrafficpolicy_binding response[] = (tunnelglobal_tunneltrafficpolicy_binding[]) obj.get_resources(service); return response; }
java
public static tunnelglobal_tunneltrafficpolicy_binding[] get(nitro_service service) throws Exception{ tunnelglobal_tunneltrafficpolicy_binding obj = new tunnelglobal_tunneltrafficpolicy_binding(); tunnelglobal_tunneltrafficpolicy_binding response[] = (tunnelglobal_tunneltrafficpolicy_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "tunnelglobal_tunneltrafficpolicy_binding", "[", "]", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "tunnelglobal_tunneltrafficpolicy_binding", "obj", "=", "new", "tunnelglobal_tunneltrafficpolicy_binding", "(", ")", ";", "tunnelglobal_tunneltrafficpolicy_binding", "response", "[", "]", "=", "(", "tunnelglobal_tunneltrafficpolicy_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch a tunnelglobal_tunneltrafficpolicy_binding resources.
[ "Use", "this", "API", "to", "fetch", "a", "tunnelglobal_tunneltrafficpolicy_binding", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tunnel/tunnelglobal_tunneltrafficpolicy_binding.java#L201-L205
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pq_stats.java
pq_stats.get
public static pq_stats get(nitro_service service) throws Exception{ pq_stats obj = new pq_stats(); pq_stats[] response = (pq_stats[])obj.stat_resources(service); return response[0]; }
java
public static pq_stats get(nitro_service service) throws Exception{ pq_stats obj = new pq_stats(); pq_stats[] response = (pq_stats[])obj.stat_resources(service); return response[0]; }
[ "public", "static", "pq_stats", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "pq_stats", "obj", "=", "new", "pq_stats", "(", ")", ";", "pq_stats", "[", "]", "response", "=", "(", "pq_stats", "[", "]", ")", "obj", ".", "stat_resources", "(", "service", ")", ";", "return", "response", "[", "0", "]", ";", "}" ]
Use this API to fetch the statistics of all pq_stats resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "the", "statistics", "of", "all", "pq_stats", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/pq/pq_stats.java#L191-L195
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cs/csvserver_authorizationpolicy_binding.java
csvserver_authorizationpolicy_binding.get
public static csvserver_authorizationpolicy_binding[] get(nitro_service service, String name) throws Exception{ csvserver_authorizationpolicy_binding obj = new csvserver_authorizationpolicy_binding(); obj.set_name(name); csvserver_authorizationpolicy_binding response[] = (csvserver_authorizationpolicy_binding[]) obj.get_resources(service); return response; }
java
public static csvserver_authorizationpolicy_binding[] get(nitro_service service, String name) throws Exception{ csvserver_authorizationpolicy_binding obj = new csvserver_authorizationpolicy_binding(); obj.set_name(name); csvserver_authorizationpolicy_binding response[] = (csvserver_authorizationpolicy_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "csvserver_authorizationpolicy_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "csvserver_authorizationpolicy_binding", "obj", "=", "new", "csvserver_authorizationpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "csvserver_authorizationpolicy_binding", "response", "[", "]", "=", "(", "csvserver_authorizationpolicy_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch csvserver_authorizationpolicy_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "csvserver_authorizationpolicy_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cs/csvserver_authorizationpolicy_binding.java#L337-L342
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java
LabeledScoredTreeFactory.newTreeNode
@Override public Tree newTreeNode(Label parentLabel, List<Tree> children) { return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children); }
java
@Override public Tree newTreeNode(Label parentLabel, List<Tree> children) { return new LabeledScoredTreeNode(lf.newLabel(parentLabel), children); }
[ "@", "Override", "public", "Tree", "newTreeNode", "(", "Label", "parentLabel", ",", "List", "<", "Tree", ">", "children", ")", "{", "return", "new", "LabeledScoredTreeNode", "(", "lf", ".", "newLabel", "(", "parentLabel", ")", ",", "children", ")", ";", "}" ]
Create a new non-leaf tree node with the given label @param parentLabel The label for the node @param children A <code>List</code> of the children of this node, each of which should itself be a <code>LabeledScoredTree</code> @return A new internal tree node
[ "Create", "a", "new", "non", "-", "leaf", "tree", "node", "with", "the", "given", "label" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/LabeledScoredTreeFactory.java#L67-L70
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap_binding.java
policystringmap_binding.get
public static policystringmap_binding get(nitro_service service, String name) throws Exception{ policystringmap_binding obj = new policystringmap_binding(); obj.set_name(name); policystringmap_binding response = (policystringmap_binding) obj.get_resource(service); return response; }
java
public static policystringmap_binding get(nitro_service service, String name) throws Exception{ policystringmap_binding obj = new policystringmap_binding(); obj.set_name(name); policystringmap_binding response = (policystringmap_binding) obj.get_resource(service); return response; }
[ "public", "static", "policystringmap_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "policystringmap_binding", "obj", "=", "new", "policystringmap_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "policystringmap_binding", "response", "=", "(", "policystringmap_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch policystringmap_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "policystringmap_binding", "resource", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/policy/policystringmap_binding.java#L103-L108
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusternodegroup_crvserver_binding.java
clusternodegroup_crvserver_binding.count
public static long count(nitro_service service, clusternodegroup_crvserver_binding obj) throws Exception{ options option = new options(); option.set_count(true); option.set_args(nitro_util.object_to_string_withoutquotes(obj)); clusternodegroup_crvserver_binding response[] = (clusternodegroup_crvserver_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count(nitro_service service, clusternodegroup_crvserver_binding obj) throws Exception{ options option = new options(); option.set_count(true); option.set_args(nitro_util.object_to_string_withoutquotes(obj)); clusternodegroup_crvserver_binding response[] = (clusternodegroup_crvserver_binding[]) obj.get_resources(service,option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count", "(", "nitro_service", "service", ",", "clusternodegroup_crvserver_binding", "obj", ")", "throws", "Exception", "{", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_count", "(", "true", ")", ";", "option", ".", "set_args", "(", "nitro_util", ".", "object_to_string_withoutquotes", "(", "obj", ")", ")", ";", "clusternodegroup_crvserver_binding", "response", "[", "]", "=", "(", "clusternodegroup_crvserver_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ",", "option", ")", ";", "if", "(", "response", "!=", "null", ")", "{", "return", "response", "[", "0", "]", ".", "__count", ";", "}", "return", "0", ";", "}" ]
Use this API to count clusternodegroup_crvserver_binding resources configued on NetScaler.
[ "Use", "this", "API", "to", "count", "clusternodegroup_crvserver_binding", "resources", "configued", "on", "NetScaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/cluster/clusternodegroup_crvserver_binding.java#L178-L187
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/ArrayUtils.java
ArrayUtils.asSet
public static <T> Set<T> asSet(T[] a) { return new HashSet<T>(Arrays.asList(a)); }
java
public static <T> Set<T> asSet(T[] a) { return new HashSet<T>(Arrays.asList(a)); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "asSet", "(", "T", "[", "]", "a", ")", "{", "return", "new", "HashSet", "<", "T", ">", "(", "Arrays", ".", "asList", "(", "a", ")", ")", ";", "}" ]
Return a set containing the same elements as the specified array.
[ "Return", "a", "set", "containing", "the", "same", "elements", "as", "the", "specified", "array", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/ArrayUtils.java#L567-L569
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/ArrayUtils.java
ArrayUtils.toDouble
public static double[] toDouble(float[] a) { double[] d = new double[a.length]; for (int i = 0; i < a.length; i++) { d[i] = a[i]; } return d; }
java
public static double[] toDouble(float[] a) { double[] d = new double[a.length]; for (int i = 0; i < a.length; i++) { d[i] = a[i]; } return d; }
[ "public", "static", "double", "[", "]", "toDouble", "(", "float", "[", "]", "a", ")", "{", "double", "[", "]", "d", "=", "new", "double", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "d", "[", "i", "]", "=", "a", "[", "i", "]", ";", "}", "return", "d", ";", "}" ]
Casts to a double array
[ "Casts", "to", "a", "double", "array" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/ArrayUtils.java#L612-L618
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/ArrayUtils.java
ArrayUtils.toDouble
public static double[] toDouble(int[] array) { double[] rv = new double[array.length]; for (int i = 0; i < array.length; i++) { rv[i] = array[i]; } return rv; }
java
public static double[] toDouble(int[] array) { double[] rv = new double[array.length]; for (int i = 0; i < array.length; i++) { rv[i] = array[i]; } return rv; }
[ "public", "static", "double", "[", "]", "toDouble", "(", "int", "[", "]", "array", ")", "{", "double", "[", "]", "rv", "=", "new", "double", "[", "array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "rv", "[", "i", "]", "=", "array", "[", "i", "]", ";", "}", "return", "rv", ";", "}" ]
Casts to a double array.
[ "Casts", "to", "a", "double", "array", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/ArrayUtils.java#L623-L629
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java
vpnsessionpolicy.add
public static base_response add(nitro_service client, vpnsessionpolicy resource) throws Exception { vpnsessionpolicy addresource = new vpnsessionpolicy(); addresource.name = resource.name; addresource.rule = resource.rule; addresource.action = resource.action; return addresource.add_resource(client); }
java
public static base_response add(nitro_service client, vpnsessionpolicy resource) throws Exception { vpnsessionpolicy addresource = new vpnsessionpolicy(); addresource.name = resource.name; addresource.rule = resource.rule; addresource.action = resource.action; return addresource.add_resource(client); }
[ "public", "static", "base_response", "add", "(", "nitro_service", "client", ",", "vpnsessionpolicy", "resource", ")", "throws", "Exception", "{", "vpnsessionpolicy", "addresource", "=", "new", "vpnsessionpolicy", "(", ")", ";", "addresource", ".", "name", "=", "resource", ".", "name", ";", "addresource", ".", "rule", "=", "resource", ".", "rule", ";", "addresource", ".", "action", "=", "resource", ".", "action", ";", "return", "addresource", ".", "add_resource", "(", "client", ")", ";", "}" ]
Use this API to add vpnsessionpolicy.
[ "Use", "this", "API", "to", "add", "vpnsessionpolicy", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java#L156-L162
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java
vpnsessionpolicy.update
public static base_response update(nitro_service client, vpnsessionpolicy resource) throws Exception { vpnsessionpolicy updateresource = new vpnsessionpolicy(); updateresource.name = resource.name; updateresource.rule = resource.rule; updateresource.action = resource.action; return updateresource.update_resource(client); }
java
public static base_response update(nitro_service client, vpnsessionpolicy resource) throws Exception { vpnsessionpolicy updateresource = new vpnsessionpolicy(); updateresource.name = resource.name; updateresource.rule = resource.rule; updateresource.action = resource.action; return updateresource.update_resource(client); }
[ "public", "static", "base_response", "update", "(", "nitro_service", "client", ",", "vpnsessionpolicy", "resource", ")", "throws", "Exception", "{", "vpnsessionpolicy", "updateresource", "=", "new", "vpnsessionpolicy", "(", ")", ";", "updateresource", ".", "name", "=", "resource", ".", "name", ";", "updateresource", ".", "rule", "=", "resource", ".", "rule", ";", "updateresource", ".", "action", "=", "resource", ".", "action", ";", "return", "updateresource", ".", "update_resource", "(", "client", ")", ";", "}" ]
Use this API to update vpnsessionpolicy.
[ "Use", "this", "API", "to", "update", "vpnsessionpolicy", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java#L235-L241
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java
vpnsessionpolicy.get
public static vpnsessionpolicy[] get(nitro_service service) throws Exception{ vpnsessionpolicy obj = new vpnsessionpolicy(); vpnsessionpolicy[] response = (vpnsessionpolicy[])obj.get_resources(service); return response; }
java
public static vpnsessionpolicy[] get(nitro_service service) throws Exception{ vpnsessionpolicy obj = new vpnsessionpolicy(); vpnsessionpolicy[] response = (vpnsessionpolicy[])obj.get_resources(service); return response; }
[ "public", "static", "vpnsessionpolicy", "[", "]", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "vpnsessionpolicy", "obj", "=", "new", "vpnsessionpolicy", "(", ")", ";", "vpnsessionpolicy", "[", "]", "response", "=", "(", "vpnsessionpolicy", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch all the vpnsessionpolicy resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "vpnsessionpolicy", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java#L308-L312
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java
vpnsessionpolicy.get
public static vpnsessionpolicy get(nitro_service service, String name) throws Exception{ vpnsessionpolicy obj = new vpnsessionpolicy(); obj.set_name(name); vpnsessionpolicy response = (vpnsessionpolicy) obj.get_resource(service); return response; }
java
public static vpnsessionpolicy get(nitro_service service, String name) throws Exception{ vpnsessionpolicy obj = new vpnsessionpolicy(); obj.set_name(name); vpnsessionpolicy response = (vpnsessionpolicy) obj.get_resource(service); return response; }
[ "public", "static", "vpnsessionpolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "vpnsessionpolicy", "obj", "=", "new", "vpnsessionpolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "vpnsessionpolicy", "response", "=", "(", "vpnsessionpolicy", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch vpnsessionpolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "vpnsessionpolicy", "resource", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnsessionpolicy.java#L324-L329
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java
SVMLightClassifierFactory.readModel
private static Pair<Double, ClassicCounter<Integer>> readModel(File modelFile, boolean multiclass) { int modelLineCount = 0; try { int numLinesToSkip = multiclass ? 13 : 10; String stopToken = "#"; BufferedReader in = new BufferedReader(new FileReader(modelFile)); for (int i=0; i < numLinesToSkip; i++) { in.readLine(); modelLineCount ++; } List<Pair<Double, ClassicCounter<Integer>>> supportVectors = new ArrayList<Pair<Double, ClassicCounter<Integer>>>(); // Read Threshold String thresholdLine = in.readLine(); modelLineCount ++; String[] pieces = thresholdLine.split("\\s+"); double threshold = Double.parseDouble(pieces[0]); // Read Support Vectors while (in.ready()) { String svLine = in.readLine(); modelLineCount ++; pieces = svLine.split("\\s+"); // First Element is the alpha_i * y_i double alpha = Double.parseDouble(pieces[0]); ClassicCounter<Integer> supportVector = new ClassicCounter<Integer>(); for (int i=1; i < pieces.length; ++i) { String piece = pieces[i]; if (piece.equals(stopToken)) break; // Each in featureIndex:num class String[] indexNum = piece.split(":"); String featureIndex = indexNum[0]; // mihai: we may see "qid" as indexNum[0]. just skip this piece. this is the block id useful only for reranking, which we don't do here. if(! featureIndex.equals("qid")){ double count = Double.parseDouble(indexNum[1]); supportVector.incrementCount(Integer.valueOf(featureIndex), count); } } supportVectors.add(new Pair<Double, ClassicCounter<Integer>>(alpha, supportVector)); } in.close(); return new Pair<Double, ClassicCounter<Integer>>(threshold, getWeights(supportVectors)); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error reading SVM model (line " + modelLineCount + " in file " + modelFile.getAbsolutePath() + ")"); } }
java
private static Pair<Double, ClassicCounter<Integer>> readModel(File modelFile, boolean multiclass) { int modelLineCount = 0; try { int numLinesToSkip = multiclass ? 13 : 10; String stopToken = "#"; BufferedReader in = new BufferedReader(new FileReader(modelFile)); for (int i=0; i < numLinesToSkip; i++) { in.readLine(); modelLineCount ++; } List<Pair<Double, ClassicCounter<Integer>>> supportVectors = new ArrayList<Pair<Double, ClassicCounter<Integer>>>(); // Read Threshold String thresholdLine = in.readLine(); modelLineCount ++; String[] pieces = thresholdLine.split("\\s+"); double threshold = Double.parseDouble(pieces[0]); // Read Support Vectors while (in.ready()) { String svLine = in.readLine(); modelLineCount ++; pieces = svLine.split("\\s+"); // First Element is the alpha_i * y_i double alpha = Double.parseDouble(pieces[0]); ClassicCounter<Integer> supportVector = new ClassicCounter<Integer>(); for (int i=1; i < pieces.length; ++i) { String piece = pieces[i]; if (piece.equals(stopToken)) break; // Each in featureIndex:num class String[] indexNum = piece.split(":"); String featureIndex = indexNum[0]; // mihai: we may see "qid" as indexNum[0]. just skip this piece. this is the block id useful only for reranking, which we don't do here. if(! featureIndex.equals("qid")){ double count = Double.parseDouble(indexNum[1]); supportVector.incrementCount(Integer.valueOf(featureIndex), count); } } supportVectors.add(new Pair<Double, ClassicCounter<Integer>>(alpha, supportVector)); } in.close(); return new Pair<Double, ClassicCounter<Integer>>(threshold, getWeights(supportVectors)); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Error reading SVM model (line " + modelLineCount + " in file " + modelFile.getAbsolutePath() + ")"); } }
[ "private", "static", "Pair", "<", "Double", ",", "ClassicCounter", "<", "Integer", ">", ">", "readModel", "(", "File", "modelFile", ",", "boolean", "multiclass", ")", "{", "int", "modelLineCount", "=", "0", ";", "try", "{", "int", "numLinesToSkip", "=", "multiclass", "?", "13", ":", "10", ";", "String", "stopToken", "=", "\"#\"", ";", "BufferedReader", "in", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "modelFile", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numLinesToSkip", ";", "i", "++", ")", "{", "in", ".", "readLine", "(", ")", ";", "modelLineCount", "++", ";", "}", "List", "<", "Pair", "<", "Double", ",", "ClassicCounter", "<", "Integer", ">", ">", ">", "supportVectors", "=", "new", "ArrayList", "<", "Pair", "<", "Double", ",", "ClassicCounter", "<", "Integer", ">", ">", ">", "(", ")", ";", "// Read Threshold\r", "String", "thresholdLine", "=", "in", ".", "readLine", "(", ")", ";", "modelLineCount", "++", ";", "String", "[", "]", "pieces", "=", "thresholdLine", ".", "split", "(", "\"\\\\s+\"", ")", ";", "double", "threshold", "=", "Double", ".", "parseDouble", "(", "pieces", "[", "0", "]", ")", ";", "// Read Support Vectors\r", "while", "(", "in", ".", "ready", "(", ")", ")", "{", "String", "svLine", "=", "in", ".", "readLine", "(", ")", ";", "modelLineCount", "++", ";", "pieces", "=", "svLine", ".", "split", "(", "\"\\\\s+\"", ")", ";", "// First Element is the alpha_i * y_i\r", "double", "alpha", "=", "Double", ".", "parseDouble", "(", "pieces", "[", "0", "]", ")", ";", "ClassicCounter", "<", "Integer", ">", "supportVector", "=", "new", "ClassicCounter", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "pieces", ".", "length", ";", "++", "i", ")", "{", "String", "piece", "=", "pieces", "[", "i", "]", ";", "if", "(", "piece", ".", "equals", "(", "stopToken", ")", ")", "break", ";", "// Each in featureIndex:num class\r", "String", "[", "]", "indexNum", "=", "piece", ".", "split", "(", "\":\"", ")", ";", "String", "featureIndex", "=", "indexNum", "[", "0", "]", ";", "// mihai: we may see \"qid\" as indexNum[0]. just skip this piece. this is the block id useful only for reranking, which we don't do here.\r", "if", "(", "!", "featureIndex", ".", "equals", "(", "\"qid\"", ")", ")", "{", "double", "count", "=", "Double", ".", "parseDouble", "(", "indexNum", "[", "1", "]", ")", ";", "supportVector", ".", "incrementCount", "(", "Integer", ".", "valueOf", "(", "featureIndex", ")", ",", "count", ")", ";", "}", "}", "supportVectors", ".", "add", "(", "new", "Pair", "<", "Double", ",", "ClassicCounter", "<", "Integer", ">", ">", "(", "alpha", ",", "supportVector", ")", ")", ";", "}", "in", ".", "close", "(", ")", ";", "return", "new", "Pair", "<", "Double", ",", "ClassicCounter", "<", "Integer", ">", ">", "(", "threshold", ",", "getWeights", "(", "supportVectors", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "throw", "new", "RuntimeException", "(", "\"Error reading SVM model (line \"", "+", "modelLineCount", "+", "\" in file \"", "+", "modelFile", ".", "getAbsolutePath", "(", ")", "+", "\")\"", ")", ";", "}", "}" ]
Reads in a model file in svm light format. It needs to know if its multiclass or not because it affects the number of header lines. Maybe there is another way to tell and we can remove this flag?
[ "Reads", "in", "a", "model", "file", "in", "svm", "light", "format", ".", "It", "needs", "to", "know", "if", "its", "multiclass", "or", "not", "because", "it", "affects", "the", "number", "of", "header", "lines", ".", "Maybe", "there", "is", "another", "way", "to", "tell", "and", "we", "can", "remove", "this", "flag?" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java#L106-L157
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java
SVMLightClassifierFactory.convertWeights
private ClassicCounter<Pair<F, L>> convertWeights(ClassicCounter<Integer> weights, Index<F> featureIndex, Index<L> labelIndex, boolean multiclass) { return multiclass ? convertSVMStructWeights(weights, featureIndex, labelIndex) : convertSVMLightWeights(weights, featureIndex, labelIndex); }
java
private ClassicCounter<Pair<F, L>> convertWeights(ClassicCounter<Integer> weights, Index<F> featureIndex, Index<L> labelIndex, boolean multiclass) { return multiclass ? convertSVMStructWeights(weights, featureIndex, labelIndex) : convertSVMLightWeights(weights, featureIndex, labelIndex); }
[ "private", "ClassicCounter", "<", "Pair", "<", "F", ",", "L", ">", ">", "convertWeights", "(", "ClassicCounter", "<", "Integer", ">", "weights", ",", "Index", "<", "F", ">", "featureIndex", ",", "Index", "<", "L", ">", "labelIndex", ",", "boolean", "multiclass", ")", "{", "return", "multiclass", "?", "convertSVMStructWeights", "(", "weights", ",", "featureIndex", ",", "labelIndex", ")", ":", "convertSVMLightWeights", "(", "weights", ",", "featureIndex", ",", "labelIndex", ")", ";", "}" ]
Converts the weight Counter to be from indexed, svm_light format, to a format we can use in our LinearClassifier.
[ "Converts", "the", "weight", "Counter", "to", "be", "from", "indexed", "svm_light", "format", "to", "a", "format", "we", "can", "use", "in", "our", "LinearClassifier", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java#L179-L181
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java
SVMLightClassifierFactory.fitSigmoid
private LinearClassifier<L, L> fitSigmoid(SVMLightClassifier<L, F> classifier, GeneralDataset<L, F> dataset) { RVFDataset<L, L> plattDataset = new RVFDataset<L, L>(); for (int i = 0; i < dataset.size(); i++) { RVFDatum<L, F> d = dataset.getRVFDatum(i); Counter<L> scores = classifier.scoresOf((Datum<L,F>)d); scores.incrementCount(null); plattDataset.add(new RVFDatum<L, L>(scores, d.label())); } LinearClassifierFactory<L, L> factory = new LinearClassifierFactory<L, L>(); factory.setPrior(new LogPrior(LogPrior.LogPriorType.NULL)); return factory.trainClassifier(plattDataset); }
java
private LinearClassifier<L, L> fitSigmoid(SVMLightClassifier<L, F> classifier, GeneralDataset<L, F> dataset) { RVFDataset<L, L> plattDataset = new RVFDataset<L, L>(); for (int i = 0; i < dataset.size(); i++) { RVFDatum<L, F> d = dataset.getRVFDatum(i); Counter<L> scores = classifier.scoresOf((Datum<L,F>)d); scores.incrementCount(null); plattDataset.add(new RVFDatum<L, L>(scores, d.label())); } LinearClassifierFactory<L, L> factory = new LinearClassifierFactory<L, L>(); factory.setPrior(new LogPrior(LogPrior.LogPriorType.NULL)); return factory.trainClassifier(plattDataset); }
[ "private", "LinearClassifier", "<", "L", ",", "L", ">", "fitSigmoid", "(", "SVMLightClassifier", "<", "L", ",", "F", ">", "classifier", ",", "GeneralDataset", "<", "L", ",", "F", ">", "dataset", ")", "{", "RVFDataset", "<", "L", ",", "L", ">", "plattDataset", "=", "new", "RVFDataset", "<", "L", ",", "L", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dataset", ".", "size", "(", ")", ";", "i", "++", ")", "{", "RVFDatum", "<", "L", ",", "F", ">", "d", "=", "dataset", ".", "getRVFDatum", "(", "i", ")", ";", "Counter", "<", "L", ">", "scores", "=", "classifier", ".", "scoresOf", "(", "(", "Datum", "<", "L", ",", "F", ">", ")", "d", ")", ";", "scores", ".", "incrementCount", "(", "null", ")", ";", "plattDataset", ".", "add", "(", "new", "RVFDatum", "<", "L", ",", "L", ">", "(", "scores", ",", "d", ".", "label", "(", ")", ")", ")", ";", "}", "LinearClassifierFactory", "<", "L", ",", "L", ">", "factory", "=", "new", "LinearClassifierFactory", "<", "L", ",", "L", ">", "(", ")", ";", "factory", ".", "setPrior", "(", "new", "LogPrior", "(", "LogPrior", ".", "LogPriorType", ".", "NULL", ")", ")", ";", "return", "factory", ".", "trainClassifier", "(", "plattDataset", ")", ";", "}" ]
Builds a sigmoid model to turn the classifier outputs into probabilities.
[ "Builds", "a", "sigmoid", "model", "to", "turn", "the", "classifier", "outputs", "into", "probabilities", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/SVMLightClassifierFactory.java#L224-L235
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbservice_binding.java
gslbservice_binding.get
public static gslbservice_binding get(nitro_service service, String servicename) throws Exception{ gslbservice_binding obj = new gslbservice_binding(); obj.set_servicename(servicename); gslbservice_binding response = (gslbservice_binding) obj.get_resource(service); return response; }
java
public static gslbservice_binding get(nitro_service service, String servicename) throws Exception{ gslbservice_binding obj = new gslbservice_binding(); obj.set_servicename(servicename); gslbservice_binding response = (gslbservice_binding) obj.get_resource(service); return response; }
[ "public", "static", "gslbservice_binding", "get", "(", "nitro_service", "service", ",", "String", "servicename", ")", "throws", "Exception", "{", "gslbservice_binding", "obj", "=", "new", "gslbservice_binding", "(", ")", ";", "obj", ".", "set_servicename", "(", "servicename", ")", ";", "gslbservice_binding", "response", "=", "(", "gslbservice_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch gslbservice_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "gslbservice_binding", "resource", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbservice_binding.java#L114-L119
train
meertensinstituut/mtas
src/main/java/mtas/analysis/util/MtasFetchData.java
MtasFetchData.getUrl
public Reader getUrl(String prefix, String postfix) throws MtasParserException { String url = getString(); if ((url != null) && !url.equals("")) { if (prefix != null) { url = prefix + url; } if (postfix != null) { url = url + postfix; } if (url.startsWith("http://") || url.startsWith("https://")) { BufferedReader in = null; try { URLConnection connection = new URL(url).openConnection(); connection.setRequestProperty("Accept-Encoding", "gzip"); connection.setReadTimeout(10000); if (connection.getHeaderField("Content-Encoding") != null && connection.getHeaderField("Content-Encoding").equals("gzip")) { in = new BufferedReader(new InputStreamReader( new GZIPInputStream(connection.getInputStream()), StandardCharsets.UTF_8)); } else { in = new BufferedReader(new InputStreamReader( connection.getInputStream(), StandardCharsets.UTF_8)); } return in; } catch (IOException ex) { log.debug(ex); throw new MtasParserException("couldn't get " + url); } } else { throw new MtasParserException("no valid url: " + url); } } else { throw new MtasParserException("no valid url: " + url); } }
java
public Reader getUrl(String prefix, String postfix) throws MtasParserException { String url = getString(); if ((url != null) && !url.equals("")) { if (prefix != null) { url = prefix + url; } if (postfix != null) { url = url + postfix; } if (url.startsWith("http://") || url.startsWith("https://")) { BufferedReader in = null; try { URLConnection connection = new URL(url).openConnection(); connection.setRequestProperty("Accept-Encoding", "gzip"); connection.setReadTimeout(10000); if (connection.getHeaderField("Content-Encoding") != null && connection.getHeaderField("Content-Encoding").equals("gzip")) { in = new BufferedReader(new InputStreamReader( new GZIPInputStream(connection.getInputStream()), StandardCharsets.UTF_8)); } else { in = new BufferedReader(new InputStreamReader( connection.getInputStream(), StandardCharsets.UTF_8)); } return in; } catch (IOException ex) { log.debug(ex); throw new MtasParserException("couldn't get " + url); } } else { throw new MtasParserException("no valid url: " + url); } } else { throw new MtasParserException("no valid url: " + url); } }
[ "public", "Reader", "getUrl", "(", "String", "prefix", ",", "String", "postfix", ")", "throws", "MtasParserException", "{", "String", "url", "=", "getString", "(", ")", ";", "if", "(", "(", "url", "!=", "null", ")", "&&", "!", "url", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "prefix", "!=", "null", ")", "{", "url", "=", "prefix", "+", "url", ";", "}", "if", "(", "postfix", "!=", "null", ")", "{", "url", "=", "url", "+", "postfix", ";", "}", "if", "(", "url", ".", "startsWith", "(", "\"http://\"", ")", "||", "url", ".", "startsWith", "(", "\"https://\"", ")", ")", "{", "BufferedReader", "in", "=", "null", ";", "try", "{", "URLConnection", "connection", "=", "new", "URL", "(", "url", ")", ".", "openConnection", "(", ")", ";", "connection", ".", "setRequestProperty", "(", "\"Accept-Encoding\"", ",", "\"gzip\"", ")", ";", "connection", ".", "setReadTimeout", "(", "10000", ")", ";", "if", "(", "connection", ".", "getHeaderField", "(", "\"Content-Encoding\"", ")", "!=", "null", "&&", "connection", ".", "getHeaderField", "(", "\"Content-Encoding\"", ")", ".", "equals", "(", "\"gzip\"", ")", ")", "{", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "GZIPInputStream", "(", "connection", ".", "getInputStream", "(", ")", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "}", "else", "{", "in", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "connection", ".", "getInputStream", "(", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ";", "}", "return", "in", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "log", ".", "debug", "(", "ex", ")", ";", "throw", "new", "MtasParserException", "(", "\"couldn't get \"", "+", "url", ")", ";", "}", "}", "else", "{", "throw", "new", "MtasParserException", "(", "\"no valid url: \"", "+", "url", ")", ";", "}", "}", "else", "{", "throw", "new", "MtasParserException", "(", "\"no valid url: \"", "+", "url", ")", ";", "}", "}" ]
Gets the url. @param prefix the prefix @param postfix the postfix @return the url @throws MtasParserException the mtas parser exception
[ "Gets", "the", "url", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/util/MtasFetchData.java#L68-L104
train
meertensinstituut/mtas
src/main/java/mtas/analysis/util/MtasFetchData.java
MtasFetchData.getFile
public Reader getFile(String prefix, String postfix) throws MtasParserException { String file = getString(); if ((file != null) && !file.equals("")) { if (prefix != null) { file = prefix + file; } if (postfix != null) { file = file + postfix; } Path path = (new File(file)).toPath(); if(Files.isReadable(path)) { try { return new InputStreamReader(new GZIPInputStream(new FileInputStream(file)), StandardCharsets.UTF_8); } catch (IOException e1) { log.debug(e1); try { String text = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8); return new StringReader(text); } catch (IOException e2) { log.debug(e2); throw new MtasParserException(e2.getMessage()); } } } else { throw new MtasParserException("file '"+file+"' does not exists or not readable"); } } else { throw new MtasParserException("no valid file: " + file); } }
java
public Reader getFile(String prefix, String postfix) throws MtasParserException { String file = getString(); if ((file != null) && !file.equals("")) { if (prefix != null) { file = prefix + file; } if (postfix != null) { file = file + postfix; } Path path = (new File(file)).toPath(); if(Files.isReadable(path)) { try { return new InputStreamReader(new GZIPInputStream(new FileInputStream(file)), StandardCharsets.UTF_8); } catch (IOException e1) { log.debug(e1); try { String text = new String(Files.readAllBytes(Paths.get(file)), StandardCharsets.UTF_8); return new StringReader(text); } catch (IOException e2) { log.debug(e2); throw new MtasParserException(e2.getMessage()); } } } else { throw new MtasParserException("file '"+file+"' does not exists or not readable"); } } else { throw new MtasParserException("no valid file: " + file); } }
[ "public", "Reader", "getFile", "(", "String", "prefix", ",", "String", "postfix", ")", "throws", "MtasParserException", "{", "String", "file", "=", "getString", "(", ")", ";", "if", "(", "(", "file", "!=", "null", ")", "&&", "!", "file", ".", "equals", "(", "\"\"", ")", ")", "{", "if", "(", "prefix", "!=", "null", ")", "{", "file", "=", "prefix", "+", "file", ";", "}", "if", "(", "postfix", "!=", "null", ")", "{", "file", "=", "file", "+", "postfix", ";", "}", "Path", "path", "=", "(", "new", "File", "(", "file", ")", ")", ".", "toPath", "(", ")", ";", "if", "(", "Files", ".", "isReadable", "(", "path", ")", ")", "{", "try", "{", "return", "new", "InputStreamReader", "(", "new", "GZIPInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}", "catch", "(", "IOException", "e1", ")", "{", "log", ".", "debug", "(", "e1", ")", ";", "try", "{", "String", "text", "=", "new", "String", "(", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "file", ")", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "return", "new", "StringReader", "(", "text", ")", ";", "}", "catch", "(", "IOException", "e2", ")", "{", "log", ".", "debug", "(", "e2", ")", ";", "throw", "new", "MtasParserException", "(", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "else", "{", "throw", "new", "MtasParserException", "(", "\"file '\"", "+", "file", "+", "\"' does not exists or not readable\"", ")", ";", "}", "}", "else", "{", "throw", "new", "MtasParserException", "(", "\"no valid file: \"", "+", "file", ")", ";", "}", "}" ]
Gets the file. @param prefix the prefix @param postfix the postfix @return the file @throws MtasParserException the mtas parser exception
[ "Gets", "the", "file", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/util/MtasFetchData.java#L114-L145
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service_binding.java
service_binding.get
public static service_binding get(nitro_service service, String name) throws Exception{ service_binding obj = new service_binding(); obj.set_name(name); service_binding response = (service_binding) obj.get_resource(service); return response; }
java
public static service_binding get(nitro_service service, String name) throws Exception{ service_binding obj = new service_binding(); obj.set_name(name); service_binding response = (service_binding) obj.get_resource(service); return response; }
[ "public", "static", "service_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "service_binding", "obj", "=", "new", "service_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "service_binding", "response", "=", "(", "service_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch service_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "service_binding", "resource", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/service_binding.java#L125-L130
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemglobal_authenticationlocalpolicy_binding.java
systemglobal_authenticationlocalpolicy_binding.get
public static systemglobal_authenticationlocalpolicy_binding[] get(nitro_service service) throws Exception{ systemglobal_authenticationlocalpolicy_binding obj = new systemglobal_authenticationlocalpolicy_binding(); systemglobal_authenticationlocalpolicy_binding response[] = (systemglobal_authenticationlocalpolicy_binding[]) obj.get_resources(service); return response; }
java
public static systemglobal_authenticationlocalpolicy_binding[] get(nitro_service service) throws Exception{ systemglobal_authenticationlocalpolicy_binding obj = new systemglobal_authenticationlocalpolicy_binding(); systemglobal_authenticationlocalpolicy_binding response[] = (systemglobal_authenticationlocalpolicy_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "systemglobal_authenticationlocalpolicy_binding", "[", "]", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "systemglobal_authenticationlocalpolicy_binding", "obj", "=", "new", "systemglobal_authenticationlocalpolicy_binding", "(", ")", ";", "systemglobal_authenticationlocalpolicy_binding", "response", "[", "]", "=", "(", "systemglobal_authenticationlocalpolicy_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch a systemglobal_authenticationlocalpolicy_binding resources.
[ "Use", "this", "API", "to", "fetch", "a", "systemglobal_authenticationlocalpolicy_binding", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/system/systemglobal_authenticationlocalpolicy_binding.java#L180-L184
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_tmglobal_binding.java
auditsyslogpolicy_tmglobal_binding.get
public static auditsyslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{ auditsyslogpolicy_tmglobal_binding obj = new auditsyslogpolicy_tmglobal_binding(); obj.set_name(name); auditsyslogpolicy_tmglobal_binding response[] = (auditsyslogpolicy_tmglobal_binding[]) obj.get_resources(service); return response; }
java
public static auditsyslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{ auditsyslogpolicy_tmglobal_binding obj = new auditsyslogpolicy_tmglobal_binding(); obj.set_name(name); auditsyslogpolicy_tmglobal_binding response[] = (auditsyslogpolicy_tmglobal_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "auditsyslogpolicy_tmglobal_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "auditsyslogpolicy_tmglobal_binding", "obj", "=", "new", "auditsyslogpolicy_tmglobal_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "auditsyslogpolicy_tmglobal_binding", "response", "[", "]", "=", "(", "auditsyslogpolicy_tmglobal_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch auditsyslogpolicy_tmglobal_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "auditsyslogpolicy_tmglobal_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_tmglobal_binding.java#L132-L137
train
meertensinstituut/mtas
src/main/java/mtas/analysis/util/MtasBufferedReader.java
MtasBufferedReader.readLine
String readLine(boolean ignoreLF) throws IOException { StringBuffer s = null; int startChar; synchronized (lock) { ensureOpen(); boolean omitLF = ignoreLF || skipLF; for (;;) { if (nextChar >= nChars) fill(); if (nextChar >= nChars) { /* EOF */ if (s != null && s.length() > 0) return s.toString(); else return null; } boolean eol = false; char c = 0; int i; /* Skip a leftover '\n', if necessary */ if (omitLF && (cb[nextChar] == '\n')) nextChar++; skipLF = false; omitLF = false; charLoop: for (i = nextChar; i < nChars; i++) { c = cb[i]; if ((c == '\n') || (c == '\r')) { eol = true; break charLoop; } } startChar = nextChar; nextChar = i; if (eol) { String str; if (s == null) { str = new String(cb, startChar, i - startChar); } else { s.append(cb, startChar, i - startChar); str = s.toString(); } nextChar++; if (c == '\r') { skipLF = true; } return str; } if (s == null) s = new StringBuffer(defaultExpectedLineLength); s.append(cb, startChar, i - startChar); } } }
java
String readLine(boolean ignoreLF) throws IOException { StringBuffer s = null; int startChar; synchronized (lock) { ensureOpen(); boolean omitLF = ignoreLF || skipLF; for (;;) { if (nextChar >= nChars) fill(); if (nextChar >= nChars) { /* EOF */ if (s != null && s.length() > 0) return s.toString(); else return null; } boolean eol = false; char c = 0; int i; /* Skip a leftover '\n', if necessary */ if (omitLF && (cb[nextChar] == '\n')) nextChar++; skipLF = false; omitLF = false; charLoop: for (i = nextChar; i < nChars; i++) { c = cb[i]; if ((c == '\n') || (c == '\r')) { eol = true; break charLoop; } } startChar = nextChar; nextChar = i; if (eol) { String str; if (s == null) { str = new String(cb, startChar, i - startChar); } else { s.append(cb, startChar, i - startChar); str = s.toString(); } nextChar++; if (c == '\r') { skipLF = true; } return str; } if (s == null) s = new StringBuffer(defaultExpectedLineLength); s.append(cb, startChar, i - startChar); } } }
[ "String", "readLine", "(", "boolean", "ignoreLF", ")", "throws", "IOException", "{", "StringBuffer", "s", "=", "null", ";", "int", "startChar", ";", "synchronized", "(", "lock", ")", "{", "ensureOpen", "(", ")", ";", "boolean", "omitLF", "=", "ignoreLF", "||", "skipLF", ";", "for", "(", ";", ";", ")", "{", "if", "(", "nextChar", ">=", "nChars", ")", "fill", "(", ")", ";", "if", "(", "nextChar", ">=", "nChars", ")", "{", "/* EOF */", "if", "(", "s", "!=", "null", "&&", "s", ".", "length", "(", ")", ">", "0", ")", "return", "s", ".", "toString", "(", ")", ";", "else", "return", "null", ";", "}", "boolean", "eol", "=", "false", ";", "char", "c", "=", "0", ";", "int", "i", ";", "/* Skip a leftover '\\n', if necessary */", "if", "(", "omitLF", "&&", "(", "cb", "[", "nextChar", "]", "==", "'", "'", ")", ")", "nextChar", "++", ";", "skipLF", "=", "false", ";", "omitLF", "=", "false", ";", "charLoop", ":", "for", "(", "i", "=", "nextChar", ";", "i", "<", "nChars", ";", "i", "++", ")", "{", "c", "=", "cb", "[", "i", "]", ";", "if", "(", "(", "c", "==", "'", "'", ")", "||", "(", "c", "==", "'", "'", ")", ")", "{", "eol", "=", "true", ";", "break", "charLoop", ";", "}", "}", "startChar", "=", "nextChar", ";", "nextChar", "=", "i", ";", "if", "(", "eol", ")", "{", "String", "str", ";", "if", "(", "s", "==", "null", ")", "{", "str", "=", "new", "String", "(", "cb", ",", "startChar", ",", "i", "-", "startChar", ")", ";", "}", "else", "{", "s", ".", "append", "(", "cb", ",", "startChar", ",", "i", "-", "startChar", ")", ";", "str", "=", "s", ".", "toString", "(", ")", ";", "}", "nextChar", "++", ";", "if", "(", "c", "==", "'", "'", ")", "{", "skipLF", "=", "true", ";", "}", "return", "str", ";", "}", "if", "(", "s", "==", "null", ")", "s", "=", "new", "StringBuffer", "(", "defaultExpectedLineLength", ")", ";", "s", ".", "append", "(", "cb", ",", "startChar", ",", "i", "-", "startChar", ")", ";", "}", "}", "}" ]
Read line. @param ignoreLF the ignore LF @return the string @throws IOException Signals that an I/O exception has occurred.
[ "Read", "line", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/util/MtasBufferedReader.java#L196-L255
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java
vpnparameter.unset
public static base_response unset(nitro_service client, vpnparameter resource, String[] args) throws Exception{ vpnparameter unsetresource = new vpnparameter(); return unsetresource.unset_resource(client,args); }
java
public static base_response unset(nitro_service client, vpnparameter resource, String[] args) throws Exception{ vpnparameter unsetresource = new vpnparameter(); return unsetresource.unset_resource(client,args); }
[ "public", "static", "base_response", "unset", "(", "nitro_service", "client", ",", "vpnparameter", "resource", ",", "String", "[", "]", "args", ")", "throws", "Exception", "{", "vpnparameter", "unsetresource", "=", "new", "vpnparameter", "(", ")", ";", "return", "unsetresource", ".", "unset_resource", "(", "client", ",", "args", ")", ";", "}" ]
Use this API to unset the properties of vpnparameter resource. Properties that need to be unset are specified in args array.
[ "Use", "this", "API", "to", "unset", "the", "properties", "of", "vpnparameter", "resource", ".", "Properties", "that", "need", "to", "be", "unset", "are", "specified", "in", "args", "array", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java#L1477-L1480
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java
vpnparameter.get
public static vpnparameter get(nitro_service service, options option) throws Exception{ vpnparameter obj = new vpnparameter(); vpnparameter[] response = (vpnparameter[])obj.get_resources(service,option); return response[0]; }
java
public static vpnparameter get(nitro_service service, options option) throws Exception{ vpnparameter obj = new vpnparameter(); vpnparameter[] response = (vpnparameter[])obj.get_resources(service,option); return response[0]; }
[ "public", "static", "vpnparameter", "get", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "vpnparameter", "obj", "=", "new", "vpnparameter", "(", ")", ";", "vpnparameter", "[", "]", "response", "=", "(", "vpnparameter", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ",", "option", ")", ";", "return", "response", "[", "0", "]", ";", "}" ]
Use this API to fetch all the vpnparameter resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "vpnparameter", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java#L1494-L1498
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java
PlainTextDocumentReaderAndWriter.getIterator
public Iterator<List<IN>> getIterator(Reader r) { Tokenizer<IN> tokenizer = tokenizerFactory.getTokenizer(r); // PTBTokenizer.newPTBTokenizer(r, false, true); List<IN> words = new ArrayList<IN>(); IN previous = tokenFactory.makeToken(); StringBuilder prepend = new StringBuilder(); /* * This changes SGML tags into whitespace -- it should maybe be moved * elsewhere */ while (tokenizer.hasNext()) { IN w = tokenizer.next(); String word = w.get(CoreAnnotations.TextAnnotation.class); Matcher m = sgml.matcher(word); if (m.matches()) { String before = StringUtils.getNotNullString(w.get(CoreAnnotations.BeforeAnnotation.class)); String after = StringUtils.getNotNullString(w.get(CoreAnnotations.AfterAnnotation.class)); prepend.append(before).append(word); String previousTokenAfter = StringUtils.getNotNullString(previous.get(CoreAnnotations.AfterAnnotation.class)); previous.set(AfterAnnotation.class, previousTokenAfter + word + after); // previous.appendAfter(w.word() + w.after()); } else { String before = StringUtils.getNotNullString(w.get(CoreAnnotations.BeforeAnnotation.class)); if (prepend.length() > 0) { w.set(BeforeAnnotation.class, prepend.toString() + before); // w.prependBefore(prepend.toString()); prepend = new StringBuilder(); } words.add(w); previous = w; } } List<List<IN>> sentences = wts.process(words); String after = ""; IN last = null; for (List<IN> sentence : sentences) { int pos = 0; for (IN w : sentence) { w.set(PositionAnnotation.class, Integer.toString(pos)); after = StringUtils.getNotNullString(w.get(CoreAnnotations.AfterAnnotation.class)); w.remove(AfterAnnotation.class); last = w; } } if (last != null) { last.set(AfterAnnotation.class, after); } return sentences.iterator(); }
java
public Iterator<List<IN>> getIterator(Reader r) { Tokenizer<IN> tokenizer = tokenizerFactory.getTokenizer(r); // PTBTokenizer.newPTBTokenizer(r, false, true); List<IN> words = new ArrayList<IN>(); IN previous = tokenFactory.makeToken(); StringBuilder prepend = new StringBuilder(); /* * This changes SGML tags into whitespace -- it should maybe be moved * elsewhere */ while (tokenizer.hasNext()) { IN w = tokenizer.next(); String word = w.get(CoreAnnotations.TextAnnotation.class); Matcher m = sgml.matcher(word); if (m.matches()) { String before = StringUtils.getNotNullString(w.get(CoreAnnotations.BeforeAnnotation.class)); String after = StringUtils.getNotNullString(w.get(CoreAnnotations.AfterAnnotation.class)); prepend.append(before).append(word); String previousTokenAfter = StringUtils.getNotNullString(previous.get(CoreAnnotations.AfterAnnotation.class)); previous.set(AfterAnnotation.class, previousTokenAfter + word + after); // previous.appendAfter(w.word() + w.after()); } else { String before = StringUtils.getNotNullString(w.get(CoreAnnotations.BeforeAnnotation.class)); if (prepend.length() > 0) { w.set(BeforeAnnotation.class, prepend.toString() + before); // w.prependBefore(prepend.toString()); prepend = new StringBuilder(); } words.add(w); previous = w; } } List<List<IN>> sentences = wts.process(words); String after = ""; IN last = null; for (List<IN> sentence : sentences) { int pos = 0; for (IN w : sentence) { w.set(PositionAnnotation.class, Integer.toString(pos)); after = StringUtils.getNotNullString(w.get(CoreAnnotations.AfterAnnotation.class)); w.remove(AfterAnnotation.class); last = w; } } if (last != null) { last.set(AfterAnnotation.class, after); } return sentences.iterator(); }
[ "public", "Iterator", "<", "List", "<", "IN", ">", ">", "getIterator", "(", "Reader", "r", ")", "{", "Tokenizer", "<", "IN", ">", "tokenizer", "=", "tokenizerFactory", ".", "getTokenizer", "(", "r", ")", ";", "// PTBTokenizer.newPTBTokenizer(r, false, true);\r", "List", "<", "IN", ">", "words", "=", "new", "ArrayList", "<", "IN", ">", "(", ")", ";", "IN", "previous", "=", "tokenFactory", ".", "makeToken", "(", ")", ";", "StringBuilder", "prepend", "=", "new", "StringBuilder", "(", ")", ";", "/*\r\n * This changes SGML tags into whitespace -- it should maybe be moved\r\n * elsewhere\r\n */", "while", "(", "tokenizer", ".", "hasNext", "(", ")", ")", "{", "IN", "w", "=", "tokenizer", ".", "next", "(", ")", ";", "String", "word", "=", "w", ".", "get", "(", "CoreAnnotations", ".", "TextAnnotation", ".", "class", ")", ";", "Matcher", "m", "=", "sgml", ".", "matcher", "(", "word", ")", ";", "if", "(", "m", ".", "matches", "(", ")", ")", "{", "String", "before", "=", "StringUtils", ".", "getNotNullString", "(", "w", ".", "get", "(", "CoreAnnotations", ".", "BeforeAnnotation", ".", "class", ")", ")", ";", "String", "after", "=", "StringUtils", ".", "getNotNullString", "(", "w", ".", "get", "(", "CoreAnnotations", ".", "AfterAnnotation", ".", "class", ")", ")", ";", "prepend", ".", "append", "(", "before", ")", ".", "append", "(", "word", ")", ";", "String", "previousTokenAfter", "=", "StringUtils", ".", "getNotNullString", "(", "previous", ".", "get", "(", "CoreAnnotations", ".", "AfterAnnotation", ".", "class", ")", ")", ";", "previous", ".", "set", "(", "AfterAnnotation", ".", "class", ",", "previousTokenAfter", "+", "word", "+", "after", ")", ";", "// previous.appendAfter(w.word() + w.after());\r", "}", "else", "{", "String", "before", "=", "StringUtils", ".", "getNotNullString", "(", "w", ".", "get", "(", "CoreAnnotations", ".", "BeforeAnnotation", ".", "class", ")", ")", ";", "if", "(", "prepend", ".", "length", "(", ")", ">", "0", ")", "{", "w", ".", "set", "(", "BeforeAnnotation", ".", "class", ",", "prepend", ".", "toString", "(", ")", "+", "before", ")", ";", "// w.prependBefore(prepend.toString());\r", "prepend", "=", "new", "StringBuilder", "(", ")", ";", "}", "words", ".", "add", "(", "w", ")", ";", "previous", "=", "w", ";", "}", "}", "List", "<", "List", "<", "IN", ">", ">", "sentences", "=", "wts", ".", "process", "(", "words", ")", ";", "String", "after", "=", "\"\"", ";", "IN", "last", "=", "null", ";", "for", "(", "List", "<", "IN", ">", "sentence", ":", "sentences", ")", "{", "int", "pos", "=", "0", ";", "for", "(", "IN", "w", ":", "sentence", ")", "{", "w", ".", "set", "(", "PositionAnnotation", ".", "class", ",", "Integer", ".", "toString", "(", "pos", ")", ")", ";", "after", "=", "StringUtils", ".", "getNotNullString", "(", "w", ".", "get", "(", "CoreAnnotations", ".", "AfterAnnotation", ".", "class", ")", ")", ";", "w", ".", "remove", "(", "AfterAnnotation", ".", "class", ")", ";", "last", "=", "w", ";", "}", "}", "if", "(", "last", "!=", "null", ")", "{", "last", ".", "set", "(", "AfterAnnotation", ".", "class", ",", "after", ")", ";", "}", "return", "sentences", ".", "iterator", "(", ")", ";", "}" ]
sentence splitting as now
[ "sentence", "splitting", "as", "now" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/PlainTextDocumentReaderAndWriter.java#L125-L178
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_dospolicy_binding.java
lbvserver_dospolicy_binding.get
public static lbvserver_dospolicy_binding[] get(nitro_service service, String name) throws Exception{ lbvserver_dospolicy_binding obj = new lbvserver_dospolicy_binding(); obj.set_name(name); lbvserver_dospolicy_binding response[] = (lbvserver_dospolicy_binding[]) obj.get_resources(service); return response; }
java
public static lbvserver_dospolicy_binding[] get(nitro_service service, String name) throws Exception{ lbvserver_dospolicy_binding obj = new lbvserver_dospolicy_binding(); obj.set_name(name); lbvserver_dospolicy_binding response[] = (lbvserver_dospolicy_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "lbvserver_dospolicy_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "lbvserver_dospolicy_binding", "obj", "=", "new", "lbvserver_dospolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "lbvserver_dospolicy_binding", "response", "[", "]", "=", "(", "lbvserver_dospolicy_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch lbvserver_dospolicy_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "lbvserver_dospolicy_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_dospolicy_binding.java#L144-L149
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsrunningconfig.java
nsrunningconfig.get
public static nsrunningconfig get(nitro_service service) throws Exception{ nsrunningconfig obj = new nsrunningconfig(); nsrunningconfig[] response = (nsrunningconfig[])obj.get_resources(service); return response[0]; }
java
public static nsrunningconfig get(nitro_service service) throws Exception{ nsrunningconfig obj = new nsrunningconfig(); nsrunningconfig[] response = (nsrunningconfig[])obj.get_resources(service); return response[0]; }
[ "public", "static", "nsrunningconfig", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "nsrunningconfig", "obj", "=", "new", "nsrunningconfig", "(", ")", ";", "nsrunningconfig", "[", "]", "response", "=", "(", "nsrunningconfig", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", "[", "0", "]", ";", "}" ]
Use this API to fetch all the nsrunningconfig resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "nsrunningconfig", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsrunningconfig.java#L116-L120
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsrunningconfig.java
nsrunningconfig.get
public static nsrunningconfig[] get(nitro_service service, nsrunningconfig_args args) throws Exception{ nsrunningconfig obj = new nsrunningconfig(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nsrunningconfig[] response = (nsrunningconfig[])obj.get_resources(service, option); return response; }
java
public static nsrunningconfig[] get(nitro_service service, nsrunningconfig_args args) throws Exception{ nsrunningconfig obj = new nsrunningconfig(); options option = new options(); option.set_args(nitro_util.object_to_string_withoutquotes(args)); nsrunningconfig[] response = (nsrunningconfig[])obj.get_resources(service, option); return response; }
[ "public", "static", "nsrunningconfig", "[", "]", "get", "(", "nitro_service", "service", ",", "nsrunningconfig_args", "args", ")", "throws", "Exception", "{", "nsrunningconfig", "obj", "=", "new", "nsrunningconfig", "(", ")", ";", "options", "option", "=", "new", "options", "(", ")", ";", "option", ".", "set_args", "(", "nitro_util", ".", "object_to_string_withoutquotes", "(", "args", ")", ")", ";", "nsrunningconfig", "[", "]", "response", "=", "(", "nsrunningconfig", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ",", "option", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch all the nsrunningconfig resources that are configured on netscaler. This uses nsrunningconfig_args which is a way to provide additional arguments while fetching the resources.
[ "Use", "this", "API", "to", "fetch", "all", "the", "nsrunningconfig", "resources", "that", "are", "configured", "on", "netscaler", ".", "This", "uses", "nsrunningconfig_args", "which", "is", "a", "way", "to", "provide", "additional", "arguments", "while", "fetching", "the", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsrunningconfig.java#L135-L141
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/basic/servicegroup_servicegroupmember_binding.java
servicegroup_servicegroupmember_binding.get
public static servicegroup_servicegroupmember_binding[] get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_servicegroupmember_binding obj = new servicegroup_servicegroupmember_binding(); obj.set_servicegroupname(servicegroupname); servicegroup_servicegroupmember_binding response[] = (servicegroup_servicegroupmember_binding[]) obj.get_resources(service); return response; }
java
public static servicegroup_servicegroupmember_binding[] get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_servicegroupmember_binding obj = new servicegroup_servicegroupmember_binding(); obj.set_servicegroupname(servicegroupname); servicegroup_servicegroupmember_binding response[] = (servicegroup_servicegroupmember_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "servicegroup_servicegroupmember_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "String", "servicegroupname", ")", "throws", "Exception", "{", "servicegroup_servicegroupmember_binding", "obj", "=", "new", "servicegroup_servicegroupmember_binding", "(", ")", ";", "obj", ".", "set_servicegroupname", "(", "servicegroupname", ")", ";", "servicegroup_servicegroupmember_binding", "response", "[", "]", "=", "(", "servicegroup_servicegroupmember_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch servicegroup_servicegroupmember_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "servicegroup_servicegroupmember_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/servicegroup_servicegroupmember_binding.java#L371-L376
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_auditnslogpolicy_binding.java
aaagroup_auditnslogpolicy_binding.get
public static aaagroup_auditnslogpolicy_binding[] get(nitro_service service, String groupname) throws Exception{ aaagroup_auditnslogpolicy_binding obj = new aaagroup_auditnslogpolicy_binding(); obj.set_groupname(groupname); aaagroup_auditnslogpolicy_binding response[] = (aaagroup_auditnslogpolicy_binding[]) obj.get_resources(service); return response; }
java
public static aaagroup_auditnslogpolicy_binding[] get(nitro_service service, String groupname) throws Exception{ aaagroup_auditnslogpolicy_binding obj = new aaagroup_auditnslogpolicy_binding(); obj.set_groupname(groupname); aaagroup_auditnslogpolicy_binding response[] = (aaagroup_auditnslogpolicy_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "aaagroup_auditnslogpolicy_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "String", "groupname", ")", "throws", "Exception", "{", "aaagroup_auditnslogpolicy_binding", "obj", "=", "new", "aaagroup_auditnslogpolicy_binding", "(", ")", ";", "obj", ".", "set_groupname", "(", "groupname", ")", ";", "aaagroup_auditnslogpolicy_binding", "response", "[", "]", "=", "(", "aaagroup_auditnslogpolicy_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch aaagroup_auditnslogpolicy_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "aaagroup_auditnslogpolicy_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_auditnslogpolicy_binding.java#L246-L251
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/network/nd6ravariables_onlinkipv6prefix_binding.java
nd6ravariables_onlinkipv6prefix_binding.get
public static nd6ravariables_onlinkipv6prefix_binding[] get(nitro_service service, Long vlan) throws Exception{ nd6ravariables_onlinkipv6prefix_binding obj = new nd6ravariables_onlinkipv6prefix_binding(); obj.set_vlan(vlan); nd6ravariables_onlinkipv6prefix_binding response[] = (nd6ravariables_onlinkipv6prefix_binding[]) obj.get_resources(service); return response; }
java
public static nd6ravariables_onlinkipv6prefix_binding[] get(nitro_service service, Long vlan) throws Exception{ nd6ravariables_onlinkipv6prefix_binding obj = new nd6ravariables_onlinkipv6prefix_binding(); obj.set_vlan(vlan); nd6ravariables_onlinkipv6prefix_binding response[] = (nd6ravariables_onlinkipv6prefix_binding[]) obj.get_resources(service); return response; }
[ "public", "static", "nd6ravariables_onlinkipv6prefix_binding", "[", "]", "get", "(", "nitro_service", "service", ",", "Long", "vlan", ")", "throws", "Exception", "{", "nd6ravariables_onlinkipv6prefix_binding", "obj", "=", "new", "nd6ravariables_onlinkipv6prefix_binding", "(", ")", ";", "obj", ".", "set_vlan", "(", "vlan", ")", ";", "nd6ravariables_onlinkipv6prefix_binding", "response", "[", "]", "=", "(", "nd6ravariables_onlinkipv6prefix_binding", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch nd6ravariables_onlinkipv6prefix_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "nd6ravariables_onlinkipv6prefix_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/nd6ravariables_onlinkipv6prefix_binding.java#L166-L171
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.exp
public static double[] exp(double[] a) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = Math.exp(a[i]); } return result; }
java
public static double[] exp(double[] a) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = Math.exp(a[i]); } return result; }
[ "public", "static", "double", "[", "]", "exp", "(", "double", "[", "]", "a", ")", "{", "double", "[", "]", "result", "=", "new", "double", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "Math", ".", "exp", "(", "a", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}" ]
OPERATIONS ON AN ARRAY - NONDESTRUCTIVE
[ "OPERATIONS", "ON", "AN", "ARRAY", "-", "NONDESTRUCTIVE" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L83-L89
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.expInPlace
public static void expInPlace(double[] a) { for (int i = 0; i < a.length; i++) { a[i] = Math.exp(a[i]); } }
java
public static void expInPlace(double[] a) { for (int i = 0; i < a.length; i++) { a[i] = Math.exp(a[i]); } }
[ "public", "static", "void", "expInPlace", "(", "double", "[", "]", "a", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "=", "Math", ".", "exp", "(", "a", "[", "i", "]", ")", ";", "}", "}" ]
OPERATIONS ON AN ARRAY - DESTRUCTIVE
[ "OPERATIONS", "ON", "AN", "ARRAY", "-", "DESTRUCTIVE" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L101-L105
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.addInPlace
public static void addInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] + b; } }
java
public static void addInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] + b; } }
[ "public", "static", "void", "addInPlace", "(", "double", "[", "]", "a", ",", "double", "b", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "=", "a", "[", "i", "]", "+", "b", ";", "}", "}" ]
Increases the values in this array by b. Does it in place. @param a The array @param b The amount by which to increase each item
[ "Increases", "the", "values", "in", "this", "array", "by", "b", ".", "Does", "it", "in", "place", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L121-L125
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.addMultInPlace
public static void addMultInPlace(double[] a, double[] b, double c) { for (int i=0; i<a.length; i++) { a[i] += b[i] * c; } }
java
public static void addMultInPlace(double[] a, double[] b, double c) { for (int i=0; i<a.length; i++) { a[i] += b[i] * c; } }
[ "public", "static", "void", "addMultInPlace", "(", "double", "[", "]", "a", ",", "double", "[", "]", "b", ",", "double", "c", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "+=", "b", "[", "i", "]", "*", "c", ";", "}", "}" ]
Add c times the array b to array a. Does it in place.
[ "Add", "c", "times", "the", "array", "b", "to", "array", "a", ".", "Does", "it", "in", "place", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L142-L146
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.multiplyInPlace
public static void multiplyInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] * b; } }
java
public static void multiplyInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] * b; } }
[ "public", "static", "void", "multiplyInPlace", "(", "double", "[", "]", "a", ",", "double", "b", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "=", "a", "[", "i", "]", "*", "b", ";", "}", "}" ]
Scales the values in this array by b. Does it in place.
[ "Scales", "the", "values", "in", "this", "array", "by", "b", ".", "Does", "it", "in", "place", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L151-L155
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.add
public static double[] add(double[] a, double c) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = a[i] + c; } return result; }
java
public static double[] add(double[] a, double c) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = a[i] + c; } return result; }
[ "public", "static", "double", "[", "]", "add", "(", "double", "[", "]", "a", ",", "double", "c", ")", "{", "double", "[", "]", "result", "=", "new", "double", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "a", "[", "i", "]", "+", "c", ";", "}", "return", "result", ";", "}" ]
OPERATIONS WITH SCALAR - NONDESTRUCTIVE
[ "OPERATIONS", "WITH", "SCALAR", "-", "NONDESTRUCTIVE" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L186-L192
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.pow
public static double[] pow(double[] a, double c) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = Math.pow(a[i], c); } return result; }
java
public static double[] pow(double[] a, double c) { double[] result = new double[a.length]; for (int i = 0; i < a.length; i++) { result[i] = Math.pow(a[i], c); } return result; }
[ "public", "static", "double", "[", "]", "pow", "(", "double", "[", "]", "a", ",", "double", "c", ")", "{", "double", "[", "]", "result", "=", "new", "double", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "Math", ".", "pow", "(", "a", "[", "i", "]", ",", "c", ")", ";", "}", "return", "result", ";", "}" ]
raises each entry in array a by power c
[ "raises", "each", "entry", "in", "array", "a", "by", "power", "c" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L227-L233
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.pairwiseAdd
public static int[] pairwiseAdd(int[] a, int[] b) { int[] result = new int[a.length]; for (int i = 0; i < a.length; i++) { result[i] = a[i] + b[i]; } return result; }
java
public static int[] pairwiseAdd(int[] a, int[] b) { int[] result = new int[a.length]; for (int i = 0; i < a.length; i++) { result[i] = a[i] + b[i]; } return result; }
[ "public", "static", "int", "[", "]", "pairwiseAdd", "(", "int", "[", "]", "a", ",", "int", "[", "]", "b", ")", "{", "int", "[", "]", "result", "=", "new", "int", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "a", "[", "i", "]", "+", "b", "[", "i", "]", ";", "}", "return", "result", ";", "}" ]
OPERATIONS WITH TWO ARRAYS - NONDESTRUCTIVE
[ "OPERATIONS", "WITH", "TWO", "ARRAYS", "-", "NONDESTRUCTIVE" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L295-L301
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.pairwiseMultiply
public static double[] pairwiseMultiply(double[] a, double[] b) { if (a.length != b.length) { throw new RuntimeException("Can't pairwise multiple different lengths: a.length=" + a.length + " b.length=" + b.length); } double[] result = new double[a.length]; for (int i = 0; i < result.length; i++) { result[i] = a[i] * b[i]; } return result; }
java
public static double[] pairwiseMultiply(double[] a, double[] b) { if (a.length != b.length) { throw new RuntimeException("Can't pairwise multiple different lengths: a.length=" + a.length + " b.length=" + b.length); } double[] result = new double[a.length]; for (int i = 0; i < result.length; i++) { result[i] = a[i] * b[i]; } return result; }
[ "public", "static", "double", "[", "]", "pairwiseMultiply", "(", "double", "[", "]", "a", ",", "double", "[", "]", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "{", "throw", "new", "RuntimeException", "(", "\"Can't pairwise multiple different lengths: a.length=\"", "+", "a", ".", "length", "+", "\" b.length=\"", "+", "b", ".", "length", ")", ";", "}", "double", "[", "]", "result", "=", "new", "double", "[", "a", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "a", "[", "i", "]", "*", "b", "[", "i", "]", ";", "}", "return", "result", ";", "}" ]
Assumes that both arrays have same length.
[ "Assumes", "that", "both", "arrays", "have", "same", "length", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L353-L362
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.norm_1
public static double norm_1(double[] a) { double sum = 0; for (double anA : a) { sum += (anA < 0 ? -anA : anA); } return sum; }
java
public static double norm_1(double[] a) { double sum = 0; for (double anA : a) { sum += (anA < 0 ? -anA : anA); } return sum; }
[ "public", "static", "double", "norm_1", "(", "double", "[", "]", "a", ")", "{", "double", "sum", "=", "0", ";", "for", "(", "double", "anA", ":", "a", ")", "{", "sum", "+=", "(", "anA", "<", "0", "?", "-", "anA", ":", "anA", ")", ";", "}", "return", "sum", ";", "}" ]
Computes 1-norm of vector @param a A vector of double @return 1-norm of a
[ "Computes", "1", "-", "norm", "of", "vector" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L610-L616
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.norm
public static double norm(double[] a) { double squaredSum = 0; for (double anA : a) { squaredSum += anA * anA; } return Math.sqrt(squaredSum); }
java
public static double norm(double[] a) { double squaredSum = 0; for (double anA : a) { squaredSum += anA * anA; } return Math.sqrt(squaredSum); }
[ "public", "static", "double", "norm", "(", "double", "[", "]", "a", ")", "{", "double", "squaredSum", "=", "0", ";", "for", "(", "double", "anA", ":", "a", ")", "{", "squaredSum", "+=", "anA", "*", "anA", ";", "}", "return", "Math", ".", "sqrt", "(", "squaredSum", ")", ";", "}" ]
Computes 2-norm of vector @param a A vector of double @return Euclidean norm of a
[ "Computes", "2", "-", "norm", "of", "vector" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L639-L645
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.innerProduct
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
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; }
[ "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", ";", "}" ]
LINEAR ALGEBRAIC FUNCTIONS
[ "LINEAR", "ALGEBRAIC", "FUNCTIONS" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1029-L1036
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.normalize
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
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 }
[ "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\r", "}" ]
Makes the values in this array sum to 1.0. Does it in place. If the total is 0.0 or NaN, throws an RuntimeException.
[ "Makes", "the", "values", "in", "this", "array", "sum", "to", "1", ".", "0", ".", "Does", "it", "in", "place", ".", "If", "the", "total", "is", "0", ".", "0", "or", "NaN", "throws", "an", "RuntimeException", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1127-L1133
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.standardize
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
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 }
[ "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\r", "multiplyInPlace", "(", "a", ",", "1.0", "/", "s", ")", ";", "// divide by standard deviation\r", "}" ]
Standardize values in this array, i.e., subtract the mean and divide by the standard deviation. If standard deviation is 0.0, throws an RuntimeException.
[ "Standardize", "values", "in", "this", "array", "i", ".", "e", ".", "subtract", "the", "mean", "and", "divide", "by", "the", "standard", "deviation", ".", "If", "standard", "deviation", "is", "0", ".", "0", "throws", "an", "RuntimeException", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1166-L1175
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.sampleFromDistribution
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
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 }
[ "public", "static", "int", "sampleFromDistribution", "(", "double", "[", "]", "d", ",", "Random", "random", ")", "{", "// sample from the uniform [0,1]\r", "double", "r", "=", "random", ".", "nextDouble", "(", ")", ";", "// now compare its value to cumulative values to find what interval it falls in\r", "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\r", "}" ]
Samples from the distribution over values 0 through d.length given by d. Assumes that the distribution sums to 1.0. @param d the distribution to sample from @return a value from 0 to d.length
[ "Samples", "from", "the", "distribution", "over", "values", "0", "through", "d", ".", "length", "given", "by", "d", ".", "Assumes", "that", "the", "distribution", "sums", "to", "1", ".", "0", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1231-L1246
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.sampleWithoutReplacement
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
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); }
[ "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", ")", ";", "}" ]
Fills the array with sample from 0 to numArgClasses-1 without replacement.
[ "Fills", "the", "array", "with", "sample", "from", "0", "to", "numArgClasses", "-", "1", "without", "replacement", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1399-L1406
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.absDiffOfMeans
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
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); }
[ "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", ")", ";", "}" ]
Assumes input arrays have equal, non-zero length.
[ "Assumes", "input", "arrays", "have", "equal", "non", "-", "zero", "length", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1563-L1579
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_lbvserver_binding.java
appfwpolicy_lbvserver_binding.get
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
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; }
[ "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", ";", "}" ]
Use this API to fetch appfwpolicy_lbvserver_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "appfwpolicy_lbvserver_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwpolicy_lbvserver_binding.java#L162-L167
train
mariosotil/river-framework
river-core/src/main/java/org/riverframework/River.java
River.getSession
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
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; }
[ "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", ";", "}" ]
Loads a wrapper that wraps libraries as lotus.domino or org.openntf.domino and creates a core Session object. Its behavior will depend on how the wrapper is implemented. Anyway, this method creates the session just one time and returns the same every time is called. To free the memory, resources, etc., it's necessary to call the close method at the end of the program or process. @param wrapper the package's full name. You can use the constants defined as River.wrapper_LOTUS_DOMINO or River.wrapper_ORG_OPENNTF_DOMINO @param parameters their values and how to set them will depend exclusively on how the wrapper is implemented. Check the wrapper documentation. @return a Session object
[ "Loads", "a", "wrapper", "that", "wraps", "libraries", "as", "lotus", ".", "domino", "or", "org", ".", "openntf", ".", "domino", "and", "creates", "a", "core", "Session", "object", ".", "Its", "behavior", "will", "depend", "on", "how", "the", "wrapper", "is", "implemented", ".", "Anyway", "this", "method", "creates", "the", "session", "just", "one", "time", "and", "returns", "the", "same", "every", "time", "is", "called", ".", "To", "free", "the", "memory", "resources", "etc", ".", "it", "s", "necessary", "to", "call", "the", "close", "method", "at", "the", "end", "of", "the", "program", "or", "process", "." ]
e8c3ae3b0a956ec9cb4e14a81376ba8e8370b44e
https://github.com/mariosotil/river-framework/blob/e8c3ae3b0a956ec9cb4e14a81376ba8e8370b44e/river-core/src/main/java/org/riverframework/River.java#L63-L118
train
mariosotil/river-framework
river-core/src/main/java/org/riverframework/River.java
River.closeSession
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
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); } }
[ "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", ")", ";", "}", "}" ]
Calls the Session close method to free resources, memory, etc. Also, it will remove it from its internal table. @param wrapper the package's full name
[ "Calls", "the", "Session", "close", "method", "to", "free", "resources", "memory", "etc", ".", "Also", "it", "will", "remove", "it", "from", "its", "internal", "table", "." ]
e8c3ae3b0a956ec9cb4e14a81376ba8e8370b44e
https://github.com/mariosotil/river-framework/blob/e8c3ae3b0a956ec9cb4e14a81376ba8e8370b44e/river-core/src/main/java/org/riverframework/River.java#L127-L142
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java
ntpparam.update
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
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); }
[ "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", ")", ";", "}" ]
Use this API to update ntpparam.
[ "Use", "this", "API", "to", "update", "ntpparam", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java#L169-L176
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java
ntpparam.unset
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
public static base_response unset(nitro_service client, ntpparam resource, String[] args) throws Exception{ ntpparam unsetresource = new ntpparam(); return unsetresource.unset_resource(client,args); }
[ "public", "static", "base_response", "unset", "(", "nitro_service", "client", ",", "ntpparam", "resource", ",", "String", "[", "]", "args", ")", "throws", "Exception", "{", "ntpparam", "unsetresource", "=", "new", "ntpparam", "(", ")", ";", "return", "unsetresource", ".", "unset_resource", "(", "client", ",", "args", ")", ";", "}" ]
Use this API to unset the properties of ntpparam resource. Properties that need to be unset are specified in args array.
[ "Use", "this", "API", "to", "unset", "the", "properties", "of", "ntpparam", "resource", ".", "Properties", "that", "need", "to", "be", "unset", "are", "specified", "in", "args", "array", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java#L182-L185
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java
ntpparam.get
public static ntpparam get(nitro_service service) throws Exception{ ntpparam obj = new ntpparam(); ntpparam[] response = (ntpparam[])obj.get_resources(service); return response[0]; }
java
public static ntpparam get(nitro_service service) throws Exception{ ntpparam obj = new ntpparam(); ntpparam[] response = (ntpparam[])obj.get_resources(service); return response[0]; }
[ "public", "static", "ntpparam", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "ntpparam", "obj", "=", "new", "ntpparam", "(", ")", ";", "ntpparam", "[", "]", "response", "=", "(", "ntpparam", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", "[", "0", "]", ";", "}" ]
Use this API to fetch all the ntpparam resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "ntpparam", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ntp/ntpparam.java#L190-L194
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.update
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
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); }
[ "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", ")", ";", "}" ]
Use this API to update snmpengineid.
[ "Use", "this", "API", "to", "update", "snmpengineid", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L137-L142
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.update
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
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; }
[ "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", ";", "}" ]
Use this API to update snmpengineid resources.
[ "Use", "this", "API", "to", "update", "snmpengineid", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L147-L159
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.unset
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
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); }
[ "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", ")", ";", "}" ]
Use this API to unset the properties of snmpengineid resource. Properties that need to be unset are specified in args array.
[ "Use", "this", "API", "to", "unset", "the", "properties", "of", "snmpengineid", "resource", ".", "Properties", "that", "need", "to", "be", "unset", "are", "specified", "in", "args", "array", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L165-L169
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.unset
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
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; }
[ "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", ";", "}" ]
Use this API to unset the properties of snmpengineid resources. Properties that need to be unset are specified in args array.
[ "Use", "this", "API", "to", "unset", "the", "properties", "of", "snmpengineid", "resources", ".", "Properties", "that", "need", "to", "be", "unset", "are", "specified", "in", "args", "array", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L185-L196
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.get
public static snmpengineid[] get(nitro_service service) throws Exception{ snmpengineid obj = new snmpengineid(); snmpengineid[] response = (snmpengineid[])obj.get_resources(service); return response; }
java
public static snmpengineid[] get(nitro_service service) throws Exception{ snmpengineid obj = new snmpengineid(); snmpengineid[] response = (snmpengineid[])obj.get_resources(service); return response; }
[ "public", "static", "snmpengineid", "[", "]", "get", "(", "nitro_service", "service", ")", "throws", "Exception", "{", "snmpengineid", "obj", "=", "new", "snmpengineid", "(", ")", ";", "snmpengineid", "[", "]", "response", "=", "(", "snmpengineid", "[", "]", ")", "obj", ".", "get_resources", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch all the snmpengineid resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "snmpengineid", "resources", "that", "are", "configured", "on", "netscaler", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L218-L222
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.get
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
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; }
[ "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", ";", "}" ]
Use this API to fetch snmpengineid resource of given name .
[ "Use", "this", "API", "to", "fetch", "snmpengineid", "resource", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L234-L239
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java
snmpengineid.get
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
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; }
[ "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", ";", "}" ]
Use this API to fetch snmpengineid resources of given names .
[ "Use", "this", "API", "to", "fetch", "snmpengineid", "resources", "of", "given", "names", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/snmp/snmpengineid.java#L244-L256
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslfipssimsource.java
sslfipssimsource.enable
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
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"); }
[ "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\"", ")", ";", "}" ]
Use this API to enable sslfipssimsource.
[ "Use", "this", "API", "to", "enable", "sslfipssimsource", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslfipssimsource.java#L132-L137
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslfipssimsource.java
sslfipssimsource.init
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
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"); }
[ "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\"", ")", ";", "}" ]
Use this API to init sslfipssimsource.
[ "Use", "this", "API", "to", "init", "sslfipssimsource", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslfipssimsource.java#L142-L146
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java
nspbrs.renumber
public static base_response renumber(nitro_service client) throws Exception { nspbrs renumberresource = new nspbrs(); return renumberresource.perform_operation(client,"renumber"); }
java
public static base_response renumber(nitro_service client) throws Exception { nspbrs renumberresource = new nspbrs(); return renumberresource.perform_operation(client,"renumber"); }
[ "public", "static", "base_response", "renumber", "(", "nitro_service", "client", ")", "throws", "Exception", "{", "nspbrs", "renumberresource", "=", "new", "nspbrs", "(", ")", ";", "return", "renumberresource", ".", "perform_operation", "(", "client", ",", "\"renumber\"", ")", ";", "}" ]
Use this API to renumber nspbrs.
[ "Use", "this", "API", "to", "renumber", "nspbrs", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java#L75-L78
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java
nspbrs.clear
public static base_response clear(nitro_service client) throws Exception { nspbrs clearresource = new nspbrs(); return clearresource.perform_operation(client,"clear"); }
java
public static base_response clear(nitro_service client) throws Exception { nspbrs clearresource = new nspbrs(); return clearresource.perform_operation(client,"clear"); }
[ "public", "static", "base_response", "clear", "(", "nitro_service", "client", ")", "throws", "Exception", "{", "nspbrs", "clearresource", "=", "new", "nspbrs", "(", ")", ";", "return", "clearresource", ".", "perform_operation", "(", "client", ",", "\"clear\"", ")", ";", "}" ]
Use this API to clear nspbrs.
[ "Use", "this", "API", "to", "clear", "nspbrs", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java#L83-L86
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java
nspbrs.apply
public static base_response apply(nitro_service client) throws Exception { nspbrs applyresource = new nspbrs(); return applyresource.perform_operation(client,"apply"); }
java
public static base_response apply(nitro_service client) throws Exception { nspbrs applyresource = new nspbrs(); return applyresource.perform_operation(client,"apply"); }
[ "public", "static", "base_response", "apply", "(", "nitro_service", "client", ")", "throws", "Exception", "{", "nspbrs", "applyresource", "=", "new", "nspbrs", "(", ")", ";", "return", "applyresource", ".", "perform_operation", "(", "client", ",", "\"apply\"", ")", ";", "}" ]
Use this API to apply nspbrs.
[ "Use", "this", "API", "to", "apply", "nspbrs", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nspbrs.java#L91-L94
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicylabel_appflowpolicy_binding.java
appflowpolicylabel_appflowpolicy_binding.get
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
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; }
[ "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", ";", "}" ]
Use this API to fetch appflowpolicylabel_appflowpolicy_binding resources of given name .
[ "Use", "this", "API", "to", "fetch", "appflowpolicylabel_appflowpolicy_binding", "resources", "of", "given", "name", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appflow/appflowpolicylabel_appflowpolicy_binding.java#L279-L284
train
meertensinstituut/mtas
src/main/java/mtas/solr/handler/component/util/MtasSolrComponentPrefix.java
MtasSolrComponentPrefix.repairPrefixItems
@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
@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); } }
[ "@", "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", ")", ";", "}", "}" ]
Repair prefix items. @param mtasResponse the mtas response
[ "Repair", "prefix", "items", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/handler/component/util/MtasSolrComponentPrefix.java#L240-L265
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.collectKnownPrefixes
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
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(); } }
[ "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", "(", ")", ";", "}", "}" ]
Collect known prefixes. @param fi the fi @return the sets the @throws IOException Signals that an I/O exception has occurred.
[ "Collect", "known", "prefixes", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L925-L969
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.collectIntersectionPrefixes
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
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(); } }
[ "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", "(", ")", ";", "}", "}" ]
Collect intersection prefixes. @param fi the fi @return the sets the @throws IOException Signals that an I/O exception has occurred.
[ "Collect", "intersection", "prefixes", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L980-L1000
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.collectPrefixes
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
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]); } } } } }
[ "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", "]", ")", ";", "}", "}", "}", "}", "}" ]
Collect prefixes. @param fieldInfos the field infos @param field the field @param fieldInfo the field info @throws IOException Signals that an I/O exception has occurred.
[ "Collect", "prefixes", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1014-L1057
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.collectSpansForOccurences
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
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; }
[ "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", ";", "}" ]
Collect spans for occurences. @param occurences the occurences @param prefixes the prefixes @param field the field @param searcher the searcher @param lrc the lrc @return the map @throws IOException Signals that an I/O exception has occurred.
[ "Collect", "spans", "for", "occurences", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1076-L1095
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createQueryFromGroupHit
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
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; } }
[ "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", ";", "}", "}" ]
Creates the query from group hit. @param prefixes the prefixes @param field the field @param hit the hit @return the mtas span query
[ "Creates", "the", "query", "from", "group", "hit", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1108-L1154
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createSubQueryFromGroupHit
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
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; }
[ "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", ";", "}" ]
Creates the sub query from group hit. @param subHit the sub hit @param reverse the reverse @param field the field @return the mtas span query
[ "Creates", "the", "sub", "query", "from", "group", "hit", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1167-L1198
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.computePositions
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
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; }
[ "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", ";", "}" ]
Compute positions. @param mtasCodecInfo the mtas codec info @param r the r @param lrc the lrc @param field the field @param docSet the doc set @return the map @throws IOException Signals that an I/O exception has occurred.
[ "Compute", "positions", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1217-L1246
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.computeArguments
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
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; }
[ "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", ";", "}" ]
Compute arguments. @param spansNumberData the spans number data @param queries the queries @param docSet the doc set @return the map
[ "Compute", "arguments", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1259-L1282
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.intersectedDocList
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
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[] {}; }
[ "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", "[", "]", "{", "}", ";", "}" ]
Intersected doc list. @param facetDocList the facet doc list @param docSet the doc set @return the integer[]
[ "Intersected", "doc", "list", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1293-L1316
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createPositions
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
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(); } } }
[ "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", "(", ")", ";", "}", "}", "}" ]
Creates the positions. @param statsPositionList the stats position list @param positionsData the positions data @param docSet the doc set @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "positions", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1330-L1357
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createTokens
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
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(); } } }
[ "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", "(", ")", ";", "}", "}", "}" ]
Creates the tokens. @param statsTokenList the stats token list @param tokensData the tokens data @param docSet the doc set @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "tokens", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1371-L1399
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.availablePrefixes
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
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; }
[ "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", ";", "}" ]
Available prefixes. @param group the group @param knownPrefixes the known prefixes @return true, if successful
[ "Available", "prefixes", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1967-L1977
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.intersectionPrefixes
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
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; }
[ "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", ";", "}" ]
Intersection prefixes. @param group the group @param intersectionPrefixes the intersection prefixes @return true, if successful
[ "Intersection", "prefixes", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L1988-L1998
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createPositionHit
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
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); }
[ "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", ")", ";", "}" ]
Creates the position hit. @param m the m @param group the group @return the interval tree node data
[ "Creates", "the", "position", "hit", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L2009-L2044
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.sortMatchList
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
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))); } }
[ "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", ")", ")", ")", ";", "}", "}" ]
Sort match list. @param list the list
[ "Sort", "match", "list", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L2266-L2272
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.groupedKeyName
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
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 + ")"; } } }
[ "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", "+", "\")\"", ";", "}", "}", "}" ]
Grouped key name. @param key the key @param baseRangeSize the base range size @param baseRangeBase the base range base @return the string
[ "Grouped", "key", "name", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L2955-L2992
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.mergeDocLists
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
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); }
[ "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", ")", ";", "}" ]
Merge doc lists. @param a the a @param b the b @return the integer[]
[ "Merge", "doc", "lists", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L3003-L3030
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.createFacet
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
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()])); } } } }
[ "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", "(", ")", "]", ")", ")", ";", "}", "}", "}", "}" ]
Creates the facet. @param facetList the facet list @param positionsData the positions data @param spansNumberData the spans number data @param facetData the facet data @param docSet the doc set @throws IOException Signals that an I/O exception has occurred.
[ "Creates", "the", "facet", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L3048-L3063
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.validateTermWithStartValue
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
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; }
[ "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", ";", "}" ]
Validate term with start value. @param term the term @param termVector the term vector @return true, if successful
[ "Validate", "term", "with", "start", "value", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L3630-L3661
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.validateTermWithDistance
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
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; } }
[ "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", ";", "}", "}" ]
Validate term with distance. @param term the term @param termVector the term vector @return true, if successful @throws IOException Signals that an I/O exception has occurred.
[ "Validate", "term", "with", "distance", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L3674-L3714
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.needSecondRoundTermvector
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
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; }
[ "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", ";", "}" ]
Need second round termvector. @param termVectorList the term vector list @return true, if successful @throws IOException Signals that an I/O exception has occurred.
[ "Need", "second", "round", "termvector", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L3725-L3754
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.preliminaryRegisterValue
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
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; } } }
[ "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", ";", "}", "}", "}" ]
Preliminary register value. @param term the term @param termVector the term vector @param number the number @param termNumberMaximum the term number maximum @param segmentNumber the segment number @param mutableKey the mutable key @return true, if successful @throws IOException Signals that an I/O exception has occurred.
[ "Preliminary", "register", "value", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L4002-L4044
train
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.computeTermvectorNumberFull
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
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; }
[ "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", ";", "}" ]
Compute termvector number full. @param docSet the doc set @param termDocId the term doc id @param termsEnum the terms enum @param lrc the lrc @param postingsEnum the postings enum @param positionsData the positions data @return the termvector number full @throws IOException Signals that an I/O exception has occurred.
[ "Compute", "termvector", "number", "full", "." ]
f02ae730848616bd88b553efa7f9eddc32818e64
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L4215-L4234
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java
ChineseEnglishWordMap.containsKey
public boolean containsKey(String key) { key = key.toLowerCase(); key = key.trim(); return map.containsKey(key); }
java
public boolean containsKey(String key) { key = key.toLowerCase(); key = key.trim(); return map.containsKey(key); }
[ "public", "boolean", "containsKey", "(", "String", "key", ")", "{", "key", "=", "key", ".", "toLowerCase", "(", ")", ";", "key", "=", "key", ".", "trim", "(", ")", ";", "return", "map", ".", "containsKey", "(", "key", ")", ";", "}" ]
Does the word exist in the dictionary? @param key The word in Chinese @return Whether it is in the dictionary
[ "Does", "the", "word", "exist", "in", "the", "dictionary?" ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java#L100-L104
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java
ChineseEnglishWordMap.getReverseMap
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
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; }
[ "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\r", "Set", "<", "String", ">", "toAdd", "=", "new", "LinkedHashSet", "<", "String", ">", "(", "6", ")", ";", "toAdd", ".", "add", "(", "k", ")", ";", "rMap", ".", "put", "(", "trans", ",", "toAdd", ")", ";", "}", "else", "{", "entry", ".", "add", "(", "k", ")", ";", "}", "}", "}", "return", "rMap", ";", "}" ]
Returns a reversed map of the current map. @return A reversed map of the current map.
[ "Returns", "a", "reversed", "map", "of", "the", "current", "map", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java#L276-L295
train
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java
ChineseEnglishWordMap.addMap
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
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; }
[ "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", ";", "}" ]
Add all of the mappings from the specified map to the current map.
[ "Add", "all", "of", "the", "mappings", "from", "the", "specified", "map", "to", "the", "current", "map", "." ]
b3d44bab9ec07ace0d13612c448a6b7298c1f681
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/international/pennchinese/ChineseEnglishWordMap.java#L300-L323
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java
dnssoarec.add
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
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); }
[ "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", ")", ";", "}" ]
Use this API to add dnssoarec.
[ "Use", "this", "API", "to", "add", "dnssoarec", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java#L337-L349
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java
dnssoarec.add
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
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; }
[ "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", ";", "}" ]
Use this API to add dnssoarec resources.
[ "Use", "this", "API", "to", "add", "dnssoarec", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java#L354-L373
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java
dnssoarec.delete
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
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; }
[ "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", ";", "}" ]
Use this API to delete dnssoarec resources.
[ "Use", "this", "API", "to", "delete", "dnssoarec", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java#L412-L423
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java
dnssoarec.update
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
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); }
[ "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", ")", ";", "}" ]
Use this API to update dnssoarec.
[ "Use", "this", "API", "to", "update", "dnssoarec", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java#L428-L440
train
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java
dnssoarec.update
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
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; }
[ "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", ";", "}" ]
Use this API to update dnssoarec resources.
[ "Use", "this", "API", "to", "update", "dnssoarec", "resources", "." ]
2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec.java#L445-L464
train