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 list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/listeners/AddResourcesListener.java | AddResourcesListener.addDatatablesResourceIfNecessary | public static void addDatatablesResourceIfNecessary(String defaultFilename, String type) {
boolean loadDatatables = shouldLibraryBeLoaded(P_GET_DATATABLE_FROM_CDN, true);
// Do we have to add datatables.min.{css|js}, or are the resources already there?
FacesContext context = FacesContext.getCurrentInstance();
U... | java | public static void addDatatablesResourceIfNecessary(String defaultFilename, String type) {
boolean loadDatatables = shouldLibraryBeLoaded(P_GET_DATATABLE_FROM_CDN, true);
// Do we have to add datatables.min.{css|js}, or are the resources already there?
FacesContext context = FacesContext.getCurrentInstance();
U... | [
"public",
"static",
"void",
"addDatatablesResourceIfNecessary",
"(",
"String",
"defaultFilename",
",",
"String",
"type",
")",
"{",
"boolean",
"loadDatatables",
"=",
"shouldLibraryBeLoaded",
"(",
"P_GET_DATATABLE_FROM_CDN",
",",
"true",
")",
";",
"// Do we have to add data... | Add the default datatables.net resource if and only if the user doesn't bring
their own copy, and if they didn't disallow it in the web.xml by setting the
context paramter net.bootsfaces.get_datatable_from_cdn to true.
@param defaultFilename The URL of the file to be loaded
@param type either "js" or "css" | [
"Add",
"the",
"default",
"datatables",
".",
"net",
"resource",
"if",
"and",
"only",
"if",
"the",
"user",
"doesn",
"t",
"bring",
"their",
"own",
"copy",
"and",
"if",
"they",
"didn",
"t",
"disallow",
"it",
"in",
"the",
"web",
".",
"xml",
"by",
"setting",... | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/listeners/AddResourcesListener.java#L957-L984 | train |
TheCoder4eu/BootsFaces-OSP | src/main/joda/ValueExpressionHelper.java | ValueExpressionHelper.getValueType | public static Class<?> getValueType(FacesContext context, UIComponent uiComponent, Collection<Class<?>> validTypes) {
Class<?> valueType = getValueType(context, uiComponent);
if (valueType != null && isValid(validTypes, valueType)) {
return valueType;
}
else {
for (UIComponent child : uiComponent.getChild... | java | public static Class<?> getValueType(FacesContext context, UIComponent uiComponent, Collection<Class<?>> validTypes) {
Class<?> valueType = getValueType(context, uiComponent);
if (valueType != null && isValid(validTypes, valueType)) {
return valueType;
}
else {
for (UIComponent child : uiComponent.getChild... | [
"public",
"static",
"Class",
"<",
"?",
">",
"getValueType",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"uiComponent",
",",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"validTypes",
")",
"{",
"Class",
"<",
"?",
">",
"valueType",
"=",
"getValueT... | Source adapted from Seam's enumConverter. The goal is to get the type to which this component's value is bound.
First, check if the valueExpression provides the type. For dropdown-like components, this may not work, so check
for SelectItems children.
@param context the current FacesContext
@param uiComponent
@param va... | [
"Source",
"adapted",
"from",
"Seam",
"s",
"enumConverter",
".",
"The",
"goal",
"is",
"to",
"get",
"the",
"type",
"to",
"which",
"this",
"component",
"s",
"value",
"is",
"bound",
".",
"First",
"check",
"if",
"the",
"valueExpression",
"provides",
"the",
"typ... | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/joda/ValueExpressionHelper.java#L21-L47 | train |
TheCoder4eu/BootsFaces-OSP | src/main/joda/ValueExpressionHelper.java | ValueExpressionHelper.getValueType | public static Class<?> getValueType(FacesContext context, UIComponent comp) {
ValueExpression expr = comp.getValueExpression("value");
Class<?> valueType = expr == null ? null : expr.getType(context.getELContext());
return valueType;
} | java | public static Class<?> getValueType(FacesContext context, UIComponent comp) {
ValueExpression expr = comp.getValueExpression("value");
Class<?> valueType = expr == null ? null : expr.getType(context.getELContext());
return valueType;
} | [
"public",
"static",
"Class",
"<",
"?",
">",
"getValueType",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"comp",
")",
"{",
"ValueExpression",
"expr",
"=",
"comp",
".",
"getValueExpression",
"(",
"\"value\"",
")",
";",
"Class",
"<",
"?",
">",
"valueTyp... | return the type for the "value" attribute of the given component, if it exists. Return null otherwise.
@param context
@param comp
@return | [
"return",
"the",
"type",
"for",
"the",
"value",
"attribute",
"of",
"the",
"given",
"component",
"if",
"it",
"exists",
".",
"Return",
"null",
"otherwise",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/joda/ValueExpressionHelper.java#L55-L59 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/slider2/Slider2Renderer.java | Slider2Renderer.removeMisleadingType | @SuppressWarnings("rawtypes")
private void removeMisleadingType(Slider2 slider) {
try {
Method method = getClass().getMethod("getPassThroughAttributes", (Class[]) null);
if (null != method) {
Object map = method.invoke(this, (Object[]) null);
if (null != map) {
Map attributes = (Map) map;
if ... | java | @SuppressWarnings("rawtypes")
private void removeMisleadingType(Slider2 slider) {
try {
Method method = getClass().getMethod("getPassThroughAttributes", (Class[]) null);
if (null != method) {
Object map = method.invoke(this, (Object[]) null);
if (null != map) {
Map attributes = (Map) map;
if ... | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"void",
"removeMisleadingType",
"(",
"Slider2",
"slider",
")",
"{",
"try",
"{",
"Method",
"method",
"=",
"getClass",
"(",
")",
".",
"getMethod",
"(",
"\"getPassThroughAttributes\"",
",",
"(",
"Class",... | remove wrong type information that may have been added by AngularFaces | [
"remove",
"wrong",
"type",
"information",
"that",
"may",
"have",
"been",
"added",
"by",
"AngularFaces"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider2/Slider2Renderer.java#L319-L335 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java | SelectMultiMenuRenderer.createSelectItem | protected SelectItem createSelectItem(FacesContext context, UISelectItems uiSelectItems, Object value,
Object label) {
String var = (String) uiSelectItems.getAttributes().get("var");
Map<String, Object> attrs = uiSelectItems.getAttributes();
Map<String, Object> requestMap = context.getExternalContext().getRequ... | java | protected SelectItem createSelectItem(FacesContext context, UISelectItems uiSelectItems, Object value,
Object label) {
String var = (String) uiSelectItems.getAttributes().get("var");
Map<String, Object> attrs = uiSelectItems.getAttributes();
Map<String, Object> requestMap = context.getExternalContext().getRequ... | [
"protected",
"SelectItem",
"createSelectItem",
"(",
"FacesContext",
"context",
",",
"UISelectItems",
"uiSelectItems",
",",
"Object",
"value",
",",
"Object",
"label",
")",
"{",
"String",
"var",
"=",
"(",
"String",
")",
"uiSelectItems",
".",
"getAttributes",
"(",
... | Copied from the InputRenderer class of PrimeFaces 5.1.
@param context
@param uiSelectItems
@param value
@param label
@return | [
"Copied",
"from",
"the",
"InputRenderer",
"class",
"of",
"PrimeFaces",
"5",
".",
"1",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectMultiMenu/SelectMultiMenuRenderer.java#L515-L550 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/beans/BsfBeanInfo.java | BsfBeanInfo.add_snake_case_properties | private void add_snake_case_properties(List<PropertyDescriptor> pdl) throws IntrospectionException {
List<PropertyDescriptor> alternatives = new ArrayList<PropertyDescriptor>();
for (PropertyDescriptor descriptor : pdl) {
String camelCase = descriptor.getName();
if (camelCase.equals("rendererType")) {
con... | java | private void add_snake_case_properties(List<PropertyDescriptor> pdl) throws IntrospectionException {
List<PropertyDescriptor> alternatives = new ArrayList<PropertyDescriptor>();
for (PropertyDescriptor descriptor : pdl) {
String camelCase = descriptor.getName();
if (camelCase.equals("rendererType")) {
con... | [
"private",
"void",
"add_snake_case_properties",
"(",
"List",
"<",
"PropertyDescriptor",
">",
"pdl",
")",
"throws",
"IntrospectionException",
"{",
"List",
"<",
"PropertyDescriptor",
">",
"alternatives",
"=",
"new",
"ArrayList",
"<",
"PropertyDescriptor",
">",
"(",
")... | Method that generates dynamically the snake-case methods from the available
camelcase properties found inside the bean list.
@param pdl
@throws IntrospectionException | [
"Method",
"that",
"generates",
"dynamically",
"the",
"snake",
"-",
"case",
"methods",
"from",
"the",
"available",
"camelcase",
"properties",
"found",
"inside",
"the",
"bean",
"list",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/beans/BsfBeanInfo.java#L105-L144 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/JSEventHandlerRenderer.java | JSEventHandlerRenderer.generateJSEventHandlers | public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException {
Map<String, Object> attributes = component.getAttributes();
String[] eventHandlers = {"onclick", "onblur", "onmouseover"};
for (String event:eventHandlers) {
String handler = A.asString(attribu... | java | public static void generateJSEventHandlers(ResponseWriter rw, UIComponent component) throws IOException {
Map<String, Object> attributes = component.getAttributes();
String[] eventHandlers = {"onclick", "onblur", "onmouseover"};
for (String event:eventHandlers) {
String handler = A.asString(attribu... | [
"public",
"static",
"void",
"generateJSEventHandlers",
"(",
"ResponseWriter",
"rw",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"attributes",
"=",
"component",
".",
"getAttributes",
"(",
")",
";",... | Generates the standard Javascript event handlers.
@param rw The response writer
@param component the current component
@throws IOException thrown if something goes wrong when writing the HTML code | [
"Generates",
"the",
"standard",
"Javascript",
"event",
"handlers",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/JSEventHandlerRenderer.java#L37-L46 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePicker.java | DateTimePicker.getConvertedValue | @Override
public Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException {
if (submittedValue == null) {
return null;
}
String val = (String) submittedValue;
// If the Trimmed submitted value is empty, return null
if (val.trim().length() == 0) {
return null;
}... | java | @Override
public Object getConvertedValue(FacesContext context, Object submittedValue) throws ConverterException {
if (submittedValue == null) {
return null;
}
String val = (String) submittedValue;
// If the Trimmed submitted value is empty, return null
if (val.trim().length() == 0) {
return null;
}... | [
"@",
"Override",
"public",
"Object",
"getConvertedValue",
"(",
"FacesContext",
"context",
",",
"Object",
"submittedValue",
")",
"throws",
"ConverterException",
"{",
"if",
"(",
"submittedValue",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"val",... | Converts the date from the moment.js format to a java.util.Date. | [
"Converts",
"the",
"date",
"from",
"the",
"moment",
".",
"js",
"format",
"to",
"a",
"java",
".",
"util",
".",
"Date",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePicker.java#L142-L186 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/slider2/Slider2.java | Slider2.toNumber | private static Number toNumber(Object object) {
if (object instanceof Number) {
return (Number) object;
}
if (object instanceof String) {
return Float.valueOf((String) object);
}
throw new IllegalArgumentException("Use number or string");
} | java | private static Number toNumber(Object object) {
if (object instanceof Number) {
return (Number) object;
}
if (object instanceof String) {
return Float.valueOf((String) object);
}
throw new IllegalArgumentException("Use number or string");
} | [
"private",
"static",
"Number",
"toNumber",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"instanceof",
"Number",
")",
"{",
"return",
"(",
"Number",
")",
"object",
";",
"}",
"if",
"(",
"object",
"instanceof",
"String",
")",
"{",
"return",
"Float... | Convert object to number. To be backwards compatible with bound integers to properties where we now also want
to accept floats now.
@param object Object to convert to number. Should be either a number or a string.
@return Object converted to number.
@throws IllegalArgumentException When an incorrect type is provided... | [
"Convert",
"object",
"to",
"number",
".",
"To",
"be",
"backwards",
"compatible",
"with",
"bound",
"integers",
"to",
"properties",
"where",
"we",
"now",
"also",
"want",
"to",
"accept",
"floats",
"now",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/slider2/Slider2.java#L65-L73 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.encodeColumn | public static final void encodeColumn(ResponseWriter rw, UIComponent c, int span, int cxs, int csm, int clg,
int offset, int oxs, int osm, int olg, String style, String sclass) throws IOException {
rw.startElement("div", c);
Map<String, Object> componentAttrs = new HashMap<String, Object>();
if (c != null) {... | java | public static final void encodeColumn(ResponseWriter rw, UIComponent c, int span, int cxs, int csm, int clg,
int offset, int oxs, int osm, int olg, String style, String sclass) throws IOException {
rw.startElement("div", c);
Map<String, Object> componentAttrs = new HashMap<String, Object>();
if (c != null) {... | [
"public",
"static",
"final",
"void",
"encodeColumn",
"(",
"ResponseWriter",
"rw",
",",
"UIComponent",
"c",
",",
"int",
"span",
",",
"int",
"cxs",
",",
"int",
"csm",
",",
"int",
"clg",
",",
"int",
"offset",
",",
"int",
"oxs",
",",
"int",
"osm",
",",
"... | Encodes a Column
@param rw
@param c
@param span
@param cxs
@param csm
@param clg
@param offset
@param oxs
@param osm
@param olg
@param style
@param sclass
@throws IOException | [
"Encodes",
"a",
"Column"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L64-L131 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.addClass2FacetComponent | public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) {
// If the facet contains only one component, getChildCount()=0 and the
// Facet is the UIComponent
if (f.getClass().getName().endsWith(cname)) {
addClass2Component(f, aclass);
} else {
if (f.getChildCount() > 0) {
... | java | public static void addClass2FacetComponent(UIComponent f, String cname, String aclass) {
// If the facet contains only one component, getChildCount()=0 and the
// Facet is the UIComponent
if (f.getClass().getName().endsWith(cname)) {
addClass2Component(f, aclass);
} else {
if (f.getChildCount() > 0) {
... | [
"public",
"static",
"void",
"addClass2FacetComponent",
"(",
"UIComponent",
"f",
",",
"String",
"cname",
",",
"String",
"aclass",
")",
"{",
"// If the facet contains only one component, getChildCount()=0 and the",
"// Facet is the UIComponent",
"if",
"(",
"f",
".",
"getClass... | Adds a CSS class to a component within a facet.
@param f
the facet
@param cname
the class name of the component to be manipulated.
@param aclass
the CSS class to be added | [
"Adds",
"a",
"CSS",
"class",
"to",
"a",
"component",
"within",
"a",
"facet",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L171-L185 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.addClass2Component | protected static void addClass2Component(UIComponent c, String aclass) {
Map<String, Object> a = c.getAttributes();
if (a.containsKey("styleClass")) {
a.put("styleClass", a.get("styleClass") + " " + aclass);
} else {
a.put("styleClass", aclass);
}
} | java | protected static void addClass2Component(UIComponent c, String aclass) {
Map<String, Object> a = c.getAttributes();
if (a.containsKey("styleClass")) {
a.put("styleClass", a.get("styleClass") + " " + aclass);
} else {
a.put("styleClass", aclass);
}
} | [
"protected",
"static",
"void",
"addClass2Component",
"(",
"UIComponent",
"c",
",",
"String",
"aclass",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"a",
"=",
"c",
".",
"getAttributes",
"(",
")",
";",
"if",
"(",
"a",
".",
"containsKey",
"(",
"\"s... | Adds a CSS class to a component in the view tree. The class is appended
to the styleClass value.
@param c
the component
@param aclass
the CSS class to be added | [
"Adds",
"a",
"CSS",
"class",
"to",
"a",
"component",
"in",
"the",
"view",
"tree",
".",
"The",
"class",
"is",
"appended",
"to",
"the",
"styleClass",
"value",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L196-L203 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.decorateFacetComponent | public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
/*
* System.out.println("COMPONENT CLASS = " + comp.getClass().getName());
* System.out.println("FAMILY = " + comp.getFamily());
* System.out.println("CHILD COUNT = " +... | java | public static void decorateFacetComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
/*
* System.out.println("COMPONENT CLASS = " + comp.getClass().getName());
* System.out.println("FAMILY = " + comp.getFamily());
* System.out.println("CHILD COUNT = " +... | [
"public",
"static",
"void",
"decorateFacetComponent",
"(",
"UIComponent",
"parent",
",",
"UIComponent",
"comp",
",",
"FacesContext",
"ctx",
",",
"ResponseWriter",
"rw",
")",
"throws",
"IOException",
"{",
"/*\n\t\t * System.out.println(\"COMPONENT CLASS = \" + comp.getClass().... | Decorate the facet children with a class to render bootstrap like
"prepend" and "append" sections
@param parent
@param comp
@param ctx
@param rw
@throws IOException | [
"Decorate",
"the",
"facet",
"children",
"with",
"a",
"class",
"to",
"render",
"bootstrap",
"like",
"prepend",
"and",
"append",
"sections"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L215-L241 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.decorateComponent | private static void decorateComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
if (comp instanceof Icon)
((Icon) comp).setAddon(true); // modifies the id of the icon
String classToApply = "input-group-addon";
if (comp.getClass().getName().endsWith("But... | java | private static void decorateComponent(UIComponent parent, UIComponent comp, FacesContext ctx, ResponseWriter rw)
throws IOException {
if (comp instanceof Icon)
((Icon) comp).setAddon(true); // modifies the id of the icon
String classToApply = "input-group-addon";
if (comp.getClass().getName().endsWith("But... | [
"private",
"static",
"void",
"decorateComponent",
"(",
"UIComponent",
"parent",
",",
"UIComponent",
"comp",
",",
"FacesContext",
"ctx",
",",
"ResponseWriter",
"rw",
")",
"throws",
"IOException",
"{",
"if",
"(",
"comp",
"instanceof",
"Icon",
")",
"(",
"(",
"Ico... | Add the correct class
@param parent
@param comp
@param ctx
@param rw
@throws IOException | [
"Add",
"the",
"correct",
"class"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L252-L278 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.findComponentFormId | public static String findComponentFormId(FacesContext fc, UIComponent c) {
UIComponent parent = c.getParent();
while (parent != null) {
if (parent instanceof UIForm) {
return parent.getClientId(fc);
}
parent = parent.getParent();
}
return null;
} | java | public static String findComponentFormId(FacesContext fc, UIComponent c) {
UIComponent parent = c.getParent();
while (parent != null) {
if (parent instanceof UIForm) {
return parent.getClientId(fc);
}
parent = parent.getParent();
}
return null;
} | [
"public",
"static",
"String",
"findComponentFormId",
"(",
"FacesContext",
"fc",
",",
"UIComponent",
"c",
")",
"{",
"UIComponent",
"parent",
"=",
"c",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
"i... | Finds the Form Id of a component inside a form.
@param fc
FacesContext instance
@param c
UIComponent instance
@return | [
"Finds",
"the",
"Form",
"Id",
"of",
"a",
"component",
"inside",
"a",
"form",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L313-L323 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.renderChildren | public static void renderChildren(FacesContext fc, UIComponent component) throws IOException {
for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) {
UIComponent child = (UIComponent) iterator.next();
renderChild(fc, child);
}
} | java | public static void renderChildren(FacesContext fc, UIComponent component) throws IOException {
for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) {
UIComponent child = (UIComponent) iterator.next();
renderChild(fc, child);
}
} | [
"public",
"static",
"void",
"renderChildren",
"(",
"FacesContext",
"fc",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"for",
"(",
"Iterator",
"<",
"UIComponent",
">",
"iterator",
"=",
"component",
".",
"getChildren",
"(",
")",
".",
"iter... | Renders the Childrens of a Component
@param fc
@param component
@throws IOException | [
"Renders",
"the",
"Childrens",
"of",
"a",
"Component"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L332-L337 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/render/R.java | R.renderChild | public static void renderChild(FacesContext fc, UIComponent child) throws IOException {
if (!child.isRendered()) {
return;
}
child.encodeBegin(fc);
if (child.getRendersChildren()) {
child.encodeChildren(fc);
} else {
renderChildren(fc, child);
}
child.encodeEnd(fc);
} | java | public static void renderChild(FacesContext fc, UIComponent child) throws IOException {
if (!child.isRendered()) {
return;
}
child.encodeBegin(fc);
if (child.getRendersChildren()) {
child.encodeChildren(fc);
} else {
renderChildren(fc, child);
}
child.encodeEnd(fc);
} | [
"public",
"static",
"void",
"renderChild",
"(",
"FacesContext",
"fc",
",",
"UIComponent",
"child",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"child",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"child",
".",
"encodeBegin",
"(",
"f... | Renders the Child of a Component
@param fc
@param child
@throws IOException | [
"Renders",
"the",
"Child",
"of",
"a",
"Component"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/render/R.java#L346-L359 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/ajax/AJAXBroadcastComponent.java | AJAXBroadcastComponent.evalAsMethodExpression | public static MethodExpression evalAsMethodExpression(String p_expression) throws PropertyNotFoundException {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
MethodExpre... | java | public static MethodExpression evalAsMethodExpression(String p_expression) throws PropertyNotFoundException {
FacesContext context = FacesContext.getCurrentInstance();
ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory();
ELContext elContext = context.getELContext();
MethodExpre... | [
"public",
"static",
"MethodExpression",
"evalAsMethodExpression",
"(",
"String",
"p_expression",
")",
"throws",
"PropertyNotFoundException",
"{",
"FacesContext",
"context",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"ExpressionFactory",
"expressionFactor... | Evaluates an EL expression into an object.
@param p_expression
the expression
@throws PropertyNotFoundException
if the attribute doesn't exist at all (as opposed to being
null)
@return the object | [
"Evaluates",
"an",
"EL",
"expression",
"into",
"an",
"object",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/ajax/AJAXBroadcastComponent.java#L88-L94 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/ajax/AJAXBroadcastComponent.java | AJAXBroadcastComponent.checkELSyntax | private void checkELSyntax(String el, ELContext context) {
int pos = el.indexOf('.');
if (pos<0) {
throw new FacesException("The EL expression doesn't contain a method call: " + el);
}
int end = el.indexOf('(');
if (end < 0)
end = el.length();
if (el.indexOf('[') >= 0)
end = Math.min(end, el.indexO... | java | private void checkELSyntax(String el, ELContext context) {
int pos = el.indexOf('.');
if (pos<0) {
throw new FacesException("The EL expression doesn't contain a method call: " + el);
}
int end = el.indexOf('(');
if (end < 0)
end = el.length();
if (el.indexOf('[') >= 0)
end = Math.min(end, el.indexO... | [
"private",
"void",
"checkELSyntax",
"(",
"String",
"el",
",",
"ELContext",
"context",
")",
"{",
"int",
"pos",
"=",
"el",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"{",
"throw",
"new",
"FacesException",
"(",
"\"The EL e... | Evaluate the expression syntax
@param el
@param context | [
"Evaluate",
"the",
"expression",
"syntax"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/ajax/AJAXBroadcastComponent.java#L143-L166 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/inputText/InputTextRenderer.java | InputTextRenderer.decode | public void decode(FacesContext context, UIComponent component, List<String> legalValues, String realEventSourceName) {
InputText inputText = (InputText) component;
if (inputText.isDisabled() || inputText.isReadonly()) {
return;
}
decodeBehaviors(context, inputText);
String clientId = inputText.getClien... | java | public void decode(FacesContext context, UIComponent component, List<String> legalValues, String realEventSourceName) {
InputText inputText = (InputText) component;
if (inputText.isDisabled() || inputText.isReadonly()) {
return;
}
decodeBehaviors(context, inputText);
String clientId = inputText.getClien... | [
"public",
"void",
"decode",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
",",
"List",
"<",
"String",
">",
"legalValues",
",",
"String",
"realEventSourceName",
")",
"{",
"InputText",
"inputText",
"=",
"(",
"InputText",
")",
"component",
";",
... | This method is used by RadioButtons and SelectOneMenus to limit the list of legal values. If another value is
sent, the input field is considered empty. This comes in useful the the back-end attribute is a primitive
type like int, which doesn't support null values.
@param context
@param component
@param legalValues an ... | [
"This",
"method",
"is",
"used",
"by",
"RadioButtons",
"and",
"SelectOneMenus",
"to",
"limit",
"the",
"list",
"of",
"legal",
"values",
".",
"If",
"another",
"value",
"is",
"sent",
"the",
"input",
"field",
"is",
"considered",
"empty",
".",
"This",
"comes",
"... | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/inputText/InputTextRenderer.java#L56-L100 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java | SelectOneMenuRenderer.renderJQueryAfterComponent | private void renderJQueryAfterComponent(ResponseWriter rw, String clientId, SelectOneMenu menu) throws IOException {
Boolean select2 = menu.isSelect2();
if (select2 != null && select2) {
rw.startElement("script", menu);
rw.writeAttribute("type", "text/javascript", "script");
StringBuilder buf = new Str... | java | private void renderJQueryAfterComponent(ResponseWriter rw, String clientId, SelectOneMenu menu) throws IOException {
Boolean select2 = menu.isSelect2();
if (select2 != null && select2) {
rw.startElement("script", menu);
rw.writeAttribute("type", "text/javascript", "script");
StringBuilder buf = new Str... | [
"private",
"void",
"renderJQueryAfterComponent",
"(",
"ResponseWriter",
"rw",
",",
"String",
"clientId",
",",
"SelectOneMenu",
"menu",
")",
"throws",
"IOException",
"{",
"Boolean",
"select2",
"=",
"menu",
".",
"isSelect2",
"(",
")",
";",
"if",
"(",
"select2",
... | render a jquery javascript block after the component if necessary
@param rw
@param clientId
@param menu
@throws IOException | [
"render",
"a",
"jquery",
"javascript",
"block",
"after",
"the",
"component",
"if",
"necessary"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java#L290-L308 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java | SelectOneMenuRenderer.determineSelectedItem | private SelectItemAndComponent determineSelectedItem(FacesContext context, SelectOneMenu menu, List<SelectItemAndComponent> items, Converter converter) {
Object submittedValue = menu.getSubmittedValue();
Object selectedOption;
if (submittedValue != null) {
selectedOption = submittedValue;
} else {
selecte... | java | private SelectItemAndComponent determineSelectedItem(FacesContext context, SelectOneMenu menu, List<SelectItemAndComponent> items, Converter converter) {
Object submittedValue = menu.getSubmittedValue();
Object selectedOption;
if (submittedValue != null) {
selectedOption = submittedValue;
} else {
selecte... | [
"private",
"SelectItemAndComponent",
"determineSelectedItem",
"(",
"FacesContext",
"context",
",",
"SelectOneMenu",
"menu",
",",
"List",
"<",
"SelectItemAndComponent",
">",
"items",
",",
"Converter",
"converter",
")",
"{",
"Object",
"submittedValue",
"=",
"menu",
".",... | Compare current selection with items, if there is any element selected
@param context
@param items
@param converter
@return | [
"Compare",
"current",
"selection",
"with",
"items",
"if",
"there",
"is",
"any",
"element",
"selected"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/selectOneMenu/SelectOneMenuRenderer.java#L318-L348 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java | ScrollSpyRenderer.decodeAndEscapeSelectors | private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
selector = ExpressionResolver.getComponentIDs(context, component, selector);
selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector);
return selector;
} | java | private String decodeAndEscapeSelectors(FacesContext context, UIComponent component, String selector) {
selector = ExpressionResolver.getComponentIDs(context, component, selector);
selector = BsfUtils.escapeJQuerySpecialCharsInSelector(selector);
return selector;
} | [
"private",
"String",
"decodeAndEscapeSelectors",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
",",
"String",
"selector",
")",
"{",
"selector",
"=",
"ExpressionResolver",
".",
"getComponentIDs",
"(",
"context",
",",
"component",
",",
"selector",
"... | Decode and escape selectors if necessary
@param context
@param component
@param selector
@return | [
"Decode",
"and",
"escape",
"selectors",
"if",
"necessary"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/scrollSpy/ScrollSpyRenderer.java#L161-L166 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/FacesMessages.java | FacesMessages.getErrorSeverityClass | public static String getErrorSeverityClass(String clientId) {
String[] levels = { "bf-no-message has-success", "bf-info", "bf-warning has-warning", "bf-error has-error", "bf-fatal has-error" };
int level = 0;
Iterator<FacesMessage> messages = FacesContext.getCurrentInstance().getMessages(clientId);
if (null != ... | java | public static String getErrorSeverityClass(String clientId) {
String[] levels = { "bf-no-message has-success", "bf-info", "bf-warning has-warning", "bf-error has-error", "bf-fatal has-error" };
int level = 0;
Iterator<FacesMessage> messages = FacesContext.getCurrentInstance().getMessages(clientId);
if (null != ... | [
"public",
"static",
"String",
"getErrorSeverityClass",
"(",
"String",
"clientId",
")",
"{",
"String",
"[",
"]",
"levels",
"=",
"{",
"\"bf-no-message has-success\"",
",",
"\"bf-info\"",
",",
"\"bf-warning has-warning\"",
",",
"\"bf-error has-error\"",
",",
"\"bf-fatal ha... | Returns style matching the severity error.
@param clientId
@return | [
"Returns",
"style",
"matching",
"the",
"severity",
"error",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/FacesMessages.java#L206-L232 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/tab/TabRepeat.java | TabRepeat.saveInitialChildState | private void saveInitialChildState(FacesContext facesContext) {
index = -1;
initialChildState = new ConcurrentHashMap<String, SavedState>();
initialClientId = getClientId(facesContext);
if (getChildCount() > 0) {
for (UIComponent child : getChildren()) {
saveInitialChildState(facesContext, child);
}
... | java | private void saveInitialChildState(FacesContext facesContext) {
index = -1;
initialChildState = new ConcurrentHashMap<String, SavedState>();
initialClientId = getClientId(facesContext);
if (getChildCount() > 0) {
for (UIComponent child : getChildren()) {
saveInitialChildState(facesContext, child);
}
... | [
"private",
"void",
"saveInitialChildState",
"(",
"FacesContext",
"facesContext",
")",
"{",
"index",
"=",
"-",
"1",
";",
"initialChildState",
"=",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"SavedState",
">",
"(",
")",
";",
"initialClientId",
"=",
"getClient... | Save the initial child state.
<p>
In order to be able to restore each row to a pristine condition if NO state
was necessary to be saved for a given row we need to store the initial state
(a.k.a the state of the skeleton) so we can restore the skeleton as if it was
just created by the page markup.
</p>
@param facesCon... | [
"Save",
"the",
"initial",
"child",
"state",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/tab/TabRepeat.java#L493-L502 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/LocaleUtils.java | LocaleUtils.autoParseDateFormat | public static Date autoParseDateFormat(String dateString) {
// STEP 1: try to detect standard locale based java date format
for (Locale locale : DateFormat.getAvailableLocales()) {
for (int style = DateFormat.FULL; style <= DateFormat.SHORT; style++) {
DateFormat df = DateFormat.getDateInstance(style, locale... | java | public static Date autoParseDateFormat(String dateString) {
// STEP 1: try to detect standard locale based java date format
for (Locale locale : DateFormat.getAvailableLocales()) {
for (int style = DateFormat.FULL; style <= DateFormat.SHORT; style++) {
DateFormat df = DateFormat.getDateInstance(style, locale... | [
"public",
"static",
"Date",
"autoParseDateFormat",
"(",
"String",
"dateString",
")",
"{",
"// STEP 1: try to detect standard locale based java date format",
"for",
"(",
"Locale",
"locale",
":",
"DateFormat",
".",
"getAvailableLocales",
"(",
")",
")",
"{",
"for",
"(",
... | Try to auto-parse the date format
@param dateString
@return | [
"Try",
"to",
"auto",
"-",
"parse",
"the",
"date",
"format"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/LocaleUtils.java#L185-L211 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/LocaleUtils.java | LocaleUtils.translateFormat | private static String translateFormat(String formatString, Map<String, String> mapping, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
int beginIndex = 0;
int i = 0;
char lastChar = 0;
char currentChar = 0;
String resultString = "";
char esc1 = escapeStart.charAt(0... | java | private static String translateFormat(String formatString, Map<String, String> mapping, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
int beginIndex = 0;
int i = 0;
char lastChar = 0;
char currentChar = 0;
String resultString = "";
char esc1 = escapeStart.charAt(0... | [
"private",
"static",
"String",
"translateFormat",
"(",
"String",
"formatString",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
",",
"String",
"escapeStart",
",",
"String",
"escapeEnd",
",",
"String",
"targetEscapeStart",
",",
"String",
"targetEscapeEnd... | Internal method to do translations
@param formatString
@param mapping
@return | [
"Internal",
"method",
"to",
"do",
"translations"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/LocaleUtils.java#L240-L278 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/utils/LocaleUtils.java | LocaleUtils.mapSubformat | private static String mapSubformat(String formatString, Map<String, String> mapping, int beginIndex,
int currentIndex, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
String subformat = formatString.substring(beginIndex, currentIndex);
if (subformat.equals(escapeStart) |... | java | private static String mapSubformat(String formatString, Map<String, String> mapping, int beginIndex,
int currentIndex, String escapeStart, String escapeEnd, String targetEscapeStart, String targetEscapeEnd) {
String subformat = formatString.substring(beginIndex, currentIndex);
if (subformat.equals(escapeStart) |... | [
"private",
"static",
"String",
"mapSubformat",
"(",
"String",
"formatString",
",",
"Map",
"<",
"String",
",",
"String",
">",
"mapping",
",",
"int",
"beginIndex",
",",
"int",
"currentIndex",
",",
"String",
"escapeStart",
",",
"String",
"escapeEnd",
",",
"String... | Append the new mapping
@param formatString
@param mapping
@param beginIndex
@param currentIndex
@param resultString
@return | [
"Append",
"the",
"new",
"mapping"
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/utils/LocaleUtils.java#L290-L304 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/dataTable/DataTable.java | DataTable.getJQueryEventParameterLists | @Override
public Map<String, String> getJQueryEventParameterLists() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "event, datatable, typeOfSelection, indexes");
result.put("deselect", "event, datatable, typeOfSelection, indexes");
return result;
} | java | @Override
public Map<String, String> getJQueryEventParameterLists() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "event, datatable, typeOfSelection, indexes");
result.put("deselect", "event, datatable, typeOfSelection, indexes");
return result;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getJQueryEventParameterLists",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"result",
"... | Returns the parameter list of jQuery and other non-standard JS callbacks. If
there's no parameter list for a certain event, the default is simply "event".
@return A hash map containing the events. May be null. | [
"Returns",
"the",
"parameter",
"list",
"of",
"jQuery",
"and",
"other",
"non",
"-",
"standard",
"JS",
"callbacks",
".",
"If",
"there",
"s",
"no",
"parameter",
"list",
"for",
"a",
"certain",
"event",
"the",
"default",
"is",
"simply",
"event",
"."
] | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dataTable/DataTable.java#L138-L144 | train |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/dataTable/DataTable.java | DataTable.getJQueryEventParameterListsForAjax | @Override
public Map<String, String> getJQueryEventParameterListsForAjax() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "'typeOfSelection':typeOfSelection,'indexes':indexes");
result.put("deselect", "'typeOfSelection':typeOfSelection,'indexes':indexes");
return result;
} | java | @Override
public Map<String, String> getJQueryEventParameterListsForAjax() {
Map<String, String> result = new HashMap<String, String>();
result.put("select", "'typeOfSelection':typeOfSelection,'indexes':indexes");
result.put("deselect", "'typeOfSelection':typeOfSelection,'indexes':indexes");
return result;
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getJQueryEventParameterListsForAjax",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"resul... | Returns the subset of the parameter list of jQuery and other non-standard JS
callbacks which is sent to the server via AJAX. If there's no parameter list
for a certain event, the default is simply null.
@return A hash map containing the events. May be null. | [
"Returns",
"the",
"subset",
"of",
"the",
"parameter",
"list",
"of",
"jQuery",
"and",
"other",
"non",
"-",
"standard",
"JS",
"callbacks",
"which",
"is",
"sent",
"to",
"the",
"server",
"via",
"AJAX",
".",
"If",
"there",
"s",
"no",
"parameter",
"list",
"for... | d1a70952bc240979b5272fa4fe1c7f100873add0 | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dataTable/DataTable.java#L153-L159 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Database.java | Database.commitOrRollbackOnNext | private static <T> Observable<Boolean> commitOrRollbackOnNext(final boolean isCommit,
final Database db, Observable<T> source) {
return source.concatMap(new Func1<T, Observable<Boolean>>() {
@Override
public Observable<Boolean> call(T t) {
if (isCommit)
... | java | private static <T> Observable<Boolean> commitOrRollbackOnNext(final boolean isCommit,
final Database db, Observable<T> source) {
return source.concatMap(new Func1<T, Observable<Boolean>>() {
@Override
public Observable<Boolean> call(T t) {
if (isCommit)
... | [
"private",
"static",
"<",
"T",
">",
"Observable",
"<",
"Boolean",
">",
"commitOrRollbackOnNext",
"(",
"final",
"boolean",
"isCommit",
",",
"final",
"Database",
"db",
",",
"Observable",
"<",
"T",
">",
"source",
")",
"{",
"return",
"source",
".",
"concatMap",
... | Emits true for commit and false for rollback.
@param isCommit
@param db
@param source
@return | [
"Emits",
"true",
"for",
"commit",
"and",
"false",
"for",
"rollback",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Database.java#L864-L875 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Database.java | Database.asynchronous | public Database asynchronous(final Scheduler nonTransactionalScheduler) {
return asynchronous(new Func0<Scheduler>() {
@Override
public Scheduler call() {
return nonTransactionalScheduler;
}
});
} | java | public Database asynchronous(final Scheduler nonTransactionalScheduler) {
return asynchronous(new Func0<Scheduler>() {
@Override
public Scheduler call() {
return nonTransactionalScheduler;
}
});
} | [
"public",
"Database",
"asynchronous",
"(",
"final",
"Scheduler",
"nonTransactionalScheduler",
")",
"{",
"return",
"asynchronous",
"(",
"new",
"Func0",
"<",
"Scheduler",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Scheduler",
"call",
"(",
")",
"{",
"return"... | Returns a Database based on the current Database except all
non-transactional queries run on the given scheduler.
@return new Database instance | [
"Returns",
"a",
"Database",
"based",
"on",
"the",
"current",
"Database",
"except",
"all",
"non",
"-",
"transactional",
"queries",
"run",
"on",
"the",
"given",
"scheduler",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Database.java#L964-L971 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QuerySelectOnSubscribe.java | QuerySelectOnSubscribe.connectAndPrepareStatement | private void connectAndPrepareStatement(Subscriber<? super T> subscriber, State state)
throws SQLException {
log.debug("connectionProvider={}", query.context().connectionProvider());
if (!subscriber.isUnsubscribed()) {
log.debug("getting connection");
state.con = quer... | java | private void connectAndPrepareStatement(Subscriber<? super T> subscriber, State state)
throws SQLException {
log.debug("connectionProvider={}", query.context().connectionProvider());
if (!subscriber.isUnsubscribed()) {
log.debug("getting connection");
state.con = quer... | [
"private",
"void",
"connectAndPrepareStatement",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"subscriber",
",",
"State",
"state",
")",
"throws",
"SQLException",
"{",
"log",
".",
"debug",
"(",
"\"connectionProvider={}\"",
",",
"query",
".",
"context",
"(",
... | Obtains connection, creates prepared statement and assigns parameters to
the prepared statement.
@param subscriber
@param state
@throws SQLException | [
"Obtains",
"connection",
"creates",
"prepared",
"statement",
"and",
"assigns",
"parameters",
"to",
"the",
"prepared",
"statement",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QuerySelectOnSubscribe.java#L101-L116 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Util.java | Util.parametersCount | static int parametersCount(Query query) {
if (query.names().isEmpty())
return countQuestionMarkParameters(query.sql());
else
return query.names().size();
} | java | static int parametersCount(Query query) {
if (query.names().isEmpty())
return countQuestionMarkParameters(query.sql());
else
return query.names().size();
} | [
"static",
"int",
"parametersCount",
"(",
"Query",
"query",
")",
"{",
"if",
"(",
"query",
".",
"names",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"countQuestionMarkParameters",
"(",
"query",
".",
"sql",
"(",
")",
")",
";",
"else",
"return",
"qu... | Count the number of JDBC parameters in a sql statement.
@param query
.sql()
@return | [
"Count",
"the",
"number",
"of",
"JDBC",
"parameters",
"in",
"a",
"sql",
"statement",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Util.java#L65-L70 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Util.java | Util.getTypeInfo | private static String getTypeInfo(List<Object> list) {
StringBuilder s = new StringBuilder();
for (Object o : list) {
if (s.length() > 0)
s.append(", ");
if (o == null)
s.append("null");
else {
s.append(o.getClass().get... | java | private static String getTypeInfo(List<Object> list) {
StringBuilder s = new StringBuilder();
for (Object o : list) {
if (s.length() > 0)
s.append(", ");
if (o == null)
s.append("null");
else {
s.append(o.getClass().get... | [
"private",
"static",
"String",
"getTypeInfo",
"(",
"List",
"<",
"Object",
">",
"list",
")",
"{",
"StringBuilder",
"s",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"list",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
... | Returns debugging info about the types of a list of objects.
@param list
@return | [
"Returns",
"debugging",
"info",
"about",
"the",
"types",
"of",
"a",
"list",
"of",
"objects",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Util.java#L458-L473 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Util.java | Util.setBlob | private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final InputStream is;
if (o instanceof byte[]) {
is = new ByteArrayInputStream((byte[]) o);
} | java | private static void setBlob(PreparedStatement ps, int i, Object o, Class<?> cls)
throws SQLException {
final InputStream is;
if (o instanceof byte[]) {
is = new ByteArrayInputStream((byte[]) o);
} | [
"private",
"static",
"void",
"setBlob",
"(",
"PreparedStatement",
"ps",
",",
"int",
"i",
",",
"Object",
"o",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"throws",
"SQLException",
"{",
"final",
"InputStream",
"is",
";",
"if",
"(",
"o",
"instanceof",
"byte",
... | Sets a blob parameter for the prepared statement.
@param ps
@param i
@param o
@param cls
@throws SQLException | [
"Sets",
"a",
"blob",
"parameter",
"for",
"the",
"prepared",
"statement",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Util.java#L808-L813 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/ConnectionProviderPooled.java | ConnectionProviderPooled.createPool | private static HikariDataSource createPool(String url, String username, String password,
int minPoolSize, int maxPoolSize, long connectionTimeoutMs) {
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl(url);
ds.setUsername(username);
ds.setPassword(password);
... | java | private static HikariDataSource createPool(String url, String username, String password,
int minPoolSize, int maxPoolSize, long connectionTimeoutMs) {
HikariDataSource ds = new HikariDataSource();
ds.setJdbcUrl(url);
ds.setUsername(username);
ds.setPassword(password);
... | [
"private",
"static",
"HikariDataSource",
"createPool",
"(",
"String",
"url",
",",
"String",
"username",
",",
"String",
"password",
",",
"int",
"minPoolSize",
",",
"int",
"maxPoolSize",
",",
"long",
"connectionTimeoutMs",
")",
"{",
"HikariDataSource",
"ds",
"=",
... | Returns a new pooled data source based on jdbc url.
@param url
jdbc url
@param username
login username
@param password
login password
@param minPoolSize
minimum database connection pool size
@param maxPoolSize
maximum database connection pool size
@param connectionTimeoutMs
@return | [
"Returns",
"a",
"new",
"pooled",
"data",
"source",
"based",
"on",
"jdbc",
"url",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/ConnectionProviderPooled.java#L103-L114 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/Queries.java | Queries.bufferedParameters | static Observable<List<Parameter>> bufferedParameters(Query query) {
int numParamsPerQuery = numParamsPerQuery(query);
if (numParamsPerQuery > 0)
// we don't check that parameters is empty after this because by
// general design we want nothing to happen if a query is passed no
... | java | static Observable<List<Parameter>> bufferedParameters(Query query) {
int numParamsPerQuery = numParamsPerQuery(query);
if (numParamsPerQuery > 0)
// we don't check that parameters is empty after this because by
// general design we want nothing to happen if a query is passed no
... | [
"static",
"Observable",
"<",
"List",
"<",
"Parameter",
">",
">",
"bufferedParameters",
"(",
"Query",
"query",
")",
"{",
"int",
"numParamsPerQuery",
"=",
"numParamsPerQuery",
"(",
"query",
")",
";",
"if",
"(",
"numParamsPerQuery",
">",
"0",
")",
"// we don't ch... | If the number of parameters in a query is >0 then group the parameters in
lists of that number in size but only after the dependencies have been
completed. If the number of parameteres is zero then return an observable
containing one item being an empty list.
@param query
@return | [
"If",
"the",
"number",
"of",
"parameters",
"in",
"a",
"query",
"is",
">",
"0",
"then",
"group",
"the",
"parameters",
"in",
"lists",
"of",
"that",
"number",
"in",
"size",
"but",
"only",
"after",
"the",
"dependencies",
"have",
"been",
"completed",
".",
"If... | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/Queries.java#L85-L95 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QuerySelect.java | QuerySelect.execute | public <T> Observable<T> execute(ResultSetMapper<? extends T> function) {
return bufferedParameters(this)
// execute once per set of parameters
.concatMap(executeOnce(function));
} | java | public <T> Observable<T> execute(ResultSetMapper<? extends T> function) {
return bufferedParameters(this)
// execute once per set of parameters
.concatMap(executeOnce(function));
} | [
"public",
"<",
"T",
">",
"Observable",
"<",
"T",
">",
"execute",
"(",
"ResultSetMapper",
"<",
"?",
"extends",
"T",
">",
"function",
")",
"{",
"return",
"bufferedParameters",
"(",
"this",
")",
"// execute once per set of parameters",
".",
"concatMap",
"(",
"exe... | Returns the results of running a select query with all sets of
parameters.
@return | [
"Returns",
"the",
"results",
"of",
"running",
"a",
"select",
"query",
"with",
"all",
"sets",
"of",
"parameters",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QuerySelect.java#L105-L109 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QuerySelectProducer.java | QuerySelectProducer.checkSubscription | private void checkSubscription(Subscriber<? super T> subscriber) {
if (subscriber.isUnsubscribed()) {
keepGoing = false;
log.debug("unsubscribing");
}
} | java | private void checkSubscription(Subscriber<? super T> subscriber) {
if (subscriber.isUnsubscribed()) {
keepGoing = false;
log.debug("unsubscribing");
}
} | [
"private",
"void",
"checkSubscription",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"subscriber",
")",
"{",
"if",
"(",
"subscriber",
".",
"isUnsubscribed",
"(",
")",
")",
"{",
"keepGoing",
"=",
"false",
";",
"log",
".",
"debug",
"(",
"\"unsubscribing\"... | If subscribe unsubscribed sets keepGoing to false.
@param subscriber | [
"If",
"subscribe",
"unsubscribed",
"sets",
"keepGoing",
"to",
"false",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QuerySelectProducer.java#L164-L169 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.getConnection | private void getConnection(State state) {
state.con = query.context().connectionProvider().get();
debug("getting connection");
debug("cp={}", query.context().connectionProvider());
} | java | private void getConnection(State state) {
state.con = query.context().connectionProvider().get();
debug("getting connection");
debug("cp={}", query.context().connectionProvider());
} | [
"private",
"void",
"getConnection",
"(",
"State",
"state",
")",
"{",
"state",
".",
"con",
"=",
"query",
".",
"context",
"(",
")",
".",
"connectionProvider",
"(",
")",
".",
"get",
"(",
")",
";",
"debug",
"(",
"\"getting connection\"",
")",
";",
"debug",
... | Gets the current connection. | [
"Gets",
"the",
"current",
"connection",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L128-L132 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.complete | private void complete(Subscriber<? super T> subscriber) {
if (!subscriber.isUnsubscribed()) {
debug("onCompleted");
subscriber.onCompleted();
} else
debug("unsubscribed");
} | java | private void complete(Subscriber<? super T> subscriber) {
if (!subscriber.isUnsubscribed()) {
debug("onCompleted");
subscriber.onCompleted();
} else
debug("unsubscribed");
} | [
"private",
"void",
"complete",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"subscriber",
")",
"{",
"if",
"(",
"!",
"subscriber",
".",
"isUnsubscribed",
"(",
")",
")",
"{",
"debug",
"(",
"\"onCompleted\"",
")",
";",
"subscriber",
".",
"onCompleted",
"... | Notify observer that sequence is complete.
@param subscriber
@param state | [
"Notify",
"observer",
"that",
"sequence",
"is",
"complete",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L295-L301 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.handleException | private void handleException(Throwable e, Subscriber<? super T> subscriber) {
debug("onError: ", e.getMessage());
Exceptions.throwOrReport(e, subscriber);
} | java | private void handleException(Throwable e, Subscriber<? super T> subscriber) {
debug("onError: ", e.getMessage());
Exceptions.throwOrReport(e, subscriber);
} | [
"private",
"void",
"handleException",
"(",
"Throwable",
"e",
",",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"subscriber",
")",
"{",
"debug",
"(",
"\"onError: \"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"Exceptions",
".",
"throwOrReport",
"(",
... | Notify observer of an error.
@param e
@param subscriber | [
"Notify",
"observer",
"of",
"an",
"error",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L309-L312 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.close | private void close(State state) {
// ensure close happens once only to avoid race conditions
if (state.closed.compareAndSet(false, true)) {
Util.closeQuietly(state.ps);
if (isCommit() || isRollback())
Util.closeQuietly(state.con);
else
... | java | private void close(State state) {
// ensure close happens once only to avoid race conditions
if (state.closed.compareAndSet(false, true)) {
Util.closeQuietly(state.ps);
if (isCommit() || isRollback())
Util.closeQuietly(state.con);
else
... | [
"private",
"void",
"close",
"(",
"State",
"state",
")",
"{",
"// ensure close happens once only to avoid race conditions",
"if",
"(",
"state",
".",
"closed",
".",
"compareAndSet",
"(",
"false",
",",
"true",
")",
")",
"{",
"Util",
".",
"closeQuietly",
"(",
"state... | Cancels a running PreparedStatement, closing it and the current
Connection but only if auto commit mode. | [
"Cancels",
"a",
"running",
"PreparedStatement",
"closing",
"it",
"and",
"the",
"current",
"Connection",
"but",
"only",
"if",
"auto",
"commit",
"mode",
"."
] | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L318-L327 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryBuilder.java | QueryBuilder.parameters | <T> void parameters(Observable<T> params) {
this.parameters = Observable.concat(parameters, params.map(Parameter.TO_PARAMETER));
} | java | <T> void parameters(Observable<T> params) {
this.parameters = Observable.concat(parameters, params.map(Parameter.TO_PARAMETER));
} | [
"<",
"T",
">",
"void",
"parameters",
"(",
"Observable",
"<",
"T",
">",
"params",
")",
"{",
"this",
".",
"parameters",
"=",
"Observable",
".",
"concat",
"(",
"parameters",
",",
"params",
".",
"map",
"(",
"Parameter",
".",
"TO_PARAMETER",
")",
")",
";",
... | Appends the given parameters to the parameter list for the query. If
there are more parameters than required for one execution of the query
then more than one execution of the query will occur.
@param params | [
"Appends",
"the",
"given",
"parameters",
"to",
"the",
"parameter",
"list",
"for",
"the",
"query",
".",
"If",
"there",
"are",
"more",
"parameters",
"than",
"required",
"for",
"one",
"execution",
"of",
"the",
"query",
"then",
"more",
"than",
"one",
"execution"... | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryBuilder.java#L56-L58 | train |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryBuilder.java | QueryBuilder.parameter | void parameter(Object value) {
// TODO check on supported types?
if (value instanceof Observable)
throw new IllegalArgumentException(
"use parameters() method not the parameter() method for an Observable");
parameters(Observable.just(value));
} | java | void parameter(Object value) {
// TODO check on supported types?
if (value instanceof Observable)
throw new IllegalArgumentException(
"use parameters() method not the parameter() method for an Observable");
parameters(Observable.just(value));
} | [
"void",
"parameter",
"(",
"Object",
"value",
")",
"{",
"// TODO check on supported types?",
"if",
"(",
"value",
"instanceof",
"Observable",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"use parameters() method not the parameter() method for an Observable\"",
")",
"... | Appends a parameter to the parameter list for the query. If there are
more parameters than required for one execution of the query then more
than one execution of the query will occur.
@param value | [
"Appends",
"a",
"parameter",
"to",
"the",
"parameter",
"list",
"for",
"the",
"query",
".",
"If",
"there",
"are",
"more",
"parameters",
"than",
"required",
"for",
"one",
"execution",
"of",
"the",
"query",
"then",
"more",
"than",
"one",
"execution",
"of",
"t... | 81e157d7071a825086bde81107b8694684cdff14 | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryBuilder.java#L79-L85 | train |
pwittchen/ReactiveWiFi | library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java | ReactiveWifi.observeWifiAccessPoints | @SuppressLint("MissingPermission") @RequiresPermission(allOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, ACCESS_WIFI_STATE
}) public static Observable<List<ScanResult>> observeWifiAccessPoints(final Context context) {
@SuppressLint("WifiManagerPotentialLeak") final WifiManager wifiM... | java | @SuppressLint("MissingPermission") @RequiresPermission(allOf = {
ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION, CHANGE_WIFI_STATE, ACCESS_WIFI_STATE
}) public static Observable<List<ScanResult>> observeWifiAccessPoints(final Context context) {
@SuppressLint("WifiManagerPotentialLeak") final WifiManager wifiM... | [
"@",
"SuppressLint",
"(",
"\"MissingPermission\"",
")",
"@",
"RequiresPermission",
"(",
"allOf",
"=",
"{",
"ACCESS_COARSE_LOCATION",
",",
"ACCESS_FINE_LOCATION",
",",
"CHANGE_WIFI_STATE",
",",
"ACCESS_WIFI_STATE",
"}",
")",
"public",
"static",
"Observable",
"<",
"List... | Observes WiFi Access Points.
Returns fresh list of Access Points
whenever WiFi signal strength changes.
@param context Context of the activity or an application
@return RxJava Observable with list of WiFi scan results | [
"Observes",
"WiFi",
"Access",
"Points",
".",
"Returns",
"fresh",
"list",
"of",
"Access",
"Points",
"whenever",
"WiFi",
"signal",
"strength",
"changes",
"."
] | eb2048663c1593b1706cfafb876542a41a223a1f | https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java#L67-L106 | train |
pwittchen/ReactiveWiFi | library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java | ReactiveWifi.observeWifiSignalLevel | @RequiresPermission(ACCESS_WIFI_STATE)
public static Observable<WifiSignalLevel> observeWifiSignalLevel(final Context context) {
return observeWifiSignalLevel(context, WifiSignalLevel.getMaxLevel()).map(
new Function<Integer, WifiSignalLevel>() {
@Override public WifiSignalLevel apply(Integer le... | java | @RequiresPermission(ACCESS_WIFI_STATE)
public static Observable<WifiSignalLevel> observeWifiSignalLevel(final Context context) {
return observeWifiSignalLevel(context, WifiSignalLevel.getMaxLevel()).map(
new Function<Integer, WifiSignalLevel>() {
@Override public WifiSignalLevel apply(Integer le... | [
"@",
"RequiresPermission",
"(",
"ACCESS_WIFI_STATE",
")",
"public",
"static",
"Observable",
"<",
"WifiSignalLevel",
">",
"observeWifiSignalLevel",
"(",
"final",
"Context",
"context",
")",
"{",
"return",
"observeWifiSignalLevel",
"(",
"context",
",",
"WifiSignalLevel",
... | Observes WiFi signal level with predefined max num levels.
Returns WiFi signal level as enum with information about current level
@param context Context of the activity or an application
@return WifiSignalLevel as an enum | [
"Observes",
"WiFi",
"signal",
"level",
"with",
"predefined",
"max",
"num",
"levels",
".",
"Returns",
"WiFi",
"signal",
"level",
"as",
"enum",
"with",
"information",
"about",
"current",
"level"
] | eb2048663c1593b1706cfafb876542a41a223a1f | https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java#L125-L133 | train |
pwittchen/ReactiveWiFi | library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java | ReactiveWifi.observeWifiSignalLevel | @RequiresPermission(ACCESS_WIFI_STATE) public static Observable<Integer> observeWifiSignalLevel(
final Context context, final int numLevels) {
final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
final IntentFilter filter = new IntentFilter();
filter.addAction(... | java | @RequiresPermission(ACCESS_WIFI_STATE) public static Observable<Integer> observeWifiSignalLevel(
final Context context, final int numLevels) {
final WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
final IntentFilter filter = new IntentFilter();
filter.addAction(... | [
"@",
"RequiresPermission",
"(",
"ACCESS_WIFI_STATE",
")",
"public",
"static",
"Observable",
"<",
"Integer",
">",
"observeWifiSignalLevel",
"(",
"final",
"Context",
"context",
",",
"final",
"int",
"numLevels",
")",
"{",
"final",
"WifiManager",
"wifiManager",
"=",
"... | Observes WiFi signal level.
Returns WiFi signal level as an integer
@param context Context of the activity or an application
@param numLevels The number of levels to consider in the calculated level as Integer
@return RxJava Observable with WiFi signal level | [
"Observes",
"WiFi",
"signal",
"level",
".",
"Returns",
"WiFi",
"signal",
"level",
"as",
"an",
"integer"
] | eb2048663c1593b1706cfafb876542a41a223a1f | https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java#L143-L171 | train |
pwittchen/ReactiveWiFi | library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java | ReactiveWifi.observeWifiStateChange | @RequiresPermission(ACCESS_WIFI_STATE) public static Observable<WifiState> observeWifiStateChange(
final Context context) {
final IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
return Observable.create(new ObservableOnSubscribe<WifiState>() {
... | java | @RequiresPermission(ACCESS_WIFI_STATE) public static Observable<WifiState> observeWifiStateChange(
final Context context) {
final IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
return Observable.create(new ObservableOnSubscribe<WifiState>() {
... | [
"@",
"RequiresPermission",
"(",
"ACCESS_WIFI_STATE",
")",
"public",
"static",
"Observable",
"<",
"WifiState",
">",
"observeWifiStateChange",
"(",
"final",
"Context",
"context",
")",
"{",
"final",
"IntentFilter",
"filter",
"=",
"new",
"IntentFilter",
"(",
")",
";",... | Observes WiFi State Change Action
Returns wifi state
whenever WiFi state changes such like enable,disable,enabling,disabling or Unknown
@param context Context of the activity or an application
@return RxJava Observable with different state change | [
"Observes",
"WiFi",
"State",
"Change",
"Action",
"Returns",
"wifi",
"state",
"whenever",
"WiFi",
"state",
"changes",
"such",
"like",
"enable",
"disable",
"enabling",
"disabling",
"or",
"Unknown"
] | eb2048663c1593b1706cfafb876542a41a223a1f | https://github.com/pwittchen/ReactiveWiFi/blob/eb2048663c1593b1706cfafb876542a41a223a1f/library/src/main/java/com/github/pwittchen/reactivewifi/ReactiveWifi.java#L282-L300 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.getDatabaseInfo | public synchronized DatabaseInfo getDatabaseInfo() {
if (databaseInfo != null) {
return databaseInfo;
}
try {
_check_mtime();
boolean hasStructureInfo = false;
byte[] delim = new byte[3];
// Advance to part of file where database info i... | java | public synchronized DatabaseInfo getDatabaseInfo() {
if (databaseInfo != null) {
return databaseInfo;
}
try {
_check_mtime();
boolean hasStructureInfo = false;
byte[] delim = new byte[3];
// Advance to part of file where database info i... | [
"public",
"synchronized",
"DatabaseInfo",
"getDatabaseInfo",
"(",
")",
"{",
"if",
"(",
"databaseInfo",
"!=",
"null",
")",
"{",
"return",
"databaseInfo",
";",
"}",
"try",
"{",
"_check_mtime",
"(",
")",
";",
"boolean",
"hasStructureInfo",
"=",
"false",
";",
"b... | Returns information about the database.
@return database info. | [
"Returns",
"information",
"about",
"the",
"database",
"."
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L537-L580 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.getLocation | public Location getLocation(String str) {
InetAddress addr;
try {
addr = InetAddress.getByName(str);
} catch (UnknownHostException e) {
return null;
}
return getLocation(addr);
} | java | public Location getLocation(String str) {
InetAddress addr;
try {
addr = InetAddress.getByName(str);
} catch (UnknownHostException e) {
return null;
}
return getLocation(addr);
} | [
"public",
"Location",
"getLocation",
"(",
"String",
"str",
")",
"{",
"InetAddress",
"addr",
";",
"try",
"{",
"addr",
"=",
"InetAddress",
".",
"getByName",
"(",
"str",
")",
";",
"}",
"catch",
"(",
"UnknownHostException",
"e",
")",
"{",
"return",
"null",
"... | for GeoIP City only | [
"for",
"GeoIP",
"City",
"only"
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L618-L627 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.seekCountryV6 | private synchronized int seekCountryV6(InetAddress addr) {
byte[] v6vec = addr.getAddress();
if (v6vec.length == 4) {
// sometimes java returns an ipv4 address for IPv6 input
// we have to work around that feature
// It happens for ::ffff:24.24.24.24
byte... | java | private synchronized int seekCountryV6(InetAddress addr) {
byte[] v6vec = addr.getAddress();
if (v6vec.length == 4) {
// sometimes java returns an ipv4 address for IPv6 input
// we have to work around that feature
// It happens for ::ffff:24.24.24.24
byte... | [
"private",
"synchronized",
"int",
"seekCountryV6",
"(",
"InetAddress",
"addr",
")",
"{",
"byte",
"[",
"]",
"v6vec",
"=",
"addr",
".",
"getAddress",
"(",
")",
";",
"if",
"(",
"v6vec",
".",
"length",
"==",
"4",
")",
"{",
"// sometimes java returns an ipv4 addr... | Finds the country index value given an IPv6 address.
@param addr
the ip address to find in long format.
@return the country index. | [
"Finds",
"the",
"country",
"index",
"value",
"given",
"an",
"IPv6",
"address",
"."
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L861-L900 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.seekCountry | private synchronized int seekCountry(long ipAddress) {
byte[] buf = new byte[2 * MAX_RECORD_LENGTH];
int[] x = new int[2];
int offset = 0;
_check_mtime();
for (int depth = 31; depth >= 0; depth--) {
readNode(buf, x, offset);
if ((ipAddress & (1 << depth))... | java | private synchronized int seekCountry(long ipAddress) {
byte[] buf = new byte[2 * MAX_RECORD_LENGTH];
int[] x = new int[2];
int offset = 0;
_check_mtime();
for (int depth = 31; depth >= 0; depth--) {
readNode(buf, x, offset);
if ((ipAddress & (1 << depth))... | [
"private",
"synchronized",
"int",
"seekCountry",
"(",
"long",
"ipAddress",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"2",
"*",
"MAX_RECORD_LENGTH",
"]",
";",
"int",
"[",
"]",
"x",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"int",
"off... | Finds the country index value given an IP address.
@param ipAddress
the ip address to find in long format.
@return the country index. | [
"Finds",
"the",
"country",
"index",
"value",
"given",
"an",
"IP",
"address",
"."
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L909-L933 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.bytesToLong | private static long bytesToLong(byte[] address) {
long ipnum = 0;
for (int i = 0; i < 4; ++i) {
long y = address[i];
if (y < 0) {
y += 256;
}
ipnum += y << ((3 - i) * 8);
}
return ipnum;
} | java | private static long bytesToLong(byte[] address) {
long ipnum = 0;
for (int i = 0; i < 4; ++i) {
long y = address[i];
if (y < 0) {
y += 256;
}
ipnum += y << ((3 - i) * 8);
}
return ipnum;
} | [
"private",
"static",
"long",
"bytesToLong",
"(",
"byte",
"[",
"]",
"address",
")",
"{",
"long",
"ipnum",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"++",
"i",
")",
"{",
"long",
"y",
"=",
"address",
"[",
"i",
"]"... | Returns the long version of an IP address given an InetAddress object.
@param address
the InetAddress.
@return the long form of the IP address. | [
"Returns",
"the",
"long",
"version",
"of",
"an",
"IP",
"address",
"given",
"an",
"InetAddress",
"object",
"."
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L970-L980 | train |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/DatabaseInfo.java | DatabaseInfo.getDate | public Date getDate() {
for (int i = 0; i < info.length() - 9; i++) {
if (Character.isWhitespace(info.charAt(i))) {
String dateString = info.substring(i + 1, i + 9);
try {
synchronized (formatter) {
return formatter.parse(da... | java | public Date getDate() {
for (int i = 0; i < info.length() - 9; i++) {
if (Character.isWhitespace(info.charAt(i))) {
String dateString = info.substring(i + 1, i + 9);
try {
synchronized (formatter) {
return formatter.parse(da... | [
"public",
"Date",
"getDate",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"info",
".",
"length",
"(",
")",
"-",
"9",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"info",
".",
"charAt",
"(",
"i... | Returns the date of the database.
@return the date of the database. | [
"Returns",
"the",
"date",
"of",
"the",
"database",
"."
] | baae36617ba6c5004370642716bc6e526774ba87 | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/DatabaseInfo.java#L108-L122 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.swapElements | public void swapElements(int i, int j) {
if (i != j) {
double s = get(i);
set(i, get(j));
set(j, s);
}
} | java | public void swapElements(int i, int j) {
if (i != j) {
double s = get(i);
set(i, get(j));
set(j, s);
}
} | [
"public",
"void",
"swapElements",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"!=",
"j",
")",
"{",
"double",
"s",
"=",
"get",
"(",
"i",
")",
";",
"set",
"(",
"i",
",",
"get",
"(",
"j",
")",
")",
";",
"set",
"(",
"j",
",",
... | Swaps the specified elements of this vector.
@param i element's index
@param j element's index | [
"Swaps",
"the",
"specified",
"elements",
"of",
"this",
"vector",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L556-L562 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.shuffle | public Vector shuffle() {
Vector result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < length; i++) {
int j = random.nextInt(length - i) + i;
swapElements(i, j);
}
return result;
} | java | public Vector shuffle() {
Vector result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < length; i++) {
int j = random.nextInt(length - i) + i;
swapElements(i, j);
}
return result;
} | [
"public",
"Vector",
"shuffle",
"(",
")",
"{",
"Vector",
"result",
"=",
"copy",
"(",
")",
";",
"// Conduct Fisher-Yates shuffle",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
... | Shuffles this vector.
<p>
Copies this vector in the new vector that contains the same elements but with
the elements shuffled around (which might also result in the same vector
(all outcomes are equally probable)).
</p>
@return the shuffled vector | [
"Shuffles",
"this",
"vector",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L593-L605 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.slice | public Vector slice(int from, int until) {
if (until - from < 0) {
fail("Wrong slice range: [" + from + ".." + until + "].");
}
Vector result = blankOfLength(until - from);
for (int i = from; i < until; i++) {
result.set(i - from, get(i));
}
ret... | java | public Vector slice(int from, int until) {
if (until - from < 0) {
fail("Wrong slice range: [" + from + ".." + until + "].");
}
Vector result = blankOfLength(until - from);
for (int i = from; i < until; i++) {
result.set(i - from, get(i));
}
ret... | [
"public",
"Vector",
"slice",
"(",
"int",
"from",
",",
"int",
"until",
")",
"{",
"if",
"(",
"until",
"-",
"from",
"<",
"0",
")",
"{",
"fail",
"(",
"\"Wrong slice range: [\"",
"+",
"from",
"+",
"\"..\"",
"+",
"until",
"+",
"\"].\"",
")",
";",
"}",
"V... | Retrieves the specified sub-vector of this vector. The sub-vector is specified by
interval of indices.
@param from the beginning of indices interval
@param until the ending of indices interval
@return the sub-vector of this vector | [
"Retrieves",
"the",
"specified",
"sub",
"-",
"vector",
"of",
"this",
"vector",
".",
"The",
"sub",
"-",
"vector",
"is",
"specified",
"by",
"interval",
"of",
"indices",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L616-L628 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.select | public Vector select(int[] indices) {
int newLength = indices.length;
if (newLength == 0) {
fail("No elements selected.");
}
Vector result = blankOfLength(newLength);
for (int i = 0; i < newLength; i++) {
result.set(i, get(indices[i]));
}
... | java | public Vector select(int[] indices) {
int newLength = indices.length;
if (newLength == 0) {
fail("No elements selected.");
}
Vector result = blankOfLength(newLength);
for (int i = 0; i < newLength; i++) {
result.set(i, get(indices[i]));
}
... | [
"public",
"Vector",
"select",
"(",
"int",
"[",
"]",
"indices",
")",
"{",
"int",
"newLength",
"=",
"indices",
".",
"length",
";",
"if",
"(",
"newLength",
"==",
"0",
")",
"{",
"fail",
"(",
"\"No elements selected.\"",
")",
";",
"}",
"Vector",
"result",
"... | Returns a new vector with the selected elements.
@param indices the array of indices
@return the new vector with the selected elements | [
"Returns",
"a",
"new",
"vector",
"with",
"the",
"selected",
"elements",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L661-L675 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.mkString | public String mkString(NumberFormat formatter, String delimiter) {
StringBuilder sb = new StringBuilder();
VectorIterator it = iterator();
while (it.hasNext()) {
double x = it.next();
int i = it.index();
sb.append(formatter.format(x))
.app... | java | public String mkString(NumberFormat formatter, String delimiter) {
StringBuilder sb = new StringBuilder();
VectorIterator it = iterator();
while (it.hasNext()) {
double x = it.next();
int i = it.index();
sb.append(formatter.format(x))
.app... | [
"public",
"String",
"mkString",
"(",
"NumberFormat",
"formatter",
",",
"String",
"delimiter",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"VectorIterator",
"it",
"=",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"has... | Converts this vector into the string representation.
@param formatter the number formatter
@param delimiter the element's delimiter
@return the vector converted to a string | [
"Converts",
"this",
"vector",
"into",
"the",
"string",
"representation",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L849-L861 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vector.java | Vector.iterator | @Override
public VectorIterator iterator() {
return new VectorIterator(length) {
private int i = -1;
@Override
public int index() {
return i;
}
@Override
public double get() {
return Vector.this.get(i);... | java | @Override
public VectorIterator iterator() {
return new VectorIterator(length) {
private int i = -1;
@Override
public int index() {
return i;
}
@Override
public double get() {
return Vector.this.get(i);... | [
"@",
"Override",
"public",
"VectorIterator",
"iterator",
"(",
")",
"{",
"return",
"new",
"VectorIterator",
"(",
"length",
")",
"{",
"private",
"int",
"i",
"=",
"-",
"1",
";",
"@",
"Override",
"public",
"int",
"index",
"(",
")",
"{",
"return",
"i",
";",... | Returns a vector iterator.
@return a vector iterator. | [
"Returns",
"a",
"vector",
"iterator",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vector.java#L902-L936 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asSumAccumulator | public static VectorAccumulator asSumAccumulator(final double neutral) {
return new VectorAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, double value) {
result = result.add(BigDecimal.valueOf(value... | java | public static VectorAccumulator asSumAccumulator(final double neutral) {
return new VectorAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, double value) {
result = result.add(BigDecimal.valueOf(value... | [
"public",
"static",
"VectorAccumulator",
"asSumAccumulator",
"(",
"final",
"double",
"neutral",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"BigDecimal",
"result",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"neutral",
")",
";",
"@",
... | Creates a sum vector accumulator that calculates the sum of all elements in the vector.
@param neutral the neutral value
@return a sum accumulator | [
"Creates",
"a",
"sum",
"vector",
"accumulator",
"that",
"calculates",
"the",
"sum",
"of",
"all",
"elements",
"in",
"the",
"vector",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L234-L250 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.mkMinAccumulator | public static VectorAccumulator mkMinAccumulator() {
return new VectorAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.min(result, value);
}
@Override
... | java | public static VectorAccumulator mkMinAccumulator() {
return new VectorAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.min(result, value);
}
@Override
... | [
"public",
"static",
"VectorAccumulator",
"mkMinAccumulator",
"(",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",... | Makes a minimum vector accumulator that accumulates the minimum across vector elements.
@return a minimum vector accumulator | [
"Makes",
"a",
"minimum",
"vector",
"accumulator",
"that",
"accumulates",
"the",
"minimum",
"across",
"vector",
"elements",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L282-L298 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.mkMaxAccumulator | public static VectorAccumulator mkMaxAccumulator() {
return new VectorAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.max(result, value);
}
@Override
... | java | public static VectorAccumulator mkMaxAccumulator() {
return new VectorAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, double value) {
result = Math.max(result, value);
}
@Override
... | [
"public",
"static",
"VectorAccumulator",
"mkMaxAccumulator",
"(",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",... | Makes a maximum vector accumulator that accumulates the maximum across vector elements.
@return a maximum vector accumulator | [
"Makes",
"a",
"maximum",
"vector",
"accumulator",
"that",
"accumulates",
"the",
"maximum",
"across",
"vector",
"elements",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L305-L321 | train |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.asAccumulatorProcedure | public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) {
return new VectorProcedure() {
@Override
public void apply(int i, double value) {
accumulator.update(i, value);
}
};
} | java | public static VectorProcedure asAccumulatorProcedure(final VectorAccumulator accumulator) {
return new VectorProcedure() {
@Override
public void apply(int i, double value) {
accumulator.update(i, value);
}
};
} | [
"public",
"static",
"VectorProcedure",
"asAccumulatorProcedure",
"(",
"final",
"VectorAccumulator",
"accumulator",
")",
"{",
"return",
"new",
"VectorProcedure",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"int",
"i",
",",
"double",
"value",
"... | Creates an accumulator procedure that adapts a vector accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple vectors.
@param accumulator the vector accumulator
@return an accumulator procedure | [
"Creates",
"an",
"accumulator",
"procedure",
"that",
"adapts",
"a",
"vector",
"accumulator",
"for",
"procedure",
"interface",
".",
"This",
"is",
"useful",
"for",
"reusing",
"a",
"single",
"accumulator",
"for",
"multiple",
"fold",
"operations",
"in",
"multiple",
... | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L457-L464 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.mkMinAccumulator | public static MatrixAccumulator mkMinAccumulator() {
return new MatrixAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.min(result, value);
}
@Ov... | java | public static MatrixAccumulator mkMinAccumulator() {
return new MatrixAccumulator() {
private double result = Double.POSITIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.min(result, value);
}
@Ov... | [
"public",
"static",
"MatrixAccumulator",
"mkMinAccumulator",
"(",
")",
"{",
"return",
"new",
"MatrixAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",... | Makes a minimum matrix accumulator that accumulates the minimum of matrix elements.
@return a minimum vector accumulator | [
"Makes",
"a",
"minimum",
"matrix",
"accumulator",
"that",
"accumulates",
"the",
"minimum",
"of",
"matrix",
"elements",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L517-L533 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.mkMaxAccumulator | public static MatrixAccumulator mkMaxAccumulator() {
return new MatrixAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.max(result, value);
}
@Ov... | java | public static MatrixAccumulator mkMaxAccumulator() {
return new MatrixAccumulator() {
private double result = Double.NEGATIVE_INFINITY;
@Override
public void update(int i, int j, double value) {
result = Math.max(result, value);
}
@Ov... | [
"public",
"static",
"MatrixAccumulator",
"mkMaxAccumulator",
"(",
")",
"{",
"return",
"new",
"MatrixAccumulator",
"(",
")",
"{",
"private",
"double",
"result",
"=",
"Double",
".",
"NEGATIVE_INFINITY",
";",
"@",
"Override",
"public",
"void",
"update",
"(",
"int",... | Makes a maximum matrix accumulator that accumulates the maximum of matrix elements.
@return a maximum vector accumulator | [
"Makes",
"a",
"maximum",
"matrix",
"accumulator",
"that",
"accumulates",
"the",
"maximum",
"of",
"matrix",
"elements",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L540-L556 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asSumAccumulator | public static MatrixAccumulator asSumAccumulator(final double neutral) {
return new MatrixAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, int j, double value) {
result = result.add(BigDecimal.valueO... | java | public static MatrixAccumulator asSumAccumulator(final double neutral) {
return new MatrixAccumulator() {
private BigDecimal result = BigDecimal.valueOf(neutral);
@Override
public void update(int i, int j, double value) {
result = result.add(BigDecimal.valueO... | [
"public",
"static",
"MatrixAccumulator",
"asSumAccumulator",
"(",
"final",
"double",
"neutral",
")",
"{",
"return",
"new",
"MatrixAccumulator",
"(",
")",
"{",
"private",
"BigDecimal",
"result",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"neutral",
")",
";",
"@",
... | Creates a sum matrix accumulator that calculates the sum of all elements in the matrix.
@param neutral the neutral value
@return a sum accumulator | [
"Creates",
"a",
"sum",
"matrix",
"accumulator",
"that",
"calculates",
"the",
"sum",
"of",
"all",
"elements",
"in",
"the",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L640-L656 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrices.java | Matrices.asAccumulatorProcedure | public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) {
return new MatrixProcedure() {
@Override
public void apply(int i, int j, double value) {
accumulator.update(i, j, value);
}
};
} | java | public static MatrixProcedure asAccumulatorProcedure(final MatrixAccumulator accumulator) {
return new MatrixProcedure() {
@Override
public void apply(int i, int j, double value) {
accumulator.update(i, j, value);
}
};
} | [
"public",
"static",
"MatrixProcedure",
"asAccumulatorProcedure",
"(",
"final",
"MatrixAccumulator",
"accumulator",
")",
"{",
"return",
"new",
"MatrixProcedure",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"int",
"i",
",",
"int",
"j",
",",
"... | Creates an accumulator procedure that adapts a matrix accumulator for procedure
interface. This is useful for reusing a single accumulator for multiple fold operations
in multiple matrices.
@param accumulator the matrix accumulator
@return an accumulator procedure | [
"Creates",
"an",
"accumulator",
"procedure",
"that",
"adapts",
"a",
"matrix",
"accumulator",
"for",
"procedure",
"interface",
".",
"This",
"is",
"useful",
"for",
"reusing",
"a",
"single",
"accumulator",
"for",
"multiple",
"fold",
"operations",
"in",
"multiple",
... | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L744-L751 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.swapRows | public void swapRows(int i, int j) {
if (i != j) {
Vector ii = getRow(i);
Vector jj = getRow(j);
setRow(i, jj);
setRow(j, ii);
}
} | java | public void swapRows(int i, int j) {
if (i != j) {
Vector ii = getRow(i);
Vector jj = getRow(j);
setRow(i, jj);
setRow(j, ii);
}
} | [
"public",
"void",
"swapRows",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"!=",
"j",
")",
"{",
"Vector",
"ii",
"=",
"getRow",
"(",
"i",
")",
";",
"Vector",
"jj",
"=",
"getRow",
"(",
"j",
")",
";",
"setRow",
"(",
"i",
",",
"j... | Swaps the specified rows of this matrix.
@param i the row index
@param j the row index | [
"Swaps",
"the",
"specified",
"rows",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L473-L481 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.swapColumns | public void swapColumns(int i, int j) {
if (i != j) {
Vector ii = getColumn(i);
Vector jj = getColumn(j);
setColumn(i, jj);
setColumn(j, ii);
}
} | java | public void swapColumns(int i, int j) {
if (i != j) {
Vector ii = getColumn(i);
Vector jj = getColumn(j);
setColumn(i, jj);
setColumn(j, ii);
}
} | [
"public",
"void",
"swapColumns",
"(",
"int",
"i",
",",
"int",
"j",
")",
"{",
"if",
"(",
"i",
"!=",
"j",
")",
"{",
"Vector",
"ii",
"=",
"getColumn",
"(",
"i",
")",
";",
"Vector",
"jj",
"=",
"getColumn",
"(",
"j",
")",
";",
"setColumn",
"(",
"i",... | Swaps the specified columns of this matrix.
@param i the column index
@param j the column index | [
"Swaps",
"the",
"specified",
"columns",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L489-L497 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.transpose | public Matrix transpose() {
Matrix result = blankOfShape(columns, rows);
MatrixIterator it = result.iterator();
while (it.hasNext()) {
it.next();
int i = it.rowIndex();
int j = it.columnIndex();
it.set(get(j, i));
}
return result;... | java | public Matrix transpose() {
Matrix result = blankOfShape(columns, rows);
MatrixIterator it = result.iterator();
while (it.hasNext()) {
it.next();
int i = it.rowIndex();
int j = it.columnIndex();
it.set(get(j, i));
}
return result;... | [
"public",
"Matrix",
"transpose",
"(",
")",
"{",
"Matrix",
"result",
"=",
"blankOfShape",
"(",
"columns",
",",
"rows",
")",
";",
"MatrixIterator",
"it",
"=",
"result",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
... | Transposes this matrix.
@return the transposed matrix | [
"Transposes",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L522-L534 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.trace | public double trace() {
double result = 0.0;
for (int i = 0; i < rows; i++) {
result += get(i, i);
}
return result;
} | java | public double trace() {
double result = 0.0;
for (int i = 0; i < rows; i++) {
result += get(i, i);
}
return result;
} | [
"public",
"double",
"trace",
"(",
")",
"{",
"double",
"result",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
";",
"i",
"++",
")",
"{",
"result",
"+=",
"get",
"(",
"i",
",",
"i",
")",
";",
"}",
"return",
"result",
... | Calculates the trace of this matrix.
<p>
See <a href="http://mathworld.wolfram.com/MatrixTrace.html">
http://mathworld.wolfram.com/MatrixTrace.html</a> for more details.
</p>
@return the trace of this matrix | [
"Calculates",
"the",
"trace",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L818-L826 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.diagonalProduct | public double diagonalProduct() {
BigDecimal result = BigDecimal.ONE;
for (int i = 0; i < rows; i++) {
result = result.multiply(BigDecimal.valueOf(get(i, i)));
}
return result.setScale(Matrices.ROUND_FACTOR,
RoundingMode.CEILING).doubleValue();
} | java | public double diagonalProduct() {
BigDecimal result = BigDecimal.ONE;
for (int i = 0; i < rows; i++) {
result = result.multiply(BigDecimal.valueOf(get(i, i)));
}
return result.setScale(Matrices.ROUND_FACTOR,
RoundingMode.CEILING).doubleValue();
} | [
"public",
"double",
"diagonalProduct",
"(",
")",
"{",
"BigDecimal",
"result",
"=",
"BigDecimal",
".",
"ONE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
";",
"i",
"++",
")",
"{",
"result",
"=",
"result",
".",
"multiply",
"(",
"Big... | Calculates the product of diagonal elements of this matrix.
@return the product of diagonal elements of this matrix | [
"Calculates",
"the",
"product",
"of",
"diagonal",
"elements",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L833-L843 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.determinant | public double determinant() {
if (rows != columns) {
throw new IllegalStateException("Can not compute determinant of non-square matrix.");
}
if (rows == 0) {
return 0.0;
} else if (rows == 1) {
return get(0, 0);
} else if (rows == 2) {
... | java | public double determinant() {
if (rows != columns) {
throw new IllegalStateException("Can not compute determinant of non-square matrix.");
}
if (rows == 0) {
return 0.0;
} else if (rows == 1) {
return get(0, 0);
} else if (rows == 2) {
... | [
"public",
"double",
"determinant",
"(",
")",
"{",
"if",
"(",
"rows",
"!=",
"columns",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Can not compute determinant of non-square matrix.\"",
")",
";",
"}",
"if",
"(",
"rows",
"==",
"0",
")",
"{",
"retur... | Calculates the determinant of this matrix.
<p>
See <a href="http://mathworld.wolfram.com/Determinant.html">
http://mathworld.wolfram.com/Determinant.html</a> for more details.
</p>
@return the determinant of this matrix | [
"Calculates",
"the",
"determinant",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L920-L971 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.rank | public int rank() {
if (rows == 0 || columns == 0) {
return 0;
}
// TODO:
// handle small (1x1, 1xn, nx1, 2x2, 2xn, nx2, 3x3, 3xn, nx3)
// matrices without SVD
MatrixDecompositor decompositor = withDecompositor(LinearAlgebra.SVD);
Matrix[] usv = deco... | java | public int rank() {
if (rows == 0 || columns == 0) {
return 0;
}
// TODO:
// handle small (1x1, 1xn, nx1, 2x2, 2xn, nx2, 3x3, 3xn, nx3)
// matrices without SVD
MatrixDecompositor decompositor = withDecompositor(LinearAlgebra.SVD);
Matrix[] usv = deco... | [
"public",
"int",
"rank",
"(",
")",
"{",
"if",
"(",
"rows",
"==",
"0",
"||",
"columns",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"// TODO:",
"// handle small (1x1, 1xn, nx1, 2x2, 2xn, nx2, 3x3, 3xn, nx3)",
"// matrices without SVD",
"MatrixDecompositor",
"decomp... | Calculates the rank of this matrix.
<p>
See <a href="http://mathworld.wolfram.com/MatrixRank.html">
http://mathworld.wolfram.com/MatrixRank.html</a> for more details.
</p>
@return the rank of this matrix | [
"Calculates",
"the",
"rank",
"of",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L983-L1006 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.insertRow | public Matrix insertRow(int i, Vector row) {
if (i > rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
}
Matrix result;
if (columns == 0) {
result = blankOfShape(rows + 1, row.length());
} else {
r... | java | public Matrix insertRow(int i, Vector row) {
if (i > rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + rows);
}
Matrix result;
if (columns == 0) {
result = blankOfShape(rows + 1, row.length());
} else {
r... | [
"public",
"Matrix",
"insertRow",
"(",
"int",
"i",
",",
"Vector",
"row",
")",
"{",
"if",
"(",
"i",
">",
"rows",
"||",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Illegal row number, must be 0..\"",
"+",
"rows",
")",
";",
... | Adds one row to matrix.
@param i the row index
@return matrix with row. | [
"Adds",
"one",
"row",
"to",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1045-L1068 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.insertColumn | public Matrix insertColumn(int j, Vector column) {
if (j > columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + columns);
}
Matrix result;
if (rows == 0) {
result = blankOfShape(column.length(), columns + 1);
} el... | java | public Matrix insertColumn(int j, Vector column) {
if (j > columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + columns);
}
Matrix result;
if (rows == 0) {
result = blankOfShape(column.length(), columns + 1);
} el... | [
"public",
"Matrix",
"insertColumn",
"(",
"int",
"j",
",",
"Vector",
"column",
")",
"{",
"if",
"(",
"j",
">",
"columns",
"||",
"j",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Illegal column number, must be 0..\"",
"+",
"columns",
... | Adds one column to matrix.
@param j the column index
@return matrix with column. | [
"Adds",
"one",
"column",
"to",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1075-L1098 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.removeRow | public Matrix removeRow(int i) {
if (i >= rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + (rows - 1));
}
Matrix result = blankOfShape(rows - 1, columns);
for (int ii = 0; ii < i; ii++) {
result.setRow(ii, getRow(ii));
... | java | public Matrix removeRow(int i) {
if (i >= rows || i < 0) {
throw new IndexOutOfBoundsException("Illegal row number, must be 0.." + (rows - 1));
}
Matrix result = blankOfShape(rows - 1, columns);
for (int ii = 0; ii < i; ii++) {
result.setRow(ii, getRow(ii));
... | [
"public",
"Matrix",
"removeRow",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"i",
">=",
"rows",
"||",
"i",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Illegal row number, must be 0..\"",
"+",
"(",
"rows",
"-",
"1",
")",
")",
";",
... | Removes one row from matrix.
@param i the row index
@return matrix without row. | [
"Removes",
"one",
"row",
"from",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1105-L1121 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.removeColumn | public Matrix removeColumn(int j) {
if (j >= columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + (columns - 1));
}
Matrix result = blankOfShape(rows, columns - 1);
for (int jj = 0; jj < j; jj++) {
result.setColumn(jj, g... | java | public Matrix removeColumn(int j) {
if (j >= columns || j < 0) {
throw new IndexOutOfBoundsException("Illegal column number, must be 0.." + (columns - 1));
}
Matrix result = blankOfShape(rows, columns - 1);
for (int jj = 0; jj < j; jj++) {
result.setColumn(jj, g... | [
"public",
"Matrix",
"removeColumn",
"(",
"int",
"j",
")",
"{",
"if",
"(",
"j",
">=",
"columns",
"||",
"j",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Illegal column number, must be 0..\"",
"+",
"(",
"columns",
"-",
"1",
")",
"... | Removes one column from matrix.
@param j the column index
@return matrix without column. | [
"Removes",
"one",
"column",
"from",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1128-L1144 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.shuffle | public Matrix shuffle() {
Matrix result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
int ii = random.nextInt(rows - i) + i;
int jj = random.nextIn... | java | public Matrix shuffle() {
Matrix result = copy();
// Conduct Fisher-Yates shuffle
Random random = new Random();
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
int ii = random.nextInt(rows - i) + i;
int jj = random.nextIn... | [
"public",
"Matrix",
"shuffle",
"(",
")",
"{",
"Matrix",
"result",
"=",
"copy",
"(",
")",
";",
"// Conduct Fisher-Yates shuffle",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rows",
";",
"i... | Shuffles this matrix.
<p>
Copies this matrix into the matrix that contains the same elements but with the elements
shuffled around (which might also result in the same matrix (with a small likelihood)).
</p>
@return the shuffled matrix | [
"Shuffles",
"this",
"matrix",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1250-L1268 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.slice | public Matrix slice(int fromRow, int fromColumn, int untilRow, int untilColumn) {
ensureIndexArgumentsAreInBounds(fromRow, fromColumn);
ensureIndexArgumentsAreInBounds(untilRow - 1, untilColumn - 1);
if (untilRow - fromRow < 0 || untilColumn - fromColumn < 0) {
fail("Wrong slice ran... | java | public Matrix slice(int fromRow, int fromColumn, int untilRow, int untilColumn) {
ensureIndexArgumentsAreInBounds(fromRow, fromColumn);
ensureIndexArgumentsAreInBounds(untilRow - 1, untilColumn - 1);
if (untilRow - fromRow < 0 || untilColumn - fromColumn < 0) {
fail("Wrong slice ran... | [
"public",
"Matrix",
"slice",
"(",
"int",
"fromRow",
",",
"int",
"fromColumn",
",",
"int",
"untilRow",
",",
"int",
"untilColumn",
")",
"{",
"ensureIndexArgumentsAreInBounds",
"(",
"fromRow",
",",
"fromColumn",
")",
";",
"ensureIndexArgumentsAreInBounds",
"(",
"unti... | Retrieves the specified sub-matrix of this matrix. The sub-matrix is specified by
intervals for row indices and column indices.
@param fromRow the beginning of the row indices interval
@param fromColumn the beginning of the column indices interval
@param untilRow the ending of the row indices interval
@param untilColu... | [
"Retrieves",
"the",
"specified",
"sub",
"-",
"matrix",
"of",
"this",
"matrix",
".",
"The",
"sub",
"-",
"matrix",
"is",
"specified",
"by",
"intervals",
"for",
"row",
"indices",
"and",
"column",
"indices",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1281-L1298 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.rowMajorIterator | public RowMajorMatrixIterator rowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = - 1;
@Override
public int rowIndex() {
return i / columns;
}
... | java | public RowMajorMatrixIterator rowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = - 1;
@Override
public int rowIndex() {
return i / columns;
}
... | [
"public",
"RowMajorMatrixIterator",
"rowMajorIterator",
"(",
")",
"{",
"return",
"new",
"RowMajorMatrixIterator",
"(",
"rows",
",",
"columns",
")",
"{",
"private",
"long",
"limit",
"=",
"(",
"long",
")",
"rows",
"*",
"columns",
";",
"private",
"int",
"i",
"=... | Returns a row-major matrix iterator.
@return a row-major matrix iterator. | [
"Returns",
"a",
"row",
"-",
"major",
"matrix",
"iterator",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1891-L1931 | train |
vkostyukov/la4j | src/main/java/org/la4j/Matrix.java | Matrix.columnMajorIterator | public ColumnMajorMatrixIterator columnMajorIterator() {
return new ColumnMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = -1;
@Override
public int rowIndex() {
return i - columnIndex() * rows;
... | java | public ColumnMajorMatrixIterator columnMajorIterator() {
return new ColumnMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private int i = -1;
@Override
public int rowIndex() {
return i - columnIndex() * rows;
... | [
"public",
"ColumnMajorMatrixIterator",
"columnMajorIterator",
"(",
")",
"{",
"return",
"new",
"ColumnMajorMatrixIterator",
"(",
"rows",
",",
"columns",
")",
"{",
"private",
"long",
"limit",
"=",
"(",
"long",
")",
"rows",
"*",
"columns",
";",
"private",
"int",
... | Returns a column-major matrix iterator.
@return a column-major matrix iterator. | [
"Returns",
"a",
"column",
"-",
"major",
"matrix",
"iterator",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrix.java#L1938-L1977 | train |
vkostyukov/la4j | src/main/java/org/la4j/matrix/SparseMatrix.java | SparseMatrix.nonZeroRowMajorIterator | public RowMajorMatrixIterator nonZeroRowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private long i = -1;
@Override
public int rowIndex() {
return (int) (i / columns);
... | java | public RowMajorMatrixIterator nonZeroRowMajorIterator() {
return new RowMajorMatrixIterator(rows, columns) {
private long limit = (long) rows * columns;
private long i = -1;
@Override
public int rowIndex() {
return (int) (i / columns);
... | [
"public",
"RowMajorMatrixIterator",
"nonZeroRowMajorIterator",
"(",
")",
"{",
"return",
"new",
"RowMajorMatrixIterator",
"(",
"rows",
",",
"columns",
")",
"{",
"private",
"long",
"limit",
"=",
"(",
"long",
")",
"rows",
"*",
"columns",
";",
"private",
"long",
"... | Returns a non-zero row-major matrix iterator.
@return a non-zero row-major matrix iterator. | [
"Returns",
"a",
"non",
"-",
"zero",
"row",
"-",
"major",
"matrix",
"iterator",
"."
] | dd1b917caf9606399a49afa6b0d738934cd3a7b3 | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/matrix/SparseMatrix.java#L419-L466 | train |
scireum/parsii | src/main/java/parsii/tokenizer/ParseException.java | ParseException.create | public static ParseException create(List<ParseError> errors) {
if (errors.size() == 1) {
return new ParseException(errors.get(0).getMessage(), errors);
} else if (errors.size() > 1) {
return new ParseException(String.format("%d errors occured. First: %s",
... | java | public static ParseException create(List<ParseError> errors) {
if (errors.size() == 1) {
return new ParseException(errors.get(0).getMessage(), errors);
} else if (errors.size() > 1) {
return new ParseException(String.format("%d errors occured. First: %s",
... | [
"public",
"static",
"ParseException",
"create",
"(",
"List",
"<",
"ParseError",
">",
"errors",
")",
"{",
"if",
"(",
"errors",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"new",
"ParseException",
"(",
"errors",
".",
"get",
"(",
"0",
")",
"."... | Creates a new exception based on the list of errors.
@param errors the errors which occurred while processing the user input
@return a new ParseException which can be thrown | [
"Creates",
"a",
"new",
"exception",
"based",
"on",
"the",
"list",
"of",
"errors",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/ParseException.java#L36-L46 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Token.java | Token.create | public static Token create(TokenType type, Position pos) {
Token result = new Token();
result.type = type;
result.line = pos.getLine();
result.pos = pos.getPos();
return result;
} | java | public static Token create(TokenType type, Position pos) {
Token result = new Token();
result.type = type;
result.line = pos.getLine();
result.pos = pos.getPos();
return result;
} | [
"public",
"static",
"Token",
"create",
"(",
"TokenType",
"type",
",",
"Position",
"pos",
")",
"{",
"Token",
"result",
"=",
"new",
"Token",
"(",
")",
";",
"result",
".",
"type",
"=",
"type",
";",
"result",
".",
"line",
"=",
"pos",
".",
"getLine",
"(",... | Creates a new token with the given type, using the given position as location info.
@param type the type if this token. Can be further specified by supplying a trigger.
@param pos the location of this token
@return a new token which can be filled with content and trigger infos | [
"Creates",
"a",
"new",
"token",
"with",
"the",
"given",
"type",
"using",
"the",
"given",
"position",
"as",
"location",
"info",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L69-L76 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Token.java | Token.createAndFill | public static Token createAndFill(TokenType type, Char ch) {
Token result = new Token();
result.type = type;
result.line = ch.getLine();
result.pos = ch.getPos();
result.contents = ch.getStringValue();
result.trigger = ch.getStringValue();
result.source = ch.toStr... | java | public static Token createAndFill(TokenType type, Char ch) {
Token result = new Token();
result.type = type;
result.line = ch.getLine();
result.pos = ch.getPos();
result.contents = ch.getStringValue();
result.trigger = ch.getStringValue();
result.source = ch.toStr... | [
"public",
"static",
"Token",
"createAndFill",
"(",
"TokenType",
"type",
",",
"Char",
"ch",
")",
"{",
"Token",
"result",
"=",
"new",
"Token",
"(",
")",
";",
"result",
".",
"type",
"=",
"type",
";",
"result",
".",
"line",
"=",
"ch",
".",
"getLine",
"("... | Creates a new token with the given type, using the Char a initial trigger and content.
@param type the type if this token. The supplied Char will be used as initial part of the trigger to further
specify the token
@param ch first character of the content and trigger of this token. Also specifies the position of the ... | [
"Creates",
"a",
"new",
"token",
"with",
"the",
"given",
"type",
"using",
"the",
"Char",
"a",
"initial",
"trigger",
"and",
"content",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L86-L95 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Token.java | Token.matches | @SuppressWarnings("squid:S1698")
public boolean matches(TokenType type, String trigger) {
if (!is(type)) {
return false;
}
if (trigger == null) {
throw new IllegalArgumentException("trigger must not be null");
}
return getTrigger() == trigger.intern()... | java | @SuppressWarnings("squid:S1698")
public boolean matches(TokenType type, String trigger) {
if (!is(type)) {
return false;
}
if (trigger == null) {
throw new IllegalArgumentException("trigger must not be null");
}
return getTrigger() == trigger.intern()... | [
"@",
"SuppressWarnings",
"(",
"\"squid:S1698\"",
")",
"public",
"boolean",
"matches",
"(",
"TokenType",
"type",
",",
"String",
"trigger",
")",
"{",
"if",
"(",
"!",
"is",
"(",
"type",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"trigger",
"==... | Determines if this token has the given type and trigger.
@param type the expected type
@param trigger the expected trigger
@return <tt>true</tt> if this token matches the given type and trigger, <tt>false</tt> otherwise | [
"Determines",
"if",
"this",
"token",
"has",
"the",
"given",
"type",
"and",
"trigger",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L262-L272 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Token.java | Token.wasTriggeredBy | @SuppressWarnings("squid:S1698")
public boolean wasTriggeredBy(String... triggers) {
if (triggers.length == 0) {
return false;
}
for (String aTrigger : triggers) {
if (aTrigger != null && aTrigger.intern() == getTrigger()) {
return true;
}
... | java | @SuppressWarnings("squid:S1698")
public boolean wasTriggeredBy(String... triggers) {
if (triggers.length == 0) {
return false;
}
for (String aTrigger : triggers) {
if (aTrigger != null && aTrigger.intern() == getTrigger()) {
return true;
}
... | [
"@",
"SuppressWarnings",
"(",
"\"squid:S1698\"",
")",
"public",
"boolean",
"wasTriggeredBy",
"(",
"String",
"...",
"triggers",
")",
"{",
"if",
"(",
"triggers",
".",
"length",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"String",
"aTrigger... | Determines if this token was triggered by one of the given triggers.
@param triggers a list of possible triggers to compare to
@return <tt>true</tt> if this token was triggered by one of the given triggers, <tt>false</tt> otherwise | [
"Determines",
"if",
"this",
"token",
"was",
"triggered",
"by",
"one",
"of",
"the",
"given",
"triggers",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Token.java#L280-L292 | train |
scireum/parsii | src/main/java/parsii/eval/Parser.java | Parser.parse | public static Expression parse(String input) throws ParseException {
return new Parser(new StringReader(input), new Scope()).parse();
} | java | public static Expression parse(String input) throws ParseException {
return new Parser(new StringReader(input), new Scope()).parse();
} | [
"public",
"static",
"Expression",
"parse",
"(",
"String",
"input",
")",
"throws",
"ParseException",
"{",
"return",
"new",
"Parser",
"(",
"new",
"StringReader",
"(",
"input",
")",
",",
"new",
"Scope",
"(",
")",
")",
".",
"parse",
"(",
")",
";",
"}"
] | Parses the given input into an expression.
@param input the expression to be parsed
@return the resulting AST as expression
@throws ParseException if the expression contains one or more errors | [
"Parses",
"the",
"given",
"input",
"into",
"an",
"expression",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/eval/Parser.java#L110-L112 | train |
scireum/parsii | src/main/java/parsii/eval/Parser.java | Parser.functionCall | protected Expression functionCall() {
FunctionCall call = new FunctionCall();
Token funToken = tokenizer.consume();
Function fun = functionTable.get(funToken.getContents());
if (fun == null) {
errors.add(ParseError.error(funToken, String.format("Unknown function: '%s'", funTo... | java | protected Expression functionCall() {
FunctionCall call = new FunctionCall();
Token funToken = tokenizer.consume();
Function fun = functionTable.get(funToken.getContents());
if (fun == null) {
errors.add(ParseError.error(funToken, String.format("Unknown function: '%s'", funTo... | [
"protected",
"Expression",
"functionCall",
"(",
")",
"{",
"FunctionCall",
"call",
"=",
"new",
"FunctionCall",
"(",
")",
";",
"Token",
"funToken",
"=",
"tokenizer",
".",
"consume",
"(",
")",
";",
"Function",
"fun",
"=",
"functionTable",
".",
"get",
"(",
"fu... | Parses a function call.
@return the function call as Expression | [
"Parses",
"a",
"function",
"call",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/eval/Parser.java#L448-L477 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.canConsumeThisString | protected boolean canConsumeThisString(String string, boolean consume) {
if (string == null) {
return false;
}
for (int i = 0; i < string.length(); i++) {
if (!input.next(i).is(string.charAt(i))) {
return false;
}
}
if (consume)... | java | protected boolean canConsumeThisString(String string, boolean consume) {
if (string == null) {
return false;
}
for (int i = 0; i < string.length(); i++) {
if (!input.next(i).is(string.charAt(i))) {
return false;
}
}
if (consume)... | [
"protected",
"boolean",
"canConsumeThisString",
"(",
"String",
"string",
",",
"boolean",
"consume",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"string",
".",
"l... | Checks if the next characters, starting from the current, match the given string.
@param string the string to check
@param consume determines if the matched string should be consumed immediately
@return <tt>true</tt> if the next characters of the input match the given string, <tt>false</tt>
otherwise | [
"Checks",
"if",
"the",
"next",
"characters",
"starting",
"from",
"the",
"current",
"match",
"the",
"given",
"string",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L242-L255 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.skipBlockComment | protected void skipBlockComment() {
while (!input.current().isEndOfInput()) {
if (isAtEndOfBlockComment()) {
return;
}
input.consume();
}
problemCollector.add(ParseError.error(input.current(), "Premature end of block comment"));
} | java | protected void skipBlockComment() {
while (!input.current().isEndOfInput()) {
if (isAtEndOfBlockComment()) {
return;
}
input.consume();
}
problemCollector.add(ParseError.error(input.current(), "Premature end of block comment"));
} | [
"protected",
"void",
"skipBlockComment",
"(",
")",
"{",
"while",
"(",
"!",
"input",
".",
"current",
"(",
")",
".",
"isEndOfInput",
"(",
")",
")",
"{",
"if",
"(",
"isAtEndOfBlockComment",
"(",
")",
")",
"{",
"return",
";",
"}",
"input",
".",
"consume",
... | Checks if we're looking at an end of block comment | [
"Checks",
"if",
"we",
"re",
"looking",
"at",
"an",
"end",
"of",
"block",
"comment"
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L310-L318 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.fetchString | protected Token fetchString() {
char separator = input.current().getValue();
char escapeChar = stringDelimiters.get(input.current().getValue());
Token result = Token.create(Token.TokenType.STRING, input.current());
result.addToTrigger(input.consume());
while (!input.current().isN... | java | protected Token fetchString() {
char separator = input.current().getValue();
char escapeChar = stringDelimiters.get(input.current().getValue());
Token result = Token.create(Token.TokenType.STRING, input.current());
result.addToTrigger(input.consume());
while (!input.current().isN... | [
"protected",
"Token",
"fetchString",
"(",
")",
"{",
"char",
"separator",
"=",
"input",
".",
"current",
"(",
")",
".",
"getValue",
"(",
")",
";",
"char",
"escapeChar",
"=",
"stringDelimiters",
".",
"get",
"(",
"input",
".",
"current",
"(",
")",
".",
"ge... | Reads and returns a string constant.
@return the parsed string constant a Token | [
"Reads",
"and",
"returns",
"a",
"string",
"constant",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L325-L348 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.fetchId | protected Token fetchId() {
Token result = Token.create(Token.TokenType.ID, input.current());
result.addToContent(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
if (!input.current().isEndOfInput() && specialIdTerm... | java | protected Token fetchId() {
Token result = Token.create(Token.TokenType.ID, input.current());
result.addToContent(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
if (!input.current().isEndOfInput() && specialIdTerm... | [
"protected",
"Token",
"fetchId",
"(",
")",
"{",
"Token",
"result",
"=",
"Token",
".",
"create",
"(",
"Token",
".",
"TokenType",
".",
"ID",
",",
"input",
".",
"current",
"(",
")",
")",
";",
"result",
".",
"addToContent",
"(",
"input",
".",
"consume",
... | Reads and returns an identifier
@return the parsed identifier as Token | [
"Reads",
"and",
"returns",
"an",
"identifier"
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L399-L415 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.handleKeywords | protected Token handleKeywords(Token idToken) {
String keyword = keywords.get(keywordsCaseSensitive ?
idToken.getContents().intern() :
idToken.getContents().toLowerCase().intern());
if (keyword != null) {
Token keywo... | java | protected Token handleKeywords(Token idToken) {
String keyword = keywords.get(keywordsCaseSensitive ?
idToken.getContents().intern() :
idToken.getContents().toLowerCase().intern());
if (keyword != null) {
Token keywo... | [
"protected",
"Token",
"handleKeywords",
"(",
"Token",
"idToken",
")",
"{",
"String",
"keyword",
"=",
"keywords",
".",
"get",
"(",
"keywordsCaseSensitive",
"?",
"idToken",
".",
"getContents",
"(",
")",
".",
"intern",
"(",
")",
":",
"idToken",
".",
"getContent... | Checks if the given identifier is a keyword and returns an appropriate Token
@param idToken the identifier to check
@return a keyword Token if the given identifier was a keyword, the original Token otherwise | [
"Checks",
"if",
"the",
"given",
"identifier",
"is",
"a",
"keyword",
"and",
"returns",
"an",
"appropriate",
"Token"
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L423-L437 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.fetchSpecialId | protected Token fetchSpecialId() {
Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current());
result.addToTrigger(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
return handleKeywords(result);
} | java | protected Token fetchSpecialId() {
Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current());
result.addToTrigger(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
return handleKeywords(result);
} | [
"protected",
"Token",
"fetchSpecialId",
"(",
")",
"{",
"Token",
"result",
"=",
"Token",
".",
"create",
"(",
"Token",
".",
"TokenType",
".",
"SPECIAL_ID",
",",
"input",
".",
"current",
"(",
")",
")",
";",
"result",
".",
"addToTrigger",
"(",
"input",
".",
... | Reads and returns a special id.
@return the parsed special id as Token | [
"Reads",
"and",
"returns",
"a",
"special",
"id",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L456-L463 | train |
scireum/parsii | src/main/java/parsii/tokenizer/Tokenizer.java | Tokenizer.fetchNumber | protected Token fetchNumber() {
Token result = Token.create(Token.TokenType.INTEGER, input.current());
result.addToContent(input.consume());
while (input.current().isDigit() || input.current().is(decimalSeparator) || (input.current()
... | java | protected Token fetchNumber() {
Token result = Token.create(Token.TokenType.INTEGER, input.current());
result.addToContent(input.consume());
while (input.current().isDigit() || input.current().is(decimalSeparator) || (input.current()
... | [
"protected",
"Token",
"fetchNumber",
"(",
")",
"{",
"Token",
"result",
"=",
"Token",
".",
"create",
"(",
"Token",
".",
"TokenType",
".",
"INTEGER",
",",
"input",
".",
"current",
"(",
")",
")",
";",
"result",
".",
"addToContent",
"(",
"input",
".",
"con... | Reads and returns a number.
@return the parsed number as Token | [
"Reads",
"and",
"returns",
"a",
"number",
"."
] | fbf686155b1147b9e07ae21dcd02820b15c79a8c | https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/tokenizer/Tokenizer.java#L518-L542 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.