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/appqoe/appqoecustomresp.java | appqoecustomresp.get | public static appqoecustomresp[] get(nitro_service service, options option) throws Exception{
appqoecustomresp obj = new appqoecustomresp();
appqoecustomresp[] response = (appqoecustomresp[])obj.get_resources(service,option);
return response;
} | java | public static appqoecustomresp[] get(nitro_service service, options option) throws Exception{
appqoecustomresp obj = new appqoecustomresp();
appqoecustomresp[] response = (appqoecustomresp[])obj.get_resources(service,option);
return response;
} | [
"public",
"static",
"appqoecustomresp",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"appqoecustomresp",
"obj",
"=",
"new",
"appqoecustomresp",
"(",
")",
";",
"appqoecustomresp",
"[",
"]",
"response",
"=",
"(",
"appqoecustomresp",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
",",
"option",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the appqoecustomresp resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"appqoecustomresp",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appqoe/appqoecustomresp.java#L222-L226 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getCodecInfoFromTerms | @SuppressWarnings("unchecked")
public static CodecInfo getCodecInfoFromTerms(Terms t) throws IOException {
try {
HashMap<String, IndexInput> indexInputList = null;
HashMap<String, Long> indexInputOffsetList = null;
Object version = null;
Method[] methods = t.getClass().getMethods();
Object[] emptyArgs = null;
for (Method m : methods) {
if (m.getName().equals("getIndexInputList")) {
indexInputList = (HashMap<String, IndexInput>) m.invoke(t, emptyArgs);
} else if (m.getName().equals("getIndexInputOffsetList")) {
indexInputOffsetList = (HashMap<String, Long>) m.invoke(t, emptyArgs);
} else if (m.getName().equals("getVersion")) {
version = m.invoke(t, emptyArgs);
}
}
if (indexInputList == null || indexInputOffsetList == null
|| version == null) {
throw new IOException("Reader doesn't provide MtasFieldsProducer");
} else {
return new CodecInfo(indexInputList, indexInputOffsetList,
(int) version);
}
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IOException("Can't get codecInfo", e);
}
} | java | @SuppressWarnings("unchecked")
public static CodecInfo getCodecInfoFromTerms(Terms t) throws IOException {
try {
HashMap<String, IndexInput> indexInputList = null;
HashMap<String, Long> indexInputOffsetList = null;
Object version = null;
Method[] methods = t.getClass().getMethods();
Object[] emptyArgs = null;
for (Method m : methods) {
if (m.getName().equals("getIndexInputList")) {
indexInputList = (HashMap<String, IndexInput>) m.invoke(t, emptyArgs);
} else if (m.getName().equals("getIndexInputOffsetList")) {
indexInputOffsetList = (HashMap<String, Long>) m.invoke(t, emptyArgs);
} else if (m.getName().equals("getVersion")) {
version = m.invoke(t, emptyArgs);
}
}
if (indexInputList == null || indexInputOffsetList == null
|| version == null) {
throw new IOException("Reader doesn't provide MtasFieldsProducer");
} else {
return new CodecInfo(indexInputList, indexInputOffsetList,
(int) version);
}
} catch (IllegalAccessException | InvocationTargetException e) {
throw new IOException("Can't get codecInfo", e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"CodecInfo",
"getCodecInfoFromTerms",
"(",
"Terms",
"t",
")",
"throws",
"IOException",
"{",
"try",
"{",
"HashMap",
"<",
"String",
",",
"IndexInput",
">",
"indexInputList",
"=",
"null",
";",
"HashMap",
"<",
"String",
",",
"Long",
">",
"indexInputOffsetList",
"=",
"null",
";",
"Object",
"version",
"=",
"null",
";",
"Method",
"[",
"]",
"methods",
"=",
"t",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
")",
";",
"Object",
"[",
"]",
"emptyArgs",
"=",
"null",
";",
"for",
"(",
"Method",
"m",
":",
"methods",
")",
"{",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"getIndexInputList\"",
")",
")",
"{",
"indexInputList",
"=",
"(",
"HashMap",
"<",
"String",
",",
"IndexInput",
">",
")",
"m",
".",
"invoke",
"(",
"t",
",",
"emptyArgs",
")",
";",
"}",
"else",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"getIndexInputOffsetList\"",
")",
")",
"{",
"indexInputOffsetList",
"=",
"(",
"HashMap",
"<",
"String",
",",
"Long",
">",
")",
"m",
".",
"invoke",
"(",
"t",
",",
"emptyArgs",
")",
";",
"}",
"else",
"if",
"(",
"m",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"getVersion\"",
")",
")",
"{",
"version",
"=",
"m",
".",
"invoke",
"(",
"t",
",",
"emptyArgs",
")",
";",
"}",
"}",
"if",
"(",
"indexInputList",
"==",
"null",
"||",
"indexInputOffsetList",
"==",
"null",
"||",
"version",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Reader doesn't provide MtasFieldsProducer\"",
")",
";",
"}",
"else",
"{",
"return",
"new",
"CodecInfo",
"(",
"indexInputList",
",",
"indexInputOffsetList",
",",
"(",
"int",
")",
"version",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"InvocationTargetException",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Can't get codecInfo\"",
",",
"e",
")",
";",
"}",
"}"
] | Gets the codec info from terms.
@param t
the t
@return the codec info from terms
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"codec",
"info",
"from",
"terms",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L79-L106 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getObjectById | public MtasToken getObjectById(String field, int docId, int mtasId)
throws IOException {
try {
Long ref;
Long objectRefApproxCorrection;
IndexDoc doc = getDoc(field, docId);
IndexInput inObjectId = indexInputList.get("indexObjectId");
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_BYTE) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 1L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readByte());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_SHORT) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 2L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readShort());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_INTEGER) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 4L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readInt());
} else {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 8L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readLong());
}
ref = objectRefApproxCorrection + doc.objectRefApproxOffset
+ (mtasId * (long) doc.objectRefApproxQuotient);
return MtasCodecPostingsFormat.getToken(inObject, inTerm, ref);
} catch (Exception e) {
throw new IOException(e);
}
} | java | public MtasToken getObjectById(String field, int docId, int mtasId)
throws IOException {
try {
Long ref;
Long objectRefApproxCorrection;
IndexDoc doc = getDoc(field, docId);
IndexInput inObjectId = indexInputList.get("indexObjectId");
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_BYTE) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 1L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readByte());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_SHORT) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 2L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readShort());
} else if (doc.storageFlags == MtasCodecPostingsFormat.MTAS_STORAGE_INTEGER) {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 4L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readInt());
} else {
inObjectId.seek(doc.fpIndexObjectId + (mtasId * 8L));
objectRefApproxCorrection = Long.valueOf(inObjectId.readLong());
}
ref = objectRefApproxCorrection + doc.objectRefApproxOffset
+ (mtasId * (long) doc.objectRefApproxQuotient);
return MtasCodecPostingsFormat.getToken(inObject, inTerm, ref);
} catch (Exception e) {
throw new IOException(e);
}
} | [
"public",
"MtasToken",
"getObjectById",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"int",
"mtasId",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Long",
"ref",
";",
"Long",
"objectRefApproxCorrection",
";",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inObjectId",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectId\"",
")",
";",
"IndexInput",
"inObject",
"=",
"indexInputList",
".",
"get",
"(",
"\"object\"",
")",
";",
"IndexInput",
"inTerm",
"=",
"indexInputList",
".",
"get",
"(",
"\"term\"",
")",
";",
"if",
"(",
"doc",
".",
"storageFlags",
"==",
"MtasCodecPostingsFormat",
".",
"MTAS_STORAGE_BYTE",
")",
"{",
"inObjectId",
".",
"seek",
"(",
"doc",
".",
"fpIndexObjectId",
"+",
"(",
"mtasId",
"*",
"1L",
")",
")",
";",
"objectRefApproxCorrection",
"=",
"Long",
".",
"valueOf",
"(",
"inObjectId",
".",
"readByte",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"doc",
".",
"storageFlags",
"==",
"MtasCodecPostingsFormat",
".",
"MTAS_STORAGE_SHORT",
")",
"{",
"inObjectId",
".",
"seek",
"(",
"doc",
".",
"fpIndexObjectId",
"+",
"(",
"mtasId",
"*",
"2L",
")",
")",
";",
"objectRefApproxCorrection",
"=",
"Long",
".",
"valueOf",
"(",
"inObjectId",
".",
"readShort",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"doc",
".",
"storageFlags",
"==",
"MtasCodecPostingsFormat",
".",
"MTAS_STORAGE_INTEGER",
")",
"{",
"inObjectId",
".",
"seek",
"(",
"doc",
".",
"fpIndexObjectId",
"+",
"(",
"mtasId",
"*",
"4L",
")",
")",
";",
"objectRefApproxCorrection",
"=",
"Long",
".",
"valueOf",
"(",
"inObjectId",
".",
"readInt",
"(",
")",
")",
";",
"}",
"else",
"{",
"inObjectId",
".",
"seek",
"(",
"doc",
".",
"fpIndexObjectId",
"+",
"(",
"mtasId",
"*",
"8L",
")",
")",
";",
"objectRefApproxCorrection",
"=",
"Long",
".",
"valueOf",
"(",
"inObjectId",
".",
"readLong",
"(",
")",
")",
";",
"}",
"ref",
"=",
"objectRefApproxCorrection",
"+",
"doc",
".",
"objectRefApproxOffset",
"+",
"(",
"mtasId",
"*",
"(",
"long",
")",
"doc",
".",
"objectRefApproxQuotient",
")",
";",
"return",
"MtasCodecPostingsFormat",
".",
"getToken",
"(",
"inObject",
",",
"inTerm",
",",
"ref",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}"
] | Gets the object by id.
@param field
the field
@param docId
the doc id
@param mtasId
the mtas id
@return the object by id
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"object",
"by",
"id",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L155-L183 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getObjectsByParentId | public List<MtasTokenString> getObjectsByParentId(String field, int docId,
int position) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectParent = indexInputList.get("indexObjectParent");
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position,
inIndexObjectParent, doc.fpIndexObjectParent,
doc.smallestObjectFilepointer);
return getObjects(hits);
} | java | public List<MtasTokenString> getObjectsByParentId(String field, int docId,
int position) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectParent = indexInputList.get("indexObjectParent");
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position,
inIndexObjectParent, doc.fpIndexObjectParent,
doc.smallestObjectFilepointer);
return getObjects(hits);
} | [
"public",
"List",
"<",
"MtasTokenString",
">",
"getObjectsByParentId",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"int",
"position",
")",
"throws",
"IOException",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inIndexObjectParent",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectParent\"",
")",
";",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"hits",
"=",
"CodecSearchTree",
".",
"searchMtasTree",
"(",
"position",
",",
"inIndexObjectParent",
",",
"doc",
".",
"fpIndexObjectParent",
",",
"doc",
".",
"smallestObjectFilepointer",
")",
";",
"return",
"getObjects",
"(",
"hits",
")",
";",
"}"
] | Gets the objects by parent id.
@param field
the field
@param docId
the doc id
@param position
the position
@return the objects by parent id
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"objects",
"by",
"parent",
"id",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L198-L206 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getObjectsByPosition | public ArrayList<MtasTokenString> getObjectsByPosition(String field,
int docId, int position) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position,
inIndexObjectPosition, doc.fpIndexObjectPosition,
doc.smallestObjectFilepointer);
return getObjects(hits);
} | java | public ArrayList<MtasTokenString> getObjectsByPosition(String field,
int docId, int position) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(position,
inIndexObjectPosition, doc.fpIndexObjectPosition,
doc.smallestObjectFilepointer);
return getObjects(hits);
} | [
"public",
"ArrayList",
"<",
"MtasTokenString",
">",
"getObjectsByPosition",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"int",
"position",
")",
"throws",
"IOException",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inIndexObjectPosition",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectPosition\"",
")",
";",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"hits",
"=",
"CodecSearchTree",
".",
"searchMtasTree",
"(",
"position",
",",
"inIndexObjectPosition",
",",
"doc",
".",
"fpIndexObjectPosition",
",",
"doc",
".",
"smallestObjectFilepointer",
")",
";",
"return",
"getObjects",
"(",
"hits",
")",
";",
"}"
] | Gets the objects by position.
@param field
the field
@param docId
the doc id
@param position
the position
@return the objects by position
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"objects",
"by",
"position",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L221-L230 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPrefixFilteredObjectsByPositions | public List<MtasTokenString> getPrefixFilteredObjectsByPositions(String field,
int docId, List<String> prefixes, int startPosition, int endPosition)
throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
if (doc != null) {
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(
startPosition, endPosition, inIndexObjectPosition,
doc.fpIndexObjectPosition, doc.smallestObjectFilepointer);
return getPrefixFilteredObjects(hits, prefixes);
} else {
return new ArrayList<>();
}
} | java | public List<MtasTokenString> getPrefixFilteredObjectsByPositions(String field,
int docId, List<String> prefixes, int startPosition, int endPosition)
throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
if (doc != null) {
ArrayList<MtasTreeHit<?>> hits = CodecSearchTree.searchMtasTree(
startPosition, endPosition, inIndexObjectPosition,
doc.fpIndexObjectPosition, doc.smallestObjectFilepointer);
return getPrefixFilteredObjects(hits, prefixes);
} else {
return new ArrayList<>();
}
} | [
"public",
"List",
"<",
"MtasTokenString",
">",
"getPrefixFilteredObjectsByPositions",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"List",
"<",
"String",
">",
"prefixes",
",",
"int",
"startPosition",
",",
"int",
"endPosition",
")",
"throws",
"IOException",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inIndexObjectPosition",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectPosition\"",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"hits",
"=",
"CodecSearchTree",
".",
"searchMtasTree",
"(",
"startPosition",
",",
"endPosition",
",",
"inIndexObjectPosition",
",",
"doc",
".",
"fpIndexObjectPosition",
",",
"doc",
".",
"smallestObjectFilepointer",
")",
";",
"return",
"getPrefixFilteredObjects",
"(",
"hits",
",",
"prefixes",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"}"
] | Gets the prefix filtered objects by positions.
@param field
the field
@param docId
the doc id
@param prefixes
the prefixes
@param startPosition
the start position
@param endPosition
the end position
@return the prefix filtered objects by positions
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"prefix",
"filtered",
"objects",
"by",
"positions",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L260-L274 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPrefixFilteredObjects | private List<MtasTokenString> getPrefixFilteredObjects(
List<MtasTreeHit<?>> hits, List<String> prefixes) throws IOException {
ArrayList<MtasTokenString> tokens = new ArrayList<>();
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
for (MtasTreeHit<?> hit : hits) {
MtasTokenString token = MtasCodecPostingsFormat.getToken(inObject, inTerm,
hit.ref);
if (token != null) {
if (prefixes != null && !prefixes.isEmpty()) {
if (prefixes.contains(token.getPrefix())) {
tokens.add(token);
}
} else {
tokens.add(token);
}
}
}
return tokens;
} | java | private List<MtasTokenString> getPrefixFilteredObjects(
List<MtasTreeHit<?>> hits, List<String> prefixes) throws IOException {
ArrayList<MtasTokenString> tokens = new ArrayList<>();
IndexInput inObject = indexInputList.get("object");
IndexInput inTerm = indexInputList.get("term");
for (MtasTreeHit<?> hit : hits) {
MtasTokenString token = MtasCodecPostingsFormat.getToken(inObject, inTerm,
hit.ref);
if (token != null) {
if (prefixes != null && !prefixes.isEmpty()) {
if (prefixes.contains(token.getPrefix())) {
tokens.add(token);
}
} else {
tokens.add(token);
}
}
}
return tokens;
} | [
"private",
"List",
"<",
"MtasTokenString",
">",
"getPrefixFilteredObjects",
"(",
"List",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"hits",
",",
"List",
"<",
"String",
">",
"prefixes",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"MtasTokenString",
">",
"tokens",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"IndexInput",
"inObject",
"=",
"indexInputList",
".",
"get",
"(",
"\"object\"",
")",
";",
"IndexInput",
"inTerm",
"=",
"indexInputList",
".",
"get",
"(",
"\"term\"",
")",
";",
"for",
"(",
"MtasTreeHit",
"<",
"?",
">",
"hit",
":",
"hits",
")",
"{",
"MtasTokenString",
"token",
"=",
"MtasCodecPostingsFormat",
".",
"getToken",
"(",
"inObject",
",",
"inTerm",
",",
"hit",
".",
"ref",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"if",
"(",
"prefixes",
"!=",
"null",
"&&",
"!",
"prefixes",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"prefixes",
".",
"contains",
"(",
"token",
".",
"getPrefix",
"(",
")",
")",
")",
"{",
"tokens",
".",
"add",
"(",
"token",
")",
";",
"}",
"}",
"else",
"{",
"tokens",
".",
"add",
"(",
"token",
")",
";",
"}",
"}",
"}",
"return",
"tokens",
";",
"}"
] | Gets the prefix filtered objects.
@param hits
the hits
@param prefixes
the prefixes
@return the prefix filtered objects
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"prefix",
"filtered",
"objects",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L287-L306 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPositionedTermsByPrefixesAndPosition | public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPosition(
String field, int docId, List<String> prefixes, int position)
throws IOException {
return getPositionedTermsByPrefixesAndPositionRange(field, docId, prefixes,
position, position);
} | java | public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPosition(
String field, int docId, List<String> prefixes, int position)
throws IOException {
return getPositionedTermsByPrefixesAndPositionRange(field, docId, prefixes,
position, position);
} | [
"public",
"List",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"getPositionedTermsByPrefixesAndPosition",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"List",
"<",
"String",
">",
"prefixes",
",",
"int",
"position",
")",
"throws",
"IOException",
"{",
"return",
"getPositionedTermsByPrefixesAndPositionRange",
"(",
"field",
",",
"docId",
",",
"prefixes",
",",
"position",
",",
"position",
")",
";",
"}"
] | Gets the positioned terms by prefixes and position.
@param field
the field
@param docId
the doc id
@param prefixes
the prefixes
@param position
the position
@return the positioned terms by prefixes and position
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"positioned",
"terms",
"by",
"prefixes",
"and",
"position",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L323-L328 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPositionedTermsByPrefixesAndPositionRange | public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPositionRange(
String field, int docId, List<String> prefixes, int startPosition,
int endPosition) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
if (doc != null) {
ArrayList<MtasTreeHit<?>> hitItems = CodecSearchTree.searchMtasTree(
startPosition, endPosition, inIndexObjectPosition,
doc.fpIndexObjectPosition, doc.smallestObjectFilepointer);
List<MtasTreeHit<String>> hits = new ArrayList<>();
Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes);
if (prefixIds != null && prefixIds.size() > 0) {
ArrayList<MtasTreeHit<?>> filteredHitItems = new ArrayList<MtasTreeHit<?>>();
for (MtasTreeHit<?> hitItem : hitItems) {
if (prefixIds.containsValue(hitItem.additionalId)) {
filteredHitItems.add(hitItem);
}
}
if (filteredHitItems.size() > 0) {
ArrayList<MtasTokenString> objects = getObjects(filteredHitItems);
for (MtasTokenString token : objects) {
MtasTreeHit<String> hit = new MtasTreeHit<String>(
token.getPositionStart(), token.getPositionEnd(),
token.getTokenRef(), 0, 0, token.getValue());
hits.add(hit);
}
}
}
return hits;
} else {
return new ArrayList<MtasTreeHit<String>>();
}
} | java | public List<MtasTreeHit<String>> getPositionedTermsByPrefixesAndPositionRange(
String field, int docId, List<String> prefixes, int startPosition,
int endPosition) throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
if (doc != null) {
ArrayList<MtasTreeHit<?>> hitItems = CodecSearchTree.searchMtasTree(
startPosition, endPosition, inIndexObjectPosition,
doc.fpIndexObjectPosition, doc.smallestObjectFilepointer);
List<MtasTreeHit<String>> hits = new ArrayList<>();
Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes);
if (prefixIds != null && prefixIds.size() > 0) {
ArrayList<MtasTreeHit<?>> filteredHitItems = new ArrayList<MtasTreeHit<?>>();
for (MtasTreeHit<?> hitItem : hitItems) {
if (prefixIds.containsValue(hitItem.additionalId)) {
filteredHitItems.add(hitItem);
}
}
if (filteredHitItems.size() > 0) {
ArrayList<MtasTokenString> objects = getObjects(filteredHitItems);
for (MtasTokenString token : objects) {
MtasTreeHit<String> hit = new MtasTreeHit<String>(
token.getPositionStart(), token.getPositionEnd(),
token.getTokenRef(), 0, 0, token.getValue());
hits.add(hit);
}
}
}
return hits;
} else {
return new ArrayList<MtasTreeHit<String>>();
}
} | [
"public",
"List",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"getPositionedTermsByPrefixesAndPositionRange",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"List",
"<",
"String",
">",
"prefixes",
",",
"int",
"startPosition",
",",
"int",
"endPosition",
")",
"throws",
"IOException",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inIndexObjectPosition",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectPosition\"",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"hitItems",
"=",
"CodecSearchTree",
".",
"searchMtasTree",
"(",
"startPosition",
",",
"endPosition",
",",
"inIndexObjectPosition",
",",
"doc",
".",
"fpIndexObjectPosition",
",",
"doc",
".",
"smallestObjectFilepointer",
")",
";",
"List",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"hits",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Map",
"<",
"String",
",",
"Integer",
">",
"prefixIds",
"=",
"getPrefixesIds",
"(",
"field",
",",
"prefixes",
")",
";",
"if",
"(",
"prefixIds",
"!=",
"null",
"&&",
"prefixIds",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"filteredHitItems",
"=",
"new",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"(",
")",
";",
"for",
"(",
"MtasTreeHit",
"<",
"?",
">",
"hitItem",
":",
"hitItems",
")",
"{",
"if",
"(",
"prefixIds",
".",
"containsValue",
"(",
"hitItem",
".",
"additionalId",
")",
")",
"{",
"filteredHitItems",
".",
"add",
"(",
"hitItem",
")",
";",
"}",
"}",
"if",
"(",
"filteredHitItems",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"ArrayList",
"<",
"MtasTokenString",
">",
"objects",
"=",
"getObjects",
"(",
"filteredHitItems",
")",
";",
"for",
"(",
"MtasTokenString",
"token",
":",
"objects",
")",
"{",
"MtasTreeHit",
"<",
"String",
">",
"hit",
"=",
"new",
"MtasTreeHit",
"<",
"String",
">",
"(",
"token",
".",
"getPositionStart",
"(",
")",
",",
"token",
".",
"getPositionEnd",
"(",
")",
",",
"token",
".",
"getTokenRef",
"(",
")",
",",
"0",
",",
"0",
",",
"token",
".",
"getValue",
"(",
")",
")",
";",
"hits",
".",
"add",
"(",
"hit",
")",
";",
"}",
"}",
"}",
"return",
"hits",
";",
"}",
"else",
"{",
"return",
"new",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"(",
")",
";",
"}",
"}"
] | Gets the positioned terms by prefixes and position range.
@param field
the field
@param docId
the doc id
@param prefixes
the prefixes
@param startPosition
the start position
@param endPosition
the end position
@return the positioned terms by prefixes and position range
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"positioned",
"terms",
"by",
"prefixes",
"and",
"position",
"range",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L347-L381 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.collectTermsByPrefixesForListOfHitPositions | public void collectTermsByPrefixesForListOfHitPositions(String field,
int docId, ArrayList<String> prefixes,
ArrayList<IntervalTreeNodeData<String>> positionsHits)
throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
IndexInput inTerm = indexInputList.get("term");
// create tree interval hits
IntervalRBTree<String> positionTree = new IntervalRBTree<String>(
positionsHits);
// find prefixIds
Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes);
// search matching tokens
if (prefixIds != null) {
CodecSearchTree.searchMtasTreeWithIntervalTree(prefixIds.values(),
positionTree, inIndexObjectPosition, doc.fpIndexObjectPosition,
doc.smallestObjectFilepointer);
// reverse list
Map<Integer, String> idPrefixes = new HashMap<>();
for (Entry<String, Integer> entry : prefixIds.entrySet()) {
idPrefixes.put(entry.getValue(), entry.getKey());
}
// term administration
Map<Long, String> refTerms = new HashMap<>();
for (IntervalTreeNodeData<String> positionHit : positionsHits) {
for (MtasTreeHit<String> hit : positionHit.list) {
if (hit.idData == null) {
hit.idData = idPrefixes.get(hit.additionalId);
if (!refTerms.containsKey(hit.additionalRef)) {
refTerms.put(hit.additionalRef,
MtasCodecPostingsFormat.getTerm(inTerm, hit.additionalRef));
}
hit.refData = refTerms.get(hit.additionalRef);
}
}
}
}
} | java | public void collectTermsByPrefixesForListOfHitPositions(String field,
int docId, ArrayList<String> prefixes,
ArrayList<IntervalTreeNodeData<String>> positionsHits)
throws IOException {
IndexDoc doc = getDoc(field, docId);
IndexInput inIndexObjectPosition = indexInputList
.get("indexObjectPosition");
IndexInput inTerm = indexInputList.get("term");
// create tree interval hits
IntervalRBTree<String> positionTree = new IntervalRBTree<String>(
positionsHits);
// find prefixIds
Map<String, Integer> prefixIds = getPrefixesIds(field, prefixes);
// search matching tokens
if (prefixIds != null) {
CodecSearchTree.searchMtasTreeWithIntervalTree(prefixIds.values(),
positionTree, inIndexObjectPosition, doc.fpIndexObjectPosition,
doc.smallestObjectFilepointer);
// reverse list
Map<Integer, String> idPrefixes = new HashMap<>();
for (Entry<String, Integer> entry : prefixIds.entrySet()) {
idPrefixes.put(entry.getValue(), entry.getKey());
}
// term administration
Map<Long, String> refTerms = new HashMap<>();
for (IntervalTreeNodeData<String> positionHit : positionsHits) {
for (MtasTreeHit<String> hit : positionHit.list) {
if (hit.idData == null) {
hit.idData = idPrefixes.get(hit.additionalId);
if (!refTerms.containsKey(hit.additionalRef)) {
refTerms.put(hit.additionalRef,
MtasCodecPostingsFormat.getTerm(inTerm, hit.additionalRef));
}
hit.refData = refTerms.get(hit.additionalRef);
}
}
}
}
} | [
"public",
"void",
"collectTermsByPrefixesForListOfHitPositions",
"(",
"String",
"field",
",",
"int",
"docId",
",",
"ArrayList",
"<",
"String",
">",
"prefixes",
",",
"ArrayList",
"<",
"IntervalTreeNodeData",
"<",
"String",
">",
">",
"positionsHits",
")",
"throws",
"IOException",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"IndexInput",
"inIndexObjectPosition",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexObjectPosition\"",
")",
";",
"IndexInput",
"inTerm",
"=",
"indexInputList",
".",
"get",
"(",
"\"term\"",
")",
";",
"// create tree interval hits",
"IntervalRBTree",
"<",
"String",
">",
"positionTree",
"=",
"new",
"IntervalRBTree",
"<",
"String",
">",
"(",
"positionsHits",
")",
";",
"// find prefixIds",
"Map",
"<",
"String",
",",
"Integer",
">",
"prefixIds",
"=",
"getPrefixesIds",
"(",
"field",
",",
"prefixes",
")",
";",
"// search matching tokens",
"if",
"(",
"prefixIds",
"!=",
"null",
")",
"{",
"CodecSearchTree",
".",
"searchMtasTreeWithIntervalTree",
"(",
"prefixIds",
".",
"values",
"(",
")",
",",
"positionTree",
",",
"inIndexObjectPosition",
",",
"doc",
".",
"fpIndexObjectPosition",
",",
"doc",
".",
"smallestObjectFilepointer",
")",
";",
"// reverse list",
"Map",
"<",
"Integer",
",",
"String",
">",
"idPrefixes",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Integer",
">",
"entry",
":",
"prefixIds",
".",
"entrySet",
"(",
")",
")",
"{",
"idPrefixes",
".",
"put",
"(",
"entry",
".",
"getValue",
"(",
")",
",",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"}",
"// term administration",
"Map",
"<",
"Long",
",",
"String",
">",
"refTerms",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"IntervalTreeNodeData",
"<",
"String",
">",
"positionHit",
":",
"positionsHits",
")",
"{",
"for",
"(",
"MtasTreeHit",
"<",
"String",
">",
"hit",
":",
"positionHit",
".",
"list",
")",
"{",
"if",
"(",
"hit",
".",
"idData",
"==",
"null",
")",
"{",
"hit",
".",
"idData",
"=",
"idPrefixes",
".",
"get",
"(",
"hit",
".",
"additionalId",
")",
";",
"if",
"(",
"!",
"refTerms",
".",
"containsKey",
"(",
"hit",
".",
"additionalRef",
")",
")",
"{",
"refTerms",
".",
"put",
"(",
"hit",
".",
"additionalRef",
",",
"MtasCodecPostingsFormat",
".",
"getTerm",
"(",
"inTerm",
",",
"hit",
".",
"additionalRef",
")",
")",
";",
"}",
"hit",
".",
"refData",
"=",
"refTerms",
".",
"get",
"(",
"hit",
".",
"additionalRef",
")",
";",
"}",
"}",
"}",
"}",
"}"
] | Collect terms by prefixes for list of hit positions.
@param field
the field
@param docId
the doc id
@param prefixes
the prefixes
@param positionsHits
the positions hits
@throws IOException
Signals that an I/O exception has occurred. | [
"Collect",
"terms",
"by",
"prefixes",
"for",
"list",
"of",
"hit",
"positions",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L397-L438 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getTerms | public ArrayList<MtasTreeHit<String>> getTerms(ArrayList<MtasTreeHit<?>> refs)
throws IOException {
try {
ArrayList<MtasTreeHit<String>> terms = new ArrayList<MtasTreeHit<String>>();
IndexInput inTerm = indexInputList.get("term");
for (MtasTreeHit<?> hit : refs) {
inTerm.seek(hit.ref);
String term = inTerm.readString();
MtasTreeHit<String> newHit = new MtasTreeHit<String>(hit.startPosition,
hit.endPosition, hit.ref, hit.additionalId, hit.additionalRef,
term);
terms.add(newHit);
}
return terms;
} catch (Exception e) {
throw new IOException(e);
}
} | java | public ArrayList<MtasTreeHit<String>> getTerms(ArrayList<MtasTreeHit<?>> refs)
throws IOException {
try {
ArrayList<MtasTreeHit<String>> terms = new ArrayList<MtasTreeHit<String>>();
IndexInput inTerm = indexInputList.get("term");
for (MtasTreeHit<?> hit : refs) {
inTerm.seek(hit.ref);
String term = inTerm.readString();
MtasTreeHit<String> newHit = new MtasTreeHit<String>(hit.startPosition,
hit.endPosition, hit.ref, hit.additionalId, hit.additionalRef,
term);
terms.add(newHit);
}
return terms;
} catch (Exception e) {
throw new IOException(e);
}
} | [
"public",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"getTerms",
"(",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"refs",
")",
"throws",
"IOException",
"{",
"try",
"{",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"String",
">>",
"terms",
"=",
"new",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"String",
">",
">",
"(",
")",
";",
"IndexInput",
"inTerm",
"=",
"indexInputList",
".",
"get",
"(",
"\"term\"",
")",
";",
"for",
"(",
"MtasTreeHit",
"<",
"?",
">",
"hit",
":",
"refs",
")",
"{",
"inTerm",
".",
"seek",
"(",
"hit",
".",
"ref",
")",
";",
"String",
"term",
"=",
"inTerm",
".",
"readString",
"(",
")",
";",
"MtasTreeHit",
"<",
"String",
">",
"newHit",
"=",
"new",
"MtasTreeHit",
"<",
"String",
">",
"(",
"hit",
".",
"startPosition",
",",
"hit",
".",
"endPosition",
",",
"hit",
".",
"ref",
",",
"hit",
".",
"additionalId",
",",
"hit",
".",
"additionalRef",
",",
"term",
")",
";",
"terms",
".",
"add",
"(",
"newHit",
")",
";",
"}",
"return",
"terms",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IOException",
"(",
"e",
")",
";",
"}",
"}"
] | Gets the terms.
@param refs
the refs
@return the terms
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"terms",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L473-L490 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPrefixesIds | Map<String, Integer> getPrefixesIds(String field, List<String> prefixes) {
LinkedHashMap<String, Long> refs = getPrefixRefs(field);
if (refs != null) {
List<String> list = new ArrayList<>(refs.keySet());
Map<String, Integer> result = new HashMap<>();
for (String prefix : prefixes) {
int id = list.indexOf(prefix);
if (id >= 0) {
result.put(prefix, id + 1);
}
}
return result;
} else {
return null;
}
} | java | Map<String, Integer> getPrefixesIds(String field, List<String> prefixes) {
LinkedHashMap<String, Long> refs = getPrefixRefs(field);
if (refs != null) {
List<String> list = new ArrayList<>(refs.keySet());
Map<String, Integer> result = new HashMap<>();
for (String prefix : prefixes) {
int id = list.indexOf(prefix);
if (id >= 0) {
result.put(prefix, id + 1);
}
}
return result;
} else {
return null;
}
} | [
"Map",
"<",
"String",
",",
"Integer",
">",
"getPrefixesIds",
"(",
"String",
"field",
",",
"List",
"<",
"String",
">",
"prefixes",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
"refs",
"=",
"getPrefixRefs",
"(",
"field",
")",
";",
"if",
"(",
"refs",
"!=",
"null",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"refs",
".",
"keySet",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"Integer",
">",
"result",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"prefix",
":",
"prefixes",
")",
"{",
"int",
"id",
"=",
"list",
".",
"indexOf",
"(",
"prefix",
")",
";",
"if",
"(",
"id",
">=",
"0",
")",
"{",
"result",
".",
"put",
"(",
"prefix",
",",
"id",
"+",
"1",
")",
";",
"}",
"}",
"return",
"result",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the prefixes ids.
@param field
the field
@param prefixes
the prefixes
@return the prefixes ids | [
"Gets",
"the",
"prefixes",
"ids",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L501-L516 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getPrefixRefs | private LinkedHashMap<String, Long> getPrefixRefs(String field) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
if (!prefixReferences.containsKey(field)) {
LinkedHashMap<String, Long> refs = new LinkedHashMap<String, Long>();
try {
IndexInput inPrefix = indexInputList.get("prefix");
inPrefix.seek(fr.refPrefix);
for (int i = 0; i < fr.numberOfPrefixes; i++) {
Long ref = inPrefix.getFilePointer();
String prefix = inPrefix.readString();
refs.put(prefix, ref);
}
} catch (Exception e) {
log.error(e);
refs.clear();
}
prefixReferences.put(field, refs);
return refs;
} else {
return prefixReferences.get(field);
}
} else {
return null;
}
} | java | private LinkedHashMap<String, Long> getPrefixRefs(String field) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
if (!prefixReferences.containsKey(field)) {
LinkedHashMap<String, Long> refs = new LinkedHashMap<String, Long>();
try {
IndexInput inPrefix = indexInputList.get("prefix");
inPrefix.seek(fr.refPrefix);
for (int i = 0; i < fr.numberOfPrefixes; i++) {
Long ref = inPrefix.getFilePointer();
String prefix = inPrefix.readString();
refs.put(prefix, ref);
}
} catch (Exception e) {
log.error(e);
refs.clear();
}
prefixReferences.put(field, refs);
return refs;
} else {
return prefixReferences.get(field);
}
} else {
return null;
}
} | [
"private",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
"getPrefixRefs",
"(",
"String",
"field",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"FieldReferences",
"fr",
"=",
"fieldReferences",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"!",
"prefixReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
"refs",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Long",
">",
"(",
")",
";",
"try",
"{",
"IndexInput",
"inPrefix",
"=",
"indexInputList",
".",
"get",
"(",
"\"prefix\"",
")",
";",
"inPrefix",
".",
"seek",
"(",
"fr",
".",
"refPrefix",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fr",
".",
"numberOfPrefixes",
";",
"i",
"++",
")",
"{",
"Long",
"ref",
"=",
"inPrefix",
".",
"getFilePointer",
"(",
")",
";",
"String",
"prefix",
"=",
"inPrefix",
".",
"readString",
"(",
")",
";",
"refs",
".",
"put",
"(",
"prefix",
",",
"ref",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"e",
")",
";",
"refs",
".",
"clear",
"(",
")",
";",
"}",
"prefixReferences",
".",
"put",
"(",
"field",
",",
"refs",
")",
";",
"return",
"refs",
";",
"}",
"else",
"{",
"return",
"prefixReferences",
".",
"get",
"(",
"field",
")",
";",
"}",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] | Gets the prefixes.
@param field
the field
@return the prefixes | [
"Gets",
"the",
"prefixes",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L530-L555 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getDoc | public IndexDoc getDoc(String field, int docId) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
try {
IndexInput inIndexDocId = indexInputList.get("indexDocId");
ArrayList<MtasTreeHit<?>> list = CodecSearchTree.searchMtasTree(docId,
inIndexDocId, fr.refIndexDocId, fr.refIndexDoc);
if (list.size() == 1) {
return new IndexDoc(list.get(0).ref);
}
} catch (IOException e) {
log.debug(e);
return null;
}
}
return null;
} | java | public IndexDoc getDoc(String field, int docId) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
try {
IndexInput inIndexDocId = indexInputList.get("indexDocId");
ArrayList<MtasTreeHit<?>> list = CodecSearchTree.searchMtasTree(docId,
inIndexDocId, fr.refIndexDocId, fr.refIndexDoc);
if (list.size() == 1) {
return new IndexDoc(list.get(0).ref);
}
} catch (IOException e) {
log.debug(e);
return null;
}
}
return null;
} | [
"public",
"IndexDoc",
"getDoc",
"(",
"String",
"field",
",",
"int",
"docId",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"FieldReferences",
"fr",
"=",
"fieldReferences",
".",
"get",
"(",
"field",
")",
";",
"try",
"{",
"IndexInput",
"inIndexDocId",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexDocId\"",
")",
";",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"list",
"=",
"CodecSearchTree",
".",
"searchMtasTree",
"(",
"docId",
",",
"inIndexDocId",
",",
"fr",
".",
"refIndexDocId",
",",
"fr",
".",
"refIndexDoc",
")",
";",
"if",
"(",
"list",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"new",
"IndexDoc",
"(",
"list",
".",
"get",
"(",
"0",
")",
".",
"ref",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"debug",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the doc.
@param field
the field
@param docId
the doc id
@return the doc | [
"Gets",
"the",
"doc",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L566-L582 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getNextDoc | public IndexDoc getNextDoc(String field, int previousDocId) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
try {
if (previousDocId < 0) {
return new IndexDoc(fr.refIndexDoc);
} else {
int nextDocId = previousDocId + 1;
IndexInput inIndexDocId = indexInputList.get("indexDocId");
ArrayList<MtasTreeHit<?>> list = CodecSearchTree.advanceMtasTree(
nextDocId, inIndexDocId, fr.refIndexDocId, fr.refIndexDoc);
if (list.size() == 1) {
IndexInput inDoc = indexInputList.get("doc");
inDoc.seek(list.get(0).ref);
return new IndexDoc(inDoc.getFilePointer());
}
}
} catch (IOException e) {
log.debug(e);
return null;
}
}
return null;
} | java | public IndexDoc getNextDoc(String field, int previousDocId) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
try {
if (previousDocId < 0) {
return new IndexDoc(fr.refIndexDoc);
} else {
int nextDocId = previousDocId + 1;
IndexInput inIndexDocId = indexInputList.get("indexDocId");
ArrayList<MtasTreeHit<?>> list = CodecSearchTree.advanceMtasTree(
nextDocId, inIndexDocId, fr.refIndexDocId, fr.refIndexDoc);
if (list.size() == 1) {
IndexInput inDoc = indexInputList.get("doc");
inDoc.seek(list.get(0).ref);
return new IndexDoc(inDoc.getFilePointer());
}
}
} catch (IOException e) {
log.debug(e);
return null;
}
}
return null;
} | [
"public",
"IndexDoc",
"getNextDoc",
"(",
"String",
"field",
",",
"int",
"previousDocId",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"FieldReferences",
"fr",
"=",
"fieldReferences",
".",
"get",
"(",
"field",
")",
";",
"try",
"{",
"if",
"(",
"previousDocId",
"<",
"0",
")",
"{",
"return",
"new",
"IndexDoc",
"(",
"fr",
".",
"refIndexDoc",
")",
";",
"}",
"else",
"{",
"int",
"nextDocId",
"=",
"previousDocId",
"+",
"1",
";",
"IndexInput",
"inIndexDocId",
"=",
"indexInputList",
".",
"get",
"(",
"\"indexDocId\"",
")",
";",
"ArrayList",
"<",
"MtasTreeHit",
"<",
"?",
">",
">",
"list",
"=",
"CodecSearchTree",
".",
"advanceMtasTree",
"(",
"nextDocId",
",",
"inIndexDocId",
",",
"fr",
".",
"refIndexDocId",
",",
"fr",
".",
"refIndexDoc",
")",
";",
"if",
"(",
"list",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"IndexInput",
"inDoc",
"=",
"indexInputList",
".",
"get",
"(",
"\"doc\"",
")",
";",
"inDoc",
".",
"seek",
"(",
"list",
".",
"get",
"(",
"0",
")",
".",
"ref",
")",
";",
"return",
"new",
"IndexDoc",
"(",
"inDoc",
".",
"getFilePointer",
"(",
")",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"debug",
"(",
"e",
")",
";",
"return",
"null",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the next doc.
@param field
the field
@param previousDocId
the previous doc id
@return the next doc | [
"Gets",
"the",
"next",
"doc",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L593-L616 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getNumberOfDocs | public int getNumberOfDocs(String field) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
return fr.numberOfDocs;
} else {
return 0;
}
} | java | public int getNumberOfDocs(String field) {
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
return fr.numberOfDocs;
} else {
return 0;
}
} | [
"public",
"int",
"getNumberOfDocs",
"(",
"String",
"field",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"FieldReferences",
"fr",
"=",
"fieldReferences",
".",
"get",
"(",
"field",
")",
";",
"return",
"fr",
".",
"numberOfDocs",
";",
"}",
"else",
"{",
"return",
"0",
";",
"}",
"}"
] | Gets the number of docs.
@param field
the field
@return the number of docs | [
"Gets",
"the",
"number",
"of",
"docs",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L625-L632 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getNumberOfPositions | public Integer getNumberOfPositions(String field, int docId) {
if (fieldReferences.containsKey(field)) {
IndexDoc doc = getDoc(field, docId);
if (doc != null) {
return 1 + doc.maxPosition - doc.minPosition;
}
}
return null;
} | java | public Integer getNumberOfPositions(String field, int docId) {
if (fieldReferences.containsKey(field)) {
IndexDoc doc = getDoc(field, docId);
if (doc != null) {
return 1 + doc.maxPosition - doc.minPosition;
}
}
return null;
} | [
"public",
"Integer",
"getNumberOfPositions",
"(",
"String",
"field",
",",
"int",
"docId",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"return",
"1",
"+",
"doc",
".",
"maxPosition",
"-",
"doc",
".",
"minPosition",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the number of positions.
@param field
the field
@param docId
the doc id
@return the number of positions | [
"Gets",
"the",
"number",
"of",
"positions",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L643-L651 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getAllNumberOfPositions | public HashMap<Integer, Integer> getAllNumberOfPositions(String field,
int docBase) throws IOException {
HashMap<Integer, Integer> numbers = new HashMap<Integer, Integer>();
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
IndexInput inIndexDoc = indexInputList.get("doc");
inIndexDoc.seek(fr.refIndexDoc);
IndexDoc doc;
for (int i = 0; i < fr.numberOfDocs; i++) {
doc = new IndexDoc(null);
numbers.put((doc.docId + docBase),
(1 + doc.maxPosition - doc.minPosition));
}
}
return numbers;
} | java | public HashMap<Integer, Integer> getAllNumberOfPositions(String field,
int docBase) throws IOException {
HashMap<Integer, Integer> numbers = new HashMap<Integer, Integer>();
if (fieldReferences.containsKey(field)) {
FieldReferences fr = fieldReferences.get(field);
IndexInput inIndexDoc = indexInputList.get("doc");
inIndexDoc.seek(fr.refIndexDoc);
IndexDoc doc;
for (int i = 0; i < fr.numberOfDocs; i++) {
doc = new IndexDoc(null);
numbers.put((doc.docId + docBase),
(1 + doc.maxPosition - doc.minPosition));
}
}
return numbers;
} | [
"public",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"getAllNumberOfPositions",
"(",
"String",
"field",
",",
"int",
"docBase",
")",
"throws",
"IOException",
"{",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"numbers",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"FieldReferences",
"fr",
"=",
"fieldReferences",
".",
"get",
"(",
"field",
")",
";",
"IndexInput",
"inIndexDoc",
"=",
"indexInputList",
".",
"get",
"(",
"\"doc\"",
")",
";",
"inIndexDoc",
".",
"seek",
"(",
"fr",
".",
"refIndexDoc",
")",
";",
"IndexDoc",
"doc",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"fr",
".",
"numberOfDocs",
";",
"i",
"++",
")",
"{",
"doc",
"=",
"new",
"IndexDoc",
"(",
"null",
")",
";",
"numbers",
".",
"put",
"(",
"(",
"doc",
".",
"docId",
"+",
"docBase",
")",
",",
"(",
"1",
"+",
"doc",
".",
"maxPosition",
"-",
"doc",
".",
"minPosition",
")",
")",
";",
"}",
"}",
"return",
"numbers",
";",
"}"
] | Gets the all number of positions.
@param field
the field
@param docBase
the doc base
@return the all number of positions
@throws IOException
Signals that an I/O exception has occurred. | [
"Gets",
"the",
"all",
"number",
"of",
"positions",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L664-L679 | train |
meertensinstituut/mtas | src/main/java/mtas/codec/util/CodecInfo.java | CodecInfo.getNumberOfTokens | public Integer getNumberOfTokens(String field, int docId) {
if (fieldReferences.containsKey(field)) {
IndexDoc doc = getDoc(field, docId);
if (doc != null) {
return doc.size;
}
}
return null;
} | java | public Integer getNumberOfTokens(String field, int docId) {
if (fieldReferences.containsKey(field)) {
IndexDoc doc = getDoc(field, docId);
if (doc != null) {
return doc.size;
}
}
return null;
} | [
"public",
"Integer",
"getNumberOfTokens",
"(",
"String",
"field",
",",
"int",
"docId",
")",
"{",
"if",
"(",
"fieldReferences",
".",
"containsKey",
"(",
"field",
")",
")",
"{",
"IndexDoc",
"doc",
"=",
"getDoc",
"(",
"field",
",",
"docId",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"return",
"doc",
".",
"size",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Gets the number of tokens.
@param field
the field
@param docId
the doc id
@return the number of tokens | [
"Gets",
"the",
"number",
"of",
"tokens",
"."
] | f02ae730848616bd88b553efa7f9eddc32818e64 | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L690-L698 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java | FeatureFactory.addAllInterningAndSuffixing | @SuppressWarnings({"MethodMayBeStatic"})
protected void addAllInterningAndSuffixing(Collection<String> accumulator, Collection<String> addend, String suffix) {
boolean nonNullSuffix = suffix != null && ! "".equals(suffix);
if (nonNullSuffix) {
suffix = '|' + suffix;
}
// boolean intern2 = flags.intern2;
for (String feat : addend) {
if (nonNullSuffix) {
feat = feat.concat(suffix);
}
// if (intern2) {
// feat = feat.intern();
// }
accumulator.add(feat);
}
} | java | @SuppressWarnings({"MethodMayBeStatic"})
protected void addAllInterningAndSuffixing(Collection<String> accumulator, Collection<String> addend, String suffix) {
boolean nonNullSuffix = suffix != null && ! "".equals(suffix);
if (nonNullSuffix) {
suffix = '|' + suffix;
}
// boolean intern2 = flags.intern2;
for (String feat : addend) {
if (nonNullSuffix) {
feat = feat.concat(suffix);
}
// if (intern2) {
// feat = feat.intern();
// }
accumulator.add(feat);
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"MethodMayBeStatic\"",
"}",
")",
"protected",
"void",
"addAllInterningAndSuffixing",
"(",
"Collection",
"<",
"String",
">",
"accumulator",
",",
"Collection",
"<",
"String",
">",
"addend",
",",
"String",
"suffix",
")",
"{",
"boolean",
"nonNullSuffix",
"=",
"suffix",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"suffix",
")",
";",
"if",
"(",
"nonNullSuffix",
")",
"{",
"suffix",
"=",
"'",
"'",
"+",
"suffix",
";",
"}",
"// boolean intern2 = flags.intern2;\r",
"for",
"(",
"String",
"feat",
":",
"addend",
")",
"{",
"if",
"(",
"nonNullSuffix",
")",
"{",
"feat",
"=",
"feat",
".",
"concat",
"(",
"suffix",
")",
";",
"}",
"// if (intern2) {\r",
"// feat = feat.intern();\r",
"// }\r",
"accumulator",
".",
"add",
"(",
"feat",
")",
";",
"}",
"}"
] | Makes more complete feature names out of partial feature names, by
adding a suffix to the String feature name, adding results to an
accumulator
@param accumulator The output features are added here
@param addend The base set of features
@param suffix The suffix added to each feature in the addend set | [
"Makes",
"more",
"complete",
"feature",
"names",
"out",
"of",
"partial",
"feature",
"names",
"by",
"adding",
"a",
"suffix",
"to",
"the",
"String",
"feature",
"name",
"adding",
"results",
"to",
"an",
"accumulator"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java#L92-L108 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java | FeatureFactory.getWord | protected String getWord(CoreLabel label) {
String word = label.getString(TextAnnotation.class);
if (flags.wordFunction != null) {
word = flags.wordFunction.apply(word);
}
return word;
} | java | protected String getWord(CoreLabel label) {
String word = label.getString(TextAnnotation.class);
if (flags.wordFunction != null) {
word = flags.wordFunction.apply(word);
}
return word;
} | [
"protected",
"String",
"getWord",
"(",
"CoreLabel",
"label",
")",
"{",
"String",
"word",
"=",
"label",
".",
"getString",
"(",
"TextAnnotation",
".",
"class",
")",
";",
"if",
"(",
"flags",
".",
"wordFunction",
"!=",
"null",
")",
"{",
"word",
"=",
"flags",
".",
"wordFunction",
".",
"apply",
"(",
"word",
")",
";",
"}",
"return",
"word",
";",
"}"
] | Convenience methods for subclasses which use CoreLabel. Gets the
word after applying any wordFunction present in the
SeqClassifierFlags. | [
"Convenience",
"methods",
"for",
"subclasses",
"which",
"use",
"CoreLabel",
".",
"Gets",
"the",
"word",
"after",
"applying",
"any",
"wordFunction",
"present",
"in",
"the",
"SeqClassifierFlags",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/FeatureFactory.java#L115-L121 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/stats/ClassicCounter.java | ClassicCounter.mutableRemove | private MutableDouble mutableRemove(E key) {
MutableDouble md = map.remove(key);
if (md != null) {
totalCount -= md.doubleValue();
}
return md;
} | java | private MutableDouble mutableRemove(E key) {
MutableDouble md = map.remove(key);
if (md != null) {
totalCount -= md.doubleValue();
}
return md;
} | [
"private",
"MutableDouble",
"mutableRemove",
"(",
"E",
"key",
")",
"{",
"MutableDouble",
"md",
"=",
"map",
".",
"remove",
"(",
"key",
")",
";",
"if",
"(",
"md",
"!=",
"null",
")",
"{",
"totalCount",
"-=",
"md",
".",
"doubleValue",
"(",
")",
";",
"}",
"return",
"md",
";",
"}"
] | This is used internally to the class for getting back a
MutableDouble in a remove operation. Not for public use.
@param key The key to remove
@return Its value as a MutableDouble | [
"This",
"is",
"used",
"internally",
"to",
"the",
"class",
"for",
"getting",
"back",
"a",
"MutableDouble",
"in",
"a",
"remove",
"operation",
".",
"Not",
"for",
"public",
"use",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/ClassicCounter.java#L415-L421 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java | nsacls.renumber | public static base_response renumber(nitro_service client) throws Exception {
nsacls renumberresource = new nsacls();
return renumberresource.perform_operation(client,"renumber");
} | java | public static base_response renumber(nitro_service client) throws Exception {
nsacls renumberresource = new nsacls();
return renumberresource.perform_operation(client,"renumber");
} | [
"public",
"static",
"base_response",
"renumber",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"nsacls",
"renumberresource",
"=",
"new",
"nsacls",
"(",
")",
";",
"return",
"renumberresource",
".",
"perform_operation",
"(",
"client",
",",
"\"renumber\"",
")",
";",
"}"
] | Use this API to renumber nsacls. | [
"Use",
"this",
"API",
"to",
"renumber",
"nsacls",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java#L75-L78 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java | nsacls.clear | public static base_response clear(nitro_service client) throws Exception {
nsacls clearresource = new nsacls();
return clearresource.perform_operation(client,"clear");
} | java | public static base_response clear(nitro_service client) throws Exception {
nsacls clearresource = new nsacls();
return clearresource.perform_operation(client,"clear");
} | [
"public",
"static",
"base_response",
"clear",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"nsacls",
"clearresource",
"=",
"new",
"nsacls",
"(",
")",
";",
"return",
"clearresource",
".",
"perform_operation",
"(",
"client",
",",
"\"clear\"",
")",
";",
"}"
] | Use this API to clear nsacls. | [
"Use",
"this",
"API",
"to",
"clear",
"nsacls",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java#L83-L86 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java | nsacls.apply | public static base_response apply(nitro_service client) throws Exception {
nsacls applyresource = new nsacls();
return applyresource.perform_operation(client,"apply");
} | java | public static base_response apply(nitro_service client) throws Exception {
nsacls applyresource = new nsacls();
return applyresource.perform_operation(client,"apply");
} | [
"public",
"static",
"base_response",
"apply",
"(",
"nitro_service",
"client",
")",
"throws",
"Exception",
"{",
"nsacls",
"applyresource",
"=",
"new",
"nsacls",
"(",
")",
";",
"return",
"applyresource",
".",
"perform_operation",
"(",
"client",
",",
"\"apply\"",
")",
";",
"}"
] | Use this API to apply nsacls. | [
"Use",
"this",
"API",
"to",
"apply",
"nsacls",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsacls.java#L91-L94 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/network/vlan_linkset_binding.java | vlan_linkset_binding.get | public static vlan_linkset_binding[] get(nitro_service service, Long id) throws Exception{
vlan_linkset_binding obj = new vlan_linkset_binding();
obj.set_id(id);
vlan_linkset_binding response[] = (vlan_linkset_binding[]) obj.get_resources(service);
return response;
} | java | public static vlan_linkset_binding[] get(nitro_service service, Long id) throws Exception{
vlan_linkset_binding obj = new vlan_linkset_binding();
obj.set_id(id);
vlan_linkset_binding response[] = (vlan_linkset_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"vlan_linkset_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"Long",
"id",
")",
"throws",
"Exception",
"{",
"vlan_linkset_binding",
"obj",
"=",
"new",
"vlan_linkset_binding",
"(",
")",
";",
"obj",
".",
"set_id",
"(",
"id",
")",
";",
"vlan_linkset_binding",
"response",
"[",
"]",
"=",
"(",
"vlan_linkset_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vlan_linkset_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vlan_linkset_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/vlan_linkset_binding.java#L198-L203 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsencryptionparams.java | nsencryptionparams.update | public static base_response update(nitro_service client, nsencryptionparams resource) throws Exception {
nsencryptionparams updateresource = new nsencryptionparams();
updateresource.method = resource.method;
updateresource.keyvalue = resource.keyvalue;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsencryptionparams resource) throws Exception {
nsencryptionparams updateresource = new nsencryptionparams();
updateresource.method = resource.method;
updateresource.keyvalue = resource.keyvalue;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsencryptionparams",
"resource",
")",
"throws",
"Exception",
"{",
"nsencryptionparams",
"updateresource",
"=",
"new",
"nsencryptionparams",
"(",
")",
";",
"updateresource",
".",
"method",
"=",
"resource",
".",
"method",
";",
"updateresource",
".",
"keyvalue",
"=",
"resource",
".",
"keyvalue",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update nsencryptionparams. | [
"Use",
"this",
"API",
"to",
"update",
"nsencryptionparams",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsencryptionparams.java#L116-L121 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsencryptionparams.java | nsencryptionparams.get | public static nsencryptionparams get(nitro_service service) throws Exception{
nsencryptionparams obj = new nsencryptionparams();
nsencryptionparams[] response = (nsencryptionparams[])obj.get_resources(service);
return response[0];
} | java | public static nsencryptionparams get(nitro_service service) throws Exception{
nsencryptionparams obj = new nsencryptionparams();
nsencryptionparams[] response = (nsencryptionparams[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"nsencryptionparams",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nsencryptionparams",
"obj",
"=",
"new",
"nsencryptionparams",
"(",
")",
";",
"nsencryptionparams",
"[",
"]",
"response",
"=",
"(",
"nsencryptionparams",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the nsencryptionparams resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsencryptionparams",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsencryptionparams.java#L126-L130 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnvserver_auditsyslogpolicy_binding.java | vpnvserver_auditsyslogpolicy_binding.get | public static vpnvserver_auditsyslogpolicy_binding[] get(nitro_service service, String name) throws Exception{
vpnvserver_auditsyslogpolicy_binding obj = new vpnvserver_auditsyslogpolicy_binding();
obj.set_name(name);
vpnvserver_auditsyslogpolicy_binding response[] = (vpnvserver_auditsyslogpolicy_binding[]) obj.get_resources(service);
return response;
} | java | public static vpnvserver_auditsyslogpolicy_binding[] get(nitro_service service, String name) throws Exception{
vpnvserver_auditsyslogpolicy_binding obj = new vpnvserver_auditsyslogpolicy_binding();
obj.set_name(name);
vpnvserver_auditsyslogpolicy_binding response[] = (vpnvserver_auditsyslogpolicy_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"vpnvserver_auditsyslogpolicy_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpnvserver_auditsyslogpolicy_binding",
"obj",
"=",
"new",
"vpnvserver_auditsyslogpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"vpnvserver_auditsyslogpolicy_binding",
"response",
"[",
"]",
"=",
"(",
"vpnvserver_auditsyslogpolicy_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vpnvserver_auditsyslogpolicy_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnvserver_auditsyslogpolicy_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnvserver_auditsyslogpolicy_binding.java#L326-L331 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwprofile_xmldosurl_binding.java | appfwprofile_xmldosurl_binding.get | public static appfwprofile_xmldosurl_binding[] get(nitro_service service, String name) throws Exception{
appfwprofile_xmldosurl_binding obj = new appfwprofile_xmldosurl_binding();
obj.set_name(name);
appfwprofile_xmldosurl_binding response[] = (appfwprofile_xmldosurl_binding[]) obj.get_resources(service);
return response;
} | java | public static appfwprofile_xmldosurl_binding[] get(nitro_service service, String name) throws Exception{
appfwprofile_xmldosurl_binding obj = new appfwprofile_xmldosurl_binding();
obj.set_name(name);
appfwprofile_xmldosurl_binding response[] = (appfwprofile_xmldosurl_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"appfwprofile_xmldosurl_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"appfwprofile_xmldosurl_binding",
"obj",
"=",
"new",
"appfwprofile_xmldosurl_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"appfwprofile_xmldosurl_binding",
"response",
"[",
"]",
"=",
"(",
"appfwprofile_xmldosurl_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch appfwprofile_xmldosurl_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"appfwprofile_xmldosurl_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/appfw/appfwprofile_xmldosurl_binding.java#L1101-L1106 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/TregexPatternCompiler.java | TregexPatternCompiler.compile | public TregexPattern compile(String tregex) {
for (Pair<String, String> macro : macros) {
tregex = tregex.replaceAll(macro.first(), macro.second());
}
TregexPattern pattern;
try {
TregexParser parser = new TregexParser(new StringReader(tregex + '\n'),
basicCatFunction, headFinder);
pattern = parser.Root();
} catch (TokenMgrError tme) {
throw new TregexParseException("Could not parse " + tregex, tme);
} catch (ParseException e) {
throw new TregexParseException("Could not parse " + tregex, e);
}
pattern.setPatternString(tregex);
return pattern;
} | java | public TregexPattern compile(String tregex) {
for (Pair<String, String> macro : macros) {
tregex = tregex.replaceAll(macro.first(), macro.second());
}
TregexPattern pattern;
try {
TregexParser parser = new TregexParser(new StringReader(tregex + '\n'),
basicCatFunction, headFinder);
pattern = parser.Root();
} catch (TokenMgrError tme) {
throw new TregexParseException("Could not parse " + tregex, tme);
} catch (ParseException e) {
throw new TregexParseException("Could not parse " + tregex, e);
}
pattern.setPatternString(tregex);
return pattern;
} | [
"public",
"TregexPattern",
"compile",
"(",
"String",
"tregex",
")",
"{",
"for",
"(",
"Pair",
"<",
"String",
",",
"String",
">",
"macro",
":",
"macros",
")",
"{",
"tregex",
"=",
"tregex",
".",
"replaceAll",
"(",
"macro",
".",
"first",
"(",
")",
",",
"macro",
".",
"second",
"(",
")",
")",
";",
"}",
"TregexPattern",
"pattern",
";",
"try",
"{",
"TregexParser",
"parser",
"=",
"new",
"TregexParser",
"(",
"new",
"StringReader",
"(",
"tregex",
"+",
"'",
"'",
")",
",",
"basicCatFunction",
",",
"headFinder",
")",
";",
"pattern",
"=",
"parser",
".",
"Root",
"(",
")",
";",
"}",
"catch",
"(",
"TokenMgrError",
"tme",
")",
"{",
"throw",
"new",
"TregexParseException",
"(",
"\"Could not parse \"",
"+",
"tregex",
",",
"tme",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"throw",
"new",
"TregexParseException",
"(",
"\"Could not parse \"",
"+",
"tregex",
",",
"e",
")",
";",
"}",
"pattern",
".",
"setPatternString",
"(",
"tregex",
")",
";",
"return",
"pattern",
";",
"}"
] | Create a TregexPattern from this tregex string using the headFinder and
basicCat function this TregexPatternCompiler was created with.
<i>Implementation note:</i> If there is an invalid token in the Tregex
parser, JavaCC will throw a TokenMgrError. This is a class
that extends Error, not Exception (OMG! - bad!), and so rather than
requiring clients to catch it, we wrap it in a ParseException.
(The original Error's are thrown in TregexParserTokenManager.)
@param tregex The pattern to parse
@return A new TregexPattern object based on this string
@throws TregexParseException If the expression is syntactically invalid | [
"Create",
"a",
"TregexPattern",
"from",
"this",
"tregex",
"string",
"using",
"the",
"headFinder",
"and",
"basicCat",
"function",
"this",
"TregexPatternCompiler",
"was",
"created",
"with",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/TregexPatternCompiler.java#L115-L131 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy_csvserver_binding.java | responderpolicy_csvserver_binding.get | public static responderpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
responderpolicy_csvserver_binding obj = new responderpolicy_csvserver_binding();
obj.set_name(name);
responderpolicy_csvserver_binding response[] = (responderpolicy_csvserver_binding[]) obj.get_resources(service);
return response;
} | java | public static responderpolicy_csvserver_binding[] get(nitro_service service, String name) throws Exception{
responderpolicy_csvserver_binding obj = new responderpolicy_csvserver_binding();
obj.set_name(name);
responderpolicy_csvserver_binding response[] = (responderpolicy_csvserver_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"responderpolicy_csvserver_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"responderpolicy_csvserver_binding",
"obj",
"=",
"new",
"responderpolicy_csvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"responderpolicy_csvserver_binding",
"response",
"[",
"]",
"=",
"(",
"responderpolicy_csvserver_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch responderpolicy_csvserver_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"responderpolicy_csvserver_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/responder/responderpolicy_csvserver_binding.java#L162-L167 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java | sslcrl_serialnumber_binding.get | public static sslcrl_serialnumber_binding[] get(nitro_service service, String crlname) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service);
return response;
} | java | public static sslcrl_serialnumber_binding[] get(nitro_service service, String crlname) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"sslcrl_serialnumber_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"crlname",
")",
"throws",
"Exception",
"{",
"sslcrl_serialnumber_binding",
"obj",
"=",
"new",
"sslcrl_serialnumber_binding",
"(",
")",
";",
"obj",
".",
"set_crlname",
"(",
"crlname",
")",
";",
"sslcrl_serialnumber_binding",
"response",
"[",
"]",
"=",
"(",
"sslcrl_serialnumber_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch sslcrl_serialnumber_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslcrl_serialnumber_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java#L122-L127 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java | sslcrl_serialnumber_binding.count | public static long count(nitro_service service, String crlname) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
options option = new options();
option.set_count(true);
sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service,option);
if (response != null) {
return response[0].__count;
}
return 0;
} | java | public static long count(nitro_service service, String crlname) throws Exception{
sslcrl_serialnumber_binding obj = new sslcrl_serialnumber_binding();
obj.set_crlname(crlname);
options option = new options();
option.set_count(true);
sslcrl_serialnumber_binding response[] = (sslcrl_serialnumber_binding[]) obj.get_resources(service,option);
if (response != null) {
return response[0].__count;
}
return 0;
} | [
"public",
"static",
"long",
"count",
"(",
"nitro_service",
"service",
",",
"String",
"crlname",
")",
"throws",
"Exception",
"{",
"sslcrl_serialnumber_binding",
"obj",
"=",
"new",
"sslcrl_serialnumber_binding",
"(",
")",
";",
"obj",
".",
"set_crlname",
"(",
"crlname",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_count",
"(",
"true",
")",
";",
"sslcrl_serialnumber_binding",
"response",
"[",
"]",
"=",
"(",
"sslcrl_serialnumber_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
",",
"option",
")",
";",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"return",
"response",
"[",
"0",
"]",
".",
"__count",
";",
"}",
"return",
"0",
";",
"}"
] | Use this API to count sslcrl_serialnumber_binding resources configued on NetScaler. | [
"Use",
"this",
"API",
"to",
"count",
"sslcrl_serialnumber_binding",
"resources",
"configued",
"on",
"NetScaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcrl_serialnumber_binding.java#L158-L168 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.add | public static base_response add(nitro_service client, aaauser resource) throws Exception {
aaauser addresource = new aaauser();
addresource.username = resource.username;
addresource.password = resource.password;
return addresource.add_resource(client);
} | java | public static base_response add(nitro_service client, aaauser resource) throws Exception {
aaauser addresource = new aaauser();
addresource.username = resource.username;
addresource.password = resource.password;
return addresource.add_resource(client);
} | [
"public",
"static",
"base_response",
"add",
"(",
"nitro_service",
"client",
",",
"aaauser",
"resource",
")",
"throws",
"Exception",
"{",
"aaauser",
"addresource",
"=",
"new",
"aaauser",
"(",
")",
";",
"addresource",
".",
"username",
"=",
"resource",
".",
"username",
";",
"addresource",
".",
"password",
"=",
"resource",
".",
"password",
";",
"return",
"addresource",
".",
"add_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to add aaauser. | [
"Use",
"this",
"API",
"to",
"add",
"aaauser",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L150-L155 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.add | public static base_responses add(nitro_service client, aaauser resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaauser addresources[] = new aaauser[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new aaauser();
addresources[i].username = resources[i].username;
addresources[i].password = resources[i].password;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | public static base_responses add(nitro_service client, aaauser resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaauser addresources[] = new aaauser[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new aaauser();
addresources[i].username = resources[i].username;
addresources[i].password = resources[i].password;
}
result = add_bulk_request(client, addresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"add",
"(",
"nitro_service",
"client",
",",
"aaauser",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"aaauser",
"addresources",
"[",
"]",
"=",
"new",
"aaauser",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"addresources",
"[",
"i",
"]",
"=",
"new",
"aaauser",
"(",
")",
";",
"addresources",
"[",
"i",
"]",
".",
"username",
"=",
"resources",
"[",
"i",
"]",
".",
"username",
";",
"addresources",
"[",
"i",
"]",
".",
"password",
"=",
"resources",
"[",
"i",
"]",
".",
"password",
";",
"}",
"result",
"=",
"add_bulk_request",
"(",
"client",
",",
"addresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to add aaauser resources. | [
"Use",
"this",
"API",
"to",
"add",
"aaauser",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L160-L172 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.update | public static base_response update(nitro_service client, aaauser resource) throws Exception {
aaauser updateresource = new aaauser();
updateresource.username = resource.username;
updateresource.password = resource.password;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, aaauser resource) throws Exception {
aaauser updateresource = new aaauser();
updateresource.username = resource.username;
updateresource.password = resource.password;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"aaauser",
"resource",
")",
"throws",
"Exception",
"{",
"aaauser",
"updateresource",
"=",
"new",
"aaauser",
"(",
")",
";",
"updateresource",
".",
"username",
"=",
"resource",
".",
"username",
";",
"updateresource",
".",
"password",
"=",
"resource",
".",
"password",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update aaauser. | [
"Use",
"this",
"API",
"to",
"update",
"aaauser",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L227-L232 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.get | public static aaauser[] get(nitro_service service) throws Exception{
aaauser obj = new aaauser();
aaauser[] response = (aaauser[])obj.get_resources(service);
return response;
} | java | public static aaauser[] get(nitro_service service) throws Exception{
aaauser obj = new aaauser();
aaauser[] response = (aaauser[])obj.get_resources(service);
return response;
} | [
"public",
"static",
"aaauser",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"aaauser",
"obj",
"=",
"new",
"aaauser",
"(",
")",
";",
"aaauser",
"[",
"]",
"response",
"=",
"(",
"aaauser",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the aaauser resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"aaauser",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L254-L258 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.get | public static aaauser[] get(nitro_service service, aaauser_args args) throws Exception{
aaauser obj = new aaauser();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
aaauser[] response = (aaauser[])obj.get_resources(service, option);
return response;
} | java | public static aaauser[] get(nitro_service service, aaauser_args args) throws Exception{
aaauser obj = new aaauser();
options option = new options();
option.set_args(nitro_util.object_to_string_withoutquotes(args));
aaauser[] response = (aaauser[])obj.get_resources(service, option);
return response;
} | [
"public",
"static",
"aaauser",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"aaauser_args",
"args",
")",
"throws",
"Exception",
"{",
"aaauser",
"obj",
"=",
"new",
"aaauser",
"(",
")",
";",
"options",
"option",
"=",
"new",
"options",
"(",
")",
";",
"option",
".",
"set_args",
"(",
"nitro_util",
".",
"object_to_string_withoutquotes",
"(",
"args",
")",
")",
";",
"aaauser",
"[",
"]",
"response",
"=",
"(",
"aaauser",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
",",
"option",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the aaauser resources that are configured on netscaler.
This uses aaauser_args which is a way to provide additional arguments while fetching the resources. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"aaauser",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
".",
"This",
"uses",
"aaauser_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/aaa/aaauser.java#L271-L277 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.get | public static aaauser get(nitro_service service, String username) throws Exception{
aaauser obj = new aaauser();
obj.set_username(username);
aaauser response = (aaauser) obj.get_resource(service);
return response;
} | java | public static aaauser get(nitro_service service, String username) throws Exception{
aaauser obj = new aaauser();
obj.set_username(username);
aaauser response = (aaauser) obj.get_resource(service);
return response;
} | [
"public",
"static",
"aaauser",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"username",
")",
"throws",
"Exception",
"{",
"aaauser",
"obj",
"=",
"new",
"aaauser",
"(",
")",
";",
"obj",
".",
"set_username",
"(",
"username",
")",
";",
"aaauser",
"response",
"=",
"(",
"aaauser",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch aaauser resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"aaauser",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L282-L287 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java | aaauser.get | public static aaauser[] get(nitro_service service, String username[]) throws Exception{
if (username !=null && username.length>0) {
aaauser response[] = new aaauser[username.length];
aaauser obj[] = new aaauser[username.length];
for (int i=0;i<username.length;i++) {
obj[i] = new aaauser();
obj[i].set_username(username[i]);
response[i] = (aaauser) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | public static aaauser[] get(nitro_service service, String username[]) throws Exception{
if (username !=null && username.length>0) {
aaauser response[] = new aaauser[username.length];
aaauser obj[] = new aaauser[username.length];
for (int i=0;i<username.length;i++) {
obj[i] = new aaauser();
obj[i].set_username(username[i]);
response[i] = (aaauser) obj[i].get_resource(service);
}
return response;
}
return null;
} | [
"public",
"static",
"aaauser",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"username",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"username",
"!=",
"null",
"&&",
"username",
".",
"length",
">",
"0",
")",
"{",
"aaauser",
"response",
"[",
"]",
"=",
"new",
"aaauser",
"[",
"username",
".",
"length",
"]",
";",
"aaauser",
"obj",
"[",
"]",
"=",
"new",
"aaauser",
"[",
"username",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"username",
".",
"length",
";",
"i",
"++",
")",
"{",
"obj",
"[",
"i",
"]",
"=",
"new",
"aaauser",
"(",
")",
";",
"obj",
"[",
"i",
"]",
".",
"set_username",
"(",
"username",
"[",
"i",
"]",
")",
";",
"response",
"[",
"i",
"]",
"=",
"(",
"aaauser",
")",
"obj",
"[",
"i",
"]",
".",
"get_resource",
"(",
"service",
")",
";",
"}",
"return",
"response",
";",
"}",
"return",
"null",
";",
"}"
] | Use this API to fetch aaauser resources of given names . | [
"Use",
"this",
"API",
"to",
"fetch",
"aaauser",
"resources",
"of",
"given",
"names",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaauser.java#L292-L304 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationcertpolicy_authenticationvserver_binding.java | authenticationcertpolicy_authenticationvserver_binding.get | public static authenticationcertpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{
authenticationcertpolicy_authenticationvserver_binding obj = new authenticationcertpolicy_authenticationvserver_binding();
obj.set_name(name);
authenticationcertpolicy_authenticationvserver_binding response[] = (authenticationcertpolicy_authenticationvserver_binding[]) obj.get_resources(service);
return response;
} | java | public static authenticationcertpolicy_authenticationvserver_binding[] get(nitro_service service, String name) throws Exception{
authenticationcertpolicy_authenticationvserver_binding obj = new authenticationcertpolicy_authenticationvserver_binding();
obj.set_name(name);
authenticationcertpolicy_authenticationvserver_binding response[] = (authenticationcertpolicy_authenticationvserver_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"authenticationcertpolicy_authenticationvserver_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"authenticationcertpolicy_authenticationvserver_binding",
"obj",
"=",
"new",
"authenticationcertpolicy_authenticationvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"authenticationcertpolicy_authenticationvserver_binding",
"response",
"[",
"]",
"=",
"(",
"authenticationcertpolicy_authenticationvserver_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch authenticationcertpolicy_authenticationvserver_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"authenticationcertpolicy_authenticationvserver_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationcertpolicy_authenticationvserver_binding.java#L132-L137 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.addRule | public void addRule(IntDependency dependency, double count) {
if ( ! directional) {
dependency = new IntDependency(dependency.head, dependency.arg, false, dependency.distance);
}
if (verbose) System.err.println("Adding dep " + dependency);
// coreDependencies.incrementCount(dependency, count);
/*new IntDependency(dependency.head.word,
dependency.head.tag,
dependency.arg.word,
dependency.arg.tag,
dependency.leftHeaded,
dependency.distance), count);
*/
expandDependency(dependency, count);
// System.err.println("stopCounter: " + stopCounter);
// System.err.println("argCounter: " + argCounter);
} | java | public void addRule(IntDependency dependency, double count) {
if ( ! directional) {
dependency = new IntDependency(dependency.head, dependency.arg, false, dependency.distance);
}
if (verbose) System.err.println("Adding dep " + dependency);
// coreDependencies.incrementCount(dependency, count);
/*new IntDependency(dependency.head.word,
dependency.head.tag,
dependency.arg.word,
dependency.arg.tag,
dependency.leftHeaded,
dependency.distance), count);
*/
expandDependency(dependency, count);
// System.err.println("stopCounter: " + stopCounter);
// System.err.println("argCounter: " + argCounter);
} | [
"public",
"void",
"addRule",
"(",
"IntDependency",
"dependency",
",",
"double",
"count",
")",
"{",
"if",
"(",
"!",
"directional",
")",
"{",
"dependency",
"=",
"new",
"IntDependency",
"(",
"dependency",
".",
"head",
",",
"dependency",
".",
"arg",
",",
"false",
",",
"dependency",
".",
"distance",
")",
";",
"}",
"if",
"(",
"verbose",
")",
"System",
".",
"err",
".",
"println",
"(",
"\"Adding dep \"",
"+",
"dependency",
")",
";",
"// coreDependencies.incrementCount(dependency, count);\r",
"/*new IntDependency(dependency.head.word,\r\n dependency.head.tag,\r\n dependency.arg.word,\r\n dependency.arg.tag,\r\n dependency.leftHeaded,\r\n dependency.distance), count);\r\n */",
"expandDependency",
"(",
"dependency",
",",
"count",
")",
";",
"// System.err.println(\"stopCounter: \" + stopCounter);\r",
"// System.err.println(\"argCounter: \" + argCounter);\r",
"}"
] | Add this dependency with the given count to the grammar.
This is the main entry point of MLEDependencyGrammarExtractor.
This is a dependency represented in the full tag space. | [
"Add",
"this",
"dependency",
"with",
"the",
"given",
"count",
"to",
"the",
"grammar",
".",
"This",
"is",
"the",
"main",
"entry",
"point",
"of",
"MLEDependencyGrammarExtractor",
".",
"This",
"is",
"a",
"dependency",
"represented",
"in",
"the",
"full",
"tag",
"space",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L343-L359 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.getCachedITW | private IntTaggedWord getCachedITW(short tag) {
// The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord).
if (tagITWList == null) {
tagITWList = new ArrayList<IntTaggedWord>(numTagBins + 2);
for (int i=0; i<numTagBins + 2; i++) {
tagITWList.add(i, null);
}
}
IntTaggedWord headT = tagITWList.get(tagBin(tag) + 2);
if (headT == null) {
headT = new IntTaggedWord(ANY_WORD_INT, tagBin(tag));
tagITWList.set(tagBin(tag) + 2, headT);
}
return headT;
} | java | private IntTaggedWord getCachedITW(short tag) {
// The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord).
if (tagITWList == null) {
tagITWList = new ArrayList<IntTaggedWord>(numTagBins + 2);
for (int i=0; i<numTagBins + 2; i++) {
tagITWList.add(i, null);
}
}
IntTaggedWord headT = tagITWList.get(tagBin(tag) + 2);
if (headT == null) {
headT = new IntTaggedWord(ANY_WORD_INT, tagBin(tag));
tagITWList.set(tagBin(tag) + 2, headT);
}
return headT;
} | [
"private",
"IntTaggedWord",
"getCachedITW",
"(",
"short",
"tag",
")",
"{",
"// The +2 below is because -1 and -2 are used with special meanings (see IntTaggedWord).\r",
"if",
"(",
"tagITWList",
"==",
"null",
")",
"{",
"tagITWList",
"=",
"new",
"ArrayList",
"<",
"IntTaggedWord",
">",
"(",
"numTagBins",
"+",
"2",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numTagBins",
"+",
"2",
";",
"i",
"++",
")",
"{",
"tagITWList",
".",
"add",
"(",
"i",
",",
"null",
")",
";",
"}",
"}",
"IntTaggedWord",
"headT",
"=",
"tagITWList",
".",
"get",
"(",
"tagBin",
"(",
"tag",
")",
"+",
"2",
")",
";",
"if",
"(",
"headT",
"==",
"null",
")",
"{",
"headT",
"=",
"new",
"IntTaggedWord",
"(",
"ANY_WORD_INT",
",",
"tagBin",
"(",
"tag",
")",
")",
";",
"tagITWList",
".",
"set",
"(",
"tagBin",
"(",
"tag",
")",
"+",
"2",
",",
"headT",
")",
";",
"}",
"return",
"headT",
";",
"}"
] | This maps from a tag to a cached IntTagWord that represents the
tag by having the wildcard word ANY_WORD_INT and the tag in the
reduced tag space.
The argument is in terms of the full tag space; internally this
function maps to the reduced space.
@param tag short representation of tag in full tag space
@return an IntTaggedWord in the reduced tag space | [
"This",
"maps",
"from",
"a",
"tag",
"to",
"a",
"cached",
"IntTagWord",
"that",
"represents",
"the",
"tag",
"by",
"having",
"the",
"wildcard",
"word",
"ANY_WORD_INT",
"and",
"the",
"tag",
"in",
"the",
"reduced",
"tag",
"space",
".",
"The",
"argument",
"is",
"in",
"terms",
"of",
"the",
"full",
"tag",
"space",
";",
"internally",
"this",
"function",
"maps",
"to",
"the",
"reduced",
"space",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L373-L387 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.expandDependency | protected void expandDependency(IntDependency dependency, double count) {
//if (Test.prunePunc && pruneTW(dependency.arg))
// return;
if (dependency.head == null || dependency.arg == null) {
return;
}
if (dependency.arg.word != STOP_WORD_INT) {
expandArg(dependency, valenceBin(dependency.distance), count);
}
expandStop(dependency, distanceBin(dependency.distance), count, true);
} | java | protected void expandDependency(IntDependency dependency, double count) {
//if (Test.prunePunc && pruneTW(dependency.arg))
// return;
if (dependency.head == null || dependency.arg == null) {
return;
}
if (dependency.arg.word != STOP_WORD_INT) {
expandArg(dependency, valenceBin(dependency.distance), count);
}
expandStop(dependency, distanceBin(dependency.distance), count, true);
} | [
"protected",
"void",
"expandDependency",
"(",
"IntDependency",
"dependency",
",",
"double",
"count",
")",
"{",
"//if (Test.prunePunc && pruneTW(dependency.arg))\r",
"// return;\r",
"if",
"(",
"dependency",
".",
"head",
"==",
"null",
"||",
"dependency",
".",
"arg",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"dependency",
".",
"arg",
".",
"word",
"!=",
"STOP_WORD_INT",
")",
"{",
"expandArg",
"(",
"dependency",
",",
"valenceBin",
"(",
"dependency",
".",
"distance",
")",
",",
"count",
")",
";",
"}",
"expandStop",
"(",
"dependency",
",",
"distanceBin",
"(",
"dependency",
".",
"distance",
")",
",",
"count",
",",
"true",
")",
";",
"}"
] | The dependency arg is still in the full tag space.
@param dependency An opbserved dependency
@param count The weight of the dependency | [
"The",
"dependency",
"arg",
"is",
"still",
"in",
"the",
"full",
"tag",
"space",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L394-L405 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.scoreTB | public double scoreTB(IntDependency dependency) {
return op.testOptions.depWeight * Math.log(probTB(dependency));
} | java | public double scoreTB(IntDependency dependency) {
return op.testOptions.depWeight * Math.log(probTB(dependency));
} | [
"public",
"double",
"scoreTB",
"(",
"IntDependency",
"dependency",
")",
"{",
"return",
"op",
".",
"testOptions",
".",
"depWeight",
"*",
"Math",
".",
"log",
"(",
"probTB",
"(",
"dependency",
")",
")",
";",
"}"
] | Score a tag binned dependency. | [
"Score",
"a",
"tag",
"binned",
"dependency",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L499-L501 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.readData | @Override
public void readData(BufferedReader in) throws IOException {
final String LEFT = "left";
int lineNum = 1;
// all lines have one rule per line
boolean doingStop = false;
for (String line = in.readLine(); line != null && line.length() > 0; line = in.readLine()) {
try {
if (line.equals("BEGIN_STOP")) {
doingStop = true;
continue;
}
String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash
// System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]);
short distance = (short)Integer.parseInt(fields[4]);
IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex);
IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex);
IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].equals(LEFT), distance);
double count = Double.parseDouble(fields[5]);
if (doingStop) {
expandStop(tempDependency, distance, count, false);
} else {
expandArg(tempDependency, distance, count);
}
} catch (Exception e) {
IOException ioe = new IOException("Error on line " + lineNum + ": " + line);
ioe.initCause(e);
throw ioe;
}
// System.out.println("read line " + lineNum + ": " + line);
lineNum++;
}
} | java | @Override
public void readData(BufferedReader in) throws IOException {
final String LEFT = "left";
int lineNum = 1;
// all lines have one rule per line
boolean doingStop = false;
for (String line = in.readLine(); line != null && line.length() > 0; line = in.readLine()) {
try {
if (line.equals("BEGIN_STOP")) {
doingStop = true;
continue;
}
String[] fields = StringUtils.splitOnCharWithQuoting(line, ' ', '\"', '\\'); // split on spaces, quote with doublequote, and escape with backslash
// System.out.println("fields:\n" + fields[0] + "\n" + fields[1] + "\n" + fields[2] + "\n" + fields[3] + "\n" + fields[4] + "\n" + fields[5]);
short distance = (short)Integer.parseInt(fields[4]);
IntTaggedWord tempHead = new IntTaggedWord(fields[0], '/', wordIndex, tagIndex);
IntTaggedWord tempArg = new IntTaggedWord(fields[2], '/', wordIndex, tagIndex);
IntDependency tempDependency = new IntDependency(tempHead, tempArg, fields[3].equals(LEFT), distance);
double count = Double.parseDouble(fields[5]);
if (doingStop) {
expandStop(tempDependency, distance, count, false);
} else {
expandArg(tempDependency, distance, count);
}
} catch (Exception e) {
IOException ioe = new IOException("Error on line " + lineNum + ": " + line);
ioe.initCause(e);
throw ioe;
}
// System.out.println("read line " + lineNum + ": " + line);
lineNum++;
}
} | [
"@",
"Override",
"public",
"void",
"readData",
"(",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"final",
"String",
"LEFT",
"=",
"\"left\"",
";",
"int",
"lineNum",
"=",
"1",
";",
"// all lines have one rule per line\r",
"boolean",
"doingStop",
"=",
"false",
";",
"for",
"(",
"String",
"line",
"=",
"in",
".",
"readLine",
"(",
")",
";",
"line",
"!=",
"null",
"&&",
"line",
".",
"length",
"(",
")",
">",
"0",
";",
"line",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"{",
"try",
"{",
"if",
"(",
"line",
".",
"equals",
"(",
"\"BEGIN_STOP\"",
")",
")",
"{",
"doingStop",
"=",
"true",
";",
"continue",
";",
"}",
"String",
"[",
"]",
"fields",
"=",
"StringUtils",
".",
"splitOnCharWithQuoting",
"(",
"line",
",",
"'",
"'",
",",
"'",
"'",
",",
"'",
"'",
")",
";",
"// split on spaces, quote with doublequote, and escape with backslash\r",
"// System.out.println(\"fields:\\n\" + fields[0] + \"\\n\" + fields[1] + \"\\n\" + fields[2] + \"\\n\" + fields[3] + \"\\n\" + fields[4] + \"\\n\" + fields[5]);\r",
"short",
"distance",
"=",
"(",
"short",
")",
"Integer",
".",
"parseInt",
"(",
"fields",
"[",
"4",
"]",
")",
";",
"IntTaggedWord",
"tempHead",
"=",
"new",
"IntTaggedWord",
"(",
"fields",
"[",
"0",
"]",
",",
"'",
"'",
",",
"wordIndex",
",",
"tagIndex",
")",
";",
"IntTaggedWord",
"tempArg",
"=",
"new",
"IntTaggedWord",
"(",
"fields",
"[",
"2",
"]",
",",
"'",
"'",
",",
"wordIndex",
",",
"tagIndex",
")",
";",
"IntDependency",
"tempDependency",
"=",
"new",
"IntDependency",
"(",
"tempHead",
",",
"tempArg",
",",
"fields",
"[",
"3",
"]",
".",
"equals",
"(",
"LEFT",
")",
",",
"distance",
")",
";",
"double",
"count",
"=",
"Double",
".",
"parseDouble",
"(",
"fields",
"[",
"5",
"]",
")",
";",
"if",
"(",
"doingStop",
")",
"{",
"expandStop",
"(",
"tempDependency",
",",
"distance",
",",
"count",
",",
"false",
")",
";",
"}",
"else",
"{",
"expandArg",
"(",
"tempDependency",
",",
"distance",
",",
"count",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"IOException",
"ioe",
"=",
"new",
"IOException",
"(",
"\"Error on line \"",
"+",
"lineNum",
"+",
"\": \"",
"+",
"line",
")",
";",
"ioe",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"ioe",
";",
"}",
"// System.out.println(\"read line \" + lineNum + \": \" + line);\r",
"lineNum",
"++",
";",
"}",
"}"
] | Populates data in this DependencyGrammar from the character stream
given by the Reader r. | [
"Populates",
"data",
"in",
"this",
"DependencyGrammar",
"from",
"the",
"character",
"stream",
"given",
"by",
"the",
"Reader",
"r",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L804-L840 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java | MLEDependencyGrammar.writeData | @Override
public void writeData(PrintWriter out) throws IOException {
// all lines have one rule per line
for (IntDependency dependency : argCounter.keySet()) {
if (dependency.head != wildTW && dependency.arg != wildTW &&
dependency.head.word != -1 && dependency.arg.word != -1) {
double count = argCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.println("BEGIN_STOP");
for (IntDependency dependency : stopCounter.keySet()) {
if (dependency.head.word != -1) {
double count = stopCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.flush();
} | java | @Override
public void writeData(PrintWriter out) throws IOException {
// all lines have one rule per line
for (IntDependency dependency : argCounter.keySet()) {
if (dependency.head != wildTW && dependency.arg != wildTW &&
dependency.head.word != -1 && dependency.arg.word != -1) {
double count = argCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.println("BEGIN_STOP");
for (IntDependency dependency : stopCounter.keySet()) {
if (dependency.head.word != -1) {
double count = stopCounter.getCount(dependency);
out.println(dependency.toString(wordIndex, tagIndex) + " " + count);
}
}
out.flush();
} | [
"@",
"Override",
"public",
"void",
"writeData",
"(",
"PrintWriter",
"out",
")",
"throws",
"IOException",
"{",
"// all lines have one rule per line\r",
"for",
"(",
"IntDependency",
"dependency",
":",
"argCounter",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"dependency",
".",
"head",
"!=",
"wildTW",
"&&",
"dependency",
".",
"arg",
"!=",
"wildTW",
"&&",
"dependency",
".",
"head",
".",
"word",
"!=",
"-",
"1",
"&&",
"dependency",
".",
"arg",
".",
"word",
"!=",
"-",
"1",
")",
"{",
"double",
"count",
"=",
"argCounter",
".",
"getCount",
"(",
"dependency",
")",
";",
"out",
".",
"println",
"(",
"dependency",
".",
"toString",
"(",
"wordIndex",
",",
"tagIndex",
")",
"+",
"\" \"",
"+",
"count",
")",
";",
"}",
"}",
"out",
".",
"println",
"(",
"\"BEGIN_STOP\"",
")",
";",
"for",
"(",
"IntDependency",
"dependency",
":",
"stopCounter",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"dependency",
".",
"head",
".",
"word",
"!=",
"-",
"1",
")",
"{",
"double",
"count",
"=",
"stopCounter",
".",
"getCount",
"(",
"dependency",
")",
";",
"out",
".",
"println",
"(",
"dependency",
".",
"toString",
"(",
"wordIndex",
",",
"tagIndex",
")",
"+",
"\" \"",
"+",
"count",
")",
";",
"}",
"}",
"out",
".",
"flush",
"(",
")",
";",
"}"
] | Writes out data from this Object to the Writer w. | [
"Writes",
"out",
"data",
"from",
"this",
"Object",
"to",
"the",
"Writer",
"w",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/parser/lexparser/MLEDependencyGrammar.java#L845-L867 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.add | public static base_response add(nitro_service client, vpnintranetapplication resource) throws Exception {
vpnintranetapplication addresource = new vpnintranetapplication();
addresource.intranetapplication = resource.intranetapplication;
addresource.protocol = resource.protocol;
addresource.destip = resource.destip;
addresource.netmask = resource.netmask;
addresource.iprange = resource.iprange;
addresource.hostname = resource.hostname;
addresource.clientapplication = resource.clientapplication;
addresource.spoofiip = resource.spoofiip;
addresource.destport = resource.destport;
addresource.interception = resource.interception;
addresource.srcip = resource.srcip;
addresource.srcport = resource.srcport;
return addresource.add_resource(client);
} | java | public static base_response add(nitro_service client, vpnintranetapplication resource) throws Exception {
vpnintranetapplication addresource = new vpnintranetapplication();
addresource.intranetapplication = resource.intranetapplication;
addresource.protocol = resource.protocol;
addresource.destip = resource.destip;
addresource.netmask = resource.netmask;
addresource.iprange = resource.iprange;
addresource.hostname = resource.hostname;
addresource.clientapplication = resource.clientapplication;
addresource.spoofiip = resource.spoofiip;
addresource.destport = resource.destport;
addresource.interception = resource.interception;
addresource.srcip = resource.srcip;
addresource.srcport = resource.srcport;
return addresource.add_resource(client);
} | [
"public",
"static",
"base_response",
"add",
"(",
"nitro_service",
"client",
",",
"vpnintranetapplication",
"resource",
")",
"throws",
"Exception",
"{",
"vpnintranetapplication",
"addresource",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"addresource",
".",
"intranetapplication",
"=",
"resource",
".",
"intranetapplication",
";",
"addresource",
".",
"protocol",
"=",
"resource",
".",
"protocol",
";",
"addresource",
".",
"destip",
"=",
"resource",
".",
"destip",
";",
"addresource",
".",
"netmask",
"=",
"resource",
".",
"netmask",
";",
"addresource",
".",
"iprange",
"=",
"resource",
".",
"iprange",
";",
"addresource",
".",
"hostname",
"=",
"resource",
".",
"hostname",
";",
"addresource",
".",
"clientapplication",
"=",
"resource",
".",
"clientapplication",
";",
"addresource",
".",
"spoofiip",
"=",
"resource",
".",
"spoofiip",
";",
"addresource",
".",
"destport",
"=",
"resource",
".",
"destport",
";",
"addresource",
".",
"interception",
"=",
"resource",
".",
"interception",
";",
"addresource",
".",
"srcip",
"=",
"resource",
".",
"srcip",
";",
"addresource",
".",
"srcport",
"=",
"resource",
".",
"srcport",
";",
"return",
"addresource",
".",
"add_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to add vpnintranetapplication. | [
"Use",
"this",
"API",
"to",
"add",
"vpnintranetapplication",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L324-L339 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.add | public static base_responses add(nitro_service client, vpnintranetapplication resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnintranetapplication addresources[] = new vpnintranetapplication[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new vpnintranetapplication();
addresources[i].intranetapplication = resources[i].intranetapplication;
addresources[i].protocol = resources[i].protocol;
addresources[i].destip = resources[i].destip;
addresources[i].netmask = resources[i].netmask;
addresources[i].iprange = resources[i].iprange;
addresources[i].hostname = resources[i].hostname;
addresources[i].clientapplication = resources[i].clientapplication;
addresources[i].spoofiip = resources[i].spoofiip;
addresources[i].destport = resources[i].destport;
addresources[i].interception = resources[i].interception;
addresources[i].srcip = resources[i].srcip;
addresources[i].srcport = resources[i].srcport;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | public static base_responses add(nitro_service client, vpnintranetapplication resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
vpnintranetapplication addresources[] = new vpnintranetapplication[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new vpnintranetapplication();
addresources[i].intranetapplication = resources[i].intranetapplication;
addresources[i].protocol = resources[i].protocol;
addresources[i].destip = resources[i].destip;
addresources[i].netmask = resources[i].netmask;
addresources[i].iprange = resources[i].iprange;
addresources[i].hostname = resources[i].hostname;
addresources[i].clientapplication = resources[i].clientapplication;
addresources[i].spoofiip = resources[i].spoofiip;
addresources[i].destport = resources[i].destport;
addresources[i].interception = resources[i].interception;
addresources[i].srcip = resources[i].srcip;
addresources[i].srcport = resources[i].srcport;
}
result = add_bulk_request(client, addresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"add",
"(",
"nitro_service",
"client",
",",
"vpnintranetapplication",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"vpnintranetapplication",
"addresources",
"[",
"]",
"=",
"new",
"vpnintranetapplication",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"addresources",
"[",
"i",
"]",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"addresources",
"[",
"i",
"]",
".",
"intranetapplication",
"=",
"resources",
"[",
"i",
"]",
".",
"intranetapplication",
";",
"addresources",
"[",
"i",
"]",
".",
"protocol",
"=",
"resources",
"[",
"i",
"]",
".",
"protocol",
";",
"addresources",
"[",
"i",
"]",
".",
"destip",
"=",
"resources",
"[",
"i",
"]",
".",
"destip",
";",
"addresources",
"[",
"i",
"]",
".",
"netmask",
"=",
"resources",
"[",
"i",
"]",
".",
"netmask",
";",
"addresources",
"[",
"i",
"]",
".",
"iprange",
"=",
"resources",
"[",
"i",
"]",
".",
"iprange",
";",
"addresources",
"[",
"i",
"]",
".",
"hostname",
"=",
"resources",
"[",
"i",
"]",
".",
"hostname",
";",
"addresources",
"[",
"i",
"]",
".",
"clientapplication",
"=",
"resources",
"[",
"i",
"]",
".",
"clientapplication",
";",
"addresources",
"[",
"i",
"]",
".",
"spoofiip",
"=",
"resources",
"[",
"i",
"]",
".",
"spoofiip",
";",
"addresources",
"[",
"i",
"]",
".",
"destport",
"=",
"resources",
"[",
"i",
"]",
".",
"destport",
";",
"addresources",
"[",
"i",
"]",
".",
"interception",
"=",
"resources",
"[",
"i",
"]",
".",
"interception",
";",
"addresources",
"[",
"i",
"]",
".",
"srcip",
"=",
"resources",
"[",
"i",
"]",
".",
"srcip",
";",
"addresources",
"[",
"i",
"]",
".",
"srcport",
"=",
"resources",
"[",
"i",
"]",
".",
"srcport",
";",
"}",
"result",
"=",
"add_bulk_request",
"(",
"client",
",",
"addresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to add vpnintranetapplication resources. | [
"Use",
"this",
"API",
"to",
"add",
"vpnintranetapplication",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L344-L366 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.delete | public static base_response delete(nitro_service client, String intranetapplication) throws Exception {
vpnintranetapplication deleteresource = new vpnintranetapplication();
deleteresource.intranetapplication = intranetapplication;
return deleteresource.delete_resource(client);
} | java | public static base_response delete(nitro_service client, String intranetapplication) throws Exception {
vpnintranetapplication deleteresource = new vpnintranetapplication();
deleteresource.intranetapplication = intranetapplication;
return deleteresource.delete_resource(client);
} | [
"public",
"static",
"base_response",
"delete",
"(",
"nitro_service",
"client",
",",
"String",
"intranetapplication",
")",
"throws",
"Exception",
"{",
"vpnintranetapplication",
"deleteresource",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"deleteresource",
".",
"intranetapplication",
"=",
"intranetapplication",
";",
"return",
"deleteresource",
".",
"delete_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to delete vpnintranetapplication of given name. | [
"Use",
"this",
"API",
"to",
"delete",
"vpnintranetapplication",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L371-L375 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.get | public static vpnintranetapplication[] get(nitro_service service) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
vpnintranetapplication[] response = (vpnintranetapplication[])obj.get_resources(service);
return response;
} | java | public static vpnintranetapplication[] get(nitro_service service) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
vpnintranetapplication[] response = (vpnintranetapplication[])obj.get_resources(service);
return response;
} | [
"public",
"static",
"vpnintranetapplication",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"vpnintranetapplication",
"obj",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"vpnintranetapplication",
"[",
"]",
"response",
"=",
"(",
"vpnintranetapplication",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch all the vpnintranetapplication resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"vpnintranetapplication",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L421-L425 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.get | public static vpnintranetapplication get(nitro_service service, String intranetapplication) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
obj.set_intranetapplication(intranetapplication);
vpnintranetapplication response = (vpnintranetapplication) obj.get_resource(service);
return response;
} | java | public static vpnintranetapplication get(nitro_service service, String intranetapplication) throws Exception{
vpnintranetapplication obj = new vpnintranetapplication();
obj.set_intranetapplication(intranetapplication);
vpnintranetapplication response = (vpnintranetapplication) obj.get_resource(service);
return response;
} | [
"public",
"static",
"vpnintranetapplication",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"intranetapplication",
")",
"throws",
"Exception",
"{",
"vpnintranetapplication",
"obj",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"obj",
".",
"set_intranetapplication",
"(",
"intranetapplication",
")",
";",
"vpnintranetapplication",
"response",
"=",
"(",
"vpnintranetapplication",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vpnintranetapplication resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnintranetapplication",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L437-L442 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java | vpnintranetapplication.get | public static vpnintranetapplication[] get(nitro_service service, String intranetapplication[]) throws Exception{
if (intranetapplication !=null && intranetapplication.length>0) {
vpnintranetapplication response[] = new vpnintranetapplication[intranetapplication.length];
vpnintranetapplication obj[] = new vpnintranetapplication[intranetapplication.length];
for (int i=0;i<intranetapplication.length;i++) {
obj[i] = new vpnintranetapplication();
obj[i].set_intranetapplication(intranetapplication[i]);
response[i] = (vpnintranetapplication) obj[i].get_resource(service);
}
return response;
}
return null;
} | java | public static vpnintranetapplication[] get(nitro_service service, String intranetapplication[]) throws Exception{
if (intranetapplication !=null && intranetapplication.length>0) {
vpnintranetapplication response[] = new vpnintranetapplication[intranetapplication.length];
vpnintranetapplication obj[] = new vpnintranetapplication[intranetapplication.length];
for (int i=0;i<intranetapplication.length;i++) {
obj[i] = new vpnintranetapplication();
obj[i].set_intranetapplication(intranetapplication[i]);
response[i] = (vpnintranetapplication) obj[i].get_resource(service);
}
return response;
}
return null;
} | [
"public",
"static",
"vpnintranetapplication",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"intranetapplication",
"[",
"]",
")",
"throws",
"Exception",
"{",
"if",
"(",
"intranetapplication",
"!=",
"null",
"&&",
"intranetapplication",
".",
"length",
">",
"0",
")",
"{",
"vpnintranetapplication",
"response",
"[",
"]",
"=",
"new",
"vpnintranetapplication",
"[",
"intranetapplication",
".",
"length",
"]",
";",
"vpnintranetapplication",
"obj",
"[",
"]",
"=",
"new",
"vpnintranetapplication",
"[",
"intranetapplication",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intranetapplication",
".",
"length",
";",
"i",
"++",
")",
"{",
"obj",
"[",
"i",
"]",
"=",
"new",
"vpnintranetapplication",
"(",
")",
";",
"obj",
"[",
"i",
"]",
".",
"set_intranetapplication",
"(",
"intranetapplication",
"[",
"i",
"]",
")",
";",
"response",
"[",
"i",
"]",
"=",
"(",
"vpnintranetapplication",
")",
"obj",
"[",
"i",
"]",
".",
"get_resource",
"(",
"service",
")",
";",
"}",
"return",
"response",
";",
"}",
"return",
"null",
";",
"}"
] | Use this API to fetch vpnintranetapplication resources of given names . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpnintranetapplication",
"resources",
"of",
"given",
"names",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnintranetapplication.java#L447-L459 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicy_sslvserver_binding.java | sslpolicy_sslvserver_binding.get | public static sslpolicy_sslvserver_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_sslvserver_binding obj = new sslpolicy_sslvserver_binding();
obj.set_name(name);
sslpolicy_sslvserver_binding response[] = (sslpolicy_sslvserver_binding[]) obj.get_resources(service);
return response;
} | java | public static sslpolicy_sslvserver_binding[] get(nitro_service service, String name) throws Exception{
sslpolicy_sslvserver_binding obj = new sslpolicy_sslvserver_binding();
obj.set_name(name);
sslpolicy_sslvserver_binding response[] = (sslpolicy_sslvserver_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"sslpolicy_sslvserver_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"sslpolicy_sslvserver_binding",
"obj",
"=",
"new",
"sslpolicy_sslvserver_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"sslpolicy_sslvserver_binding",
"response",
"[",
"]",
"=",
"(",
"sslpolicy_sslvserver_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch sslpolicy_sslvserver_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslpolicy_sslvserver_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicy_sslvserver_binding.java#L162-L167 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmsessionpolicy_tmglobal_binding.java | tmsessionpolicy_tmglobal_binding.get | public static tmsessionpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{
tmsessionpolicy_tmglobal_binding obj = new tmsessionpolicy_tmglobal_binding();
obj.set_name(name);
tmsessionpolicy_tmglobal_binding response[] = (tmsessionpolicy_tmglobal_binding[]) obj.get_resources(service);
return response;
} | java | public static tmsessionpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{
tmsessionpolicy_tmglobal_binding obj = new tmsessionpolicy_tmglobal_binding();
obj.set_name(name);
tmsessionpolicy_tmglobal_binding response[] = (tmsessionpolicy_tmglobal_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"tmsessionpolicy_tmglobal_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"tmsessionpolicy_tmglobal_binding",
"obj",
"=",
"new",
"tmsessionpolicy_tmglobal_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"tmsessionpolicy_tmglobal_binding",
"response",
"[",
"]",
"=",
"(",
"tmsessionpolicy_tmglobal_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch tmsessionpolicy_tmglobal_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"tmsessionpolicy_tmglobal_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tm/tmsessionpolicy_tmglobal_binding.java#L132-L137 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsweblogparam.java | nsweblogparam.update | public static base_response update(nitro_service client, nsweblogparam resource) throws Exception {
nsweblogparam updateresource = new nsweblogparam();
updateresource.buffersizemb = resource.buffersizemb;
updateresource.customreqhdrs = resource.customreqhdrs;
updateresource.customrsphdrs = resource.customrsphdrs;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsweblogparam resource) throws Exception {
nsweblogparam updateresource = new nsweblogparam();
updateresource.buffersizemb = resource.buffersizemb;
updateresource.customreqhdrs = resource.customreqhdrs;
updateresource.customrsphdrs = resource.customrsphdrs;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsweblogparam",
"resource",
")",
"throws",
"Exception",
"{",
"nsweblogparam",
"updateresource",
"=",
"new",
"nsweblogparam",
"(",
")",
";",
"updateresource",
".",
"buffersizemb",
"=",
"resource",
".",
"buffersizemb",
";",
"updateresource",
".",
"customreqhdrs",
"=",
"resource",
".",
"customreqhdrs",
";",
"updateresource",
".",
"customrsphdrs",
"=",
"resource",
".",
"customrsphdrs",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update nsweblogparam. | [
"Use",
"this",
"API",
"to",
"update",
"nsweblogparam",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsweblogparam.java#L141-L147 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsweblogparam.java | nsweblogparam.unset | public static base_response unset(nitro_service client, nsweblogparam resource, String[] args) throws Exception{
nsweblogparam unsetresource = new nsweblogparam();
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, nsweblogparam resource, String[] args) throws Exception{
nsweblogparam unsetresource = new nsweblogparam();
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"nsweblogparam",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"nsweblogparam",
"unsetresource",
"=",
"new",
"nsweblogparam",
"(",
")",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of nsweblogparam resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"nsweblogparam",
"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/ns/nsweblogparam.java#L153-L156 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsweblogparam.java | nsweblogparam.get | public static nsweblogparam get(nitro_service service, options option) throws Exception{
nsweblogparam obj = new nsweblogparam();
nsweblogparam[] response = (nsweblogparam[])obj.get_resources(service,option);
return response[0];
} | java | public static nsweblogparam get(nitro_service service, options option) throws Exception{
nsweblogparam obj = new nsweblogparam();
nsweblogparam[] response = (nsweblogparam[])obj.get_resources(service,option);
return response[0];
} | [
"public",
"static",
"nsweblogparam",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"nsweblogparam",
"obj",
"=",
"new",
"nsweblogparam",
"(",
")",
";",
"nsweblogparam",
"[",
"]",
"response",
"=",
"(",
"nsweblogparam",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
",",
"option",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the nsweblogparam resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsweblogparam",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsweblogparam.java#L170-L174 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslicense.java | nslicense.get | public static nslicense get(nitro_service service) throws Exception{
nslicense obj = new nslicense();
nslicense[] response = (nslicense[])obj.get_resources(service);
return response[0];
} | java | public static nslicense get(nitro_service service) throws Exception{
nslicense obj = new nslicense();
nslicense[] response = (nslicense[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"nslicense",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nslicense",
"obj",
"=",
"new",
"nslicense",
"(",
")",
";",
"nslicense",
"[",
"]",
"response",
"=",
"(",
"nslicense",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the nslicense resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nslicense",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslicense.java#L540-L544 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/network/ipset_binding.java | ipset_binding.get | public static ipset_binding get(nitro_service service, String name) throws Exception{
ipset_binding obj = new ipset_binding();
obj.set_name(name);
ipset_binding response = (ipset_binding) obj.get_resource(service);
return response;
} | java | public static ipset_binding get(nitro_service service, String name) throws Exception{
ipset_binding obj = new ipset_binding();
obj.set_name(name);
ipset_binding response = (ipset_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"ipset_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"ipset_binding",
"obj",
"=",
"new",
"ipset_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"ipset_binding",
"response",
"=",
"(",
"ipset_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch ipset_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"ipset_binding",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/network/ipset_binding.java#L114-L119 | train |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/AbstractLongList.java | AbstractLongList.elements | public long[] elements() {
long[] myElements = new long[size];
for (int i=size; --i >= 0; ) myElements[i]=getQuick(i);
return myElements;
}
/**
* Sets the receiver's elements to be the specified array.
* The size and capacity of the list is the length of the array.
* <b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>.
* So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.
*
* @param elements the new elements to be stored.
* @return the receiver itself.
*/
public AbstractLongList elements(long[] elements) {
clear();
addAllOfFromTo(new LongArrayList(elements),0,elements.length-1);
return this;
}
/**
* Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.
* If necessary, allocates new internal memory and increases the capacity of the receiver.
*
* @param minCapacity the desired minimum capacity.
*/
public abstract void ensureCapacity(int minCapacity);
/**
* Compares the specified Object with the receiver.
* Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the
* same size, and all corresponding pairs of elements in the two Lists are identical.
* In other words, two Lists are defined to be equal if they contain the
* same elements in the same order.
*
* @param otherObj the Object to be compared for equality with the receiver.
* @return true if the specified Object is equal to the receiver.
*/
public boolean equals(Object otherObj) { //delta
if (! (otherObj instanceof AbstractLongList)) {return false;}
if (this==otherObj) return true;
if (otherObj==null) return false;
AbstractLongList other = (AbstractLongList) otherObj;
if (size()!=other.size()) return false;
for (int i=size(); --i >= 0; ) {
if (getQuick(i) != other.getQuick(i)) return false;
}
return true;
}
/**
* Sets the specified range of elements in the specified array to the specified value.
*
* @param from the index of the first element (inclusive) to be filled with the specified value.
* @param to the index of the last element (inclusive) to be filled with the specified value.
* @param val the value to be stored in the specified elements of the receiver.
*/
public void fillFromToWith(int from, int to, long val) {
checkRangeFromTo(from,to,this.size);
for (int i=from; i<=to;) setQuick(i++,val);
}
/**
* Applies a procedure to each element of the receiver, if any.
* Starts at index 0, moving rightwards.
* @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
public boolean forEach(LongProcedure procedure) {
for (int i=0; i<size;) if (! procedure.apply(get(i++))) return false;
return true;
}
/**
* Returns the element at the specified position in the receiver.
*
* @param index index of element to return.
* @exception IndexOutOfBoundsException index is out of range (index
* < 0 || index >= size()).
*/
public long get(int index) {
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
return getQuick(index);
}
/**
* Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions.
* Provided with invalid parameters this method may return invalid elements without throwing any exception!
* <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
* Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.
*
* This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.
* However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.
*
* @param index index of element to return.
*/
protected abstract long getQuick(int index);
/**
* Returns the index of the first occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
*
* @param element the element to be searched for.
* @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
*/
public int indexOf(long element) { //delta
return indexOfFromTo(element, 0, size-1);
}
/**
* Returns the index of the first occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
* Searches between <code>from</code>, inclusive and <code>to</code>, inclusive.
* Tests for identity.
*
* @param element element to search for.
* @param from the leftmost search position, inclusive.
* @param to the rightmost search position, inclusive.
* @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public int indexOfFromTo(long element, int from, int to) {
checkRangeFromTo(from, to, size);
for (int i = from ; i <= to; i++) {
if (element==getQuick(i)) return i; //found
}
return -1; //not found
}
/**
* Returns the index of the last occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
*
* @param element the element to be searched for.
* @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
*/
public int lastIndexOf(long element) {
return lastIndexOfFromTo(element, 0, size-1);
}
/**
* Returns the index of the last occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
* Searches beginning at <code>to</code>, inclusive until <code>from</code>, inclusive.
* Tests for identity.
*
* @param element element to search for.
* @param from the leftmost search position, inclusive.
* @param to the rightmost search position, inclusive.
* @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public int lastIndexOfFromTo(long element, int from, int to) {
checkRangeFromTo(from, to, size());
for (int i = to ; i >= from; i--) {
if (element==getQuick(i)) return i; //found
}
return -1; //not found
}
/**
* Sorts the specified range of the receiver into ascending order.
*
* The sorting algorithm is a modified mergesort (in which the merge is
* omitted if the highest element in the low sublist is less than the
* lowest element in the high sublist). This algorithm offers guaranteed
* n*log(n) performance, and can approach linear performance on nearly
* sorted lists.
*
* <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
* It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
*
* @param from the index of the first element (inclusive) to be sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void mergeSortFromTo(int from, int to) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Sorts the receiver according
* to the order induced by the specified comparator. All elements in the
* range must be <i>mutually comparable</i> by the specified comparator
* (that is, <tt>c.compare(e1, e2)</tt> must not throw a
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
* <tt>e2</tt> in the range).<p>
*
* This sort is guaranteed to be <i>stable</i>: equal elements will
* not be reordered as a result of the sort.<p>
*
* The sorting algorithm is a modified mergesort (in which the merge is
* omitted if the highest element in the low sublist is less than the
* lowest element in the high sublist). This algorithm offers guaranteed
* n*log(n) performance, and can approach linear performance on nearly
* sorted lists.
*
* @param from the index of the first element (inclusive) to be
* sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @param c the comparator to determine the order of the receiver.
* @throws ClassCastException if the array contains elements that are not
* <i>mutually comparable</i> using the specified comparator.
* @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
* @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
* <tt>toIndex > a.length</tt>
* @see Comparator
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void mergeSortFromTo(int from, int to, LongComparator c) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.
* @param from the index of the first element (inclusive).
* @param to the index of the last element (inclusive).
* @return a new list
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public AbstractLongList partFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int length = to-from+1;
LongArrayList part = new LongArrayList(length);
part.addAllOfFromTo(this,from,to);
return part;
}
/**
* Sorts the specified range of the receiver into
* ascending numerical order. The sorting algorithm is a tuned quicksort,
* adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a
* Sort Function", Software-Practice and Experience, Vol. 23(11)
* P. 1249-1265 (November 1993). This algorithm offers n*log(n)
* performance on many data sets that cause other quicksorts to degrade to
* quadratic performance.
*
* <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
* It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
*
* @param from the index of the first element (inclusive) to be sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void quickSortFromTo(int from, int to) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Sorts the receiver according
* to the order induced by the specified comparator. All elements in the
* range must be <i>mutually comparable</i> by the specified comparator
* (that is, <tt>c.compare(e1, e2)</tt> must not throw a
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
* <tt>e2</tt> in the range).<p>
*
* The sorting algorithm is a tuned quicksort,
* adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a
* Sort Function", Software-Practice and Experience, Vol. 23(11)
* P. 1249-1265 (November 1993). This algorithm offers n*log(n)
* performance on many data sets that cause other quicksorts to degrade to
* quadratic performance.
*
* @param from the index of the first element (inclusive) to be
* sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @param c the comparator to determine the order of the receiver.
* @throws ClassCastException if the array contains elements that are not
* <i>mutually comparable</i> using the specified comparator.
* @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
* @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
* <tt>toIndex > a.length</tt>
* @see Comparator
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void quickSortFromTo(int from, int to, LongComparator c) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Removes from the receiver all elements that are contained in the specified list.
* Tests for identity.
*
* @param other the other list.
* @return <code>true</code> if the receiver changed as a result of the call.
*/
public boolean removeAll(AbstractLongList other) {
if (other.size()==0) return false; //nothing to do
int limit = other.size()-1;
int j=0;
for (int i=0; i<size ; i++) {
if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++,getQuick(i));
}
boolean modified = (j!=size);
setSize(j);
return modified;
}
/**
* Removes from the receiver all elements whose index is between
* <code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding
* elements to the left (reduces their index).
* This call shortens the list by <tt>(to - from + 1)</tt> elements.
*
* @param from index of first element to be removed.
* @param to index of last element to be removed.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved > 0) {
replaceFromToWithFrom(from, from-1+numMoved, this, to+1);
//fillFromToWith(from+numMoved, size-1, 0.0f); //delta
}
int width = to-from+1;
if (width>0) setSizeRaw(size-width);
}
/**
* Replaces a number of elements in the receiver with the same number of elements of another list.
* Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive),
* with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive).
*
* @param from the position of the first element to be replaced in the receiver
* @param to the position of the last element to be replaced in the receiver
* @param other list holding elements to be copied into the receiver.
* @param otherFrom position of first element within other list to be copied.
*/
public void replaceFromToWithFrom(int from, int to, AbstractLongList other, int otherFrom) {
int length=to-from+1;
if (length>0) {
checkRangeFromTo(from, to, size());
checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
// unambiguous copy (it may hold other==this)
if (from<=otherFrom) {
for (; --length >= 0; ) setQuick(from++,other.getQuick(otherFrom++));
}
else {
int otherTo = otherFrom+length-1;
for (; --length >= 0; ) setQuick(to--,other.getQuick(otherTo--));
}
}
}
/**
* Replaces the part between <code>from</code> (inclusive) and <code>to</code> (inclusive) with the other list's
* part between <code>otherFrom</code> and <code>otherTo</code>.
* Powerful (and tricky) method!
* Both parts need not be of the same size (part A can both be smaller or larger than part B).
* Parts may overlap.
* Receiver and other list may (but most not) be identical.
* If <code>from > to</code>, then inserts other part before <code>from</code>.
*
* @param from the first element of the receiver (inclusive)
* @param to the last element of the receiver (inclusive)
* @param other the other list (may be identical with receiver)
* @param otherFrom the first element of the other list (inclusive)
* @param otherTo the last element of the other list (inclusive)
*
* <p><b>Examples:</b><pre>
* a=[0, 1, 2, 3, 4, 5, 6, 7]
* b=[50, 60, 70, 80, 90]
* a.R(...)=a.replaceFromToWithFromTo(...)
*
* a.R(3,5,b,0,4)-->[0, 1, 2, 50, 60, 70, 80, 90, 6, 7]
* a.R(1,6,b,0,4)-->[0, 50, 60, 70, 80, 90, 7]
* a.R(0,6,b,0,4)-->[50, 60, 70, 80, 90, 7]
* a.R(3,5,b,1,2)-->[0, 1, 2, 60, 70, 6, 7]
* a.R(1,6,b,1,2)-->[0, 60, 70, 7]
* a.R(0,6,b,1,2)-->[60, 70, 7]
* a.R(5,3,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]
* a.R(5,0,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]
* a.R(5,3,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]
* a.R(5,0,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]
*
* Extreme cases:
* a.R(5,3,b,0,0)-->[0, 1, 2, 3, 4, 50, 5, 6, 7]
* a.R(5,3,b,4,4)-->[0, 1, 2, 3, 4, 90, 5, 6, 7]
* a.R(3,5,a,0,1)-->[0, 1, 2, 0, 1, 6, 7]
* a.R(3,5,a,3,5)-->[0, 1, 2, 3, 4, 5, 6, 7]
* a.R(3,5,a,4,4)-->[0, 1, 2, 4, 6, 7]
* a.R(5,3,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(0,-1,b,0,4)-->[50, 60, 70, 80, 90, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(0,-1,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(8,0,a,0,4)-->[0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4]
* </pre>
*/
public void replaceFromToWithFromTo(int from, int to, AbstractLongList other, int otherFrom, int otherTo) {
if (otherFrom>otherTo) {
throw new IndexOutOfBoundsException("otherFrom: "+otherFrom+", otherTo: "+otherTo);
}
if (this==other && to-from!=otherTo-otherFrom) { // avoid stumbling over my own feet
replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom);
return;
}
int length=otherTo-otherFrom+1;
int diff=length;
int theLast=from-1;
if (to>=from) {
diff -= (to-from+1);
theLast=to;
}
if (diff>0) {
beforeInsertDummies(theLast+1, diff);
}
else {
if (diff<0) {
removeFromTo(theLast+diff, theLast-1);
}
}
if (length>0) {
replaceFromToWithFrom(from,from+length-1,other,otherFrom);
}
}
/**
* Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection.
* Does not alter the size of the receiver.
* Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements.
*
* @param from the index at which to copy the first element from the specified collection.
* @param other Collection to replace part of the receiver
* @exception IndexOutOfBoundsException index is out of range (index < 0 || index >= size()).
*/
public void replaceFromWith(int from, java.util.Collection other) {
checkRange(from,size());
java.util.Iterator e = other.iterator();
int index=from;
int limit = Math.min(size()-from, other.size());
for (int i=0; i<limit; i++)
set(index++,((Number) e.next()).longValue()); //delta
}
/**
* Retains (keeps) only the elements in the receiver that are contained in the specified other list.
* In other words, removes from the receiver all of its elements that are not contained in the
* specified other list.
* @param other the other list to test against.
* @return <code>true</code> if the receiver changed as a result of the call.
*/
public boolean retainAll(AbstractLongList other) {
if (other.size()==0) {
if (size==0) return false;
setSize(0);
return true;
}
int limit = other.size()-1;
int j=0;
for (int i=0; i<size ; i++) {
if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i));
}
boolean modified = (j!=size);
setSize(j);
return modified;
}
/**
* Reverses the elements of the receiver.
* Last becomes first, second last becomes second first, and so on.
*/
public void reverse() {
long tmp;
int limit=size()/2;
int j=size()-1;
for (int i=0; i<limit;) { //swap
tmp=getQuick(i);
setQuick(i++,getQuick(j));
setQuick(j--,tmp);
}
}
/**
* Replaces the element at the specified position in the receiver with the specified element.
*
* @param index index of element to replace.
* @param element element to be stored at the specified position.
* @throws IndexOutOfBoundsException if <tt>index < 0 || index >= size()</tt>.
*/
public void set(int index, long element) {
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
setQuick(index,element);
}
/**
* Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions.
* Provided with invalid parameters this method may access invalid indexes without throwing any exception!
* <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
* Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.
*
* This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.
* However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.
*
* @param index index of element to replace.
* @param element element to be stored at the specified position.
*/
protected abstract void setQuick(int index, long element);
/**
* Sets the size of the receiver without modifying it otherwise.
* This method should not release or allocate new memory but simply set some instance variable like <tt>size</tt>.
*
* If your subclass overrides and delegates size changing methods to some other object,
* you must make sure that those overriding methods not only update the size of the delegate but also of this class.
* For example:
* public DatabaseList extends AbstractLongList {
* ...
* public void removeFromTo(int from,int to) {
* myDatabase.removeFromTo(from,to);
* this.setSizeRaw(size-(to-from+1));
* }
* }
*/
protected void setSizeRaw(int newSize) {
size = newSize;
}
/**
* Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive).
* @param from the index of the first element (inclusive) to be permuted.
* @param to the index of the last element (inclusive) to be permuted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void shuffleFromTo(int from, int to) {
checkRangeFromTo(from, to, size());
//cern.jet.random.Uniform gen = new cern.jet.random.Uniform(new cern.jet.random.engine.DRand(new java.util.Date()));
java.util.Random gen = new java.util.Random();
for (int i=from; i<to; i++) {
int rp = gen.nextInt(to-i);
int random = rp + i;
// int random = gen.nextIntFromTo(i, to);
//swap(i, random)
long tmpElement = getQuick(random);
setQuick(random,getQuick(i));
setQuick(i,tmpElement);
}
} | java | public long[] elements() {
long[] myElements = new long[size];
for (int i=size; --i >= 0; ) myElements[i]=getQuick(i);
return myElements;
}
/**
* Sets the receiver's elements to be the specified array.
* The size and capacity of the list is the length of the array.
* <b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>.
* So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.
*
* @param elements the new elements to be stored.
* @return the receiver itself.
*/
public AbstractLongList elements(long[] elements) {
clear();
addAllOfFromTo(new LongArrayList(elements),0,elements.length-1);
return this;
}
/**
* Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.
* If necessary, allocates new internal memory and increases the capacity of the receiver.
*
* @param minCapacity the desired minimum capacity.
*/
public abstract void ensureCapacity(int minCapacity);
/**
* Compares the specified Object with the receiver.
* Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the
* same size, and all corresponding pairs of elements in the two Lists are identical.
* In other words, two Lists are defined to be equal if they contain the
* same elements in the same order.
*
* @param otherObj the Object to be compared for equality with the receiver.
* @return true if the specified Object is equal to the receiver.
*/
public boolean equals(Object otherObj) { //delta
if (! (otherObj instanceof AbstractLongList)) {return false;}
if (this==otherObj) return true;
if (otherObj==null) return false;
AbstractLongList other = (AbstractLongList) otherObj;
if (size()!=other.size()) return false;
for (int i=size(); --i >= 0; ) {
if (getQuick(i) != other.getQuick(i)) return false;
}
return true;
}
/**
* Sets the specified range of elements in the specified array to the specified value.
*
* @param from the index of the first element (inclusive) to be filled with the specified value.
* @param to the index of the last element (inclusive) to be filled with the specified value.
* @param val the value to be stored in the specified elements of the receiver.
*/
public void fillFromToWith(int from, int to, long val) {
checkRangeFromTo(from,to,this.size);
for (int i=from; i<=to;) setQuick(i++,val);
}
/**
* Applies a procedure to each element of the receiver, if any.
* Starts at index 0, moving rightwards.
* @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues.
* @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise.
*/
public boolean forEach(LongProcedure procedure) {
for (int i=0; i<size;) if (! procedure.apply(get(i++))) return false;
return true;
}
/**
* Returns the element at the specified position in the receiver.
*
* @param index index of element to return.
* @exception IndexOutOfBoundsException index is out of range (index
* < 0 || index >= size()).
*/
public long get(int index) {
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
return getQuick(index);
}
/**
* Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions.
* Provided with invalid parameters this method may return invalid elements without throwing any exception!
* <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
* Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.
*
* This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.
* However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.
*
* @param index index of element to return.
*/
protected abstract long getQuick(int index);
/**
* Returns the index of the first occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
*
* @param element the element to be searched for.
* @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
*/
public int indexOf(long element) { //delta
return indexOfFromTo(element, 0, size-1);
}
/**
* Returns the index of the first occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
* Searches between <code>from</code>, inclusive and <code>to</code>, inclusive.
* Tests for identity.
*
* @param element element to search for.
* @param from the leftmost search position, inclusive.
* @param to the rightmost search position, inclusive.
* @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public int indexOfFromTo(long element, int from, int to) {
checkRangeFromTo(from, to, size);
for (int i = from ; i <= to; i++) {
if (element==getQuick(i)) return i; //found
}
return -1; //not found
}
/**
* Returns the index of the last occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
*
* @param element the element to be searched for.
* @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
*/
public int lastIndexOf(long element) {
return lastIndexOfFromTo(element, 0, size-1);
}
/**
* Returns the index of the last occurrence of the specified
* element. Returns <code>-1</code> if the receiver does not contain this element.
* Searches beginning at <code>to</code>, inclusive until <code>from</code>, inclusive.
* Tests for identity.
*
* @param element element to search for.
* @param from the leftmost search position, inclusive.
* @param to the rightmost search position, inclusive.
* @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public int lastIndexOfFromTo(long element, int from, int to) {
checkRangeFromTo(from, to, size());
for (int i = to ; i >= from; i--) {
if (element==getQuick(i)) return i; //found
}
return -1; //not found
}
/**
* Sorts the specified range of the receiver into ascending order.
*
* The sorting algorithm is a modified mergesort (in which the merge is
* omitted if the highest element in the low sublist is less than the
* lowest element in the high sublist). This algorithm offers guaranteed
* n*log(n) performance, and can approach linear performance on nearly
* sorted lists.
*
* <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
* It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
*
* @param from the index of the first element (inclusive) to be sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void mergeSortFromTo(int from, int to) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Sorts the receiver according
* to the order induced by the specified comparator. All elements in the
* range must be <i>mutually comparable</i> by the specified comparator
* (that is, <tt>c.compare(e1, e2)</tt> must not throw a
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
* <tt>e2</tt> in the range).<p>
*
* This sort is guaranteed to be <i>stable</i>: equal elements will
* not be reordered as a result of the sort.<p>
*
* The sorting algorithm is a modified mergesort (in which the merge is
* omitted if the highest element in the low sublist is less than the
* lowest element in the high sublist). This algorithm offers guaranteed
* n*log(n) performance, and can approach linear performance on nearly
* sorted lists.
*
* @param from the index of the first element (inclusive) to be
* sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @param c the comparator to determine the order of the receiver.
* @throws ClassCastException if the array contains elements that are not
* <i>mutually comparable</i> using the specified comparator.
* @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
* @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
* <tt>toIndex > a.length</tt>
* @see Comparator
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void mergeSortFromTo(int from, int to, LongComparator c) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.
* @param from the index of the first element (inclusive).
* @param to the index of the last element (inclusive).
* @return a new list
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public AbstractLongList partFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int length = to-from+1;
LongArrayList part = new LongArrayList(length);
part.addAllOfFromTo(this,from,to);
return part;
}
/**
* Sorts the specified range of the receiver into
* ascending numerical order. The sorting algorithm is a tuned quicksort,
* adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a
* Sort Function", Software-Practice and Experience, Vol. 23(11)
* P. 1249-1265 (November 1993). This algorithm offers n*log(n)
* performance on many data sets that cause other quicksorts to degrade to
* quadratic performance.
*
* <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>
* It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.
*
* @param from the index of the first element (inclusive) to be sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void quickSortFromTo(int from, int to) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Sorts the receiver according
* to the order induced by the specified comparator. All elements in the
* range must be <i>mutually comparable</i> by the specified comparator
* (that is, <tt>c.compare(e1, e2)</tt> must not throw a
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
* <tt>e2</tt> in the range).<p>
*
* The sorting algorithm is a tuned quicksort,
* adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a
* Sort Function", Software-Practice and Experience, Vol. 23(11)
* P. 1249-1265 (November 1993). This algorithm offers n*log(n)
* performance on many data sets that cause other quicksorts to degrade to
* quadratic performance.
*
* @param from the index of the first element (inclusive) to be
* sorted.
* @param to the index of the last element (inclusive) to be sorted.
* @param c the comparator to determine the order of the receiver.
* @throws ClassCastException if the array contains elements that are not
* <i>mutually comparable</i> using the specified comparator.
* @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>
* @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or
* <tt>toIndex > a.length</tt>
* @see Comparator
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void quickSortFromTo(int from, int to, LongComparator c) {
int mySize = size();
checkRangeFromTo(from, to, mySize);
long[] myElements = elements();
java.util.Arrays.sort(myElements, from, to+1);
elements(myElements);
setSizeRaw(mySize);
}
/**
* Removes from the receiver all elements that are contained in the specified list.
* Tests for identity.
*
* @param other the other list.
* @return <code>true</code> if the receiver changed as a result of the call.
*/
public boolean removeAll(AbstractLongList other) {
if (other.size()==0) return false; //nothing to do
int limit = other.size()-1;
int j=0;
for (int i=0; i<size ; i++) {
if (other.indexOfFromTo(getQuick(i), 0, limit) < 0) setQuick(j++,getQuick(i));
}
boolean modified = (j!=size);
setSize(j);
return modified;
}
/**
* Removes from the receiver all elements whose index is between
* <code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding
* elements to the left (reduces their index).
* This call shortens the list by <tt>(to - from + 1)</tt> elements.
*
* @param from index of first element to be removed.
* @param to index of last element to be removed.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved > 0) {
replaceFromToWithFrom(from, from-1+numMoved, this, to+1);
//fillFromToWith(from+numMoved, size-1, 0.0f); //delta
}
int width = to-from+1;
if (width>0) setSizeRaw(size-width);
}
/**
* Replaces a number of elements in the receiver with the same number of elements of another list.
* Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive),
* with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive).
*
* @param from the position of the first element to be replaced in the receiver
* @param to the position of the last element to be replaced in the receiver
* @param other list holding elements to be copied into the receiver.
* @param otherFrom position of first element within other list to be copied.
*/
public void replaceFromToWithFrom(int from, int to, AbstractLongList other, int otherFrom) {
int length=to-from+1;
if (length>0) {
checkRangeFromTo(from, to, size());
checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
// unambiguous copy (it may hold other==this)
if (from<=otherFrom) {
for (; --length >= 0; ) setQuick(from++,other.getQuick(otherFrom++));
}
else {
int otherTo = otherFrom+length-1;
for (; --length >= 0; ) setQuick(to--,other.getQuick(otherTo--));
}
}
}
/**
* Replaces the part between <code>from</code> (inclusive) and <code>to</code> (inclusive) with the other list's
* part between <code>otherFrom</code> and <code>otherTo</code>.
* Powerful (and tricky) method!
* Both parts need not be of the same size (part A can both be smaller or larger than part B).
* Parts may overlap.
* Receiver and other list may (but most not) be identical.
* If <code>from > to</code>, then inserts other part before <code>from</code>.
*
* @param from the first element of the receiver (inclusive)
* @param to the last element of the receiver (inclusive)
* @param other the other list (may be identical with receiver)
* @param otherFrom the first element of the other list (inclusive)
* @param otherTo the last element of the other list (inclusive)
*
* <p><b>Examples:</b><pre>
* a=[0, 1, 2, 3, 4, 5, 6, 7]
* b=[50, 60, 70, 80, 90]
* a.R(...)=a.replaceFromToWithFromTo(...)
*
* a.R(3,5,b,0,4)-->[0, 1, 2, 50, 60, 70, 80, 90, 6, 7]
* a.R(1,6,b,0,4)-->[0, 50, 60, 70, 80, 90, 7]
* a.R(0,6,b,0,4)-->[50, 60, 70, 80, 90, 7]
* a.R(3,5,b,1,2)-->[0, 1, 2, 60, 70, 6, 7]
* a.R(1,6,b,1,2)-->[0, 60, 70, 7]
* a.R(0,6,b,1,2)-->[60, 70, 7]
* a.R(5,3,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]
* a.R(5,0,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]
* a.R(5,3,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]
* a.R(5,0,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]
*
* Extreme cases:
* a.R(5,3,b,0,0)-->[0, 1, 2, 3, 4, 50, 5, 6, 7]
* a.R(5,3,b,4,4)-->[0, 1, 2, 3, 4, 90, 5, 6, 7]
* a.R(3,5,a,0,1)-->[0, 1, 2, 0, 1, 6, 7]
* a.R(3,5,a,3,5)-->[0, 1, 2, 3, 4, 5, 6, 7]
* a.R(3,5,a,4,4)-->[0, 1, 2, 4, 6, 7]
* a.R(5,3,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(0,-1,b,0,4)-->[50, 60, 70, 80, 90, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(0,-1,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]
* a.R(8,0,a,0,4)-->[0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4]
* </pre>
*/
public void replaceFromToWithFromTo(int from, int to, AbstractLongList other, int otherFrom, int otherTo) {
if (otherFrom>otherTo) {
throw new IndexOutOfBoundsException("otherFrom: "+otherFrom+", otherTo: "+otherTo);
}
if (this==other && to-from!=otherTo-otherFrom) { // avoid stumbling over my own feet
replaceFromToWithFromTo(from, to, partFromTo(otherFrom, otherTo), 0, otherTo-otherFrom);
return;
}
int length=otherTo-otherFrom+1;
int diff=length;
int theLast=from-1;
if (to>=from) {
diff -= (to-from+1);
theLast=to;
}
if (diff>0) {
beforeInsertDummies(theLast+1, diff);
}
else {
if (diff<0) {
removeFromTo(theLast+diff, theLast-1);
}
}
if (length>0) {
replaceFromToWithFrom(from,from+length-1,other,otherFrom);
}
}
/**
* Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection.
* Does not alter the size of the receiver.
* Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements.
*
* @param from the index at which to copy the first element from the specified collection.
* @param other Collection to replace part of the receiver
* @exception IndexOutOfBoundsException index is out of range (index < 0 || index >= size()).
*/
public void replaceFromWith(int from, java.util.Collection other) {
checkRange(from,size());
java.util.Iterator e = other.iterator();
int index=from;
int limit = Math.min(size()-from, other.size());
for (int i=0; i<limit; i++)
set(index++,((Number) e.next()).longValue()); //delta
}
/**
* Retains (keeps) only the elements in the receiver that are contained in the specified other list.
* In other words, removes from the receiver all of its elements that are not contained in the
* specified other list.
* @param other the other list to test against.
* @return <code>true</code> if the receiver changed as a result of the call.
*/
public boolean retainAll(AbstractLongList other) {
if (other.size()==0) {
if (size==0) return false;
setSize(0);
return true;
}
int limit = other.size()-1;
int j=0;
for (int i=0; i<size ; i++) {
if (other.indexOfFromTo(getQuick(i), 0, limit) >= 0) setQuick(j++, getQuick(i));
}
boolean modified = (j!=size);
setSize(j);
return modified;
}
/**
* Reverses the elements of the receiver.
* Last becomes first, second last becomes second first, and so on.
*/
public void reverse() {
long tmp;
int limit=size()/2;
int j=size()-1;
for (int i=0; i<limit;) { //swap
tmp=getQuick(i);
setQuick(i++,getQuick(j));
setQuick(j--,tmp);
}
}
/**
* Replaces the element at the specified position in the receiver with the specified element.
*
* @param index index of element to replace.
* @param element element to be stored at the specified position.
* @throws IndexOutOfBoundsException if <tt>index < 0 || index >= size()</tt>.
*/
public void set(int index, long element) {
if (index >= size || index < 0)
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
setQuick(index,element);
}
/**
* Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions.
* Provided with invalid parameters this method may access invalid indexes without throwing any exception!
* <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>
* Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.
*
* This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.
* However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.
*
* @param index index of element to replace.
* @param element element to be stored at the specified position.
*/
protected abstract void setQuick(int index, long element);
/**
* Sets the size of the receiver without modifying it otherwise.
* This method should not release or allocate new memory but simply set some instance variable like <tt>size</tt>.
*
* If your subclass overrides and delegates size changing methods to some other object,
* you must make sure that those overriding methods not only update the size of the delegate but also of this class.
* For example:
* public DatabaseList extends AbstractLongList {
* ...
* public void removeFromTo(int from,int to) {
* myDatabase.removeFromTo(from,to);
* this.setSizeRaw(size-(to-from+1));
* }
* }
*/
protected void setSizeRaw(int newSize) {
size = newSize;
}
/**
* Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive).
* @param from the index of the first element (inclusive) to be permuted.
* @param to the index of the last element (inclusive) to be permuted.
* @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).
*/
public void shuffleFromTo(int from, int to) {
checkRangeFromTo(from, to, size());
//cern.jet.random.Uniform gen = new cern.jet.random.Uniform(new cern.jet.random.engine.DRand(new java.util.Date()));
java.util.Random gen = new java.util.Random();
for (int i=from; i<to; i++) {
int rp = gen.nextInt(to-i);
int random = rp + i;
// int random = gen.nextIntFromTo(i, to);
//swap(i, random)
long tmpElement = getQuick(random);
setQuick(random,getQuick(i));
setQuick(i,tmpElement);
}
} | [
"public",
"long",
"[",
"]",
"elements",
"(",
")",
"{",
"long",
"[",
"]",
"myElements",
"=",
"new",
"long",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"size",
";",
"--",
"i",
">=",
"0",
";",
")",
"myElements",
"[",
"i",
"]",
"=",
"getQuick",
"(",
"i",
")",
";",
"return",
"myElements",
";",
"}",
"/**\r\n * Sets the receiver's elements to be the specified array.\r\n * The size and capacity of the list is the length of the array.\r\n * <b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>.\r\n * So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.\r\n *\r\n * @param elements the new elements to be stored.\r\n * @return the receiver itself.\r\n */",
"public",
"AbstractLongList",
"elements",
"(",
"long",
"[",
"]",
"elements",
")",
"{",
"clear",
"(",
")",
";",
"addAllOfFromTo",
"(",
"new",
"LongArrayList",
"(",
"elements",
")",
",",
"0",
",",
"elements",
".",
"length",
"-",
"1",
")",
";",
"return",
"this",
";",
"}",
"/**\r\n * Ensures that the receiver can hold at least the specified number of elements without needing to allocate new internal memory.\r\n * If necessary, allocates new internal memory and increases the capacity of the receiver.\r\n *\r\n * @param minCapacity the desired minimum capacity.\r\n */",
"public",
"abstract",
"void",
"ensureCapacity",
"(",
"int",
"minCapacity",
")",
";",
"/**\r\n * Compares the specified Object with the receiver. \r\n * Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the\r\n * same size, and all corresponding pairs of elements in the two Lists are identical.\r\n * In other words, two Lists are defined to be equal if they contain the\r\n * same elements in the same order.\r\n *\r\n * @param otherObj the Object to be compared for equality with the receiver.\r\n * @return true if the specified Object is equal to the receiver.\r\n */",
"public",
"boolean",
"equals",
"(",
"Object",
"otherObj",
")",
"{",
"//delta\r",
"if",
"(",
"!",
"(",
"otherObj",
"instanceof",
"AbstractLongList",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
"==",
"otherObj",
")",
"return",
"true",
";",
"if",
"(",
"otherObj",
"==",
"null",
")",
"return",
"false",
";",
"AbstractLongList",
"other",
"=",
"(",
"AbstractLongList",
")",
"otherObj",
";",
"if",
"(",
"size",
"(",
")",
"!=",
"other",
".",
"size",
"(",
")",
")",
"return",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"size",
"(",
")",
";",
"--",
"i",
">=",
"0",
";",
")",
"{",
"if",
"(",
"getQuick",
"(",
"i",
")",
"!=",
"other",
".",
"getQuick",
"(",
"i",
")",
")",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}",
"/**\r\n * Sets the specified range of elements in the specified array to the specified value.\r\n *\r\n * @param from the index of the first element (inclusive) to be filled with the specified value.\r\n * @param to the index of the last element (inclusive) to be filled with the specified value.\r\n * @param val the value to be stored in the specified elements of the receiver.\r\n */",
"public",
"void",
"fillFromToWith",
"",
"(",
"int",
"from",
",",
"int",
"to",
",",
"long",
"val",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"this",
".",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"from",
";",
"i",
"<=",
"to",
";",
")",
"setQuick",
"(",
"i",
"++",
"",
",",
"val",
")",
";",
"}",
"/**\r\n * Applies a procedure to each element of the receiver, if any.\r\n * Starts at index 0, moving rightwards.\r\n * @param procedure the procedure to be applied. Stops iteration if the procedure returns <tt>false</tt>, otherwise continues. \r\n * @return <tt>false</tt> if the procedure stopped before all elements where iterated over, <tt>true</tt> otherwise. \r\n */",
"public",
"boolean",
"forEach",
"",
"(",
"LongProcedure",
"procedure",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
")",
"if",
"(",
"!",
"procedure",
".",
"apply",
"(",
"get",
"(",
"i",
"++",
")",
")",
")",
"return",
"false",
";",
"return",
"true",
";",
"}",
"/**\r\n * Returns the element at the specified position in the receiver.\r\n *\r\n * @param index index of element to return.\r\n * @exception IndexOutOfBoundsException index is out of range (index\r\n * \t\t < 0 || index >= size()).\r\n */",
"public",
"long",
"get",
"",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"index",
"+",
"\", Size: \"",
"+",
"size",
")",
";",
"return",
"getQuick",
"(",
"index",
")",
";",
"}",
"/**\r\n * Returns the element at the specified position in the receiver; <b>WARNING:</b> Does not check preconditions. \r\n * Provided with invalid parameters this method may return invalid elements without throwing any exception!\r\n * <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>\r\n * Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.\r\n *\r\n * This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.\r\n * However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.\r\n *\r\n * @param index index of element to return.\r\n */",
"protected",
"abstract",
"long",
"getQuick",
"",
"(",
"int",
"index",
")",
";",
"/**\r\n * Returns the index of the first occurrence of the specified\r\n * element. Returns <code>-1</code> if the receiver does not contain this element.\r\n *\r\n * @param element the element to be searched for.\r\n * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.\r\n */",
"public",
"int",
"indexOf",
"",
"(",
"long",
"element",
")",
"{",
"//delta\r",
"return",
"indexOfFromTo",
"(",
"element",
",",
"0",
",",
"size",
"-",
"1",
")",
";",
"}",
"/**\r\n * Returns the index of the first occurrence of the specified\r\n * element. Returns <code>-1</code> if the receiver does not contain this element.\r\n * Searches between <code>from</code>, inclusive and <code>to</code>, inclusive.\r\n * Tests for identity.\r\n *\r\n * @param element element to search for.\r\n * @param from the leftmost search position, inclusive.\r\n * @param to the rightmost search position, inclusive.\r\n * @return the index of the first occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"int",
"indexOfFromTo",
"",
"(",
"long",
"element",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"from",
";",
"i",
"<=",
"to",
";",
"i",
"++",
")",
"{",
"if",
"(",
"element",
"==",
"getQuick",
"(",
"i",
")",
")",
"return",
"i",
";",
"//found\r",
"}",
"return",
"-",
"1",
";",
"//not found\r",
"}",
"/**\r\n * Returns the index of the last occurrence of the specified\r\n * element. Returns <code>-1</code> if the receiver does not contain this element.\r\n *\r\n * @param element the element to be searched for.\r\n * @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.\r\n */",
"public",
"int",
"lastIndexOf",
"",
"(",
"long",
"element",
")",
"{",
"return",
"lastIndexOfFromTo",
"(",
"element",
",",
"0",
",",
"size",
"-",
"1",
")",
";",
"}",
"/**\r\n * Returns the index of the last occurrence of the specified\r\n * element. Returns <code>-1</code> if the receiver does not contain this element.\r\n * Searches beginning at <code>to</code>, inclusive until <code>from</code>, inclusive.\r\n * Tests for identity.\r\n *\r\n * @param element element to search for.\r\n * @param from the leftmost search position, inclusive.\r\n * @param to the rightmost search position, inclusive.\r\n * @return the index of the last occurrence of the element in the receiver; returns <code>-1</code> if the element is not found.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"int",
"lastIndexOfFromTo",
"",
"(",
"long",
"element",
",",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"to",
";",
"i",
">=",
"from",
";",
"i",
"--",
")",
"{",
"if",
"(",
"element",
"==",
"getQuick",
"(",
"i",
")",
")",
"return",
"i",
";",
"//found\r",
"}",
"return",
"-",
"1",
";",
"//not found\r",
"}",
"/**\r\n * Sorts the specified range of the receiver into ascending order. \r\n *\r\n * The sorting algorithm is a modified mergesort (in which the merge is\r\n * omitted if the highest element in the low sublist is less than the\r\n * lowest element in the high sublist). This algorithm offers guaranteed\r\n * n*log(n) performance, and can approach linear performance on nearly\r\n * sorted lists.\r\n *\r\n * <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>\r\n * It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.\r\n *\r\n * @param from the index of the first element (inclusive) to be sorted.\r\n * @param to the index of the last element (inclusive) to be sorted.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"mergeSortFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"int",
"mySize",
"=",
"size",
"(",
")",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"mySize",
")",
";",
"long",
"[",
"]",
"myElements",
"=",
"elements",
"(",
")",
";",
"java",
".",
"util",
".",
"Arrays",
".",
"sort",
"(",
"myElements",
",",
"from",
",",
"to",
"+",
"1",
")",
";",
"elements",
"(",
"myElements",
")",
";",
"setSizeRaw",
"(",
"mySize",
")",
";",
"}",
"/**\r\n * Sorts the receiver according\r\n * to the order induced by the specified comparator. All elements in the\r\n * range must be <i>mutually comparable</i> by the specified comparator\r\n * (that is, <tt>c.compare(e1, e2)</tt> must not throw a\r\n * <tt>ClassCastException</tt> for any elements <tt>e1</tt> and\r\n * <tt>e2</tt> in the range).<p>\r\n *\r\n * This sort is guaranteed to be <i>stable</i>: equal elements will\r\n * not be reordered as a result of the sort.<p>\r\n *\r\n * The sorting algorithm is a modified mergesort (in which the merge is\r\n * omitted if the highest element in the low sublist is less than the\r\n * lowest element in the high sublist). This algorithm offers guaranteed\r\n * n*log(n) performance, and can approach linear performance on nearly\r\n * sorted lists.\r\n *\r\n * @param from the index of the first element (inclusive) to be\r\n * sorted.\r\n * @param to the index of the last element (inclusive) to be sorted.\r\n * @param c the comparator to determine the order of the receiver.\r\n * @throws ClassCastException if the array contains elements that are not\r\n *\t <i>mutually comparable</i> using the specified comparator.\r\n * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>\r\n * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or\r\n *\t <tt>toIndex > a.length</tt>\r\n * @see Comparator\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"mergeSortFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
",",
"LongComparator",
"c",
")",
"{",
"int",
"mySize",
"=",
"size",
"(",
")",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"mySize",
")",
";",
"long",
"[",
"]",
"myElements",
"=",
"elements",
"(",
")",
";",
"java",
".",
"util",
".",
"Arrays",
".",
"sort",
"(",
"myElements",
",",
"from",
",",
"to",
"+",
"1",
")",
";",
"elements",
"(",
"myElements",
")",
";",
"setSizeRaw",
"(",
"mySize",
")",
";",
"}",
"/**\r\n * Returns a new list of the part of the receiver between <code>from</code>, inclusive, and <code>to</code>, inclusive.\r\n * @param from the index of the first element (inclusive).\r\n * @param to the index of the last element (inclusive).\r\n * @return a new list\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"AbstractLongList",
"partFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"int",
"length",
"=",
"to",
"-",
"from",
"+",
"1",
";",
"LongArrayList",
"part",
"=",
"new",
"LongArrayList",
"(",
"length",
")",
";",
"part",
".",
"addAllOfFromTo",
"(",
"this",
",",
"from",
",",
"to",
")",
";",
"return",
"part",
";",
"}",
"/**\r\n * Sorts the specified range of the receiver into\r\n * ascending numerical order. The sorting algorithm is a tuned quicksort,\r\n * adapted from Jon L. Bentley and M. Douglas McIlroy's \"Engineering a\r\n * Sort Function\", Software-Practice and Experience, Vol. 23(11)\r\n * P. 1249-1265 (November 1993). This algorithm offers n*log(n)\r\n * performance on many data sets that cause other quicksorts to degrade to\r\n * quadratic performance.\r\n *\r\n * <p><b>You should never call this method unless you are sure that this particular sorting algorithm is the right one for your data set.</b>\r\n * It is generally better to call <tt>sort()</tt> or <tt>sortFromTo(...)</tt> instead, because those methods automatically choose the best sorting algorithm.\r\n *\r\n * @param from the index of the first element (inclusive) to be sorted.\r\n * @param to the index of the last element (inclusive) to be sorted.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"quickSortFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"int",
"mySize",
"=",
"size",
"(",
")",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"mySize",
")",
";",
"long",
"[",
"]",
"myElements",
"=",
"elements",
"(",
")",
";",
"java",
".",
"util",
".",
"Arrays",
".",
"sort",
"(",
"myElements",
",",
"from",
",",
"to",
"+",
"1",
")",
";",
"elements",
"(",
"myElements",
")",
";",
"setSizeRaw",
"(",
"mySize",
")",
";",
"}",
"/**\r\n * Sorts the receiver according\r\n * to the order induced by the specified comparator. All elements in the\r\n * range must be <i>mutually comparable</i> by the specified comparator\r\n * (that is, <tt>c.compare(e1, e2)</tt> must not throw a\r\n * <tt>ClassCastException</tt> for any elements <tt>e1</tt> and\r\n * <tt>e2</tt> in the range).<p>\r\n *\r\n * The sorting algorithm is a tuned quicksort,\r\n * adapted from Jon L. Bentley and M. Douglas McIlroy's \"Engineering a\r\n * Sort Function\", Software-Practice and Experience, Vol. 23(11)\r\n * P. 1249-1265 (November 1993). This algorithm offers n*log(n)\r\n * performance on many data sets that cause other quicksorts to degrade to\r\n * quadratic performance.\r\n *\r\n * @param from the index of the first element (inclusive) to be\r\n * sorted.\r\n * @param to the index of the last element (inclusive) to be sorted.\r\n * @param c the comparator to determine the order of the receiver.\r\n * @throws ClassCastException if the array contains elements that are not\r\n *\t <i>mutually comparable</i> using the specified comparator.\r\n * @throws IllegalArgumentException if <tt>fromIndex > toIndex</tt>\r\n * @throws ArrayIndexOutOfBoundsException if <tt>fromIndex < 0</tt> or\r\n *\t <tt>toIndex > a.length</tt>\r\n * @see Comparator\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"quickSortFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
",",
"LongComparator",
"c",
")",
"{",
"int",
"mySize",
"=",
"size",
"(",
")",
";",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"mySize",
")",
";",
"long",
"[",
"]",
"myElements",
"=",
"elements",
"(",
")",
";",
"java",
".",
"util",
".",
"Arrays",
".",
"sort",
"(",
"myElements",
",",
"from",
",",
"to",
"+",
"1",
")",
";",
"elements",
"(",
"myElements",
")",
";",
"setSizeRaw",
"(",
"mySize",
")",
";",
"}",
"/**\r\n* Removes from the receiver all elements that are contained in the specified list.\r\n* Tests for identity.\r\n*\r\n* @param other the other list.\r\n* @return <code>true</code> if the receiver changed as a result of the call.\r\n*/",
"public",
"boolean",
"removeAll",
"",
"(",
"AbstractLongList",
"other",
")",
"{",
"if",
"(",
"other",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"false",
";",
"//nothing to do\r",
"int",
"limit",
"=",
"other",
".",
"size",
"(",
")",
"-",
"1",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"other",
".",
"indexOfFromTo",
"(",
"getQuick",
"(",
"i",
")",
",",
"0",
",",
"limit",
")",
"<",
"0",
")",
"setQuick",
"(",
"j",
"++",
",",
"getQuick",
"(",
"i",
")",
")",
";",
"}",
"boolean",
"modified",
"=",
"(",
"j",
"!=",
"size",
")",
";",
"setSize",
"(",
"j",
")",
";",
"return",
"modified",
";",
"}",
"/**\r\n * Removes from the receiver all elements whose index is between\r\n * <code>from</code>, inclusive and <code>to</code>, inclusive. Shifts any succeeding\r\n * elements to the left (reduces their index).\r\n * This call shortens the list by <tt>(to - from + 1)</tt> elements.\r\n *\r\n * @param from index of first element to be removed.\r\n * @param to index of last element to be removed.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"removeFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
")",
";",
"int",
"numMoved",
"=",
"size",
"-",
"to",
"-",
"1",
";",
"if",
"(",
"numMoved",
">",
"0",
")",
"{",
"replaceFromToWithFrom",
"(",
"from",
",",
"from",
"-",
"1",
"+",
"numMoved",
",",
"this",
",",
"to",
"+",
"1",
")",
";",
"//fillFromToWith(from+numMoved, size-1, 0.0f); //delta\r",
"}",
"int",
"width",
"=",
"to",
"-",
"from",
"+",
"1",
";",
"if",
"(",
"width",
">",
"0",
")",
"setSizeRaw",
"(",
"size",
"-",
"width",
")",
";",
"}",
"/**\r\n * Replaces a number of elements in the receiver with the same number of elements of another list.\r\n * Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive),\r\n * with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive).\r\n *\r\n * @param from the position of the first element to be replaced in the receiver\r\n * @param to the position of the last element to be replaced in the receiver\r\n * @param other list holding elements to be copied into the receiver.\r\n * @param otherFrom position of first element within other list to be copied.\r\n */",
"public",
"void",
"replaceFromToWithFrom",
"",
"(",
"int",
"from",
",",
"int",
"to",
",",
"AbstractLongList",
"other",
",",
"int",
"otherFrom",
")",
"{",
"int",
"length",
"=",
"to",
"-",
"from",
"+",
"1",
";",
"if",
"(",
"length",
">",
"0",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
"(",
")",
")",
";",
"checkRangeFromTo",
"(",
"otherFrom",
",",
"otherFrom",
"+",
"length",
"-",
"1",
",",
"other",
".",
"size",
"(",
")",
")",
";",
"// unambiguous copy (it may hold other==this)\r",
"if",
"(",
"from",
"<=",
"otherFrom",
")",
"{",
"for",
"(",
";",
"--",
"length",
">=",
"0",
";",
")",
"setQuick",
"(",
"from",
"++",
"",
",",
"other",
".",
"getQuick",
"(",
"otherFrom",
"++",
")",
")",
";",
"}",
"else",
"{",
"int",
"otherTo",
"=",
"otherFrom",
"+",
"length",
"-",
"1",
";",
"for",
"(",
";",
"--",
"length",
">=",
"0",
";",
")",
"setQuick",
"(",
"to",
"--",
"",
",",
"other",
".",
"getQuick",
"(",
"otherTo",
"--",
")",
")",
";",
"}",
"}",
"}",
"/**\r\n* Replaces the part between <code>from</code> (inclusive) and <code>to</code> (inclusive) with the other list's\r\n* part between <code>otherFrom</code> and <code>otherTo</code>. \r\n* Powerful (and tricky) method!\r\n* Both parts need not be of the same size (part A can both be smaller or larger than part B).\r\n* Parts may overlap.\r\n* Receiver and other list may (but most not) be identical.\r\n* If <code>from > to</code>, then inserts other part before <code>from</code>.\r\n*\r\n* @param from the first element of the receiver (inclusive)\r\n* @param to the last element of the receiver (inclusive)\r\n* @param other the other list (may be identical with receiver)\r\n* @param otherFrom the first element of the other list (inclusive)\r\n* @param otherTo the last element of the other list (inclusive)\r\n*\r\n* <p><b>Examples:</b><pre>\r\n* a=[0, 1, 2, 3, 4, 5, 6, 7]\r\n* b=[50, 60, 70, 80, 90]\r\n* a.R(...)=a.replaceFromToWithFromTo(...)\r\n*\r\n* a.R(3,5,b,0,4)-->[0, 1, 2, 50, 60, 70, 80, 90, 6, 7]\r\n* a.R(1,6,b,0,4)-->[0, 50, 60, 70, 80, 90, 7]\r\n* a.R(0,6,b,0,4)-->[50, 60, 70, 80, 90, 7]\r\n* a.R(3,5,b,1,2)-->[0, 1, 2, 60, 70, 6, 7]\r\n* a.R(1,6,b,1,2)-->[0, 60, 70, 7]\r\n* a.R(0,6,b,1,2)-->[60, 70, 7]\r\n* a.R(5,3,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]\r\n* a.R(5,0,b,0,4)-->[0, 1, 2, 3, 4, 50, 60, 70, 80, 90, 5, 6, 7]\r\n* a.R(5,3,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]\r\n* a.R(5,0,b,1,2)-->[0, 1, 2, 3, 4, 60, 70, 5, 6, 7]\r\n*\r\n* Extreme cases:\r\n* a.R(5,3,b,0,0)-->[0, 1, 2, 3, 4, 50, 5, 6, 7]\r\n* a.R(5,3,b,4,4)-->[0, 1, 2, 3, 4, 90, 5, 6, 7]\r\n* a.R(3,5,a,0,1)-->[0, 1, 2, 0, 1, 6, 7]\r\n* a.R(3,5,a,3,5)-->[0, 1, 2, 3, 4, 5, 6, 7]\r\n* a.R(3,5,a,4,4)-->[0, 1, 2, 4, 6, 7]\r\n* a.R(5,3,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]\r\n* a.R(0,-1,b,0,4)-->[50, 60, 70, 80, 90, 0, 1, 2, 3, 4, 5, 6, 7]\r\n* a.R(0,-1,a,0,4)-->[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7]\r\n* a.R(8,0,a,0,4)-->[0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4]\r\n* </pre>\r\n*/",
"public",
"void",
"replaceFromToWithFromTo",
"",
"(",
"int",
"from",
",",
"int",
"to",
",",
"AbstractLongList",
"other",
",",
"int",
"otherFrom",
",",
"int",
"otherTo",
")",
"{",
"if",
"(",
"otherFrom",
">",
"otherTo",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"otherFrom: \"",
"+",
"otherFrom",
"+",
"\", otherTo: \"",
"+",
"otherTo",
")",
";",
"}",
"if",
"(",
"this",
"==",
"other",
"&&",
"to",
"-",
"from",
"!=",
"otherTo",
"-",
"otherFrom",
")",
"{",
"// avoid stumbling over my own feet\r",
"replaceFromToWithFromTo",
"(",
"from",
",",
"to",
",",
"partFromTo",
"(",
"otherFrom",
",",
"otherTo",
")",
",",
"0",
",",
"otherTo",
"-",
"otherFrom",
")",
";",
"return",
";",
"}",
"int",
"length",
"=",
"otherTo",
"-",
"otherFrom",
"+",
"1",
";",
"int",
"diff",
"=",
"length",
";",
"int",
"theLast",
"=",
"from",
"-",
"1",
";",
"if",
"(",
"to",
">=",
"from",
")",
"{",
"diff",
"-=",
"(",
"to",
"-",
"from",
"+",
"1",
")",
";",
"theLast",
"=",
"to",
";",
"}",
"if",
"(",
"diff",
">",
"0",
")",
"{",
"beforeInsertDummies",
"(",
"theLast",
"+",
"1",
",",
"diff",
")",
";",
"}",
"else",
"{",
"if",
"(",
"diff",
"<",
"0",
")",
"{",
"removeFromTo",
"(",
"theLast",
"+",
"diff",
",",
"theLast",
"-",
"1",
")",
";",
"}",
"}",
"if",
"(",
"length",
">",
"0",
")",
"{",
"replaceFromToWithFrom",
"(",
"from",
",",
"from",
"+",
"length",
"-",
"1",
",",
"other",
",",
"otherFrom",
")",
";",
"}",
"}",
"/**\r\n * Replaces the part of the receiver starting at <code>from</code> (inclusive) with all the elements of the specified collection.\r\n * Does not alter the size of the receiver.\r\n * Replaces exactly <tt>Math.max(0,Math.min(size()-from, other.size()))</tt> elements.\r\n *\r\n * @param from the index at which to copy the first element from the specified collection.\r\n * @param other Collection to replace part of the receiver\r\n * @exception IndexOutOfBoundsException index is out of range (index < 0 || index >= size()).\r\n */",
"public",
"void",
"replaceFromWith",
"",
"(",
"int",
"from",
",",
"java",
".",
"util",
".",
"Collection",
"other",
")",
"{",
"checkRange",
"(",
"from",
",",
"size",
"(",
")",
")",
";",
"java",
".",
"util",
".",
"Iterator",
"e",
"=",
"other",
".",
"iterator",
"(",
")",
";",
"int",
"index",
"=",
"from",
";",
"int",
"limit",
"=",
"Math",
".",
"min",
"(",
"size",
"(",
")",
"-",
"from",
",",
"other",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"limit",
";",
"i",
"++",
")",
"set",
"(",
"index",
"++",
"",
",",
"(",
"(",
"Number",
")",
"e",
".",
"next",
"(",
")",
")",
".",
"longValue",
"(",
")",
")",
";",
"//delta\r",
"}",
"/**\r\n* Retains (keeps) only the elements in the receiver that are contained in the specified other list.\r\n* In other words, removes from the receiver all of its elements that are not contained in the\r\n* specified other list. \r\n* @param other the other list to test against.\r\n* @return <code>true</code> if the receiver changed as a result of the call.\r\n*/",
"public",
"boolean",
"retainAll",
"",
"(",
"AbstractLongList",
"other",
")",
"{",
"if",
"(",
"other",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"false",
";",
"setSize",
"(",
"0",
")",
";",
"return",
"true",
";",
"}",
"int",
"limit",
"=",
"other",
".",
"size",
"(",
")",
"-",
"1",
";",
"int",
"j",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"other",
".",
"indexOfFromTo",
"(",
"getQuick",
"(",
"i",
")",
",",
"0",
",",
"limit",
")",
">=",
"0",
")",
"setQuick",
"(",
"j",
"++",
",",
"getQuick",
"(",
"i",
")",
")",
";",
"}",
"boolean",
"modified",
"=",
"(",
"j",
"!=",
"size",
")",
";",
"setSize",
"(",
"j",
")",
";",
"return",
"modified",
";",
"}",
"/**\r\n * Reverses the elements of the receiver.\r\n * Last becomes first, second last becomes second first, and so on.\r\n */",
"public",
"void",
"reverse",
"",
"(",
")",
"{",
"long",
"tmp",
";",
"int",
"limit",
"=",
"size",
"(",
")",
"/",
"2",
";",
"int",
"j",
"=",
"size",
"(",
")",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"limit",
";",
")",
"{",
"//swap\r",
"tmp",
"=",
"getQuick",
"(",
"i",
")",
";",
"setQuick",
"(",
"i",
"++",
",",
"getQuick",
"(",
"j",
")",
")",
";",
"setQuick",
"(",
"j",
"--",
",",
"tmp",
")",
";",
"}",
"}",
"/**\r\n * Replaces the element at the specified position in the receiver with the specified element.\r\n *\r\n * @param index index of element to replace.\r\n * @param element element to be stored at the specified position.\r\n * @throws IndexOutOfBoundsException if <tt>index < 0 || index >= size()</tt>.\r\n */",
"public",
"void",
"set",
"",
"(",
"int",
"index",
",",
"long",
"element",
")",
"{",
"if",
"(",
"index",
">=",
"size",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"index",
"+",
"\", Size: \"",
"+",
"size",
")",
";",
"setQuick",
"(",
"index",
",",
"element",
")",
";",
"}",
"/**\r\n * Replaces the element at the specified position in the receiver with the specified element; <b>WARNING:</b> Does not check preconditions.\r\n * Provided with invalid parameters this method may access invalid indexes without throwing any exception!\r\n * <b>You should only use this method when you are absolutely sure that the index is within bounds.</b>\r\n * Precondition (unchecked): <tt>index >= 0 && index < size()</tt>.\r\n *\r\n * This method is normally only used internally in large loops where bounds are explicitly checked before the loop and need no be rechecked within the loop.\r\n * However, when desperately, you can give this method <tt>public</tt> visibility in subclasses.\r\n *\r\n * @param index index of element to replace.\r\n * @param element element to be stored at the specified position.\r\n */",
"protected",
"abstract",
"void",
"setQuick",
"",
"(",
"int",
"index",
",",
"long",
"element",
")",
";",
"/**\r\n * Sets the size of the receiver without modifying it otherwise.\r\n * This method should not release or allocate new memory but simply set some instance variable like <tt>size</tt>.\r\n *\r\n * If your subclass overrides and delegates size changing methods to some other object,\r\n * you must make sure that those overriding methods not only update the size of the delegate but also of this class.\r\n * For example:\r\n * public DatabaseList extends AbstractLongList {\r\n * ...\r\n * public void removeFromTo(int from,int to) {\r\n * myDatabase.removeFromTo(from,to);\r\n * this.setSizeRaw(size-(to-from+1));\r\n * }\r\n * }\r\n */",
"protected",
"void",
"setSizeRaw",
"(",
"int",
"newSize",
")",
"{",
"size",
"=",
"newSize",
";",
"}",
"/**\r\n * Randomly permutes the part of the receiver between <code>from</code> (inclusive) and <code>to</code> (inclusive). \r\n * @param from the index of the first element (inclusive) to be permuted.\r\n * @param to the index of the last element (inclusive) to be permuted.\r\n * @exception IndexOutOfBoundsException index is out of range (<tt>size()>0 && (from<0 || from>to || to>=size())</tt>).\r\n */",
"public",
"void",
"shuffleFromTo",
"(",
"int",
"from",
",",
"int",
"to",
")",
"{",
"checkRangeFromTo",
"(",
"from",
",",
"to",
",",
"size",
"(",
")",
")",
";",
"//cern.jet.random.Uniform gen = new cern.jet.random.Uniform(new cern.jet.random.engine.DRand(new java.util.Date()));\r",
"java",
".",
"util",
".",
"Random",
"gen",
"=",
"new",
"java",
".",
"util",
".",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"from",
";",
"i",
"<",
"to",
";",
"i",
"++",
")",
"{",
"int",
"rp",
"=",
"gen",
".",
"nextInt",
"(",
"to",
"-",
"i",
")",
";",
"int",
"random",
"=",
"rp",
"+",
"i",
";",
"//\t\tint random = gen.nextIntFromTo(i, to);\r",
"//swap(i, random)\r",
"long",
"tmpElement",
"=",
"getQuick",
"(",
"random",
")",
";",
"setQuick",
"(",
"random",
",",
"getQuick",
"(",
"i",
")",
")",
";",
"setQuick",
"(",
"i",
",",
"tmpElement",
")",
";",
"}",
"}"
] | Returns the elements currently stored, possibly including invalid elements between size and capacity.
<b>WARNING:</b> For efficiency reasons and to keep memory usage low, this method may decide <b>not to copy the array</b>.
So if subsequently you modify the returned array directly via the [] operator, be sure you know what you're doing.
@return the elements currently stored. | [
"Returns",
"the",
"elements",
"currently",
"stored",
"possibly",
"including",
"invalid",
"elements",
"between",
"size",
"and",
"capacity",
"."
] | ab8b0a83dbf600fe80c27711815c90bd3055b217 | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/AbstractLongList.java#L189-L745 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_binding.java | auditsyslogpolicy_binding.get | public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{
auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding();
obj.set_name(name);
auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service);
return response;
} | java | public static auditsyslogpolicy_binding get(nitro_service service, String name) throws Exception{
auditsyslogpolicy_binding obj = new auditsyslogpolicy_binding();
obj.set_name(name);
auditsyslogpolicy_binding response = (auditsyslogpolicy_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"auditsyslogpolicy_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"auditsyslogpolicy_binding",
"obj",
"=",
"new",
"auditsyslogpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"auditsyslogpolicy_binding",
"response",
"=",
"(",
"auditsyslogpolicy_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch auditsyslogpolicy_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"auditsyslogpolicy_binding",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditsyslogpolicy_binding.java#L191-L196 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_sslciphersuite_binding.java | sslcipher_sslciphersuite_binding.get | public static sslcipher_sslciphersuite_binding[] get(nitro_service service, String ciphergroupname) throws Exception{
sslcipher_sslciphersuite_binding obj = new sslcipher_sslciphersuite_binding();
obj.set_ciphergroupname(ciphergroupname);
sslcipher_sslciphersuite_binding response[] = (sslcipher_sslciphersuite_binding[]) obj.get_resources(service);
return response;
} | java | public static sslcipher_sslciphersuite_binding[] get(nitro_service service, String ciphergroupname) throws Exception{
sslcipher_sslciphersuite_binding obj = new sslcipher_sslciphersuite_binding();
obj.set_ciphergroupname(ciphergroupname);
sslcipher_sslciphersuite_binding response[] = (sslcipher_sslciphersuite_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"sslcipher_sslciphersuite_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"ciphergroupname",
")",
"throws",
"Exception",
"{",
"sslcipher_sslciphersuite_binding",
"obj",
"=",
"new",
"sslcipher_sslciphersuite_binding",
"(",
")",
";",
"obj",
".",
"set_ciphergroupname",
"(",
"ciphergroupname",
")",
";",
"sslcipher_sslciphersuite_binding",
"response",
"[",
"]",
"=",
"(",
"sslcipher_sslciphersuite_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch sslcipher_sslciphersuite_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslcipher_sslciphersuite_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_sslciphersuite_binding.java#L225-L230 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_binding.java | sslcipher_binding.get | public static sslcipher_binding get(nitro_service service, String ciphergroupname) throws Exception{
sslcipher_binding obj = new sslcipher_binding();
obj.set_ciphergroupname(ciphergroupname);
sslcipher_binding response = (sslcipher_binding) obj.get_resource(service);
return response;
} | java | public static sslcipher_binding get(nitro_service service, String ciphergroupname) throws Exception{
sslcipher_binding obj = new sslcipher_binding();
obj.set_ciphergroupname(ciphergroupname);
sslcipher_binding response = (sslcipher_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"sslcipher_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"ciphergroupname",
")",
"throws",
"Exception",
"{",
"sslcipher_binding",
"obj",
"=",
"new",
"sslcipher_binding",
"(",
")",
";",
"obj",
".",
"set_ciphergroupname",
"(",
"ciphergroupname",
")",
";",
"sslcipher_binding",
"response",
"=",
"(",
"sslcipher_binding",
")",
"obj",
".",
"get_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch sslcipher_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslcipher_binding",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslcipher_binding.java#L114-L119 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditnslogpolicy_tmglobal_binding.java | auditnslogpolicy_tmglobal_binding.get | public static auditnslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{
auditnslogpolicy_tmglobal_binding obj = new auditnslogpolicy_tmglobal_binding();
obj.set_name(name);
auditnslogpolicy_tmglobal_binding response[] = (auditnslogpolicy_tmglobal_binding[]) obj.get_resources(service);
return response;
} | java | public static auditnslogpolicy_tmglobal_binding[] get(nitro_service service, String name) throws Exception{
auditnslogpolicy_tmglobal_binding obj = new auditnslogpolicy_tmglobal_binding();
obj.set_name(name);
auditnslogpolicy_tmglobal_binding response[] = (auditnslogpolicy_tmglobal_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"auditnslogpolicy_tmglobal_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"auditnslogpolicy_tmglobal_binding",
"obj",
"=",
"new",
"auditnslogpolicy_tmglobal_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"auditnslogpolicy_tmglobal_binding",
"response",
"[",
"]",
"=",
"(",
"auditnslogpolicy_tmglobal_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch auditnslogpolicy_tmglobal_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"auditnslogpolicy_tmglobal_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/audit/auditnslogpolicy_tmglobal_binding.java#L132-L137 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java | nsdhcpparams.update | public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception {
nsdhcpparams updateresource = new nsdhcpparams();
updateresource.dhcpclient = resource.dhcpclient;
updateresource.saveroute = resource.saveroute;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsdhcpparams resource) throws Exception {
nsdhcpparams updateresource = new nsdhcpparams();
updateresource.dhcpclient = resource.dhcpclient;
updateresource.saveroute = resource.saveroute;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsdhcpparams",
"resource",
")",
"throws",
"Exception",
"{",
"nsdhcpparams",
"updateresource",
"=",
"new",
"nsdhcpparams",
"(",
")",
";",
"updateresource",
".",
"dhcpclient",
"=",
"resource",
".",
"dhcpclient",
";",
"updateresource",
".",
"saveroute",
"=",
"resource",
".",
"saveroute",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update nsdhcpparams. | [
"Use",
"this",
"API",
"to",
"update",
"nsdhcpparams",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java#L156-L161 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java | nsdhcpparams.unset | public static base_response unset(nitro_service client, nsdhcpparams resource, String[] args) throws Exception{
nsdhcpparams unsetresource = new nsdhcpparams();
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, nsdhcpparams resource, String[] args) throws Exception{
nsdhcpparams unsetresource = new nsdhcpparams();
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"nsdhcpparams",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"nsdhcpparams",
"unsetresource",
"=",
"new",
"nsdhcpparams",
"(",
")",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of nsdhcpparams resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"nsdhcpparams",
"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/ns/nsdhcpparams.java#L167-L170 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java | nsdhcpparams.get | public static nsdhcpparams get(nitro_service service) throws Exception{
nsdhcpparams obj = new nsdhcpparams();
nsdhcpparams[] response = (nsdhcpparams[])obj.get_resources(service);
return response[0];
} | java | public static nsdhcpparams get(nitro_service service) throws Exception{
nsdhcpparams obj = new nsdhcpparams();
nsdhcpparams[] response = (nsdhcpparams[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"nsdhcpparams",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nsdhcpparams",
"obj",
"=",
"new",
"nsdhcpparams",
"(",
")",
";",
"nsdhcpparams",
"[",
"]",
"response",
"=",
"(",
"nsdhcpparams",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the nsdhcpparams resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"nsdhcpparams",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsdhcpparams.java#L175-L179 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterprebodyinjection.java | filterprebodyinjection.update | public static base_response update(nitro_service client, filterprebodyinjection resource) throws Exception {
filterprebodyinjection updateresource = new filterprebodyinjection();
updateresource.prebody = resource.prebody;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, filterprebodyinjection resource) throws Exception {
filterprebodyinjection updateresource = new filterprebodyinjection();
updateresource.prebody = resource.prebody;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"filterprebodyinjection",
"resource",
")",
"throws",
"Exception",
"{",
"filterprebodyinjection",
"updateresource",
"=",
"new",
"filterprebodyinjection",
"(",
")",
";",
"updateresource",
".",
"prebody",
"=",
"resource",
".",
"prebody",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update filterprebodyinjection. | [
"Use",
"this",
"API",
"to",
"update",
"filterprebodyinjection",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterprebodyinjection.java#L107-L111 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterprebodyinjection.java | filterprebodyinjection.unset | public static base_response unset(nitro_service client, filterprebodyinjection resource, String[] args) throws Exception{
filterprebodyinjection unsetresource = new filterprebodyinjection();
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, filterprebodyinjection resource, String[] args) throws Exception{
filterprebodyinjection unsetresource = new filterprebodyinjection();
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"filterprebodyinjection",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"filterprebodyinjection",
"unsetresource",
"=",
"new",
"filterprebodyinjection",
"(",
")",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of filterprebodyinjection resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"filterprebodyinjection",
"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/filter/filterprebodyinjection.java#L117-L120 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterprebodyinjection.java | filterprebodyinjection.get | public static filterprebodyinjection get(nitro_service service) throws Exception{
filterprebodyinjection obj = new filterprebodyinjection();
filterprebodyinjection[] response = (filterprebodyinjection[])obj.get_resources(service);
return response[0];
} | java | public static filterprebodyinjection get(nitro_service service) throws Exception{
filterprebodyinjection obj = new filterprebodyinjection();
filterprebodyinjection[] response = (filterprebodyinjection[])obj.get_resources(service);
return response[0];
} | [
"public",
"static",
"filterprebodyinjection",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"filterprebodyinjection",
"obj",
"=",
"new",
"filterprebodyinjection",
"(",
")",
";",
"filterprebodyinjection",
"[",
"]",
"response",
"=",
"(",
"filterprebodyinjection",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch all the filterprebodyinjection resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"all",
"the",
"filterprebodyinjection",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/filter/filterprebodyinjection.java#L125-L129 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy_aaauser_binding.java | vpntrafficpolicy_aaauser_binding.get | public static vpntrafficpolicy_aaauser_binding[] get(nitro_service service, String name) throws Exception{
vpntrafficpolicy_aaauser_binding obj = new vpntrafficpolicy_aaauser_binding();
obj.set_name(name);
vpntrafficpolicy_aaauser_binding response[] = (vpntrafficpolicy_aaauser_binding[]) obj.get_resources(service);
return response;
} | java | public static vpntrafficpolicy_aaauser_binding[] get(nitro_service service, String name) throws Exception{
vpntrafficpolicy_aaauser_binding obj = new vpntrafficpolicy_aaauser_binding();
obj.set_name(name);
vpntrafficpolicy_aaauser_binding response[] = (vpntrafficpolicy_aaauser_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"vpntrafficpolicy_aaauser_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"vpntrafficpolicy_aaauser_binding",
"obj",
"=",
"new",
"vpntrafficpolicy_aaauser_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"vpntrafficpolicy_aaauser_binding",
"response",
"[",
"]",
"=",
"(",
"vpntrafficpolicy_aaauser_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch vpntrafficpolicy_aaauser_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"vpntrafficpolicy_aaauser_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpntrafficpolicy_aaauser_binding.java#L132-L137 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel_sslpolicy_binding.java | sslpolicylabel_sslpolicy_binding.get | public static sslpolicylabel_sslpolicy_binding[] get(nitro_service service, String labelname) throws Exception{
sslpolicylabel_sslpolicy_binding obj = new sslpolicylabel_sslpolicy_binding();
obj.set_labelname(labelname);
sslpolicylabel_sslpolicy_binding response[] = (sslpolicylabel_sslpolicy_binding[]) obj.get_resources(service);
return response;
} | java | public static sslpolicylabel_sslpolicy_binding[] get(nitro_service service, String labelname) throws Exception{
sslpolicylabel_sslpolicy_binding obj = new sslpolicylabel_sslpolicy_binding();
obj.set_labelname(labelname);
sslpolicylabel_sslpolicy_binding response[] = (sslpolicylabel_sslpolicy_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"sslpolicylabel_sslpolicy_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"sslpolicylabel_sslpolicy_binding",
"obj",
"=",
"new",
"sslpolicylabel_sslpolicy_binding",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
";",
"sslpolicylabel_sslpolicy_binding",
"response",
"[",
"]",
"=",
"(",
"sslpolicylabel_sslpolicy_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch sslpolicylabel_sslpolicy_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"sslpolicylabel_sslpolicy_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ssl/sslpolicylabel_sslpolicy_binding.java#L279-L284 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.init | void init() {
numnegative = new int[numSamples() + 1];
numpositive = new int[numSamples() + 1];
numnegative[0] = 0;
numpositive[0] = 0;
int num = numSamples();
for (int i = 1; i <= num; i++) {
numnegative[i] = numnegative[i - 1] + (classes[i - 1] == 0 ? 1 : 0);
}
for (int i = 1; i <= num; i++) {
numpositive[i] = numpositive[i - 1] + (classes[num - i] == 0 ? 0 : 1);
}
System.err.println("total positive " + numpositive[num] + " total negative " + numnegative[num] + " total " + num);
for (int i = 1; i < numpositive.length; i++) {
//System.out.println(i + " positive " + numpositive[i] + " negative " + numnegative[i] + " classes " + classes[i - 1] + " " + classes[num - i]);
}
} | java | void init() {
numnegative = new int[numSamples() + 1];
numpositive = new int[numSamples() + 1];
numnegative[0] = 0;
numpositive[0] = 0;
int num = numSamples();
for (int i = 1; i <= num; i++) {
numnegative[i] = numnegative[i - 1] + (classes[i - 1] == 0 ? 1 : 0);
}
for (int i = 1; i <= num; i++) {
numpositive[i] = numpositive[i - 1] + (classes[num - i] == 0 ? 0 : 1);
}
System.err.println("total positive " + numpositive[num] + " total negative " + numnegative[num] + " total " + num);
for (int i = 1; i < numpositive.length; i++) {
//System.out.println(i + " positive " + numpositive[i] + " negative " + numnegative[i] + " classes " + classes[i - 1] + " " + classes[num - i]);
}
} | [
"void",
"init",
"(",
")",
"{",
"numnegative",
"=",
"new",
"int",
"[",
"numSamples",
"(",
")",
"+",
"1",
"]",
";",
"numpositive",
"=",
"new",
"int",
"[",
"numSamples",
"(",
")",
"+",
"1",
"]",
";",
"numnegative",
"[",
"0",
"]",
"=",
"0",
";",
"numpositive",
"[",
"0",
"]",
"=",
"0",
";",
"int",
"num",
"=",
"numSamples",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"num",
";",
"i",
"++",
")",
"{",
"numnegative",
"[",
"i",
"]",
"=",
"numnegative",
"[",
"i",
"-",
"1",
"]",
"+",
"(",
"classes",
"[",
"i",
"-",
"1",
"]",
"==",
"0",
"?",
"1",
":",
"0",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"num",
";",
"i",
"++",
")",
"{",
"numpositive",
"[",
"i",
"]",
"=",
"numpositive",
"[",
"i",
"-",
"1",
"]",
"+",
"(",
"classes",
"[",
"num",
"-",
"i",
"]",
"==",
"0",
"?",
"0",
":",
"1",
")",
";",
"}",
"System",
".",
"err",
".",
"println",
"(",
"\"total positive \"",
"+",
"numpositive",
"[",
"num",
"]",
"+",
"\" total negative \"",
"+",
"numnegative",
"[",
"num",
"]",
"+",
"\" total \"",
"+",
"num",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"numpositive",
".",
"length",
";",
"i",
"++",
")",
"{",
"//System.out.println(i + \" positive \" + numpositive[i] + \" negative \" + numnegative[i] + \" classes \" + classes[i - 1] + \" \" + classes[num - i]);\r",
"}",
"}"
] | initialize the numpositive and the numnegative arrays | [
"initialize",
"the",
"numpositive",
"and",
"the",
"numnegative",
"arrays"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L128-L144 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.precision | public int precision(int recall) {
int optimum = 0;
for (int right = 0; right <= recall; right++) {
int candidate = numpositive[right] + numnegative[recall - right];
if (candidate > optimum) {
optimum = candidate;
}
}
return optimum;
} | java | public int precision(int recall) {
int optimum = 0;
for (int right = 0; right <= recall; right++) {
int candidate = numpositive[right] + numnegative[recall - right];
if (candidate > optimum) {
optimum = candidate;
}
}
return optimum;
} | [
"public",
"int",
"precision",
"(",
"int",
"recall",
")",
"{",
"int",
"optimum",
"=",
"0",
";",
"for",
"(",
"int",
"right",
"=",
"0",
";",
"right",
"<=",
"recall",
";",
"right",
"++",
")",
"{",
"int",
"candidate",
"=",
"numpositive",
"[",
"right",
"]",
"+",
"numnegative",
"[",
"recall",
"-",
"right",
"]",
";",
"if",
"(",
"candidate",
">",
"optimum",
")",
"{",
"optimum",
"=",
"candidate",
";",
"}",
"}",
"return",
"optimum",
";",
"}"
] | what is the best precision at the given recall | [
"what",
"is",
"the",
"best",
"precision",
"at",
"the",
"given",
"recall"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L154-L163 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.fmeasure | public double fmeasure(int numleft, int numright) {
int tp = 0, fp = 0, fn = 0;
tp = numpositive[numright];
fp = numright - tp;
fn = numleft - numnegative[numleft];
return f1(tp, fp, fn);
} | java | public double fmeasure(int numleft, int numright) {
int tp = 0, fp = 0, fn = 0;
tp = numpositive[numright];
fp = numright - tp;
fn = numleft - numnegative[numleft];
return f1(tp, fp, fn);
} | [
"public",
"double",
"fmeasure",
"(",
"int",
"numleft",
",",
"int",
"numright",
")",
"{",
"int",
"tp",
"=",
"0",
",",
"fp",
"=",
"0",
",",
"fn",
"=",
"0",
";",
"tp",
"=",
"numpositive",
"[",
"numright",
"]",
";",
"fp",
"=",
"numright",
"-",
"tp",
";",
"fn",
"=",
"numleft",
"-",
"numnegative",
"[",
"numleft",
"]",
";",
"return",
"f1",
"(",
"tp",
",",
"fp",
",",
"fn",
")",
";",
"}"
] | the f-measure if we just guess as negativ the first numleft and guess as poitive the last numright | [
"the",
"f",
"-",
"measure",
"if",
"we",
"just",
"guess",
"as",
"negativ",
"the",
"first",
"numleft",
"and",
"guess",
"as",
"poitive",
"the",
"last",
"numright"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L181-L187 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.logPrecision | public int logPrecision(int recall) {
int totaltaken = 0;
int rightIndex = numSamples() - 1; //next right candidate
int leftIndex = 0; //next left candidate
int totalcorrect = 0;
while (totaltaken < recall) {
double confr = Math.abs(scores[rightIndex] - .5);
double confl = Math.abs(scores[leftIndex] - .5);
int chosen = leftIndex;
if (confr > confl) {
chosen = rightIndex;
rightIndex--;
} else {
leftIndex++;
}
//System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen]));
if ((scores[chosen] >= .5) && (classes[chosen] == 1)) {
totalcorrect++;
}
if ((scores[chosen] < .5) && (classes[chosen] == 0)) {
totalcorrect++;
}
totaltaken++;
}
return totalcorrect;
} | java | public int logPrecision(int recall) {
int totaltaken = 0;
int rightIndex = numSamples() - 1; //next right candidate
int leftIndex = 0; //next left candidate
int totalcorrect = 0;
while (totaltaken < recall) {
double confr = Math.abs(scores[rightIndex] - .5);
double confl = Math.abs(scores[leftIndex] - .5);
int chosen = leftIndex;
if (confr > confl) {
chosen = rightIndex;
rightIndex--;
} else {
leftIndex++;
}
//System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen]));
if ((scores[chosen] >= .5) && (classes[chosen] == 1)) {
totalcorrect++;
}
if ((scores[chosen] < .5) && (classes[chosen] == 0)) {
totalcorrect++;
}
totaltaken++;
}
return totalcorrect;
} | [
"public",
"int",
"logPrecision",
"(",
"int",
"recall",
")",
"{",
"int",
"totaltaken",
"=",
"0",
";",
"int",
"rightIndex",
"=",
"numSamples",
"(",
")",
"-",
"1",
";",
"//next right candidate\r",
"int",
"leftIndex",
"=",
"0",
";",
"//next left candidate\r",
"int",
"totalcorrect",
"=",
"0",
";",
"while",
"(",
"totaltaken",
"<",
"recall",
")",
"{",
"double",
"confr",
"=",
"Math",
".",
"abs",
"(",
"scores",
"[",
"rightIndex",
"]",
"-",
".5",
")",
";",
"double",
"confl",
"=",
"Math",
".",
"abs",
"(",
"scores",
"[",
"leftIndex",
"]",
"-",
".5",
")",
";",
"int",
"chosen",
"=",
"leftIndex",
";",
"if",
"(",
"confr",
">",
"confl",
")",
"{",
"chosen",
"=",
"rightIndex",
";",
"rightIndex",
"--",
";",
"}",
"else",
"{",
"leftIndex",
"++",
";",
"}",
"//System.err.println(\"chose \"+chosen+\" score \"+scores[chosen]+\" class \"+classes[chosen]+\" correct \"+correct(scores[chosen],classes[chosen]));\r",
"if",
"(",
"(",
"scores",
"[",
"chosen",
"]",
">=",
".5",
")",
"&&",
"(",
"classes",
"[",
"chosen",
"]",
"==",
"1",
")",
")",
"{",
"totalcorrect",
"++",
";",
"}",
"if",
"(",
"(",
"scores",
"[",
"chosen",
"]",
"<",
".5",
")",
"&&",
"(",
"classes",
"[",
"chosen",
"]",
"==",
"0",
")",
")",
"{",
"totalcorrect",
"++",
";",
"}",
"totaltaken",
"++",
";",
"}",
"return",
"totalcorrect",
";",
"}"
] | what is the precision at this recall if we look at the score as the probability of class 1 given x
as if coming from logistic regression | [
"what",
"is",
"the",
"precision",
"at",
"this",
"recall",
"if",
"we",
"look",
"at",
"the",
"score",
"as",
"the",
"probability",
"of",
"class",
"1",
"given",
"x",
"as",
"if",
"coming",
"from",
"logistic",
"regression"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L195-L222 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.optFmeasure | public double optFmeasure(int recall) {
double max = 0;
for (int i = 0; i < (recall + 1); i++) {
double f = fmeasure(i, recall - i);
if (f > max) {
max = f;
}
}
return max;
} | java | public double optFmeasure(int recall) {
double max = 0;
for (int i = 0; i < (recall + 1); i++) {
double f = fmeasure(i, recall - i);
if (f > max) {
max = f;
}
}
return max;
} | [
"public",
"double",
"optFmeasure",
"(",
"int",
"recall",
")",
"{",
"double",
"max",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"recall",
"+",
"1",
")",
";",
"i",
"++",
")",
"{",
"double",
"f",
"=",
"fmeasure",
"(",
"i",
",",
"recall",
"-",
"i",
")",
";",
"if",
"(",
"f",
">",
"max",
")",
"{",
"max",
"=",
"f",
";",
"}",
"}",
"return",
"max",
";",
"}"
] | what is the optimal f-measure we can achieve given recall guesses
using the optimal monotonic function | [
"what",
"is",
"the",
"optimal",
"f",
"-",
"measure",
"we",
"can",
"achieve",
"given",
"recall",
"guesses",
"using",
"the",
"optimal",
"monotonic",
"function"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L229-L238 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.fmeasure | public double fmeasure(int recall) {
int totaltaken = 0;
int rightIndex = numSamples() - 1; //next right candidate
int leftIndex = 0; //next left candidate
int tp = 0, fp = 0, fn = 0;
while (totaltaken < recall) {
double confr = Math.abs(scores[rightIndex] - .5);
double confl = Math.abs(scores[leftIndex] - .5);
int chosen = leftIndex;
if (confr > confl) {
chosen = rightIndex;
rightIndex--;
} else {
leftIndex++;
}
//System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen]));
if ((scores[chosen] >= .5)) {
if (classes[chosen] == 1) {
tp++;
} else {
fp++;
}
}
if ((scores[chosen] < .5)) {
if (classes[chosen] == 1) {
fn++;
}
}
totaltaken++;
}
return f1(tp, fp, fn);
} | java | public double fmeasure(int recall) {
int totaltaken = 0;
int rightIndex = numSamples() - 1; //next right candidate
int leftIndex = 0; //next left candidate
int tp = 0, fp = 0, fn = 0;
while (totaltaken < recall) {
double confr = Math.abs(scores[rightIndex] - .5);
double confl = Math.abs(scores[leftIndex] - .5);
int chosen = leftIndex;
if (confr > confl) {
chosen = rightIndex;
rightIndex--;
} else {
leftIndex++;
}
//System.err.println("chose "+chosen+" score "+scores[chosen]+" class "+classes[chosen]+" correct "+correct(scores[chosen],classes[chosen]));
if ((scores[chosen] >= .5)) {
if (classes[chosen] == 1) {
tp++;
} else {
fp++;
}
}
if ((scores[chosen] < .5)) {
if (classes[chosen] == 1) {
fn++;
}
}
totaltaken++;
}
return f1(tp, fp, fn);
} | [
"public",
"double",
"fmeasure",
"(",
"int",
"recall",
")",
"{",
"int",
"totaltaken",
"=",
"0",
";",
"int",
"rightIndex",
"=",
"numSamples",
"(",
")",
"-",
"1",
";",
"//next right candidate\r",
"int",
"leftIndex",
"=",
"0",
";",
"//next left candidate\r",
"int",
"tp",
"=",
"0",
",",
"fp",
"=",
"0",
",",
"fn",
"=",
"0",
";",
"while",
"(",
"totaltaken",
"<",
"recall",
")",
"{",
"double",
"confr",
"=",
"Math",
".",
"abs",
"(",
"scores",
"[",
"rightIndex",
"]",
"-",
".5",
")",
";",
"double",
"confl",
"=",
"Math",
".",
"abs",
"(",
"scores",
"[",
"leftIndex",
"]",
"-",
".5",
")",
";",
"int",
"chosen",
"=",
"leftIndex",
";",
"if",
"(",
"confr",
">",
"confl",
")",
"{",
"chosen",
"=",
"rightIndex",
";",
"rightIndex",
"--",
";",
"}",
"else",
"{",
"leftIndex",
"++",
";",
"}",
"//System.err.println(\"chose \"+chosen+\" score \"+scores[chosen]+\" class \"+classes[chosen]+\" correct \"+correct(scores[chosen],classes[chosen]));\r",
"if",
"(",
"(",
"scores",
"[",
"chosen",
"]",
">=",
".5",
")",
")",
"{",
"if",
"(",
"classes",
"[",
"chosen",
"]",
"==",
"1",
")",
"{",
"tp",
"++",
";",
"}",
"else",
"{",
"fp",
"++",
";",
"}",
"}",
"if",
"(",
"(",
"scores",
"[",
"chosen",
"]",
"<",
".5",
")",
")",
"{",
"if",
"(",
"classes",
"[",
"chosen",
"]",
"==",
"1",
")",
"{",
"fn",
"++",
";",
"}",
"}",
"totaltaken",
"++",
";",
"}",
"return",
"f1",
"(",
"tp",
",",
"fp",
",",
"fn",
")",
";",
"}"
] | what is the f-measure at this recall if we look at the score as the probability of class 1 given x
as if coming from logistic regression same as logPrecision but calculating f-measure
@param recall make this many guesses for which we are most confident | [
"what",
"is",
"the",
"f",
"-",
"measure",
"at",
"this",
"recall",
"if",
"we",
"look",
"at",
"the",
"score",
"as",
"the",
"probability",
"of",
"class",
"1",
"given",
"x",
"as",
"if",
"coming",
"from",
"logistic",
"regression",
"same",
"as",
"logPrecision",
"but",
"calculating",
"f",
"-",
"measure"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L250-L283 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.logLikelihood | public double logLikelihood() {
double loglik = 0;
for (int i = 0; i < scores.length; i++) {
loglik += Math.log(classes[i] == 0 ? 1 - scores[i] : scores[i]);
}
return loglik;
} | java | public double logLikelihood() {
double loglik = 0;
for (int i = 0; i < scores.length; i++) {
loglik += Math.log(classes[i] == 0 ? 1 - scores[i] : scores[i]);
}
return loglik;
} | [
"public",
"double",
"logLikelihood",
"(",
")",
"{",
"double",
"loglik",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"scores",
".",
"length",
";",
"i",
"++",
")",
"{",
"loglik",
"+=",
"Math",
".",
"log",
"(",
"classes",
"[",
"i",
"]",
"==",
"0",
"?",
"1",
"-",
"scores",
"[",
"i",
"]",
":",
"scores",
"[",
"i",
"]",
")",
";",
"}",
"return",
"loglik",
";",
"}"
] | assuming the scores are probability of 1 given x | [
"assuming",
"the",
"scores",
"are",
"probability",
"of",
"1",
"given",
"x"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L290-L296 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/PRCurve.java | PRCurve.optimalCwa | public double optimalCwa() {
double acc = 0;
for (int recall = 1; recall <= numSamples(); recall++) {
acc += precision(recall) / (double) recall;
}
return acc / numSamples();
} | java | public double optimalCwa() {
double acc = 0;
for (int recall = 1; recall <= numSamples(); recall++) {
acc += precision(recall) / (double) recall;
}
return acc / numSamples();
} | [
"public",
"double",
"optimalCwa",
"(",
")",
"{",
"double",
"acc",
"=",
"0",
";",
"for",
"(",
"int",
"recall",
"=",
"1",
";",
"recall",
"<=",
"numSamples",
"(",
")",
";",
"recall",
"++",
")",
"{",
"acc",
"+=",
"precision",
"(",
"recall",
")",
"/",
"(",
"double",
")",
"recall",
";",
"}",
"return",
"acc",
"/",
"numSamples",
"(",
")",
";",
"}"
] | optimal confidence weighted accuracy assuming for each recall we can fit an optimal monotonic function | [
"optimal",
"confidence",
"weighted",
"accuracy",
"assuming",
"for",
"each",
"recall",
"we",
"can",
"fit",
"an",
"optimal",
"monotonic",
"function"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/PRCurve.java#L338-L344 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nssimpleacl6_stats.java | nssimpleacl6_stats.get | public static nssimpleacl6_stats get(nitro_service service) throws Exception{
nssimpleacl6_stats obj = new nssimpleacl6_stats();
nssimpleacl6_stats[] response = (nssimpleacl6_stats[])obj.stat_resources(service);
return response[0];
} | java | public static nssimpleacl6_stats get(nitro_service service) throws Exception{
nssimpleacl6_stats obj = new nssimpleacl6_stats();
nssimpleacl6_stats[] response = (nssimpleacl6_stats[])obj.stat_resources(service);
return response[0];
} | [
"public",
"static",
"nssimpleacl6_stats",
"get",
"(",
"nitro_service",
"service",
")",
"throws",
"Exception",
"{",
"nssimpleacl6_stats",
"obj",
"=",
"new",
"nssimpleacl6_stats",
"(",
")",
";",
"nssimpleacl6_stats",
"[",
"]",
"response",
"=",
"(",
"nssimpleacl6_stats",
"[",
"]",
")",
"obj",
".",
"stat_resources",
"(",
"service",
")",
";",
"return",
"response",
"[",
"0",
"]",
";",
"}"
] | Use this API to fetch the statistics of all nssimpleacl6_stats resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"the",
"statistics",
"of",
"all",
"nssimpleacl6_stats",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nssimpleacl6_stats.java#L204-L208 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.getOperationFromReader | public static Pair<TregexPattern, TsurgeonPattern> getOperationFromReader(BufferedReader reader, TregexPatternCompiler compiler) throws IOException {
String patternString = getPatternFromFile(reader);
// System.err.println("Read tregex pattern: " + patternString);
if ("".equals(patternString)) {
return null;
}
TregexPattern matchPattern = compiler.compile(patternString);
TsurgeonPattern collectedPattern = getTsurgeonOperationsFromReader(reader);
return new Pair<TregexPattern,TsurgeonPattern>(matchPattern,collectedPattern);
} | java | public static Pair<TregexPattern, TsurgeonPattern> getOperationFromReader(BufferedReader reader, TregexPatternCompiler compiler) throws IOException {
String patternString = getPatternFromFile(reader);
// System.err.println("Read tregex pattern: " + patternString);
if ("".equals(patternString)) {
return null;
}
TregexPattern matchPattern = compiler.compile(patternString);
TsurgeonPattern collectedPattern = getTsurgeonOperationsFromReader(reader);
return new Pair<TregexPattern,TsurgeonPattern>(matchPattern,collectedPattern);
} | [
"public",
"static",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
"getOperationFromReader",
"(",
"BufferedReader",
"reader",
",",
"TregexPatternCompiler",
"compiler",
")",
"throws",
"IOException",
"{",
"String",
"patternString",
"=",
"getPatternFromFile",
"(",
"reader",
")",
";",
"// System.err.println(\"Read tregex pattern: \" + patternString);\r",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"patternString",
")",
")",
"{",
"return",
"null",
";",
"}",
"TregexPattern",
"matchPattern",
"=",
"compiler",
".",
"compile",
"(",
"patternString",
")",
";",
"TsurgeonPattern",
"collectedPattern",
"=",
"getTsurgeonOperationsFromReader",
"(",
"reader",
")",
";",
"return",
"new",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
"(",
"matchPattern",
",",
"collectedPattern",
")",
";",
"}"
] | Parses a tsurgeon script text input and compiles a tregex pattern and a list
of tsurgeon operations into a pair.
@param reader Reader to read patterns from
@return A pair of a tregex and tsurgeon pattern read from a file, or <code>null</code>
when the operations in the Reader have been exhausted
@throws IOException If any IO problem | [
"Parses",
"a",
"tsurgeon",
"script",
"text",
"input",
"and",
"compiles",
"a",
"tregex",
"pattern",
"and",
"a",
"list",
"of",
"tsurgeon",
"operations",
"into",
"a",
"pair",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L304-L314 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.getPatternFromFile | public static String getPatternFromFile(BufferedReader reader) throws IOException {
StringBuilder matchString = new StringBuilder();
for (String thisLine; (thisLine = reader.readLine()) != null; ) {
if (matchString.length() > 0 && emptyLinePattern.matcher(thisLine).matches()) {
// A blank line after getting some real content (not just comments or nothing)
break;
}
Matcher m = commentPattern.matcher(thisLine);
if (m.matches()) {
// delete it
thisLine = m.replaceFirst("");
}
if ( ! emptyLinePattern.matcher(thisLine).matches()) {
matchString.append(thisLine);
}
}
return matchString.toString();
} | java | public static String getPatternFromFile(BufferedReader reader) throws IOException {
StringBuilder matchString = new StringBuilder();
for (String thisLine; (thisLine = reader.readLine()) != null; ) {
if (matchString.length() > 0 && emptyLinePattern.matcher(thisLine).matches()) {
// A blank line after getting some real content (not just comments or nothing)
break;
}
Matcher m = commentPattern.matcher(thisLine);
if (m.matches()) {
// delete it
thisLine = m.replaceFirst("");
}
if ( ! emptyLinePattern.matcher(thisLine).matches()) {
matchString.append(thisLine);
}
}
return matchString.toString();
} | [
"public",
"static",
"String",
"getPatternFromFile",
"(",
"BufferedReader",
"reader",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"matchString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"thisLine",
";",
"(",
"thisLine",
"=",
"reader",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
";",
")",
"{",
"if",
"(",
"matchString",
".",
"length",
"(",
")",
">",
"0",
"&&",
"emptyLinePattern",
".",
"matcher",
"(",
"thisLine",
")",
".",
"matches",
"(",
")",
")",
"{",
"// A blank line after getting some real content (not just comments or nothing)\r",
"break",
";",
"}",
"Matcher",
"m",
"=",
"commentPattern",
".",
"matcher",
"(",
"thisLine",
")",
";",
"if",
"(",
"m",
".",
"matches",
"(",
")",
")",
"{",
"// delete it\r",
"thisLine",
"=",
"m",
".",
"replaceFirst",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"!",
"emptyLinePattern",
".",
"matcher",
"(",
"thisLine",
")",
".",
"matches",
"(",
")",
")",
"{",
"matchString",
".",
"append",
"(",
"thisLine",
")",
";",
"}",
"}",
"return",
"matchString",
".",
"toString",
"(",
")",
";",
"}"
] | Assumes that we are at the beginning of a tsurgeon script file and gets the string for the
tregex pattern leading the file
@return tregex pattern string | [
"Assumes",
"that",
"we",
"are",
"at",
"the",
"beginning",
"of",
"a",
"tsurgeon",
"script",
"file",
"and",
"gets",
"the",
"string",
"for",
"the",
"tregex",
"pattern",
"leading",
"the",
"file"
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L321-L338 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.getOperationsFromFile | public static List<Pair<TregexPattern, TsurgeonPattern>> getOperationsFromFile(String filename, String encoding, TregexPatternCompiler compiler) throws IOException {
List<Pair<TregexPattern,TsurgeonPattern>> operations = new ArrayList<Pair<TregexPattern, TsurgeonPattern>>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding));
for ( ; ; ) {
Pair<TregexPattern, TsurgeonPattern> operation = getOperationFromReader(reader, compiler);
if (operation == null) {
break;
}
operations.add(operation);
}
reader.close();
return operations;
} | java | public static List<Pair<TregexPattern, TsurgeonPattern>> getOperationsFromFile(String filename, String encoding, TregexPatternCompiler compiler) throws IOException {
List<Pair<TregexPattern,TsurgeonPattern>> operations = new ArrayList<Pair<TregexPattern, TsurgeonPattern>>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), encoding));
for ( ; ; ) {
Pair<TregexPattern, TsurgeonPattern> operation = getOperationFromReader(reader, compiler);
if (operation == null) {
break;
}
operations.add(operation);
}
reader.close();
return operations;
} | [
"public",
"static",
"List",
"<",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
">",
"getOperationsFromFile",
"(",
"String",
"filename",
",",
"String",
"encoding",
",",
"TregexPatternCompiler",
"compiler",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
">",
"operations",
"=",
"new",
"ArrayList",
"<",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
">",
"(",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"filename",
")",
",",
"encoding",
")",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
"operation",
"=",
"getOperationFromReader",
"(",
"reader",
",",
"compiler",
")",
";",
"if",
"(",
"operation",
"==",
"null",
")",
"{",
"break",
";",
"}",
"operations",
".",
"add",
"(",
"operation",
")",
";",
"}",
"reader",
".",
"close",
"(",
")",
";",
"return",
"operations",
";",
"}"
] | Parses a tsurgeon script file and compiles all operations in the file into a list
of pairs of tregex and tsurgeon patterns.
@param filename file containing the tsurgeon script
@return A pair of a tregex and tsurgeon pattern read from a file
@throws IOException If there is any I/O problem | [
"Parses",
"a",
"tsurgeon",
"script",
"file",
"and",
"compiles",
"all",
"operations",
"in",
"the",
"file",
"into",
"a",
"list",
"of",
"pairs",
"of",
"tregex",
"and",
"tsurgeon",
"patterns",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L400-L412 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.processPatternsOnTree | public static Tree processPatternsOnTree(List<Pair<TregexPattern, TsurgeonPattern>> ops, Tree t) {
matchedOnTree = false;
for (Pair<TregexPattern,TsurgeonPattern> op : ops) {
try {
if (DEBUG) {
System.err.println("Running pattern " + op.first());
}
TregexMatcher m = op.first().matcher(t);
while (m.find()) {
matchedOnTree = true;
t = op.second().evaluate(t,m);
if (t == null) {
return null;
}
m = op.first().matcher(t);
}
} catch (NullPointerException npe) {
throw new RuntimeException("Tsurgeon.processPatternsOnTree failed to match label for pattern: " + op.first() + ", " + op.second(), npe);
}
}
return t;
} | java | public static Tree processPatternsOnTree(List<Pair<TregexPattern, TsurgeonPattern>> ops, Tree t) {
matchedOnTree = false;
for (Pair<TregexPattern,TsurgeonPattern> op : ops) {
try {
if (DEBUG) {
System.err.println("Running pattern " + op.first());
}
TregexMatcher m = op.first().matcher(t);
while (m.find()) {
matchedOnTree = true;
t = op.second().evaluate(t,m);
if (t == null) {
return null;
}
m = op.first().matcher(t);
}
} catch (NullPointerException npe) {
throw new RuntimeException("Tsurgeon.processPatternsOnTree failed to match label for pattern: " + op.first() + ", " + op.second(), npe);
}
}
return t;
} | [
"public",
"static",
"Tree",
"processPatternsOnTree",
"(",
"List",
"<",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
">",
"ops",
",",
"Tree",
"t",
")",
"{",
"matchedOnTree",
"=",
"false",
";",
"for",
"(",
"Pair",
"<",
"TregexPattern",
",",
"TsurgeonPattern",
">",
"op",
":",
"ops",
")",
"{",
"try",
"{",
"if",
"(",
"DEBUG",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Running pattern \"",
"+",
"op",
".",
"first",
"(",
")",
")",
";",
"}",
"TregexMatcher",
"m",
"=",
"op",
".",
"first",
"(",
")",
".",
"matcher",
"(",
"t",
")",
";",
"while",
"(",
"m",
".",
"find",
"(",
")",
")",
"{",
"matchedOnTree",
"=",
"true",
";",
"t",
"=",
"op",
".",
"second",
"(",
")",
".",
"evaluate",
"(",
"t",
",",
"m",
")",
";",
"if",
"(",
"t",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"m",
"=",
"op",
".",
"first",
"(",
")",
".",
"matcher",
"(",
"t",
")",
";",
"}",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Tsurgeon.processPatternsOnTree failed to match label for pattern: \"",
"+",
"op",
".",
"first",
"(",
")",
"+",
"\", \"",
"+",
"op",
".",
"second",
"(",
")",
",",
"npe",
")",
";",
"}",
"}",
"return",
"t",
";",
"}"
] | hack-in field for seeing whether there was a match. | [
"hack",
"-",
"in",
"field",
"for",
"seeing",
"whether",
"there",
"was",
"a",
"match",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L448-L469 | train |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java | Tsurgeon.collectOperations | public static TsurgeonPattern collectOperations(List<TsurgeonPattern> patterns) {
return new TsurgeonPatternRoot(patterns.toArray(new TsurgeonPattern[patterns.size()]));
} | java | public static TsurgeonPattern collectOperations(List<TsurgeonPattern> patterns) {
return new TsurgeonPatternRoot(patterns.toArray(new TsurgeonPattern[patterns.size()]));
} | [
"public",
"static",
"TsurgeonPattern",
"collectOperations",
"(",
"List",
"<",
"TsurgeonPattern",
">",
"patterns",
")",
"{",
"return",
"new",
"TsurgeonPatternRoot",
"(",
"patterns",
".",
"toArray",
"(",
"new",
"TsurgeonPattern",
"[",
"patterns",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"}"
] | Collects a list of operation patterns into a sequence of operations to be applied. Required to keep track of global properties
across a sequence of operations. For example, if you want to insert a named node and then coindex it with another node,
you will need to collect the insertion and coindexation operations into a single TsurgeonPattern so that tsurgeon is aware
of the name of the new node and coindexation becomes possible.
@param patterns a list of {@link TsurgeonPattern} operations that you want to collect together into a single compound operation
@return a new {@link TsurgeonPattern} that performs all the operations in the sequence of the <code>patterns</code> argument | [
"Collects",
"a",
"list",
"of",
"operation",
"patterns",
"into",
"a",
"sequence",
"of",
"operations",
"to",
"be",
"applied",
".",
"Required",
"to",
"keep",
"track",
"of",
"global",
"properties",
"across",
"a",
"sequence",
"of",
"operations",
".",
"For",
"example",
"if",
"you",
"want",
"to",
"insert",
"a",
"named",
"node",
"and",
"then",
"coindex",
"it",
"with",
"another",
"node",
"you",
"will",
"need",
"to",
"collect",
"the",
"insertion",
"and",
"coindexation",
"operations",
"into",
"a",
"single",
"TsurgeonPattern",
"so",
"that",
"tsurgeon",
"is",
"aware",
"of",
"the",
"name",
"of",
"the",
"new",
"node",
"and",
"coindexation",
"becomes",
"possible",
"."
] | b3d44bab9ec07ace0d13612c448a6b7298c1f681 | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/tregex/tsurgeon/Tsurgeon.java#L507-L509 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnspolicylabel_stats.java | dnspolicylabel_stats.get | public static dnspolicylabel_stats[] get(nitro_service service, options option) throws Exception{
dnspolicylabel_stats obj = new dnspolicylabel_stats();
dnspolicylabel_stats[] response = (dnspolicylabel_stats[])obj.stat_resources(service,option);
return response;
} | java | public static dnspolicylabel_stats[] get(nitro_service service, options option) throws Exception{
dnspolicylabel_stats obj = new dnspolicylabel_stats();
dnspolicylabel_stats[] response = (dnspolicylabel_stats[])obj.stat_resources(service,option);
return response;
} | [
"public",
"static",
"dnspolicylabel_stats",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"options",
"option",
")",
"throws",
"Exception",
"{",
"dnspolicylabel_stats",
"obj",
"=",
"new",
"dnspolicylabel_stats",
"(",
")",
";",
"dnspolicylabel_stats",
"[",
"]",
"response",
"=",
"(",
"dnspolicylabel_stats",
"[",
"]",
")",
"obj",
".",
"stat_resources",
"(",
"service",
",",
"option",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch the statistics of all dnspolicylabel_stats resources that are configured on netscaler. | [
"Use",
"this",
"API",
"to",
"fetch",
"the",
"statistics",
"of",
"all",
"dnspolicylabel_stats",
"resources",
"that",
"are",
"configured",
"on",
"netscaler",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnspolicylabel_stats.java#L140-L144 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnspolicylabel_stats.java | dnspolicylabel_stats.get | public static dnspolicylabel_stats get(nitro_service service, String labelname) throws Exception{
dnspolicylabel_stats obj = new dnspolicylabel_stats();
obj.set_labelname(labelname);
dnspolicylabel_stats response = (dnspolicylabel_stats) obj.stat_resource(service);
return response;
} | java | public static dnspolicylabel_stats get(nitro_service service, String labelname) throws Exception{
dnspolicylabel_stats obj = new dnspolicylabel_stats();
obj.set_labelname(labelname);
dnspolicylabel_stats response = (dnspolicylabel_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"dnspolicylabel_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"dnspolicylabel_stats",
"obj",
"=",
"new",
"dnspolicylabel_stats",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"labelname",
")",
";",
"dnspolicylabel_stats",
"response",
"=",
"(",
"dnspolicylabel_stats",
")",
"obj",
".",
"stat_resource",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch statistics of dnspolicylabel_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"dnspolicylabel_stats",
"resource",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dns/dnspolicylabel_stats.java#L149-L154 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbvserver_domain_binding.java | gslbvserver_domain_binding.get | public static gslbvserver_domain_binding[] get(nitro_service service, String name) throws Exception{
gslbvserver_domain_binding obj = new gslbvserver_domain_binding();
obj.set_name(name);
gslbvserver_domain_binding response[] = (gslbvserver_domain_binding[]) obj.get_resources(service);
return response;
} | java | public static gslbvserver_domain_binding[] get(nitro_service service, String name) throws Exception{
gslbvserver_domain_binding obj = new gslbvserver_domain_binding();
obj.set_name(name);
gslbvserver_domain_binding response[] = (gslbvserver_domain_binding[]) obj.get_resources(service);
return response;
} | [
"public",
"static",
"gslbvserver_domain_binding",
"[",
"]",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"gslbvserver_domain_binding",
"obj",
"=",
"new",
"gslbvserver_domain_binding",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
";",
"gslbvserver_domain_binding",
"response",
"[",
"]",
"=",
"(",
"gslbvserver_domain_binding",
"[",
"]",
")",
"obj",
".",
"get_resources",
"(",
"service",
")",
";",
"return",
"response",
";",
"}"
] | Use this API to fetch gslbvserver_domain_binding resources of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"gslbvserver_domain_binding",
"resources",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/gslb/gslbvserver_domain_binding.java#L346-L351 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.add | public static base_response add(nitro_service client, nsip resource) throws Exception {
nsip addresource = new nsip();
addresource.ipaddress = resource.ipaddress;
addresource.netmask = resource.netmask;
addresource.type = resource.type;
addresource.arp = resource.arp;
addresource.icmp = resource.icmp;
addresource.vserver = resource.vserver;
addresource.telnet = resource.telnet;
addresource.ftp = resource.ftp;
addresource.gui = resource.gui;
addresource.ssh = resource.ssh;
addresource.snmp = resource.snmp;
addresource.mgmtaccess = resource.mgmtaccess;
addresource.restrictaccess = resource.restrictaccess;
addresource.dynamicrouting = resource.dynamicrouting;
addresource.ospf = resource.ospf;
addresource.bgp = resource.bgp;
addresource.rip = resource.rip;
addresource.hostroute = resource.hostroute;
addresource.hostrtgw = resource.hostrtgw;
addresource.metric = resource.metric;
addresource.vserverrhilevel = resource.vserverrhilevel;
addresource.ospflsatype = resource.ospflsatype;
addresource.ospfarea = resource.ospfarea;
addresource.state = resource.state;
addresource.vrid = resource.vrid;
addresource.icmpresponse = resource.icmpresponse;
addresource.ownernode = resource.ownernode;
addresource.arpresponse = resource.arpresponse;
addresource.td = resource.td;
return addresource.add_resource(client);
} | java | public static base_response add(nitro_service client, nsip resource) throws Exception {
nsip addresource = new nsip();
addresource.ipaddress = resource.ipaddress;
addresource.netmask = resource.netmask;
addresource.type = resource.type;
addresource.arp = resource.arp;
addresource.icmp = resource.icmp;
addresource.vserver = resource.vserver;
addresource.telnet = resource.telnet;
addresource.ftp = resource.ftp;
addresource.gui = resource.gui;
addresource.ssh = resource.ssh;
addresource.snmp = resource.snmp;
addresource.mgmtaccess = resource.mgmtaccess;
addresource.restrictaccess = resource.restrictaccess;
addresource.dynamicrouting = resource.dynamicrouting;
addresource.ospf = resource.ospf;
addresource.bgp = resource.bgp;
addresource.rip = resource.rip;
addresource.hostroute = resource.hostroute;
addresource.hostrtgw = resource.hostrtgw;
addresource.metric = resource.metric;
addresource.vserverrhilevel = resource.vserverrhilevel;
addresource.ospflsatype = resource.ospflsatype;
addresource.ospfarea = resource.ospfarea;
addresource.state = resource.state;
addresource.vrid = resource.vrid;
addresource.icmpresponse = resource.icmpresponse;
addresource.ownernode = resource.ownernode;
addresource.arpresponse = resource.arpresponse;
addresource.td = resource.td;
return addresource.add_resource(client);
} | [
"public",
"static",
"base_response",
"add",
"(",
"nitro_service",
"client",
",",
"nsip",
"resource",
")",
"throws",
"Exception",
"{",
"nsip",
"addresource",
"=",
"new",
"nsip",
"(",
")",
";",
"addresource",
".",
"ipaddress",
"=",
"resource",
".",
"ipaddress",
";",
"addresource",
".",
"netmask",
"=",
"resource",
".",
"netmask",
";",
"addresource",
".",
"type",
"=",
"resource",
".",
"type",
";",
"addresource",
".",
"arp",
"=",
"resource",
".",
"arp",
";",
"addresource",
".",
"icmp",
"=",
"resource",
".",
"icmp",
";",
"addresource",
".",
"vserver",
"=",
"resource",
".",
"vserver",
";",
"addresource",
".",
"telnet",
"=",
"resource",
".",
"telnet",
";",
"addresource",
".",
"ftp",
"=",
"resource",
".",
"ftp",
";",
"addresource",
".",
"gui",
"=",
"resource",
".",
"gui",
";",
"addresource",
".",
"ssh",
"=",
"resource",
".",
"ssh",
";",
"addresource",
".",
"snmp",
"=",
"resource",
".",
"snmp",
";",
"addresource",
".",
"mgmtaccess",
"=",
"resource",
".",
"mgmtaccess",
";",
"addresource",
".",
"restrictaccess",
"=",
"resource",
".",
"restrictaccess",
";",
"addresource",
".",
"dynamicrouting",
"=",
"resource",
".",
"dynamicrouting",
";",
"addresource",
".",
"ospf",
"=",
"resource",
".",
"ospf",
";",
"addresource",
".",
"bgp",
"=",
"resource",
".",
"bgp",
";",
"addresource",
".",
"rip",
"=",
"resource",
".",
"rip",
";",
"addresource",
".",
"hostroute",
"=",
"resource",
".",
"hostroute",
";",
"addresource",
".",
"hostrtgw",
"=",
"resource",
".",
"hostrtgw",
";",
"addresource",
".",
"metric",
"=",
"resource",
".",
"metric",
";",
"addresource",
".",
"vserverrhilevel",
"=",
"resource",
".",
"vserverrhilevel",
";",
"addresource",
".",
"ospflsatype",
"=",
"resource",
".",
"ospflsatype",
";",
"addresource",
".",
"ospfarea",
"=",
"resource",
".",
"ospfarea",
";",
"addresource",
".",
"state",
"=",
"resource",
".",
"state",
";",
"addresource",
".",
"vrid",
"=",
"resource",
".",
"vrid",
";",
"addresource",
".",
"icmpresponse",
"=",
"resource",
".",
"icmpresponse",
";",
"addresource",
".",
"ownernode",
"=",
"resource",
".",
"ownernode",
";",
"addresource",
".",
"arpresponse",
"=",
"resource",
".",
"arpresponse",
";",
"addresource",
".",
"td",
"=",
"resource",
".",
"td",
";",
"return",
"addresource",
".",
"add_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to add nsip. | [
"Use",
"this",
"API",
"to",
"add",
"nsip",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L785-L817 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.add | public static base_responses add(nitro_service client, nsip resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nsip addresources[] = new nsip[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new nsip();
addresources[i].ipaddress = resources[i].ipaddress;
addresources[i].netmask = resources[i].netmask;
addresources[i].type = resources[i].type;
addresources[i].arp = resources[i].arp;
addresources[i].icmp = resources[i].icmp;
addresources[i].vserver = resources[i].vserver;
addresources[i].telnet = resources[i].telnet;
addresources[i].ftp = resources[i].ftp;
addresources[i].gui = resources[i].gui;
addresources[i].ssh = resources[i].ssh;
addresources[i].snmp = resources[i].snmp;
addresources[i].mgmtaccess = resources[i].mgmtaccess;
addresources[i].restrictaccess = resources[i].restrictaccess;
addresources[i].dynamicrouting = resources[i].dynamicrouting;
addresources[i].ospf = resources[i].ospf;
addresources[i].bgp = resources[i].bgp;
addresources[i].rip = resources[i].rip;
addresources[i].hostroute = resources[i].hostroute;
addresources[i].hostrtgw = resources[i].hostrtgw;
addresources[i].metric = resources[i].metric;
addresources[i].vserverrhilevel = resources[i].vserverrhilevel;
addresources[i].ospflsatype = resources[i].ospflsatype;
addresources[i].ospfarea = resources[i].ospfarea;
addresources[i].state = resources[i].state;
addresources[i].vrid = resources[i].vrid;
addresources[i].icmpresponse = resources[i].icmpresponse;
addresources[i].ownernode = resources[i].ownernode;
addresources[i].arpresponse = resources[i].arpresponse;
addresources[i].td = resources[i].td;
}
result = add_bulk_request(client, addresources);
}
return result;
} | java | public static base_responses add(nitro_service client, nsip resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nsip addresources[] = new nsip[resources.length];
for (int i=0;i<resources.length;i++){
addresources[i] = new nsip();
addresources[i].ipaddress = resources[i].ipaddress;
addresources[i].netmask = resources[i].netmask;
addresources[i].type = resources[i].type;
addresources[i].arp = resources[i].arp;
addresources[i].icmp = resources[i].icmp;
addresources[i].vserver = resources[i].vserver;
addresources[i].telnet = resources[i].telnet;
addresources[i].ftp = resources[i].ftp;
addresources[i].gui = resources[i].gui;
addresources[i].ssh = resources[i].ssh;
addresources[i].snmp = resources[i].snmp;
addresources[i].mgmtaccess = resources[i].mgmtaccess;
addresources[i].restrictaccess = resources[i].restrictaccess;
addresources[i].dynamicrouting = resources[i].dynamicrouting;
addresources[i].ospf = resources[i].ospf;
addresources[i].bgp = resources[i].bgp;
addresources[i].rip = resources[i].rip;
addresources[i].hostroute = resources[i].hostroute;
addresources[i].hostrtgw = resources[i].hostrtgw;
addresources[i].metric = resources[i].metric;
addresources[i].vserverrhilevel = resources[i].vserverrhilevel;
addresources[i].ospflsatype = resources[i].ospflsatype;
addresources[i].ospfarea = resources[i].ospfarea;
addresources[i].state = resources[i].state;
addresources[i].vrid = resources[i].vrid;
addresources[i].icmpresponse = resources[i].icmpresponse;
addresources[i].ownernode = resources[i].ownernode;
addresources[i].arpresponse = resources[i].arpresponse;
addresources[i].td = resources[i].td;
}
result = add_bulk_request(client, addresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"add",
"(",
"nitro_service",
"client",
",",
"nsip",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"nsip",
"addresources",
"[",
"]",
"=",
"new",
"nsip",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"addresources",
"[",
"i",
"]",
"=",
"new",
"nsip",
"(",
")",
";",
"addresources",
"[",
"i",
"]",
".",
"ipaddress",
"=",
"resources",
"[",
"i",
"]",
".",
"ipaddress",
";",
"addresources",
"[",
"i",
"]",
".",
"netmask",
"=",
"resources",
"[",
"i",
"]",
".",
"netmask",
";",
"addresources",
"[",
"i",
"]",
".",
"type",
"=",
"resources",
"[",
"i",
"]",
".",
"type",
";",
"addresources",
"[",
"i",
"]",
".",
"arp",
"=",
"resources",
"[",
"i",
"]",
".",
"arp",
";",
"addresources",
"[",
"i",
"]",
".",
"icmp",
"=",
"resources",
"[",
"i",
"]",
".",
"icmp",
";",
"addresources",
"[",
"i",
"]",
".",
"vserver",
"=",
"resources",
"[",
"i",
"]",
".",
"vserver",
";",
"addresources",
"[",
"i",
"]",
".",
"telnet",
"=",
"resources",
"[",
"i",
"]",
".",
"telnet",
";",
"addresources",
"[",
"i",
"]",
".",
"ftp",
"=",
"resources",
"[",
"i",
"]",
".",
"ftp",
";",
"addresources",
"[",
"i",
"]",
".",
"gui",
"=",
"resources",
"[",
"i",
"]",
".",
"gui",
";",
"addresources",
"[",
"i",
"]",
".",
"ssh",
"=",
"resources",
"[",
"i",
"]",
".",
"ssh",
";",
"addresources",
"[",
"i",
"]",
".",
"snmp",
"=",
"resources",
"[",
"i",
"]",
".",
"snmp",
";",
"addresources",
"[",
"i",
"]",
".",
"mgmtaccess",
"=",
"resources",
"[",
"i",
"]",
".",
"mgmtaccess",
";",
"addresources",
"[",
"i",
"]",
".",
"restrictaccess",
"=",
"resources",
"[",
"i",
"]",
".",
"restrictaccess",
";",
"addresources",
"[",
"i",
"]",
".",
"dynamicrouting",
"=",
"resources",
"[",
"i",
"]",
".",
"dynamicrouting",
";",
"addresources",
"[",
"i",
"]",
".",
"ospf",
"=",
"resources",
"[",
"i",
"]",
".",
"ospf",
";",
"addresources",
"[",
"i",
"]",
".",
"bgp",
"=",
"resources",
"[",
"i",
"]",
".",
"bgp",
";",
"addresources",
"[",
"i",
"]",
".",
"rip",
"=",
"resources",
"[",
"i",
"]",
".",
"rip",
";",
"addresources",
"[",
"i",
"]",
".",
"hostroute",
"=",
"resources",
"[",
"i",
"]",
".",
"hostroute",
";",
"addresources",
"[",
"i",
"]",
".",
"hostrtgw",
"=",
"resources",
"[",
"i",
"]",
".",
"hostrtgw",
";",
"addresources",
"[",
"i",
"]",
".",
"metric",
"=",
"resources",
"[",
"i",
"]",
".",
"metric",
";",
"addresources",
"[",
"i",
"]",
".",
"vserverrhilevel",
"=",
"resources",
"[",
"i",
"]",
".",
"vserverrhilevel",
";",
"addresources",
"[",
"i",
"]",
".",
"ospflsatype",
"=",
"resources",
"[",
"i",
"]",
".",
"ospflsatype",
";",
"addresources",
"[",
"i",
"]",
".",
"ospfarea",
"=",
"resources",
"[",
"i",
"]",
".",
"ospfarea",
";",
"addresources",
"[",
"i",
"]",
".",
"state",
"=",
"resources",
"[",
"i",
"]",
".",
"state",
";",
"addresources",
"[",
"i",
"]",
".",
"vrid",
"=",
"resources",
"[",
"i",
"]",
".",
"vrid",
";",
"addresources",
"[",
"i",
"]",
".",
"icmpresponse",
"=",
"resources",
"[",
"i",
"]",
".",
"icmpresponse",
";",
"addresources",
"[",
"i",
"]",
".",
"ownernode",
"=",
"resources",
"[",
"i",
"]",
".",
"ownernode",
";",
"addresources",
"[",
"i",
"]",
".",
"arpresponse",
"=",
"resources",
"[",
"i",
"]",
".",
"arpresponse",
";",
"addresources",
"[",
"i",
"]",
".",
"td",
"=",
"resources",
"[",
"i",
"]",
".",
"td",
";",
"}",
"result",
"=",
"add_bulk_request",
"(",
"client",
",",
"addresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to add nsip resources. | [
"Use",
"this",
"API",
"to",
"add",
"nsip",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L822-L861 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.delete | public static base_response delete(nitro_service client, nsip resource) throws Exception {
nsip deleteresource = new nsip();
deleteresource.ipaddress = resource.ipaddress;
deleteresource.td = resource.td;
return deleteresource.delete_resource(client);
} | java | public static base_response delete(nitro_service client, nsip resource) throws Exception {
nsip deleteresource = new nsip();
deleteresource.ipaddress = resource.ipaddress;
deleteresource.td = resource.td;
return deleteresource.delete_resource(client);
} | [
"public",
"static",
"base_response",
"delete",
"(",
"nitro_service",
"client",
",",
"nsip",
"resource",
")",
"throws",
"Exception",
"{",
"nsip",
"deleteresource",
"=",
"new",
"nsip",
"(",
")",
";",
"deleteresource",
".",
"ipaddress",
"=",
"resource",
".",
"ipaddress",
";",
"deleteresource",
".",
"td",
"=",
"resource",
".",
"td",
";",
"return",
"deleteresource",
".",
"delete_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to delete nsip. | [
"Use",
"this",
"API",
"to",
"delete",
"nsip",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L875-L880 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.update | public static base_response update(nitro_service client, nsip resource) throws Exception {
nsip updateresource = new nsip();
updateresource.ipaddress = resource.ipaddress;
updateresource.td = resource.td;
updateresource.netmask = resource.netmask;
updateresource.arp = resource.arp;
updateresource.icmp = resource.icmp;
updateresource.vserver = resource.vserver;
updateresource.telnet = resource.telnet;
updateresource.ftp = resource.ftp;
updateresource.gui = resource.gui;
updateresource.ssh = resource.ssh;
updateresource.snmp = resource.snmp;
updateresource.mgmtaccess = resource.mgmtaccess;
updateresource.restrictaccess = resource.restrictaccess;
updateresource.dynamicrouting = resource.dynamicrouting;
updateresource.ospf = resource.ospf;
updateresource.bgp = resource.bgp;
updateresource.rip = resource.rip;
updateresource.hostroute = resource.hostroute;
updateresource.hostrtgw = resource.hostrtgw;
updateresource.metric = resource.metric;
updateresource.vserverrhilevel = resource.vserverrhilevel;
updateresource.ospflsatype = resource.ospflsatype;
updateresource.ospfarea = resource.ospfarea;
updateresource.vrid = resource.vrid;
updateresource.icmpresponse = resource.icmpresponse;
updateresource.arpresponse = resource.arpresponse;
return updateresource.update_resource(client);
} | java | public static base_response update(nitro_service client, nsip resource) throws Exception {
nsip updateresource = new nsip();
updateresource.ipaddress = resource.ipaddress;
updateresource.td = resource.td;
updateresource.netmask = resource.netmask;
updateresource.arp = resource.arp;
updateresource.icmp = resource.icmp;
updateresource.vserver = resource.vserver;
updateresource.telnet = resource.telnet;
updateresource.ftp = resource.ftp;
updateresource.gui = resource.gui;
updateresource.ssh = resource.ssh;
updateresource.snmp = resource.snmp;
updateresource.mgmtaccess = resource.mgmtaccess;
updateresource.restrictaccess = resource.restrictaccess;
updateresource.dynamicrouting = resource.dynamicrouting;
updateresource.ospf = resource.ospf;
updateresource.bgp = resource.bgp;
updateresource.rip = resource.rip;
updateresource.hostroute = resource.hostroute;
updateresource.hostrtgw = resource.hostrtgw;
updateresource.metric = resource.metric;
updateresource.vserverrhilevel = resource.vserverrhilevel;
updateresource.ospflsatype = resource.ospflsatype;
updateresource.ospfarea = resource.ospfarea;
updateresource.vrid = resource.vrid;
updateresource.icmpresponse = resource.icmpresponse;
updateresource.arpresponse = resource.arpresponse;
return updateresource.update_resource(client);
} | [
"public",
"static",
"base_response",
"update",
"(",
"nitro_service",
"client",
",",
"nsip",
"resource",
")",
"throws",
"Exception",
"{",
"nsip",
"updateresource",
"=",
"new",
"nsip",
"(",
")",
";",
"updateresource",
".",
"ipaddress",
"=",
"resource",
".",
"ipaddress",
";",
"updateresource",
".",
"td",
"=",
"resource",
".",
"td",
";",
"updateresource",
".",
"netmask",
"=",
"resource",
".",
"netmask",
";",
"updateresource",
".",
"arp",
"=",
"resource",
".",
"arp",
";",
"updateresource",
".",
"icmp",
"=",
"resource",
".",
"icmp",
";",
"updateresource",
".",
"vserver",
"=",
"resource",
".",
"vserver",
";",
"updateresource",
".",
"telnet",
"=",
"resource",
".",
"telnet",
";",
"updateresource",
".",
"ftp",
"=",
"resource",
".",
"ftp",
";",
"updateresource",
".",
"gui",
"=",
"resource",
".",
"gui",
";",
"updateresource",
".",
"ssh",
"=",
"resource",
".",
"ssh",
";",
"updateresource",
".",
"snmp",
"=",
"resource",
".",
"snmp",
";",
"updateresource",
".",
"mgmtaccess",
"=",
"resource",
".",
"mgmtaccess",
";",
"updateresource",
".",
"restrictaccess",
"=",
"resource",
".",
"restrictaccess",
";",
"updateresource",
".",
"dynamicrouting",
"=",
"resource",
".",
"dynamicrouting",
";",
"updateresource",
".",
"ospf",
"=",
"resource",
".",
"ospf",
";",
"updateresource",
".",
"bgp",
"=",
"resource",
".",
"bgp",
";",
"updateresource",
".",
"rip",
"=",
"resource",
".",
"rip",
";",
"updateresource",
".",
"hostroute",
"=",
"resource",
".",
"hostroute",
";",
"updateresource",
".",
"hostrtgw",
"=",
"resource",
".",
"hostrtgw",
";",
"updateresource",
".",
"metric",
"=",
"resource",
".",
"metric",
";",
"updateresource",
".",
"vserverrhilevel",
"=",
"resource",
".",
"vserverrhilevel",
";",
"updateresource",
".",
"ospflsatype",
"=",
"resource",
".",
"ospflsatype",
";",
"updateresource",
".",
"ospfarea",
"=",
"resource",
".",
"ospfarea",
";",
"updateresource",
".",
"vrid",
"=",
"resource",
".",
"vrid",
";",
"updateresource",
".",
"icmpresponse",
"=",
"resource",
".",
"icmpresponse",
";",
"updateresource",
".",
"arpresponse",
"=",
"resource",
".",
"arpresponse",
";",
"return",
"updateresource",
".",
"update_resource",
"(",
"client",
")",
";",
"}"
] | Use this API to update nsip. | [
"Use",
"this",
"API",
"to",
"update",
"nsip",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L918-L947 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.update | public static base_responses update(nitro_service client, nsip resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nsip updateresources[] = new nsip[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new nsip();
updateresources[i].ipaddress = resources[i].ipaddress;
updateresources[i].td = resources[i].td;
updateresources[i].netmask = resources[i].netmask;
updateresources[i].arp = resources[i].arp;
updateresources[i].icmp = resources[i].icmp;
updateresources[i].vserver = resources[i].vserver;
updateresources[i].telnet = resources[i].telnet;
updateresources[i].ftp = resources[i].ftp;
updateresources[i].gui = resources[i].gui;
updateresources[i].ssh = resources[i].ssh;
updateresources[i].snmp = resources[i].snmp;
updateresources[i].mgmtaccess = resources[i].mgmtaccess;
updateresources[i].restrictaccess = resources[i].restrictaccess;
updateresources[i].dynamicrouting = resources[i].dynamicrouting;
updateresources[i].ospf = resources[i].ospf;
updateresources[i].bgp = resources[i].bgp;
updateresources[i].rip = resources[i].rip;
updateresources[i].hostroute = resources[i].hostroute;
updateresources[i].hostrtgw = resources[i].hostrtgw;
updateresources[i].metric = resources[i].metric;
updateresources[i].vserverrhilevel = resources[i].vserverrhilevel;
updateresources[i].ospflsatype = resources[i].ospflsatype;
updateresources[i].ospfarea = resources[i].ospfarea;
updateresources[i].vrid = resources[i].vrid;
updateresources[i].icmpresponse = resources[i].icmpresponse;
updateresources[i].arpresponse = resources[i].arpresponse;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | java | public static base_responses update(nitro_service client, nsip resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
nsip updateresources[] = new nsip[resources.length];
for (int i=0;i<resources.length;i++){
updateresources[i] = new nsip();
updateresources[i].ipaddress = resources[i].ipaddress;
updateresources[i].td = resources[i].td;
updateresources[i].netmask = resources[i].netmask;
updateresources[i].arp = resources[i].arp;
updateresources[i].icmp = resources[i].icmp;
updateresources[i].vserver = resources[i].vserver;
updateresources[i].telnet = resources[i].telnet;
updateresources[i].ftp = resources[i].ftp;
updateresources[i].gui = resources[i].gui;
updateresources[i].ssh = resources[i].ssh;
updateresources[i].snmp = resources[i].snmp;
updateresources[i].mgmtaccess = resources[i].mgmtaccess;
updateresources[i].restrictaccess = resources[i].restrictaccess;
updateresources[i].dynamicrouting = resources[i].dynamicrouting;
updateresources[i].ospf = resources[i].ospf;
updateresources[i].bgp = resources[i].bgp;
updateresources[i].rip = resources[i].rip;
updateresources[i].hostroute = resources[i].hostroute;
updateresources[i].hostrtgw = resources[i].hostrtgw;
updateresources[i].metric = resources[i].metric;
updateresources[i].vserverrhilevel = resources[i].vserverrhilevel;
updateresources[i].ospflsatype = resources[i].ospflsatype;
updateresources[i].ospfarea = resources[i].ospfarea;
updateresources[i].vrid = resources[i].vrid;
updateresources[i].icmpresponse = resources[i].icmpresponse;
updateresources[i].arpresponse = resources[i].arpresponse;
}
result = update_bulk_request(client, updateresources);
}
return result;
} | [
"public",
"static",
"base_responses",
"update",
"(",
"nitro_service",
"client",
",",
"nsip",
"resources",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"resources",
"!=",
"null",
"&&",
"resources",
".",
"length",
">",
"0",
")",
"{",
"nsip",
"updateresources",
"[",
"]",
"=",
"new",
"nsip",
"[",
"resources",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"resources",
".",
"length",
";",
"i",
"++",
")",
"{",
"updateresources",
"[",
"i",
"]",
"=",
"new",
"nsip",
"(",
")",
";",
"updateresources",
"[",
"i",
"]",
".",
"ipaddress",
"=",
"resources",
"[",
"i",
"]",
".",
"ipaddress",
";",
"updateresources",
"[",
"i",
"]",
".",
"td",
"=",
"resources",
"[",
"i",
"]",
".",
"td",
";",
"updateresources",
"[",
"i",
"]",
".",
"netmask",
"=",
"resources",
"[",
"i",
"]",
".",
"netmask",
";",
"updateresources",
"[",
"i",
"]",
".",
"arp",
"=",
"resources",
"[",
"i",
"]",
".",
"arp",
";",
"updateresources",
"[",
"i",
"]",
".",
"icmp",
"=",
"resources",
"[",
"i",
"]",
".",
"icmp",
";",
"updateresources",
"[",
"i",
"]",
".",
"vserver",
"=",
"resources",
"[",
"i",
"]",
".",
"vserver",
";",
"updateresources",
"[",
"i",
"]",
".",
"telnet",
"=",
"resources",
"[",
"i",
"]",
".",
"telnet",
";",
"updateresources",
"[",
"i",
"]",
".",
"ftp",
"=",
"resources",
"[",
"i",
"]",
".",
"ftp",
";",
"updateresources",
"[",
"i",
"]",
".",
"gui",
"=",
"resources",
"[",
"i",
"]",
".",
"gui",
";",
"updateresources",
"[",
"i",
"]",
".",
"ssh",
"=",
"resources",
"[",
"i",
"]",
".",
"ssh",
";",
"updateresources",
"[",
"i",
"]",
".",
"snmp",
"=",
"resources",
"[",
"i",
"]",
".",
"snmp",
";",
"updateresources",
"[",
"i",
"]",
".",
"mgmtaccess",
"=",
"resources",
"[",
"i",
"]",
".",
"mgmtaccess",
";",
"updateresources",
"[",
"i",
"]",
".",
"restrictaccess",
"=",
"resources",
"[",
"i",
"]",
".",
"restrictaccess",
";",
"updateresources",
"[",
"i",
"]",
".",
"dynamicrouting",
"=",
"resources",
"[",
"i",
"]",
".",
"dynamicrouting",
";",
"updateresources",
"[",
"i",
"]",
".",
"ospf",
"=",
"resources",
"[",
"i",
"]",
".",
"ospf",
";",
"updateresources",
"[",
"i",
"]",
".",
"bgp",
"=",
"resources",
"[",
"i",
"]",
".",
"bgp",
";",
"updateresources",
"[",
"i",
"]",
".",
"rip",
"=",
"resources",
"[",
"i",
"]",
".",
"rip",
";",
"updateresources",
"[",
"i",
"]",
".",
"hostroute",
"=",
"resources",
"[",
"i",
"]",
".",
"hostroute",
";",
"updateresources",
"[",
"i",
"]",
".",
"hostrtgw",
"=",
"resources",
"[",
"i",
"]",
".",
"hostrtgw",
";",
"updateresources",
"[",
"i",
"]",
".",
"metric",
"=",
"resources",
"[",
"i",
"]",
".",
"metric",
";",
"updateresources",
"[",
"i",
"]",
".",
"vserverrhilevel",
"=",
"resources",
"[",
"i",
"]",
".",
"vserverrhilevel",
";",
"updateresources",
"[",
"i",
"]",
".",
"ospflsatype",
"=",
"resources",
"[",
"i",
"]",
".",
"ospflsatype",
";",
"updateresources",
"[",
"i",
"]",
".",
"ospfarea",
"=",
"resources",
"[",
"i",
"]",
".",
"ospfarea",
";",
"updateresources",
"[",
"i",
"]",
".",
"vrid",
"=",
"resources",
"[",
"i",
"]",
".",
"vrid",
";",
"updateresources",
"[",
"i",
"]",
".",
"icmpresponse",
"=",
"resources",
"[",
"i",
"]",
".",
"icmpresponse",
";",
"updateresources",
"[",
"i",
"]",
".",
"arpresponse",
"=",
"resources",
"[",
"i",
"]",
".",
"arpresponse",
";",
"}",
"result",
"=",
"update_bulk_request",
"(",
"client",
",",
"updateresources",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to update nsip resources. | [
"Use",
"this",
"API",
"to",
"update",
"nsip",
"resources",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L952-L988 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.unset | public static base_response unset(nitro_service client, nsip resource, String[] args) throws Exception{
nsip unsetresource = new nsip();
unsetresource.ipaddress = resource.ipaddress;
unsetresource.td = resource.td;
return unsetresource.unset_resource(client,args);
} | java | public static base_response unset(nitro_service client, nsip resource, String[] args) throws Exception{
nsip unsetresource = new nsip();
unsetresource.ipaddress = resource.ipaddress;
unsetresource.td = resource.td;
return unsetresource.unset_resource(client,args);
} | [
"public",
"static",
"base_response",
"unset",
"(",
"nitro_service",
"client",
",",
"nsip",
"resource",
",",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"nsip",
"unsetresource",
"=",
"new",
"nsip",
"(",
")",
";",
"unsetresource",
".",
"ipaddress",
"=",
"resource",
".",
"ipaddress",
";",
"unsetresource",
".",
"td",
"=",
"resource",
".",
"td",
";",
"return",
"unsetresource",
".",
"unset_resource",
"(",
"client",
",",
"args",
")",
";",
"}"
] | Use this API to unset the properties of nsip resource.
Properties that need to be unset are specified in args array. | [
"Use",
"this",
"API",
"to",
"unset",
"the",
"properties",
"of",
"nsip",
"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/ns/nsip.java#L994-L999 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.enable | public static base_response enable(nitro_service client, String ipaddress) throws Exception {
nsip enableresource = new nsip();
enableresource.ipaddress = ipaddress;
return enableresource.perform_operation(client,"enable");
} | java | public static base_response enable(nitro_service client, String ipaddress) throws Exception {
nsip enableresource = new nsip();
enableresource.ipaddress = ipaddress;
return enableresource.perform_operation(client,"enable");
} | [
"public",
"static",
"base_response",
"enable",
"(",
"nitro_service",
"client",
",",
"String",
"ipaddress",
")",
"throws",
"Exception",
"{",
"nsip",
"enableresource",
"=",
"new",
"nsip",
"(",
")",
";",
"enableresource",
".",
"ipaddress",
"=",
"ipaddress",
";",
"return",
"enableresource",
".",
"perform_operation",
"(",
"client",
",",
"\"enable\"",
")",
";",
"}"
] | Use this API to enable nsip of given name. | [
"Use",
"this",
"API",
"to",
"enable",
"nsip",
"of",
"given",
"name",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L1039-L1043 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.enable | public static base_response enable(nitro_service client, nsip resource) throws Exception {
nsip enableresource = new nsip();
enableresource.ipaddress = resource.ipaddress;
enableresource.td = resource.td;
return enableresource.perform_operation(client,"enable");
} | java | public static base_response enable(nitro_service client, nsip resource) throws Exception {
nsip enableresource = new nsip();
enableresource.ipaddress = resource.ipaddress;
enableresource.td = resource.td;
return enableresource.perform_operation(client,"enable");
} | [
"public",
"static",
"base_response",
"enable",
"(",
"nitro_service",
"client",
",",
"nsip",
"resource",
")",
"throws",
"Exception",
"{",
"nsip",
"enableresource",
"=",
"new",
"nsip",
"(",
")",
";",
"enableresource",
".",
"ipaddress",
"=",
"resource",
".",
"ipaddress",
";",
"enableresource",
".",
"td",
"=",
"resource",
".",
"td",
";",
"return",
"enableresource",
".",
"perform_operation",
"(",
"client",
",",
"\"enable\"",
")",
";",
"}"
] | Use this API to enable nsip. | [
"Use",
"this",
"API",
"to",
"enable",
"nsip",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L1048-L1053 | train |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java | nsip.enable | public static base_responses enable(nitro_service client, String ipaddress[]) throws Exception {
base_responses result = null;
if (ipaddress != null && ipaddress.length > 0) {
nsip enableresources[] = new nsip[ipaddress.length];
for (int i=0;i<ipaddress.length;i++){
enableresources[i] = new nsip();
enableresources[i].ipaddress = ipaddress[i];
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | java | public static base_responses enable(nitro_service client, String ipaddress[]) throws Exception {
base_responses result = null;
if (ipaddress != null && ipaddress.length > 0) {
nsip enableresources[] = new nsip[ipaddress.length];
for (int i=0;i<ipaddress.length;i++){
enableresources[i] = new nsip();
enableresources[i].ipaddress = ipaddress[i];
}
result = perform_operation_bulk_request(client, enableresources,"enable");
}
return result;
} | [
"public",
"static",
"base_responses",
"enable",
"(",
"nitro_service",
"client",
",",
"String",
"ipaddress",
"[",
"]",
")",
"throws",
"Exception",
"{",
"base_responses",
"result",
"=",
"null",
";",
"if",
"(",
"ipaddress",
"!=",
"null",
"&&",
"ipaddress",
".",
"length",
">",
"0",
")",
"{",
"nsip",
"enableresources",
"[",
"]",
"=",
"new",
"nsip",
"[",
"ipaddress",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ipaddress",
".",
"length",
";",
"i",
"++",
")",
"{",
"enableresources",
"[",
"i",
"]",
"=",
"new",
"nsip",
"(",
")",
";",
"enableresources",
"[",
"i",
"]",
".",
"ipaddress",
"=",
"ipaddress",
"[",
"i",
"]",
";",
"}",
"result",
"=",
"perform_operation_bulk_request",
"(",
"client",
",",
"enableresources",
",",
"\"enable\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] | Use this API to enable nsip resources of given names. | [
"Use",
"this",
"API",
"to",
"enable",
"nsip",
"resources",
"of",
"given",
"names",
"."
] | 2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4 | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nsip.java#L1058-L1069 | train |
Subsets and Splits