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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java | GenericTreeWalker.getFirstChild | private Node getFirstChild(Node node) {
if (node == null)
return null;
Node newNode = node.getFirstChild();
if (newNode == null)
return null;
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP && newNode.hasChildNod... | java | private Node getFirstChild(Node node) {
if (node == null)
return null;
Node newNode = node.getFirstChild();
if (newNode == null)
return null;
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP && newNode.hasChildNod... | [
"private",
"Node",
"getFirstChild",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"null",
";",
"Node",
"newNode",
"=",
"node",
".",
"getFirstChild",
"(",
")",
";",
"if",
"(",
"newNode",
"==",
"null",
")",
"return",
"n... | Internal function. Return the first child Node, from the input node after
applying filter, whatToshow. The current node is not consulted or set. | [
"Internal",
"function",
".",
"Return",
"the",
"first",
"child",
"Node",
"from",
"the",
"input",
"node",
"after",
"applying",
"filter",
"whatToshow",
".",
"The",
"current",
"node",
"is",
"not",
"consulted",
"or",
"set",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L387-L404 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java | GenericTreeWalker.getLastChild | private Node getLastChild(Node node) {
if (node == null)
return null;
Node newNode = node.getLastChild();
if (newNode == null)
return null;
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP && newNode.hasChildNodes... | java | private Node getLastChild(Node node) {
if (node == null)
return null;
Node newNode = node.getLastChild();
if (newNode == null)
return null;
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else if (accept == NodeFilter.FILTER_SKIP && newNode.hasChildNodes... | [
"private",
"Node",
"getLastChild",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
"null",
";",
"Node",
"newNode",
"=",
"node",
".",
"getLastChild",
"(",
")",
";",
"if",
"(",
"newNode",
"==",
"null",
")",
"return",
"nul... | Internal function. Return the last child Node, from the input node after
applying filter, whatToshow. The current node is not consulted or set. | [
"Internal",
"function",
".",
"Return",
"the",
"last",
"child",
"Node",
"from",
"the",
"input",
"node",
"after",
"applying",
"filter",
"whatToshow",
".",
"The",
"current",
"node",
"is",
"not",
"consulted",
"or",
"set",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L410-L428 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java | GenericTreeWalker.acceptNode | private short acceptNode(Node node) {
/***
* 7.1.2.4. Filters and whatToShow flags
*
* Iterator and TreeWalker apply whatToShow flags before applying
* Filters. If a node is rejected by the active whatToShow flags, a
* Filter will not be called to evaluate that node. When a node is
* rejected by th... | java | private short acceptNode(Node node) {
/***
* 7.1.2.4. Filters and whatToShow flags
*
* Iterator and TreeWalker apply whatToShow flags before applying
* Filters. If a node is rejected by the active whatToShow flags, a
* Filter will not be called to evaluate that node. When a node is
* rejected by th... | [
"private",
"short",
"acceptNode",
"(",
"Node",
"node",
")",
"{",
"/***\n\t\t * 7.1.2.4. Filters and whatToShow flags\n\t\t * \n\t\t * Iterator and TreeWalker apply whatToShow flags before applying\n\t\t * Filters. If a node is rejected by the active whatToShow flags, a\n\t\t * Filter will not be cal... | Internal function. The node whatToShow and the filter are combined into
one result. | [
"Internal",
"function",
".",
"The",
"node",
"whatToShow",
"and",
"the",
"filter",
"are",
"combined",
"into",
"one",
"result",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L434-L449 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/SelectorImpl.java | SelectorImpl.computeSpecificity | public void computeSpecificity(CombinedSelector.Specificity spec) {
for(SelectorPart item: list) {
item.computeSpecificity(spec);
}
} | java | public void computeSpecificity(CombinedSelector.Specificity spec) {
for(SelectorPart item: list) {
item.computeSpecificity(spec);
}
} | [
"public",
"void",
"computeSpecificity",
"(",
"CombinedSelector",
".",
"Specificity",
"spec",
")",
"{",
"for",
"(",
"SelectorPart",
"item",
":",
"list",
")",
"{",
"item",
".",
"computeSpecificity",
"(",
"spec",
")",
";",
"}",
"}"
] | Computes specificity of this selector | [
"Computes",
"specificity",
"of",
"this",
"selector"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/SelectorImpl.java#L168-L172 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Variator.java | Variator.createInherit | private CSSProperty createInherit(int i) {
try {
Class<? extends CSSProperty> clazz = types.get(i);
CSSProperty property = CSSProperty.Translator.createInherit(clazz);
if (property != null)
return property;
throw new IllegalAccessException("No inherit value for: "
+ clazz.getName());
} catch ... | java | private CSSProperty createInherit(int i) {
try {
Class<? extends CSSProperty> clazz = types.get(i);
CSSProperty property = CSSProperty.Translator.createInherit(clazz);
if (property != null)
return property;
throw new IllegalAccessException("No inherit value for: "
+ clazz.getName());
} catch ... | [
"private",
"CSSProperty",
"createInherit",
"(",
"int",
"i",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
"extends",
"CSSProperty",
">",
"clazz",
"=",
"types",
".",
"get",
"(",
"i",
")",
";",
"CSSProperty",
"property",
"=",
"CSSProperty",
".",
"Translator",
"... | Creates INHERIT value of given class
@param i
Ordinal in list of types
@return Created CSSProperty with value inherit
@throws UnsupportedOperationException
If class does not provide INHERIT or is not implementation of
CSSProperty | [
"Creates",
"INHERIT",
"value",
"of",
"given",
"class"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L149-L164 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Variator.java | Variator.vary | public boolean vary(Map<String, CSSProperty> properties,
Map<String, Term<?>> values) {
// try inherit variant
if (terms.size() == 1
&& checkInherit(ALL_VARIANTS, terms.get(0), properties))
return true;
// for all terms
for (IntegerRef i = new IntegerRef(0); i.get() < terms.size(); i.inc()) {
bo... | java | public boolean vary(Map<String, CSSProperty> properties,
Map<String, Term<?>> values) {
// try inherit variant
if (terms.size() == 1
&& checkInherit(ALL_VARIANTS, terms.get(0), properties))
return true;
// for all terms
for (IntegerRef i = new IntegerRef(0); i.get() < terms.size(); i.inc()) {
bo... | [
"public",
"boolean",
"vary",
"(",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"// try inherit variant",
"if",
"(",
"terms",
".",
"size",
"(",
")",
"==",
... | Test all terms | [
"Test",
"all",
"terms"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L207-L248 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Variator.java | Variator.tryOneTermVariant | public boolean tryOneTermVariant(int variant, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
// only one term is allowed
if (d.size() != 1)
return false;
// try inherit variant
if (checkInherit(variant, d.get(0), properties))
return true;
this.terms = new ArrayL... | java | public boolean tryOneTermVariant(int variant, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
// only one term is allowed
if (d.size() != 1)
return false;
// try inherit variant
if (checkInherit(variant, d.get(0), properties))
return true;
this.terms = new ArrayL... | [
"public",
"boolean",
"tryOneTermVariant",
"(",
"int",
"variant",
",",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"// only one term is... | Uses variator functionality to test selected variant on term
@param variant
Which variant will be tested
@param d
The declaration on which variant will be tested
@param properties
Properties map where to store property type
@param values
Values map where to store property value
@return <code>true</code> in case of suc... | [
"Uses",
"variator",
"functionality",
"to",
"test",
"selected",
"variant",
"on",
"term"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L264-L279 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Variator.java | Variator.tryMultiTermVariant | public boolean tryMultiTermVariant(int variant,
Map<String, CSSProperty> properties, Map<String, Term<?>> values,
Term<?>... terms) {
this.terms = Arrays.asList(terms);
// try inherit variant
if (this.terms.size() == 1
&& checkInherit(variant, this.terms.get(0), properties))
return true;
return ... | java | public boolean tryMultiTermVariant(int variant,
Map<String, CSSProperty> properties, Map<String, Term<?>> values,
Term<?>... terms) {
this.terms = Arrays.asList(terms);
// try inherit variant
if (this.terms.size() == 1
&& checkInherit(variant, this.terms.get(0), properties))
return true;
return ... | [
"public",
"boolean",
"tryMultiTermVariant",
"(",
"int",
"variant",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
",",
"Term",
"<",
"?",
">",
"...",
"terms",
")",
... | Uses variator functionality to test selected variant on more terms. This
is used when variant is represented by more terms. Since usually only one
term per variant is used, only one multiple variant is allowed per
variator and should be placed as the last one
@param variant
Number of variant (last variant in variator)... | [
"Uses",
"variator",
"functionality",
"to",
"test",
"selected",
"variant",
"on",
"more",
"terms",
".",
"This",
"is",
"used",
"when",
"variant",
"is",
"represented",
"by",
"more",
"terms",
".",
"Since",
"usually",
"only",
"one",
"term",
"per",
"variant",
"is",... | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L298-L310 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Variator.java | Variator.assignDefaults | public void assignDefaults(Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
SupportedCSS css = CSSFactory.getSupportedCSS();
for (String name : names) {
CSSProperty dp = css.getDefaultProperty(name);
if (dp != null)
properties.put(name, dp);
Term<?> d... | java | public void assignDefaults(Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
SupportedCSS css = CSSFactory.getSupportedCSS();
for (String name : names) {
CSSProperty dp = css.getDefaultProperty(name);
if (dp != null)
properties.put(name, dp);
Term<?> d... | [
"public",
"void",
"assignDefaults",
"(",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"SupportedCSS",
"css",
"=",
"CSSFactory",
".",
"getSupportedCSS",
"(",
"... | Assigns the default values to all the properties.
@param properties
@param values | [
"Assigns",
"the",
"default",
"values",
"to",
"all",
"the",
"properties",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Variator.java#L348-L358 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/AssignedDeclaration.java | AssignedDeclaration.getOriginOrder | public int getOriginOrder()
{
if (important)
{
if (origin == StyleSheet.Origin.AUTHOR)
return 4;
else if (origin == StyleSheet.Origin.AGENT)
return 1;
else
return 5;
}
else
{
if (origin == StyleSheet.Origin.AUTHOR)
return 3;
else if (origin == StyleSheet.Origin.AGENT)
retur... | java | public int getOriginOrder()
{
if (important)
{
if (origin == StyleSheet.Origin.AUTHOR)
return 4;
else if (origin == StyleSheet.Origin.AGENT)
return 1;
else
return 5;
}
else
{
if (origin == StyleSheet.Origin.AUTHOR)
return 3;
else if (origin == StyleSheet.Origin.AGENT)
retur... | [
"public",
"int",
"getOriginOrder",
"(",
")",
"{",
"if",
"(",
"important",
")",
"{",
"if",
"(",
"origin",
"==",
"StyleSheet",
".",
"Origin",
".",
"AUTHOR",
")",
"return",
"4",
";",
"else",
"if",
"(",
"origin",
"==",
"StyleSheet",
".",
"Origin",
".",
"... | Computes the priority order of the declaration based on its origin and importance
according to the CSS specification.
@return The priority order (1..5).
@see <a href="http://www.w3.org/TR/CSS21/cascade.html#cascading-order">http://www.w3.org/TR/CSS21/cascade.html#cascading-order</a> | [
"Computes",
"the",
"priority",
"order",
"of",
"the",
"declaration",
"based",
"on",
"its",
"origin",
"and",
"importance",
"according",
"to",
"the",
"CSS",
"specification",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/AssignedDeclaration.java#L61-L81 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationMap.java | DeclarationMap.addDeclaration | public void addDeclaration(Element el, PseudoElementType pseudo, Declaration decl)
{
List<Declaration> list = getOrCreate(el, pseudo);
list.add(decl);
} | java | public void addDeclaration(Element el, PseudoElementType pseudo, Declaration decl)
{
List<Declaration> list = getOrCreate(el, pseudo);
list.add(decl);
} | [
"public",
"void",
"addDeclaration",
"(",
"Element",
"el",
",",
"PseudoElementType",
"pseudo",
",",
"Declaration",
"decl",
")",
"{",
"List",
"<",
"Declaration",
">",
"list",
"=",
"getOrCreate",
"(",
"el",
",",
"pseudo",
")",
";",
"list",
".",
"add",
"(",
... | Adds a declaration for a specified list. If the list does not exist yet, it is created.
@param el the element that the declaration belongs to
@param pseudo an optional pseudo-element or null
@param decl the new declaration | [
"Adds",
"a",
"declaration",
"for",
"a",
"specified",
"list",
".",
"If",
"the",
"list",
"does",
"not",
"exist",
"yet",
"it",
"is",
"created",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationMap.java#L32-L36 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationMap.java | DeclarationMap.sortDeclarations | public void sortDeclarations(Element el, PseudoElementType pseudo)
{
List<Declaration> list = get(el, pseudo);
if (list != null)
Collections.sort(list);
} | java | public void sortDeclarations(Element el, PseudoElementType pseudo)
{
List<Declaration> list = get(el, pseudo);
if (list != null)
Collections.sort(list);
} | [
"public",
"void",
"sortDeclarations",
"(",
"Element",
"el",
",",
"PseudoElementType",
"pseudo",
")",
"{",
"List",
"<",
"Declaration",
">",
"list",
"=",
"get",
"(",
"el",
",",
"pseudo",
")",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"Collections",
".",
... | Sorts the given list according to the rule specificity.
@param el the element to which the list is assigned
@param pseudo an optional pseudo-element or null | [
"Sorts",
"the",
"given",
"list",
"according",
"to",
"the",
"rule",
"specificity",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationMap.java#L43-L48 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/TermColorImpl.java | TermColorImpl.hslToRgb | private static int[] hslToRgb(float h, float s, float l) {
int[] ret = new int[3];
float m2 = (l <= 0.5f) ? l * (s + 1) : l + s - l * s;
float m1 = l * 2 - m2;
ret[0] = Math.round(hueToRgb(m1, m2, h + 1.0f/3.0f) * MAX_VALUE);
ret[1] = Math.round(hueToRgb(m1, m2... | java | private static int[] hslToRgb(float h, float s, float l) {
int[] ret = new int[3];
float m2 = (l <= 0.5f) ? l * (s + 1) : l + s - l * s;
float m1 = l * 2 - m2;
ret[0] = Math.round(hueToRgb(m1, m2, h + 1.0f/3.0f) * MAX_VALUE);
ret[1] = Math.round(hueToRgb(m1, m2... | [
"private",
"static",
"int",
"[",
"]",
"hslToRgb",
"(",
"float",
"h",
",",
"float",
"s",
",",
"float",
"l",
")",
"{",
"int",
"[",
"]",
"ret",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"float",
"m2",
"=",
"(",
"l",
"<=",
"0.5f",
")",
"?",
"l",
"... | Converts the HSL color model to RGB
@param h hue normalized to 0..1
@param s saturation normalized to 0..1
@param l level normalized to 0..1
@return an array of three values R, G and B in the interval 0..255 | [
"Converts",
"the",
"HSL",
"color",
"model",
"to",
"RGB"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/TermColorImpl.java#L263-L273 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java | CSSTokenRecovery.nextToken | public Token nextToken() {
if(lexer._input == null) {
throw new IllegalStateException("nextToken requires a non-null input stream.");
} else {
int tokenStartMarker = lexer._input.mark();
try {
Token ttype1;
label110:
w... | java | public Token nextToken() {
if(lexer._input == null) {
throw new IllegalStateException("nextToken requires a non-null input stream.");
} else {
int tokenStartMarker = lexer._input.mark();
try {
Token ttype1;
label110:
w... | [
"public",
"Token",
"nextToken",
"(",
")",
"{",
"if",
"(",
"lexer",
".",
"_input",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"nextToken requires a non-null input stream.\"",
")",
";",
"}",
"else",
"{",
"int",
"tokenStartMarker",
"=",... | Implements Lexer's next token with extra token passing from
recovery function | [
"Implements",
"Lexer",
"s",
"next",
"token",
"with",
"extra",
"token",
"passing",
"from",
"recovery",
"function"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java#L120-L185 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java | CSSTokenRecovery.generateEOFRecover | public CSSToken generateEOFRecover() {
CSSToken t = null;
if (ls.aposOpen) {
ls.aposOpen = false;
t = new CSSToken(typeMapper.get(APOS), ls, lexerTypeMapper);
t.setText("'");
} else if (ls.quotOpen) {
ls.quotOpen = false;
t = new CSST... | java | public CSSToken generateEOFRecover() {
CSSToken t = null;
if (ls.aposOpen) {
ls.aposOpen = false;
t = new CSSToken(typeMapper.get(APOS), ls, lexerTypeMapper);
t.setText("'");
} else if (ls.quotOpen) {
ls.quotOpen = false;
t = new CSST... | [
"public",
"CSSToken",
"generateEOFRecover",
"(",
")",
"{",
"CSSToken",
"t",
"=",
"null",
";",
"if",
"(",
"ls",
".",
"aposOpen",
")",
"{",
"ls",
".",
"aposOpen",
"=",
"false",
";",
"t",
"=",
"new",
"CSSToken",
"(",
"typeMapper",
".",
"get",
"(",
"APOS... | Recovers from unexpected EOF by preparing
new token | [
"Recovers",
"from",
"unexpected",
"EOF",
"by",
"preparing",
"new",
"token"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java#L191-L219 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java | CSSTokenRecovery.consumeUntilBalanced | private void consumeUntilBalanced(IntervalSet follow) {
log.debug("Lexer entered consumeUntilBalanced with {} and follow {}",
ls, follow);
int c;
do {
c = input.LA(1);
// change apostrophe state
if (c == '\'' && ls.quotOpen == false) {
... | java | private void consumeUntilBalanced(IntervalSet follow) {
log.debug("Lexer entered consumeUntilBalanced with {} and follow {}",
ls, follow);
int c;
do {
c = input.LA(1);
// change apostrophe state
if (c == '\'' && ls.quotOpen == false) {
... | [
"private",
"void",
"consumeUntilBalanced",
"(",
"IntervalSet",
"follow",
")",
"{",
"log",
".",
"debug",
"(",
"\"Lexer entered consumeUntilBalanced with {} and follow {}\"",
",",
"ls",
",",
"follow",
")",
";",
"int",
"c",
";",
"do",
"{",
"c",
"=",
"input",
".",
... | Eats characters until on from follow is found and Lexer state
is balanced at the moment | [
"Eats",
"characters",
"until",
"on",
"from",
"follow",
"is",
"found",
"and",
"Lexer",
"state",
"is",
"balanced",
"at",
"the",
"moment"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java#L225-L268 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java | CSSTokenRecovery.consumeAnyButEOF | private boolean consumeAnyButEOF() {
int c = input.LA(1);
if (c == CharStream.EOF)
return false;
if (log.isTraceEnabled())
log.trace("Lexer consumes '{}' while consumeButEOF",
Character.toString((char) c));
// consume character
inpu... | java | private boolean consumeAnyButEOF() {
int c = input.LA(1);
if (c == CharStream.EOF)
return false;
if (log.isTraceEnabled())
log.trace("Lexer consumes '{}' while consumeButEOF",
Character.toString((char) c));
// consume character
inpu... | [
"private",
"boolean",
"consumeAnyButEOF",
"(",
")",
"{",
"int",
"c",
"=",
"input",
".",
"LA",
"(",
"1",
")",
";",
"if",
"(",
"c",
"==",
"CharStream",
".",
"EOF",
")",
"return",
"false",
";",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
... | Consumes arbitrary character but EOF
@return <code>false</code> if EOF was matched,
<code>true</code> otherwise and that character was consumed | [
"Consumes",
"arbitrary",
"character",
"but",
"EOF"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSTokenRecovery.java#L276-L290 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.getTermFactory | public static final TermFactory getTermFactory() {
if (tf == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends TermFactory> clazz = (Class<? extends TermFactory>) Class
.forName(DEFAULT_TERM_FACTORY);
Method m = clazz.getMethod("getInstance");
registerTermFactory((TermFactory) m.in... | java | public static final TermFactory getTermFactory() {
if (tf == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends TermFactory> clazz = (Class<? extends TermFactory>) Class
.forName(DEFAULT_TERM_FACTORY);
Method m = clazz.getMethod("getInstance");
registerTermFactory((TermFactory) m.in... | [
"public",
"static",
"final",
"TermFactory",
"getTermFactory",
"(",
")",
"{",
"if",
"(",
"tf",
"==",
"null",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"TermFactory",
">",
"clazz",
"=",
"(",
"Cl... | Returns TermFactory registered in step above
@return TermFactory registered | [
"Returns",
"TermFactory",
"registered",
"in",
"step",
"above"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L210-L227 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.getSupportedCSS | public static final SupportedCSS getSupportedCSS() {
if (css == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends SupportedCSS> clazz = (Class<? extends SupportedCSS>) Class
.forName(DEFAULT_SUPPORTED_CSS);
Method m = clazz.getMethod("getInstance");
registerSupportedCSS((SupportedC... | java | public static final SupportedCSS getSupportedCSS() {
if (css == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends SupportedCSS> clazz = (Class<? extends SupportedCSS>) Class
.forName(DEFAULT_SUPPORTED_CSS);
Method m = clazz.getMethod("getInstance");
registerSupportedCSS((SupportedC... | [
"public",
"static",
"final",
"SupportedCSS",
"getSupportedCSS",
"(",
")",
"{",
"if",
"(",
"css",
"==",
"null",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"SupportedCSS",
">",
"clazz",
"=",
"(",
... | Returns registered SupportedCSS
@return SupportedCSS instance | [
"Returns",
"registered",
"SupportedCSS"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L244-L262 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.getRuleFactory | public static final RuleFactory getRuleFactory() {
if (rf == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends RuleFactory> clazz = (Class<? extends RuleFactory>) Class
.forName(DEFAULT_RULE_FACTORY);
Method m = clazz.getMethod("getInstance");
registerRuleFactory((RuleFactory) m.in... | java | public static final RuleFactory getRuleFactory() {
if (rf == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends RuleFactory> clazz = (Class<? extends RuleFactory>) Class
.forName(DEFAULT_RULE_FACTORY);
Method m = clazz.getMethod("getInstance");
registerRuleFactory((RuleFactory) m.in... | [
"public",
"static",
"final",
"RuleFactory",
"getRuleFactory",
"(",
")",
"{",
"if",
"(",
"rf",
"==",
"null",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"RuleFactory",
">",
"clazz",
"=",
"(",
"Cl... | Returns registered RuleFactory
@return RuleFactory instance | [
"Returns",
"registered",
"RuleFactory"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L279-L297 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.getDeclarationTransformer | public static final DeclarationTransformer getDeclarationTransformer() {
if (dt == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends DeclarationTransformerImpl> clazz = (Class<? extends DeclarationTransformerImpl>) Class
.forName(DEF... | java | public static final DeclarationTransformer getDeclarationTransformer() {
if (dt == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends DeclarationTransformerImpl> clazz = (Class<? extends DeclarationTransformerImpl>) Class
.forName(DEF... | [
"public",
"static",
"final",
"DeclarationTransformer",
"getDeclarationTransformer",
"(",
")",
"{",
"if",
"(",
"dt",
"==",
"null",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"DeclarationTransformerImpl",
... | Returns the registered DeclarationTransformer
@return DeclarationTransformer instance | [
"Returns",
"the",
"registered",
"DeclarationTransformer"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L314-L332 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.registerNodeDataInstance | public static final void registerNodeDataInstance(
Class<? extends NodeData> clazz) {
try {
@SuppressWarnings("unused")
NodeData test = clazz.newInstance();
ndImpl = clazz;
} catch (InstantiationException e) {
throw new RuntimeException("NodeData implemenation ("
+ clazz.getName() + ") doesn't p... | java | public static final void registerNodeDataInstance(
Class<? extends NodeData> clazz) {
try {
@SuppressWarnings("unused")
NodeData test = clazz.newInstance();
ndImpl = clazz;
} catch (InstantiationException e) {
throw new RuntimeException("NodeData implemenation ("
+ clazz.getName() + ") doesn't p... | [
"public",
"static",
"final",
"void",
"registerNodeDataInstance",
"(",
"Class",
"<",
"?",
"extends",
"NodeData",
">",
"clazz",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"NodeData",
"test",
"=",
"clazz",
".",
"newInstance",
"(",
")... | Registers node data instance. Instance must provide no-argument
Constructor
@param clazz
Instance class | [
"Registers",
"node",
"data",
"instance",
".",
"Instance",
"must",
"provide",
"no",
"-",
"argument",
"Constructor"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L380-L394 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.createNodeData | public static final NodeData createNodeData() {
if (ndImpl == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends NodeData> clazz = (Class<? extends NodeData>) Class
.forName(DEFAULT_NODE_DATA_IMPL);
registerNodeDataInstance(clazz);
log.debug("Registered {} as default NodeData instan... | java | public static final NodeData createNodeData() {
if (ndImpl == null) {
try {
@SuppressWarnings("unchecked")
Class<? extends NodeData> clazz = (Class<? extends NodeData>) Class
.forName(DEFAULT_NODE_DATA_IMPL);
registerNodeDataInstance(clazz);
log.debug("Registered {} as default NodeData instan... | [
"public",
"static",
"final",
"NodeData",
"createNodeData",
"(",
")",
"{",
"if",
"(",
"ndImpl",
"==",
"null",
")",
"{",
"try",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Class",
"<",
"?",
"extends",
"NodeData",
">",
"clazz",
"=",
"(",
"Clas... | Creates instance of NodeData
@return Instance of NodeData | [
"Creates",
"instance",
"of",
"NodeData"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L401-L419 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.parse | public static final StyleSheet parse(String fileName, String encoding)
throws CSSException, IOException {
try {
File f = new File(fileName);
URL url = f.toURI().toURL();
return parse(url, encoding);
} catch (MalformedURLException e) {
String message = "Unable to construct URL from fileName: "
+... | java | public static final StyleSheet parse(String fileName, String encoding)
throws CSSException, IOException {
try {
File f = new File(fileName);
URL url = f.toURI().toURL();
return parse(url, encoding);
} catch (MalformedURLException e) {
String message = "Unable to construct URL from fileName: "
+... | [
"public",
"static",
"final",
"StyleSheet",
"parse",
"(",
"String",
"fileName",
",",
"String",
"encoding",
")",
"throws",
"CSSException",
",",
"IOException",
"{",
"try",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"fileName",
")",
";",
"URL",
"url",
"=",
"... | Parses file into StyleSheet. Internally transforms file to URL
@param fileName Name of file
@param encoding Encoding used to parse input
@return Parsed style sheet
@throws CSSException In case that parsing error occurs
@throws IOException If file is not found or not readable | [
"Parses",
"file",
"into",
"StyleSheet",
".",
"Internally",
"transforms",
"file",
"to",
"URL"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L467-L480 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/CSSFactory.java | CSSFactory.parse | @Deprecated
public static final StyleSheet parse(String css) throws IOException,
CSSException {
URL base = new URL("file:///base/url/is/not/specified"); //Cannot determine the base URI in this method but we need some base URI for relative URLs
return getCSSParserFactory().parse(css, getNetworkProcessor(),
... | java | @Deprecated
public static final StyleSheet parse(String css) throws IOException,
CSSException {
URL base = new URL("file:///base/url/is/not/specified"); //Cannot determine the base URI in this method but we need some base URI for relative URLs
return getCSSParserFactory().parse(css, getNetworkProcessor(),
... | [
"@",
"Deprecated",
"public",
"static",
"final",
"StyleSheet",
"parse",
"(",
"String",
"css",
")",
"throws",
"IOException",
",",
"CSSException",
"{",
"URL",
"base",
"=",
"new",
"URL",
"(",
"\"file:///base/url/is/not/specified\"",
")",
";",
"//Cannot determine the bas... | Parses text into StyleSheet
@param css
Text with CSS declarations
@return Parsed StyleSheet
@throws IOException
When exception during read occurs
@throws CSSException
When exception during parse occurs
@deprecated
This function does not specify the base URL. {@link #parseString(String, URL)}
should be used instead. | [
"Parses",
"text",
"into",
"StyleSheet"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L496-L502 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.matches | public boolean matches(MediaQuery q)
{
//match the media type
if (q.getType() != null)
{
if (q.getType().equals("all"))
{
if (q.isNegative())
return false; //"NOT all" doesn't match to anything
}
else if (q.g... | java | public boolean matches(MediaQuery q)
{
//match the media type
if (q.getType() != null)
{
if (q.getType().equals("all"))
{
if (q.isNegative())
return false; //"NOT all" doesn't match to anything
}
else if (q.g... | [
"public",
"boolean",
"matches",
"(",
"MediaQuery",
"q",
")",
"{",
"//match the media type",
"if",
"(",
"q",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"q",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"all\"",
")",
")",
"{",
"i... | Checks if this media specification matches a given media query.
@param q The media query
@return {@code true} when this media specification matches the given media query. | [
"Checks",
"if",
"this",
"media",
"specification",
"matches",
"a",
"given",
"media",
"query",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L374-L395 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.matches | public boolean matches(MediaExpression e)
{
String fs = e.getFeature();
boolean isMin = false;
boolean isMax = false;
if (fs.startsWith("min-")) { isMin = true; fs = fs.substring(4); }
else if (fs.startsWith("max-")) { isMax = true; fs = fs.substring(4); }
F... | java | public boolean matches(MediaExpression e)
{
String fs = e.getFeature();
boolean isMin = false;
boolean isMax = false;
if (fs.startsWith("min-")) { isMin = true; fs = fs.substring(4); }
else if (fs.startsWith("max-")) { isMax = true; fs = fs.substring(4); }
F... | [
"public",
"boolean",
"matches",
"(",
"MediaExpression",
"e",
")",
"{",
"String",
"fs",
"=",
"e",
".",
"getFeature",
"(",
")",
";",
"boolean",
"isMin",
"=",
"false",
";",
"boolean",
"isMax",
"=",
"false",
";",
"if",
"(",
"fs",
".",
"startsWith",
"(",
... | Checks if this media specification matches a given media query expression.
@param e The media query expression
@return {@code true} when this media specification matches the given expression. | [
"Checks",
"if",
"this",
"media",
"specification",
"matches",
"a",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L402-L469 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.matchesOneOf | public boolean matchesOneOf(List<MediaQuery> queries)
{
for (MediaQuery q : queries)
{
if (matches(q))
return true;
}
return false;
} | java | public boolean matchesOneOf(List<MediaQuery> queries)
{
for (MediaQuery q : queries)
{
if (matches(q))
return true;
}
return false;
} | [
"public",
"boolean",
"matchesOneOf",
"(",
"List",
"<",
"MediaQuery",
">",
"queries",
")",
"{",
"for",
"(",
"MediaQuery",
"q",
":",
"queries",
")",
"{",
"if",
"(",
"matches",
"(",
"q",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
... | Checks whether this media specification matches to at least one of the given media queries.
@param queries The list of media queries to be matched.
@return {@code true} when at least one query matches, {@code false} when no query matches. | [
"Checks",
"whether",
"this",
"media",
"specification",
"matches",
"to",
"at",
"least",
"one",
"of",
"the",
"given",
"media",
"queries",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L476-L484 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.getExpressionLengthPx | protected Float getExpressionLengthPx(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermLength)
return pxLength((TermLength) term);
else
return null;
... | java | protected Float getExpressionLengthPx(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermLength)
return pxLength((TermLength) term);
else
return null;
... | [
"protected",
"Float",
"getExpressionLengthPx",
"(",
"MediaExpression",
"e",
")",
"{",
"if",
"(",
"e",
".",
"size",
"(",
")",
"==",
"1",
")",
"//the length requires exactly one value",
"{",
"Term",
"<",
"?",
">",
"term",
"=",
"e",
".",
"get",
"(",
"0",
")... | Obtains the length specified by the given media query expression.
@param e The media query expression specifying a length.
@return The length converted to pixels or {@code null} when the value cannot be converted to length. | [
"Obtains",
"the",
"length",
"specified",
"by",
"the",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L557-L569 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.getExpressionResolution | protected Float getExpressionResolution(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermResolution)
return dpiResolution((TermResolution) term);
else
... | java | protected Float getExpressionResolution(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermResolution)
return dpiResolution((TermResolution) term);
else
... | [
"protected",
"Float",
"getExpressionResolution",
"(",
"MediaExpression",
"e",
")",
"{",
"if",
"(",
"e",
".",
"size",
"(",
")",
"==",
"1",
")",
"//the length requires exactly one value",
"{",
"Term",
"<",
"?",
">",
"term",
"=",
"e",
".",
"get",
"(",
"0",
... | Obtains the resolution specified by the given media query expression.
@param e The media query expression specifying a resolution.
@return The length converted to pixels or {@code null} when the value cannot be converted to resolution. | [
"Obtains",
"the",
"resolution",
"specified",
"by",
"the",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L576-L588 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.getExpressionRatio | protected Float getExpressionRatio(MediaExpression e)
{
if (e.size() == 2) //the ratio is two integer values
{
Term<?> term1 = e.get(0);
Term<?> term2 = e.get(1);
if (term1 instanceof TermInteger && term2 instanceof TermInteger
&& (((TermIntege... | java | protected Float getExpressionRatio(MediaExpression e)
{
if (e.size() == 2) //the ratio is two integer values
{
Term<?> term1 = e.get(0);
Term<?> term2 = e.get(1);
if (term1 instanceof TermInteger && term2 instanceof TermInteger
&& (((TermIntege... | [
"protected",
"Float",
"getExpressionRatio",
"(",
"MediaExpression",
"e",
")",
"{",
"if",
"(",
"e",
".",
"size",
"(",
")",
"==",
"2",
")",
"//the ratio is two integer values",
"{",
"Term",
"<",
"?",
">",
"term1",
"=",
"e",
".",
"get",
"(",
"0",
")",
";"... | Obtains the ratio specified by the given media query expression.
@param e The media query expression specifying a ratio.
@return The length converted to pixels or {@code null} when the value cannot be converted to ratio. | [
"Obtains",
"the",
"ratio",
"specified",
"by",
"the",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L595-L609 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.getExpressionInteger | protected Integer getExpressionInteger(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermInteger)
return ((TermInteger) term).getIntValue();
else
retur... | java | protected Integer getExpressionInteger(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermInteger)
return ((TermInteger) term).getIntValue();
else
retur... | [
"protected",
"Integer",
"getExpressionInteger",
"(",
"MediaExpression",
"e",
")",
"{",
"if",
"(",
"e",
".",
"size",
"(",
")",
"==",
"1",
")",
"//the length requires exactly one value",
"{",
"Term",
"<",
"?",
">",
"term",
"=",
"e",
".",
"get",
"(",
"0",
"... | Obtains the integer specified by the given media query expression.
@param e The media query expression specifying an integer.
@return The length converted to pixels or {@code null} when the value cannot be converted to integer. | [
"Obtains",
"the",
"integer",
"specified",
"by",
"the",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L616-L628 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.getExpressionIdentifier | protected String getExpressionIdentifier(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermIdent)
return ((TermIdent) term).getValue().trim().toLowerCase(Locale.ENGLISH);
... | java | protected String getExpressionIdentifier(MediaExpression e)
{
if (e.size() == 1) //the length requires exactly one value
{
Term<?> term = e.get(0);
if (term instanceof TermIdent)
return ((TermIdent) term).getValue().trim().toLowerCase(Locale.ENGLISH);
... | [
"protected",
"String",
"getExpressionIdentifier",
"(",
"MediaExpression",
"e",
")",
"{",
"if",
"(",
"e",
".",
"size",
"(",
")",
"==",
"1",
")",
"//the length requires exactly one value",
"{",
"Term",
"<",
"?",
">",
"term",
"=",
"e",
".",
"get",
"(",
"0",
... | Obtains the identifier specified by the given media query expression.
@param e The media query expression specifying an identifier.
@return The identifier name or {@code null} when the value cannot be converted to an identifier. | [
"Obtains",
"the",
"identifier",
"specified",
"by",
"the",
"given",
"media",
"query",
"expression",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L635-L647 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.pxLength | protected Float pxLength(TermLength spec)
{
float nval = spec.getValue();
TermLength.Unit unit = spec.getUnit();
switch (unit)
{
case pt:
return (nval * dpi) / 72.0f;
case in:
return nval * dpi;
case cm:
... | java | protected Float pxLength(TermLength spec)
{
float nval = spec.getValue();
TermLength.Unit unit = spec.getUnit();
switch (unit)
{
case pt:
return (nval * dpi) / 72.0f;
case in:
return nval * dpi;
case cm:
... | [
"protected",
"Float",
"pxLength",
"(",
"TermLength",
"spec",
")",
"{",
"float",
"nval",
"=",
"spec",
".",
"getValue",
"(",
")",
";",
"TermLength",
".",
"Unit",
"unit",
"=",
"spec",
".",
"getUnit",
"(",
")",
";",
"switch",
"(",
"unit",
")",
"{",
"case... | Converts a length from a CSS length to 'px'.
@param spec the CSS length specification
@return the length in 'px' or {@code null} when the unit is invalid | [
"Converts",
"a",
"length",
"from",
"a",
"CSS",
"length",
"to",
"px",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L654-L682 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.dpiResolution | protected Float dpiResolution(TermResolution spec)
{
float nval = spec.getValue();
TermLength.Unit unit = spec.getUnit();
switch (unit)
{
case dpi:
return nval;
case dpcm:
return nval * 2.54f;
case dppx:
... | java | protected Float dpiResolution(TermResolution spec)
{
float nval = spec.getValue();
TermLength.Unit unit = spec.getUnit();
switch (unit)
{
case dpi:
return nval;
case dpcm:
return nval * 2.54f;
case dppx:
... | [
"protected",
"Float",
"dpiResolution",
"(",
"TermResolution",
"spec",
")",
"{",
"float",
"nval",
"=",
"spec",
".",
"getValue",
"(",
")",
";",
"TermLength",
".",
"Unit",
"unit",
"=",
"spec",
".",
"getUnit",
"(",
")",
";",
"switch",
"(",
"unit",
")",
"{"... | Converts a resolution from a CSS length to 'dpi'.
@param spec the CSS resolution specification
@return the resolution in 'dpi' or {@code null} when the unit is invalid | [
"Converts",
"a",
"resolution",
"from",
"a",
"CSS",
"length",
"to",
"dpi",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L689-L705 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/css/MediaSpec.java | MediaSpec.loadDefaults | protected void loadDefaults()
{
width = 1100;
height = 850;
deviceWidth = 1920;
deviceHeight = 1200;
color = 8;
colorIndex = 0;
monochrome = 0;
resolution = 96;
scanInterlace = false;
grid = 0;
} | java | protected void loadDefaults()
{
width = 1100;
height = 850;
deviceWidth = 1920;
deviceHeight = 1200;
color = 8;
colorIndex = 0;
monochrome = 0;
resolution = 96;
scanInterlace = false;
grid = 0;
} | [
"protected",
"void",
"loadDefaults",
"(",
")",
"{",
"width",
"=",
"1100",
";",
"height",
"=",
"850",
";",
"deviceWidth",
"=",
"1920",
";",
"deviceHeight",
"=",
"1200",
";",
"color",
"=",
"8",
";",
"colorIndex",
"=",
"0",
";",
"monochrome",
"=",
"0",
... | Loads some reasonable defaults that correspond to a normal desktop configuration. | [
"Loads",
"some",
"reasonable",
"defaults",
"that",
"correspond",
"to",
"a",
"normal",
"desktop",
"configuration",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/MediaSpec.java#L712-L724 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/fn/GenericGradient.java | GenericGradient.decodeColorStops | protected List<TermFunction.Gradient.ColorStop> decodeColorStops(List<List<Term<?>>> args, int firstStop) {
boolean valid = true;
List<TermFunction.Gradient.ColorStop> colorStops = null;
if (args.size() > firstStop) {
colorStops = new ArrayList<>();
for (int i = firstStop... | java | protected List<TermFunction.Gradient.ColorStop> decodeColorStops(List<List<Term<?>>> args, int firstStop) {
boolean valid = true;
List<TermFunction.Gradient.ColorStop> colorStops = null;
if (args.size() > firstStop) {
colorStops = new ArrayList<>();
for (int i = firstStop... | [
"protected",
"List",
"<",
"TermFunction",
".",
"Gradient",
".",
"ColorStop",
">",
"decodeColorStops",
"(",
"List",
"<",
"List",
"<",
"Term",
"<",
"?",
">",
">",
">",
"args",
",",
"int",
"firstStop",
")",
"{",
"boolean",
"valid",
"=",
"true",
";",
"List... | Loads the color stops from the gunction arguments.
@param args the comma-separated function arguments
@param firstStop the first argument to start with
@return the list of color stops or {@code null} when the arguments are invalid or missing | [
"Loads",
"the",
"color",
"stops",
"from",
"the",
"gunction",
"arguments",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/fn/GenericGradient.java#L46-L72 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.get | public D get(E el, P pseudo)
{
D ret;
if (pseudo == null)
ret = mainMap.get(el);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
ret = null;
else
ret = map.get(pseudo);
}
retu... | java | public D get(E el, P pseudo)
{
D ret;
if (pseudo == null)
ret = mainMap.get(el);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
ret = null;
else
ret = map.get(pseudo);
}
retu... | [
"public",
"D",
"get",
"(",
"E",
"el",
",",
"P",
"pseudo",
")",
"{",
"D",
"ret",
";",
"if",
"(",
"pseudo",
"==",
"null",
")",
"ret",
"=",
"mainMap",
".",
"get",
"(",
"el",
")",
";",
"else",
"{",
"HashMap",
"<",
"P",
",",
"D",
">",
"map",
"="... | Gets the data for the given element and pseudo-element.
@param el the element
@param pseudo a pseudo-element or null, if no pseudo-element is required
@return the stored data | [
"Gets",
"the",
"data",
"for",
"the",
"given",
"element",
"and",
"pseudo",
"-",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L64-L78 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.getOrCreate | public D getOrCreate(E el, P pseudo)
{
D ret;
if (pseudo == null)
{
ret = mainMap.get(el);
if (ret == null)
{
ret = createDataInstance();
mainMap.put(el, ret);
}
}
else
{
HashM... | java | public D getOrCreate(E el, P pseudo)
{
D ret;
if (pseudo == null)
{
ret = mainMap.get(el);
if (ret == null)
{
ret = createDataInstance();
mainMap.put(el, ret);
}
}
else
{
HashM... | [
"public",
"D",
"getOrCreate",
"(",
"E",
"el",
",",
"P",
"pseudo",
")",
"{",
"D",
"ret",
";",
"if",
"(",
"pseudo",
"==",
"null",
")",
"{",
"ret",
"=",
"mainMap",
".",
"get",
"(",
"el",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",... | Gets the data or creates an empty list if it does not exist yet.
@param el the element
@param pseudo a pseudo-element or null, if no pseudo-element is required
@return the stored data | [
"Gets",
"the",
"data",
"or",
"creates",
"an",
"empty",
"list",
"if",
"it",
"does",
"not",
"exist",
"yet",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L96-L124 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.put | public void put(E el, P pseudo, D data)
{
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
... | java | public void put(E el, P pseudo, D data)
{
if (pseudo == null)
mainMap.put(el, data);
else
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
{
map = new HashMap<P, D>();
pseudoMaps.put(el, map);
... | [
"public",
"void",
"put",
"(",
"E",
"el",
",",
"P",
"pseudo",
",",
"D",
"data",
")",
"{",
"if",
"(",
"pseudo",
"==",
"null",
")",
"mainMap",
".",
"put",
"(",
"el",
",",
"data",
")",
";",
"else",
"{",
"HashMap",
"<",
"P",
",",
"D",
">",
"map",
... | Sets the data for the specified element and pseudo-element.
@param el the element to which the data belongs
@param pseudo a pseudo-element or null of none is required
@param data data to be set | [
"Sets",
"the",
"data",
"for",
"the",
"specified",
"element",
"and",
"pseudo",
"-",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L134-L148 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.pseudoSet | public Set<P> pseudoSet(E el)
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
return Collections.emptySet();
else
return map.keySet();
} | java | public Set<P> pseudoSet(E el)
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
return Collections.emptySet();
else
return map.keySet();
} | [
"public",
"Set",
"<",
"P",
">",
"pseudoSet",
"(",
"E",
"el",
")",
"{",
"HashMap",
"<",
"P",
",",
"D",
">",
"map",
"=",
"pseudoMaps",
".",
"get",
"(",
"el",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
... | Gets all the pseudo elements that are available for the given element.
@param el The given element
@return A set of all pseudo elements available for the element | [
"Gets",
"all",
"the",
"pseudo",
"elements",
"that",
"are",
"available",
"for",
"the",
"given",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L165-L172 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/MultiMap.java | MultiMap.hasPseudo | public boolean hasPseudo(E el, P pseudo)
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
return false;
else
return map.containsKey(pseudo);
} | java | public boolean hasPseudo(E el, P pseudo)
{
HashMap<P, D> map = pseudoMaps.get(el);
if (map == null)
return false;
else
return map.containsKey(pseudo);
} | [
"public",
"boolean",
"hasPseudo",
"(",
"E",
"el",
",",
"P",
"pseudo",
")",
"{",
"HashMap",
"<",
"P",
",",
"D",
">",
"map",
"=",
"pseudoMaps",
".",
"get",
"(",
"el",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"false",
";",
"else",
... | Checks if the given pseudo element is available for the given element
@param el The element
@param pseudo The tested pseudo element
@return true when there is some value associated with the given pair | [
"Checks",
"if",
"the",
"given",
"pseudo",
"element",
"is",
"available",
"for",
"the",
"given",
"element"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/MultiMap.java#L180-L187 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/CalcArgs.java | CalcArgs.considerType | private void considerType(TermFloatValue term) {
TermNumeric.Unit unit = term.getUnit();
if (utype == Type.none) { //only a number
if (unit != null && unit.getType() != Type.none) {
utype = unit.getType();
} else if (term instanceof TermPercent) {
... | java | private void considerType(TermFloatValue term) {
TermNumeric.Unit unit = term.getUnit();
if (utype == Type.none) { //only a number
if (unit != null && unit.getType() != Type.none) {
utype = unit.getType();
} else if (term instanceof TermPercent) {
... | [
"private",
"void",
"considerType",
"(",
"TermFloatValue",
"term",
")",
"{",
"TermNumeric",
".",
"Unit",
"unit",
"=",
"term",
".",
"getUnit",
"(",
")",
";",
"if",
"(",
"utype",
"==",
"Type",
".",
"none",
")",
"{",
"//only a number",
"if",
"(",
"unit",
"... | isLength, isFrequency, isAngle, isTime, isNumber, isInteger | [
"isLength",
"isFrequency",
"isAngle",
"isTime",
"isNumber",
"isInteger"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/CalcArgs.java#L131-L148 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java | CSSParserVisitorImpl.extractBase | private URL extractBase(TerminalNode node) {
CSSToken ct = (CSSToken) node.getSymbol();
return ct.getBase();
} | java | private URL extractBase(TerminalNode node) {
CSSToken ct = (CSSToken) node.getSymbol();
return ct.getBase();
} | [
"private",
"URL",
"extractBase",
"(",
"TerminalNode",
"node",
")",
"{",
"CSSToken",
"ct",
"=",
"(",
"CSSToken",
")",
"node",
".",
"getSymbol",
"(",
")",
";",
"return",
"ct",
".",
"getBase",
"(",
")",
";",
"}"
] | extract base from parse tree node | [
"extract",
"base",
"from",
"parse",
"tree",
"node"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java#L77-L80 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java | CSSParserVisitorImpl.extractIdUnescaped | private String extractIdUnescaped(String id) {
if (!id.isEmpty() && !Character.isDigit(id.charAt(0))) {
return org.unbescape.css.CssEscape.unescapeCss(id);
}
return null;
} | java | private String extractIdUnescaped(String id) {
if (!id.isEmpty() && !Character.isDigit(id.charAt(0))) {
return org.unbescape.css.CssEscape.unescapeCss(id);
}
return null;
} | [
"private",
"String",
"extractIdUnescaped",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"!",
"id",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"Character",
".",
"isDigit",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
")",
")",
"{",
"return",
"org",
".",
"unbesca... | check if string is valid ID
@param id ID to validate and unescapes
@return unescaped id or null | [
"check",
"if",
"string",
"is",
"valid",
"ID"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java#L88-L93 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java | CSSParserVisitorImpl.generateSpaces | private String generateSpaces(int count) {
String spaces = "";
for (int i = 0; i < count; i++) {
spaces += " ";
}
return spaces;
} | java | private String generateSpaces(int count) {
String spaces = "";
for (int i = 0; i < count; i++) {
spaces += " ";
}
return spaces;
} | [
"private",
"String",
"generateSpaces",
"(",
"int",
"count",
")",
"{",
"String",
"spaces",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"spaces",
"+=",
"\" \"",
";",
"}",
"return",
"spaces",
... | generate spaces for pretty debug printing
@param count number of generated spaces
@return string with spaces | [
"generate",
"spaces",
"for",
"pretty",
"debug",
"printing"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java#L101-L107 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java | CSSParserVisitorImpl.filterSpaceTokens | private List<ParseTree> filterSpaceTokens(List<ParseTree> inputArrayList) {
List<ParseTree> ret = new ArrayList<ParseTree>(inputArrayList.size());
for (ParseTree item : inputArrayList) {
if (!(item instanceof TerminalNode) || ((TerminalNodeImpl) item).getSymbol().getType() != CSSLexer.S) {
... | java | private List<ParseTree> filterSpaceTokens(List<ParseTree> inputArrayList) {
List<ParseTree> ret = new ArrayList<ParseTree>(inputArrayList.size());
for (ParseTree item : inputArrayList) {
if (!(item instanceof TerminalNode) || ((TerminalNodeImpl) item).getSymbol().getType() != CSSLexer.S) {
... | [
"private",
"List",
"<",
"ParseTree",
">",
"filterSpaceTokens",
"(",
"List",
"<",
"ParseTree",
">",
"inputArrayList",
")",
"{",
"List",
"<",
"ParseTree",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"ParseTree",
">",
"(",
"inputArrayList",
".",
"size",
"(",
")... | remove terminal node emtpy tokens from input list
@param inputArrayList original list
@return list without terminal node type = S (space) | [
"remove",
"terminal",
"node",
"emtpy",
"tokens",
"from",
"input",
"list"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java#L115-L123 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java | CSSParserVisitorImpl.ctxHasErrorNode | private boolean ctxHasErrorNode(ParserRuleContext ctx) {
for (int i = 0; i < ctx.children.size(); i++) {
if (ctx.getChild(i) instanceof ErrorNode) {
return true;
}
}
return false;
} | java | private boolean ctxHasErrorNode(ParserRuleContext ctx) {
for (int i = 0; i < ctx.children.size(); i++) {
if (ctx.getChild(i) instanceof ErrorNode) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"ctxHasErrorNode",
"(",
"ParserRuleContext",
"ctx",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ctx",
".",
"children",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"ctx",
".",
"getChild",
"(",
... | check if rule context contains error node
@param ctx rule context
@return contains context error node | [
"check",
"if",
"rule",
"context",
"contains",
"error",
"node"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserVisitorImpl.java#L131-L138 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java | MatchConditionOnElements.addMatch | public void addMatch(Element e, PseudoClassType pseudoClass)
{
if (elements == null)
elements = new HashMap<Element, Set<PseudoClassType>>();
Set<PseudoClassType> classes = elements.get(e);
if (classes == null)
{
classes = new HashSet<PseudoClassType>... | java | public void addMatch(Element e, PseudoClassType pseudoClass)
{
if (elements == null)
elements = new HashMap<Element, Set<PseudoClassType>>();
Set<PseudoClassType> classes = elements.get(e);
if (classes == null)
{
classes = new HashSet<PseudoClassType>... | [
"public",
"void",
"addMatch",
"(",
"Element",
"e",
",",
"PseudoClassType",
"pseudoClass",
")",
"{",
"if",
"(",
"elements",
"==",
"null",
")",
"elements",
"=",
"new",
"HashMap",
"<",
"Element",
",",
"Set",
"<",
"PseudoClassType",
">",
">",
"(",
")",
";",
... | Assigns a pseudo class to the given element. Multiple pseudo classes may be assigned to a single element.
@param e the DOM element
@param pseudoClass the pseudo class to be assigned | [
"Assigns",
"a",
"pseudo",
"class",
"to",
"the",
"given",
"element",
".",
"Multiple",
"pseudo",
"classes",
"may",
"be",
"assigned",
"to",
"a",
"single",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java#L67-L79 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java | MatchConditionOnElements.removeMatch | public void removeMatch(Element e, PseudoClassType pseudoClass)
{
if (elements != null)
{
Set<PseudoClassType> classes = elements.get(e);
if (classes != null)
classes.remove(pseudoClass);
}
} | java | public void removeMatch(Element e, PseudoClassType pseudoClass)
{
if (elements != null)
{
Set<PseudoClassType> classes = elements.get(e);
if (classes != null)
classes.remove(pseudoClass);
}
} | [
"public",
"void",
"removeMatch",
"(",
"Element",
"e",
",",
"PseudoClassType",
"pseudoClass",
")",
"{",
"if",
"(",
"elements",
"!=",
"null",
")",
"{",
"Set",
"<",
"PseudoClassType",
">",
"classes",
"=",
"elements",
".",
"get",
"(",
"e",
")",
";",
"if",
... | Removes the pseudo class from the given element.
@param e the DOM element
@param pseudoClass the pseudo class to be removed | [
"Removes",
"the",
"pseudo",
"class",
"from",
"the",
"given",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java#L86-L94 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java | MatchConditionOnElements.addMatch | public void addMatch(String name, PseudoClassType pseudoClass)
{
if (names == null)
names = new HashMap<String, Set<PseudoClassType>>();
Set<PseudoClassType> classes = names.get(name);
if (classes == null)
{
classes = new HashSet<PseudoClassType>(2);
... | java | public void addMatch(String name, PseudoClassType pseudoClass)
{
if (names == null)
names = new HashMap<String, Set<PseudoClassType>>();
Set<PseudoClassType> classes = names.get(name);
if (classes == null)
{
classes = new HashSet<PseudoClassType>(2);
... | [
"public",
"void",
"addMatch",
"(",
"String",
"name",
",",
"PseudoClassType",
"pseudoClass",
")",
"{",
"if",
"(",
"names",
"==",
"null",
")",
"names",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Set",
"<",
"PseudoClassType",
">",
">",
"(",
")",
";",
"Se... | Assigns a pseudo class to the given element name. Element names are case-insensitive.
Multiple pseudo classes may be assigned to a single element name.
@param name the element name
@param pseudoClass the pseudo class to be assigned | [
"Assigns",
"a",
"pseudo",
"class",
"to",
"the",
"given",
"element",
"name",
".",
"Element",
"names",
"are",
"case",
"-",
"insensitive",
".",
"Multiple",
"pseudo",
"classes",
"may",
"be",
"assigned",
"to",
"a",
"single",
"element",
"name",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java#L102-L114 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java | MatchConditionOnElements.removeMatch | public void removeMatch(String name, PseudoClassType pseudoClass)
{
if (names != null)
{
Set<PseudoClassType> classes = names.get(name);
if (classes != null)
classes.remove(pseudoClass);
}
} | java | public void removeMatch(String name, PseudoClassType pseudoClass)
{
if (names != null)
{
Set<PseudoClassType> classes = names.get(name);
if (classes != null)
classes.remove(pseudoClass);
}
} | [
"public",
"void",
"removeMatch",
"(",
"String",
"name",
",",
"PseudoClassType",
"pseudoClass",
")",
"{",
"if",
"(",
"names",
"!=",
"null",
")",
"{",
"Set",
"<",
"PseudoClassType",
">",
"classes",
"=",
"names",
".",
"get",
"(",
"name",
")",
";",
"if",
"... | Removes the pseudo class from the given element name. Element names are case-insensitive.
@param name the element name
@param pseudoClass the pseudo class to be removed | [
"Removes",
"the",
"pseudo",
"class",
"from",
"the",
"given",
"element",
"name",
".",
"Element",
"names",
"are",
"case",
"-",
"insensitive",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/MatchConditionOnElements.java#L121-L129 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Analyzer.java | Analyzer.evaluateDOM | public StyleMap evaluateDOM(Document doc, MediaSpec media, final boolean inherit) {
DeclarationMap declarations = assingDeclarationsToDOM(doc, media, inherit);
StyleMap nodes = new StyleMap(declarations.size());
Traversal<StyleMap> traversal = new Traversal<StyleMap>(
doc, (Object) declarations, NodeFilter... | java | public StyleMap evaluateDOM(Document doc, MediaSpec media, final boolean inherit) {
DeclarationMap declarations = assingDeclarationsToDOM(doc, media, inherit);
StyleMap nodes = new StyleMap(declarations.size());
Traversal<StyleMap> traversal = new Traversal<StyleMap>(
doc, (Object) declarations, NodeFilter... | [
"public",
"StyleMap",
"evaluateDOM",
"(",
"Document",
"doc",
",",
"MediaSpec",
"media",
",",
"final",
"boolean",
"inherit",
")",
"{",
"DeclarationMap",
"declarations",
"=",
"assingDeclarationsToDOM",
"(",
"doc",
",",
"media",
",",
"inherit",
")",
";",
"StyleMap"... | Evaluates CSS properties of DOM tree
@param doc
Document tree
@param media
Media
@param inherit
Use inheritance
@return Map where each element contains its CSS properties | [
"Evaluates",
"CSS",
"properties",
"of",
"DOM",
"tree"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Analyzer.java#L134-L183 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Analyzer.java | Analyzer.assingDeclarationsToDOM | protected DeclarationMap assingDeclarationsToDOM(Document doc, MediaSpec media, final boolean inherit) {
// classify the rules
classifyAllSheets(media);
// resulting map
DeclarationMap declarations = new DeclarationMap();
// if the holder is empty skip evaluation
if(rules!=null && !rul... | java | protected DeclarationMap assingDeclarationsToDOM(Document doc, MediaSpec media, final boolean inherit) {
// classify the rules
classifyAllSheets(media);
// resulting map
DeclarationMap declarations = new DeclarationMap();
// if the holder is empty skip evaluation
if(rules!=null && !rul... | [
"protected",
"DeclarationMap",
"assingDeclarationsToDOM",
"(",
"Document",
"doc",
",",
"MediaSpec",
"media",
",",
"final",
"boolean",
"inherit",
")",
"{",
"// classify the rules",
"classifyAllSheets",
"(",
"media",
")",
";",
"// resulting map",
"DeclarationMap",
"declar... | Creates map of declarations assigned to each element of a DOM tree
@param doc
DOM document
@param media
Media type to be used for declarations
@param inherit
Inheritance (cascade propagation of values)
@return Map of elements as keys and their declarations | [
"Creates",
"map",
"of",
"declarations",
"assigned",
"to",
"each",
"element",
"of",
"a",
"DOM",
"tree"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Analyzer.java#L200-L230 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Analyzer.java | Analyzer.classifyAllSheets | protected void classifyAllSheets(MediaSpec mediaspec)
{
rules = new Holder();
AnalyzerUtil.classifyAllSheets(sheets, rules, mediaspec);
} | java | protected void classifyAllSheets(MediaSpec mediaspec)
{
rules = new Holder();
AnalyzerUtil.classifyAllSheets(sheets, rules, mediaspec);
} | [
"protected",
"void",
"classifyAllSheets",
"(",
"MediaSpec",
"mediaspec",
")",
"{",
"rules",
"=",
"new",
"Holder",
"(",
")",
";",
"AnalyzerUtil",
".",
"classifyAllSheets",
"(",
"sheets",
",",
"rules",
",",
"mediaspec",
")",
";",
"}"
] | Classifies the rules in all the style sheets.
@param mediaspec The specification of the media for evaluating the media queries. | [
"Classifies",
"the",
"rules",
"in",
"all",
"the",
"style",
"sheets",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Analyzer.java#L411-L416 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/CombinedSelectorImpl.java | CombinedSelectorImpl.computeSpecificity | public Specificity computeSpecificity() {
Specificity spec = new SpecificityImpl();
for(Selector s: list)
s.computeSpecificity(spec);
return spec;
} | java | public Specificity computeSpecificity() {
Specificity spec = new SpecificityImpl();
for(Selector s: list)
s.computeSpecificity(spec);
return spec;
} | [
"public",
"Specificity",
"computeSpecificity",
"(",
")",
"{",
"Specificity",
"spec",
"=",
"new",
"SpecificityImpl",
"(",
")",
";",
"for",
"(",
"Selector",
"s",
":",
"list",
")",
"s",
".",
"computeSpecificity",
"(",
"spec",
")",
";",
"return",
"spec",
";",
... | Computes specificity of selector | [
"Computes",
"specificity",
"of",
"selector"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/CombinedSelectorImpl.java#L34-L43 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.parse | public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type,
Element inline, boolean inlinePriority, URL base) throws IOException, CSSException {
StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory()
.createStyleSheet().unl... | java | public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type,
Element inline, boolean inlinePriority, URL base) throws IOException, CSSException {
StyleSheet sheet = (StyleSheet) CSSFactory.getRuleFactory()
.createStyleSheet().unl... | [
"public",
"StyleSheet",
"parse",
"(",
"Object",
"source",
",",
"NetworkProcessor",
"network",
",",
"String",
"encoding",
",",
"SourceType",
"type",
",",
"Element",
"inline",
",",
"boolean",
"inlinePriority",
",",
"URL",
"base",
")",
"throws",
"IOException",
",",... | Parses source of given type
@param source Source, interpretation depends on {@code type}
@param type Type of source provided
@param inline InlineElement
@param inlinePriority True when the rule should have an 'inline' (greater) priority
@return Created StyleSheet
@throws IOException When pro... | [
"Parses",
"source",
"of",
"given",
"type"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L65-L73 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.parse | public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type, URL base)
throws IOException, CSSException {
if (type == SourceType.INLINE)
throw new IllegalArgumentException(
"Missing element for INLINE input");
return pars... | java | public StyleSheet parse(Object source, NetworkProcessor network, String encoding, SourceType type, URL base)
throws IOException, CSSException {
if (type == SourceType.INLINE)
throw new IllegalArgumentException(
"Missing element for INLINE input");
return pars... | [
"public",
"StyleSheet",
"parse",
"(",
"Object",
"source",
",",
"NetworkProcessor",
"network",
",",
"String",
"encoding",
",",
"SourceType",
"type",
",",
"URL",
"base",
")",
"throws",
"IOException",
",",
"CSSException",
"{",
"if",
"(",
"type",
"==",
"SourceType... | Parses source of given type. Uses no element.
@param source Source, interpretation depends on {@code type}
@param type Type of source provided
@param base The base URL
@return Created StyleSheet
@throws IOException When problem with input stream occurs
@throws CSSException When unrecoverab... | [
"Parses",
"source",
"of",
"given",
"type",
".",
"Uses",
"no",
"element",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L87-L94 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.append | public StyleSheet append(Object source, NetworkProcessor network, String encoding, SourceType type,
Element inline, boolean inlinePriority, StyleSheet sheet, URL base) throws IOException, CSSException {
Preparator preparator = new SimplePreparator(inline, inlinePriority);
r... | java | public StyleSheet append(Object source, NetworkProcessor network, String encoding, SourceType type,
Element inline, boolean inlinePriority, StyleSheet sheet, URL base) throws IOException, CSSException {
Preparator preparator = new SimplePreparator(inline, inlinePriority);
r... | [
"public",
"StyleSheet",
"append",
"(",
"Object",
"source",
",",
"NetworkProcessor",
"network",
",",
"String",
"encoding",
",",
"SourceType",
"type",
",",
"Element",
"inline",
",",
"boolean",
"inlinePriority",
",",
"StyleSheet",
"sheet",
",",
"URL",
"base",
")",
... | Appends parsed source to passed style sheet. This style sheet must be
IMPERATIVELY parsed by this factory to guarantee proper appending
@param source Source, interpretation depends on {@code type}
@param type Type of source provided
@param inline Inline element
@param inlinePriority True when... | [
"Appends",
"parsed",
"source",
"to",
"passed",
"style",
"sheet",
".",
"This",
"style",
"sheet",
"must",
"be",
"IMPERATIVELY",
"parsed",
"by",
"this",
"factory",
"to",
"guarantee",
"proper",
"appending"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L110-L115 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.parseAndImport | protected StyleSheet parseAndImport(Object source, NetworkProcessor network, String encoding, SourceType type,
StyleSheet sheet, Preparator preparator, URL base, List<MediaQuery> media)
throws CSSException, IOException {
CSSParser parser = createParser(source,... | java | protected StyleSheet parseAndImport(Object source, NetworkProcessor network, String encoding, SourceType type,
StyleSheet sheet, Preparator preparator, URL base, List<MediaQuery> media)
throws CSSException, IOException {
CSSParser parser = createParser(source,... | [
"protected",
"StyleSheet",
"parseAndImport",
"(",
"Object",
"source",
",",
"NetworkProcessor",
"network",
",",
"String",
"encoding",
",",
"SourceType",
"type",
",",
"StyleSheet",
"sheet",
",",
"Preparator",
"preparator",
",",
"URL",
"base",
",",
"List",
"<",
"Me... | Parses the source using the given infrastructure and returns the resulting style sheet.
The imports are handled recursively. | [
"Parses",
"the",
"source",
"using",
"the",
"given",
"infrastructure",
"and",
"returns",
"the",
"resulting",
"style",
"sheet",
".",
"The",
"imports",
"are",
"handled",
"recursively",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L143-L167 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.createParser | private static CSSParser createParser(Object source, NetworkProcessor network, String encoding, SourceType type,
URL base) throws IOException, CSSException {
CSSInputStream input = getInput(source, network, encoding, type);
input.setBase(base);
return c... | java | private static CSSParser createParser(Object source, NetworkProcessor network, String encoding, SourceType type,
URL base) throws IOException, CSSException {
CSSInputStream input = getInput(source, network, encoding, type);
input.setBase(base);
return c... | [
"private",
"static",
"CSSParser",
"createParser",
"(",
"Object",
"source",
",",
"NetworkProcessor",
"network",
",",
"String",
"encoding",
",",
"SourceType",
"type",
",",
"URL",
"base",
")",
"throws",
"IOException",
",",
"CSSException",
"{",
"CSSInputStream",
"inpu... | creates the parser | [
"creates",
"the",
"parser"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L170-L176 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java | CSSParserFactory.encapsulateException | protected static CSSException encapsulateException(Throwable t, String msg) {
log.error("THROWN:", t);
return new CSSException(msg, t);
} | java | protected static CSSException encapsulateException(Throwable t, String msg) {
log.error("THROWN:", t);
return new CSSException(msg, t);
} | [
"protected",
"static",
"CSSException",
"encapsulateException",
"(",
"Throwable",
"t",
",",
"String",
"msg",
")",
"{",
"log",
".",
"error",
"(",
"\"THROWN:\"",
",",
"t",
")",
";",
"return",
"new",
"CSSException",
"(",
"msg",
",",
"t",
")",
";",
"}"
] | Creates new CSSException which encapsulates cause
@param t Cause
@param msg Message
@return New CSSException | [
"Creates",
"new",
"CSSException",
"which",
"encapsulates",
"cause"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSParserFactory.java#L255-L258 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Repeater.java | Repeater.repeat | public boolean repeat(Map<String, CSSProperty> properties,
Map<String, Term<?>> values) {
for (int i = 0; i < times; i++) {
if (!operation(i, properties, values))
return false;
}
return true;
} | java | public boolean repeat(Map<String, CSSProperty> properties,
Map<String, Term<?>> values) {
for (int i = 0; i < times; i++) {
if (!operation(i, properties, values))
return false;
}
return true;
} | [
"public",
"boolean",
"repeat",
"(",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"times",
";",
"i",
... | Repeats operations on terms
@param properties
Properties map where to store properties types
@param values
Values map where to store properties values
@return <code>true</code> in case of success, <code>false</code>
elsewhere | [
"Repeats",
"operations",
"on",
"terms"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Repeater.java#L81-L88 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Repeater.java | Repeater.assignPropertyNames | public void assignPropertyNames(String... propertyNames)
throws IllegalArgumentException {
if (propertyNames.length != times)
throw new IllegalArgumentException(
"Invalid length of propertyNames in Repeater.");
this.names = Arrays.asList(propertyNames);
} | java | public void assignPropertyNames(String... propertyNames)
throws IllegalArgumentException {
if (propertyNames.length != times)
throw new IllegalArgumentException(
"Invalid length of propertyNames in Repeater.");
this.names = Arrays.asList(propertyNames);
} | [
"public",
"void",
"assignPropertyNames",
"(",
"String",
"...",
"propertyNames",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"propertyNames",
".",
"length",
"!=",
"times",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid length of propertyN... | Assigns property names
@param propertyNames
Names of properties for each iteration
@throws IllegalArgumentException
In case when number of properties names does not correspond
with number of iterations | [
"Assigns",
"property",
"names"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Repeater.java#L171-L177 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/Repeater.java | Repeater.assignTerms | public void assignTerms(Term<?>... terms) throws IllegalArgumentException {
if (terms.length != times)
throw new IllegalArgumentException(
"Invalid length of terms in Repeater.");
this.terms = Arrays.asList(terms);
} | java | public void assignTerms(Term<?>... terms) throws IllegalArgumentException {
if (terms.length != times)
throw new IllegalArgumentException(
"Invalid length of terms in Repeater.");
this.terms = Arrays.asList(terms);
} | [
"public",
"void",
"assignTerms",
"(",
"Term",
"<",
"?",
">",
"...",
"terms",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"terms",
".",
"length",
"!=",
"times",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid length of terms in Repea... | Assigns terms to repeater
@param terms
Terms to be assigned
@throws IllegalArgumentException
In case when number of terms does not correspond with number
of iterations | [
"Assigns",
"terms",
"to",
"repeater"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/Repeater.java#L188-L193 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.parseDeclaration | @Override
public boolean parseDeclaration(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
final String propertyName = d.getProperty();
// no such declaration is supported or declaration is empty
if (!css.isSupportedCSSProperty(propertyName) || d.isEmpty())
return false;... | java | @Override
public boolean parseDeclaration(Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
final String propertyName = d.getProperty();
// no such declaration is supported or declaration is empty
if (!css.isSupportedCSSProperty(propertyName) || d.isEmpty())
return false;... | [
"@",
"Override",
"public",
"boolean",
"parseDeclaration",
"(",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"Map",
"<",
"String",
",",
"Term",
"<",
"?",
">",
">",
"values",
")",
"{",
"final",
"String",
"prope... | Core function. Parses CSS declaration into structure applicable to
DataNodeImpl
@param d
Declaration
@param properties
Wrap of parsed declaration's properties
@param values
Wrap of parsed declaration's value
@return <code>true</code> in case of success, <code>false</code>
otherwise | [
"Core",
"function",
".",
"Parses",
"CSS",
"declaration",
"into",
"structure",
"applicable",
"to",
"DataNodeImpl"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L146-L180 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericPropertyRaw | public <T extends CSSProperty> T genericPropertyRaw(Class<T> type,
Set<T> intersection, TermIdent term) {
try {
String name = term.getValue().replace("-", "_").toUpperCase();
T property = CSSProperty.Translator.valueOf(type, name);
if (intersection != null && intersection.contains(property))
return p... | java | public <T extends CSSProperty> T genericPropertyRaw(Class<T> type,
Set<T> intersection, TermIdent term) {
try {
String name = term.getValue().replace("-", "_").toUpperCase();
T property = CSSProperty.Translator.valueOf(type, name);
if (intersection != null && intersection.contains(property))
return p... | [
"public",
"<",
"T",
"extends",
"CSSProperty",
">",
"T",
"genericPropertyRaw",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Set",
"<",
"T",
">",
"intersection",
",",
"TermIdent",
"term",
")",
"{",
"try",
"{",
"String",
"name",
"=",
"term",
".",
"getValue"... | Converts TermIdent into CSSProperty using intersection set.
CSSProperty.Translator is used.
@param <T>
Subclass of CSSProperty to be returned
@param type
Class of property to be used to retrieve value
@param intersection
Intersection set or <code>null</code> if no intersection is
used
@param term
TermIdent to be trans... | [
"Converts",
"TermIdent",
"into",
"CSSProperty",
"using",
"intersection",
"set",
".",
"CSSProperty",
".",
"Translator",
"is",
"used",
"."
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L227-L239 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericProperty | protected <T extends CSSProperty> boolean genericProperty(Class<T> type,
TermIdent term, boolean avoidInherit,
Map<String, CSSProperty> properties, String propertyName) {
T property = genericPropertyRaw(type, null, term);
if (property == null || (avoidInherit && property.equalsInherit()))
return false;
... | java | protected <T extends CSSProperty> boolean genericProperty(Class<T> type,
TermIdent term, boolean avoidInherit,
Map<String, CSSProperty> properties, String propertyName) {
T property = genericPropertyRaw(type, null, term);
if (property == null || (avoidInherit && property.equalsInherit()))
return false;
... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericProperty",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"TermIdent",
"term",
",",
"boolean",
"avoidInherit",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"String"... | Converts TermIdent into value of enum of given class and stores it into
properties map under key property
@param <T>
Enum & CSSProperty limitation
@param type
Type of enum which instance is retrieved
@param term
Term with value to be converted
@param avoidInherit
If <code>true</code> inherit value is not considere... | [
"Converts",
"TermIdent",
"into",
"value",
"of",
"enum",
"of",
"given",
"class",
"and",
"stores",
"it",
"into",
"properties",
"map",
"under",
"key",
"property"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L260-L270 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericTermIdent | protected <T extends CSSProperty> boolean genericTermIdent(Class<T> type,
Term<?> term, boolean avoidInherit, String propertyName,
Map<String, CSSProperty> properties) {
if (term instanceof TermIdent) {
return genericProperty(type, (TermIdent) term, avoidInherit,
properties, propertyName);
}
return... | java | protected <T extends CSSProperty> boolean genericTermIdent(Class<T> type,
Term<?> term, boolean avoidInherit, String propertyName,
Map<String, CSSProperty> properties) {
if (term instanceof TermIdent) {
return genericProperty(type, (TermIdent) term, avoidInherit,
properties, propertyName);
}
return... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericTermIdent",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Term",
"<",
"?",
">",
"term",
",",
"boolean",
"avoidInherit",
",",
"String",
"propertyName",
",",
"Map",
"<",
"String",
",",
"... | Converts TermIdent into value of CSSProperty for given class | [
"Converts",
"TermIdent",
"into",
"value",
"of",
"CSSProperty",
"for",
"given",
"class"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L276-L285 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericTermColor | protected <T extends CSSProperty> boolean genericTermColor(Term<?> term,
String propertyName, T colorIdentification,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (term instanceof TermColor) {
properties.put(propertyName, colorIdentification);
values.put(propertyName, term);
r... | java | protected <T extends CSSProperty> boolean genericTermColor(Term<?> term,
String propertyName, T colorIdentification,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (term instanceof TermColor) {
properties.put(propertyName, colorIdentification);
values.put(propertyName, term);
r... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericTermColor",
"(",
"Term",
"<",
"?",
">",
"term",
",",
"String",
"propertyName",
",",
"T",
"colorIdentification",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"M... | Converts term into Color and stored values and types in maps
@param <T>
CSSProperty
@param term
Term to be parsed
@param propertyName
How to store colorIdentificiton
@param colorIdentification
What to store under propertyName
@param properties
Map to store property types
@param values
Map to store property values
@ret... | [
"Converts",
"term",
"into",
"Color",
"and",
"stored",
"values",
"and",
"types",
"in",
"maps"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L305-L317 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericTermLength | protected <T extends CSSProperty> boolean genericTermLength(Term<?> term,
String propertyName, T lengthIdentification, ValueRange range,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (term instanceof TermInteger && ((TermInteger) term).getUnit().equals(TermNumber.Unit.none)) {
... | java | protected <T extends CSSProperty> boolean genericTermLength(Term<?> term,
String propertyName, T lengthIdentification, ValueRange range,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (term instanceof TermInteger && ((TermInteger) term).getUnit().equals(TermNumber.Unit.none)) {
... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericTermLength",
"(",
"Term",
"<",
"?",
">",
"term",
",",
"String",
"propertyName",
",",
"T",
"lengthIdentification",
",",
"ValueRange",
"range",
",",
"Map",
"<",
"String",
",",
"CSSProperty"... | Converts term into TermLength and stores values and types in maps
@param <T>
CSSProperty
@param term
Term to be parsed
@param propertyName
How to store colorIdentificiton
@param lengthIdentification
What to store under propertyName
@param properties
Map to store property types
@param values
Map to store property value... | [
"Converts",
"term",
"into",
"TermLength",
"and",
"stores",
"values",
"and",
"types",
"in",
"maps"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L337-L356 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericTerm | protected <T extends CSSProperty> boolean genericTerm(
Class<? extends Term<?>> termType, Term<?> term,
String propertyName, T typeIdentification, ValueRange range,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
// check type
if (termType.isInstance(term)) {
// sanity check
if (... | java | protected <T extends CSSProperty> boolean genericTerm(
Class<? extends Term<?>> termType, Term<?> term,
String propertyName, T typeIdentification, ValueRange range,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
// check type
if (termType.isInstance(term)) {
// sanity check
if (... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericTerm",
"(",
"Class",
"<",
"?",
"extends",
"Term",
"<",
"?",
">",
">",
"termType",
",",
"Term",
"<",
"?",
">",
"term",
",",
"String",
"propertyName",
",",
"T",
"typeIdentification",
... | Check whether given declaration contains one term of given type. It is
able to check even whether is above zero for numeric values
@param <T>
Class of CSSProperty to be used for result
@param termType
Supposed type of term
@param term
Term of which is supposed to be of type <code>termType</code>,
that is input data
@p... | [
"Check",
"whether",
"given",
"declaration",
"contains",
"one",
"term",
"of",
"given",
"type",
".",
"It",
"is",
"able",
"to",
"check",
"even",
"whether",
"is",
"above",
"zero",
"for",
"numeric",
"values"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L382-L435 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericOneIdent | protected <T extends CSSProperty> boolean genericOneIdent(Class<T> type,
Declaration d, Map<String, CSSProperty> properties) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties);
} | java | protected <T extends CSSProperty> boolean genericOneIdent(Class<T> type,
Declaration d, Map<String, CSSProperty> properties) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties);
} | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericOneIdent",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
")",
"{",
"if",
"(",
"d",
".",
"size",
"... | Processes declaration which is supposed to contain one identification
term
@param <T>
Type of CSSProperty
@param type
Class of CSSProperty to be stored
@param d
Declaration to be parsed
@param properties
Properties map where to store enum
@return <code>true</code> in case of success, <code>false</code>
elsewhere | [
"Processes",
"declaration",
"which",
"is",
"supposed",
"to",
"contain",
"one",
"identification",
"term"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L452-L460 | train |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java | DeclarationTransformerImpl.genericOneIdentOrColor | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
... | java | protected <T extends CSSProperty> boolean genericOneIdentOrColor(
Class<T> type, T colorIdentification, Declaration d,
Map<String, CSSProperty> properties, Map<String, Term<?>> values) {
if (d.size() != 1)
return false;
return genericTermIdent(type, d.get(0), ALLOW_INH, d.getProperty(),
properties)
... | [
"protected",
"<",
"T",
"extends",
"CSSProperty",
">",
"boolean",
"genericOneIdentOrColor",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"colorIdentification",
",",
"Declaration",
"d",
",",
"Map",
"<",
"String",
",",
"CSSProperty",
">",
"properties",
",",
"... | Processes declaration which is supposed to contain one identification
term or one TermColor
@param <T>
Type of CSSProperty
@param type
Class of enum to be stored
@param colorIdentification
Instance of CSSProperty stored into properties to indicate
that additional value of type TermColor is stored in values
@param d
De... | [
"Processes",
"declaration",
"which",
"is",
"supposed",
"to",
"contain",
"one",
"identification",
"term",
"or",
"one",
"TermColor"
] | 8ab049ac6866aa52c4d7deee25c9e294e7191957 | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DeclarationTransformerImpl.java#L481-L492 | train |
whitesource/agents | wss-agent-client/src/main/java/org/whitesource/agent/client/WssServiceClientImpl.java | WssServiceClientImpl.service | @SuppressWarnings("unchecked")
protected <R> R service(ServiceRequest<R> request) throws WssServiceException {
R result;
String response = "";
try {
HttpRequestBase httpRequest = createHttpRequest(request);
RequestConfig requestConfig = RequestConfig.custom().setCooki... | java | @SuppressWarnings("unchecked")
protected <R> R service(ServiceRequest<R> request) throws WssServiceException {
R result;
String response = "";
try {
HttpRequestBase httpRequest = createHttpRequest(request);
RequestConfig requestConfig = RequestConfig.custom().setCooki... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"R",
">",
"R",
"service",
"(",
"ServiceRequest",
"<",
"R",
">",
"request",
")",
"throws",
"WssServiceException",
"{",
"R",
"result",
";",
"String",
"response",
"=",
"\"\"",
";",
"try",
"... | The method service the given request.
@param request Request to serve.
@return Result from WhiteSource service.
@throws WssServiceException In case of errors while serving the request. | [
"The",
"method",
"service",
"the",
"given",
"request",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-client/src/main/java/org/whitesource/agent/client/WssServiceClientImpl.java#L273-L320 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java | FileUtils.copyResource | public static void copyResource(String resource, File destination) throws IOException {
InputStream is = null;
FileOutputStream fos = null;
try {
is = FileUtils.class.getResourceAsStream("/" + resource);
fos = new FileOutputStream(destination);
final... | java | public static void copyResource(String resource, File destination) throws IOException {
InputStream is = null;
FileOutputStream fos = null;
try {
is = FileUtils.class.getResourceAsStream("/" + resource);
fos = new FileOutputStream(destination);
final... | [
"public",
"static",
"void",
"copyResource",
"(",
"String",
"resource",
",",
"File",
"destination",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"FileOutputStream",
"fos",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"FileUtils",
".",... | Copy a classpath resource to a destination file.
@param resource Path to resource to copy.
@param destination File to copy resource to.
@throws IOException exception2 | [
"Copy",
"a",
"classpath",
"resource",
"to",
"a",
"destination",
"file",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java#L38-L56 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java | FileUtils.deleteRecursive | public static boolean deleteRecursive(File path) throws FileNotFoundException {
if (!path.exists()) {
throw new FileNotFoundException(path.getAbsolutePath());
}
boolean success = true;
if (path.isDirectory()) {
for (File f : path.listFiles()) {
... | java | public static boolean deleteRecursive(File path) throws FileNotFoundException {
if (!path.exists()) {
throw new FileNotFoundException(path.getAbsolutePath());
}
boolean success = true;
if (path.isDirectory()) {
for (File f : path.listFiles()) {
... | [
"public",
"static",
"boolean",
"deleteRecursive",
"(",
"File",
"path",
")",
"throws",
"FileNotFoundException",
"{",
"if",
"(",
"!",
"path",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"path",
".",
"getAbsolutePath",
"(",
... | Delete all files rooted in the given path.
@param path root path to delete
@return <code>True</code> if all files were deleted successfully.
@throws FileNotFoundException in case path couldn't be found. | [
"Delete",
"all",
"files",
"rooted",
"in",
"the",
"given",
"path",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/FileUtils.java#L102-L115 | train |
whitesource/agents | wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java | WhitesourceService.offlineUpdate | @Deprecated
public UpdateInventoryRequest offlineUpdate(String orgToken,
String product,
Boolean removeBeforeAdd,
String productVersion,
... | java | @Deprecated
public UpdateInventoryRequest offlineUpdate(String orgToken,
String product,
Boolean removeBeforeAdd,
String productVersion,
... | [
"@",
"Deprecated",
"public",
"UpdateInventoryRequest",
"offlineUpdate",
"(",
"String",
"orgToken",
",",
"String",
"product",
",",
"Boolean",
"removeBeforeAdd",
",",
"String",
"productVersion",
",",
"Collection",
"<",
"AgentProjectInfo",
">",
"projectInfos",
",",
"Stri... | Generates a file with json representation of the update request.
@param orgToken Organization token uniquely identifying the account at white source.
@param product The product name or token to update.
@param removeBeforeAdd Should remove before add
@param productVersion The product version.
@param pro... | [
"Generates",
"a",
"file",
"with",
"json",
"representation",
"of",
"the",
"update",
"request",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java#L374-L385 | train |
whitesource/agents | wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java | WhitesourceService.getDependencyData | @Deprecated
public GetDependencyDataResult getDependencyData(String orgToken,
String product,
String productVersion,
Collection<AgentProjectInfo> projectInfo... | java | @Deprecated
public GetDependencyDataResult getDependencyData(String orgToken,
String product,
String productVersion,
Collection<AgentProjectInfo> projectInfo... | [
"@",
"Deprecated",
"public",
"GetDependencyDataResult",
"getDependencyData",
"(",
"String",
"orgToken",
",",
"String",
"product",
",",
"String",
"productVersion",
",",
"Collection",
"<",
"AgentProjectInfo",
">",
"projectInfos",
",",
"String",
"userKey",
",",
"String",... | Gets additional data for given dependencies.
@param orgToken Organization token uniquely identifying the account at white source.
@param product The product name or token to update.
@param productVersion The product version.
@param projectInfos OSS usage information to send to white source.
@param userK... | [
"Gets",
"additional",
"data",
"for",
"given",
"dependencies",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java#L624-L635 | train |
whitesource/agents | wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java | WhitesourceService.checkVulnerabilities | @Deprecated
public CheckVulnerabilitiesResult checkVulnerabilities(String orgToken,
String product,
String productVersion,
Collection<Agent... | java | @Deprecated
public CheckVulnerabilitiesResult checkVulnerabilities(String orgToken,
String product,
String productVersion,
Collection<Agent... | [
"@",
"Deprecated",
"public",
"CheckVulnerabilitiesResult",
"checkVulnerabilities",
"(",
"String",
"orgToken",
",",
"String",
"product",
",",
"String",
"productVersion",
",",
"Collection",
"<",
"AgentProjectInfo",
">",
"projectInfos",
",",
"String",
"userKey",
",",
"St... | Gets vulnerabilities data for given dependencies.
@param orgToken Organization token uniquely identifying the account at white source.
@param product The product name or token to update.
@param productVersion The product version.
@param projectInfos OSS usage information to send to white source.
@param ... | [
"Gets",
"vulnerabilities",
"data",
"for",
"given",
"dependencies",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-client/src/main/java/org/whitesource/agent/client/WhitesourceService.java#L746-L757 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/OfflineUpdateRequest.java | OfflineUpdateRequest.generate | public File generate(File outputDir, boolean zip, boolean prettyJson) throws IOException {
if (request == null) {
throw new IllegalStateException("Update inventory request is null");
}
// prepare working directory
File workDir = new File(outputDir, "whitesource");
if... | java | public File generate(File outputDir, boolean zip, boolean prettyJson) throws IOException {
if (request == null) {
throw new IllegalStateException("Update inventory request is null");
}
// prepare working directory
File workDir = new File(outputDir, "whitesource");
if... | [
"public",
"File",
"generate",
"(",
"File",
"outputDir",
",",
"boolean",
"zip",
",",
"boolean",
"prettyJson",
")",
"throws",
"IOException",
"{",
"if",
"(",
"request",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Update inventory reques... | The method generates the update request file.
@param outputDir Directory where request file will be created.
@param zip Whether or not to zip the request.
@param prettyJson Whether or not to parse the json before writing to file (only if zip is false).
@return File reference to the resulting request.
@throws java.io.... | [
"The",
"method",
"generates",
"the",
"update",
"request",
"file",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/OfflineUpdateRequest.java#L65-L91 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java | HashCalculator.calculateJavaScriptHashes | public Map<ChecksumType, String> calculateJavaScriptHashes(File file) throws WssHashException {
Map<ChecksumType, String> checksums = new EnumMap<>(ChecksumType.class);
try {
long fileLength = file.length();
if (fileLength >= FILE_MAX_SIZE_THRESHOLD){
logger.debug... | java | public Map<ChecksumType, String> calculateJavaScriptHashes(File file) throws WssHashException {
Map<ChecksumType, String> checksums = new EnumMap<>(ChecksumType.class);
try {
long fileLength = file.length();
if (fileLength >= FILE_MAX_SIZE_THRESHOLD){
logger.debug... | [
"public",
"Map",
"<",
"ChecksumType",
",",
"String",
">",
"calculateJavaScriptHashes",
"(",
"File",
"file",
")",
"throws",
"WssHashException",
"{",
"Map",
"<",
"ChecksumType",
",",
"String",
">",
"checksums",
"=",
"new",
"EnumMap",
"<>",
"(",
"ChecksumType",
"... | Removes all JavaScript comments from the file and calculates SHA-1 checksum.
@param file to calculate
@return Calculated SHA-1 checksums for the given file. | [
"Removes",
"all",
"JavaScript",
"comments",
"from",
"the",
"file",
"and",
"calculates",
"SHA",
"-",
"1",
"checksum",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java#L210-L223 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java | HashCalculator.calculateJavaScriptHashes | public Map<ChecksumType, String> calculateJavaScriptHashes(byte[] byteArray) throws WssHashException {
Map<ChecksumType, String> checksums = new EnumMap<>(ChecksumType.class);
try {
String fileContent = IOUtils.toString(byteArray, UTF_8);
ParseResult parseResult = new JavaScriptP... | java | public Map<ChecksumType, String> calculateJavaScriptHashes(byte[] byteArray) throws WssHashException {
Map<ChecksumType, String> checksums = new EnumMap<>(ChecksumType.class);
try {
String fileContent = IOUtils.toString(byteArray, UTF_8);
ParseResult parseResult = new JavaScriptP... | [
"public",
"Map",
"<",
"ChecksumType",
",",
"String",
">",
"calculateJavaScriptHashes",
"(",
"byte",
"[",
"]",
"byteArray",
")",
"throws",
"WssHashException",
"{",
"Map",
"<",
"ChecksumType",
",",
"String",
">",
"checksums",
"=",
"new",
"EnumMap",
"<>",
"(",
... | Removes all JavaScript header comments from the file and calculates SHA-1 checksum.
@param byteArray to calculate
@return Calculated SHA-1 for the given file. | [
"Removes",
"all",
"JavaScript",
"header",
"comments",
"from",
"the",
"file",
"and",
"calculates",
"SHA",
"-",
"1",
"checksum",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java#L231-L257 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java | HashCalculator.calculateSha1ByNameVersionAndType | public String calculateSha1ByNameVersionAndType(String name, String version, DependencyType dependencyType) throws IOException {
String sha1ToCalc = name + UNDERSCORE + version + UNDERSCORE + dependencyType.toString();
return calculateByteArraySHA1(sha1ToCalc.getBytes(StandardCharsets.UTF_8));
} | java | public String calculateSha1ByNameVersionAndType(String name, String version, DependencyType dependencyType) throws IOException {
String sha1ToCalc = name + UNDERSCORE + version + UNDERSCORE + dependencyType.toString();
return calculateByteArraySHA1(sha1ToCalc.getBytes(StandardCharsets.UTF_8));
} | [
"public",
"String",
"calculateSha1ByNameVersionAndType",
"(",
"String",
"name",
",",
"String",
"version",
",",
"DependencyType",
"dependencyType",
")",
"throws",
"IOException",
"{",
"String",
"sha1ToCalc",
"=",
"name",
"+",
"UNDERSCORE",
"+",
"version",
"+",
"UNDERS... | Calculates SHA-1 for library by name, version and dependencyType
@param name of library
@param version of library
@param dependencyType of library
@return Calculated SHA-1 for library by name, version and dependencyType
@throws IOException when failed to calculate sha-1 | [
"Calculates",
"SHA",
"-",
"1",
"for",
"library",
"by",
"name",
"version",
"and",
"dependencyType"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java#L268-L271 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java | HashCalculator.stripWhiteSpaces | private byte[] stripWhiteSpaces(byte[] data) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for (byte b : data) {
if (!WHITESPACES.contains(b)) {
bos.write(b);
}
}
return bos.toByteArray();
} | java | private byte[] stripWhiteSpaces(byte[] data) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for (byte b : data) {
if (!WHITESPACES.contains(b)) {
bos.write(b);
}
}
return bos.toByteArray();
} | [
"private",
"byte",
"[",
"]",
"stripWhiteSpaces",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"for",
"(",
"byte",
"b",
":",
"data",
")",
"{",
"if",
"(",
"!",
"WHITESPACES",
... | Removes all whitespaces from the text - the same way that Shir is doing for source files.
@param data - byte array
@return file as string | [
"Removes",
"all",
"whitespaces",
"from",
"the",
"text",
"-",
"the",
"same",
"way",
"that",
"Shir",
"is",
"doing",
"for",
"source",
"files",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HashCalculator.java#L307-L315 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.compress | @Deprecated
public static String compress(String text) throws IOException {
String result;
if (text != null && text.length() > 0) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(text.length());
GZIPOutputStream gzipos = new GZIPOutputStream(baos);) {
... | java | @Deprecated
public static String compress(String text) throws IOException {
String result;
if (text != null && text.length() > 0) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream(text.length());
GZIPOutputStream gzipos = new GZIPOutputStream(baos);) {
... | [
"@",
"Deprecated",
"public",
"static",
"String",
"compress",
"(",
"String",
"text",
")",
"throws",
"IOException",
"{",
"String",
"result",
";",
"if",
"(",
"text",
"!=",
"null",
"&&",
"text",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"try",
"(",
"B... | The method compresses the string using gzip.
@param text The string to compress.
@return The compressed string.
@throws java.io.IOException Does some thing in old style.
@deprecated use {@link #compressString(String)} instead. | [
"The",
"method",
"compresses",
"the",
"string",
"using",
"gzip",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L68-L92 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.decompress | public static String decompress(String text) throws IOException {
if (text == null || text.length() == 0) {
return text;
}
// byte[] bytes = new BASE64Decoder().decodeBuffer(text);
byte[] bytes = Base64.decodeBase64(text);
try (GZIPInputStream gis = new GZIPInputStr... | java | public static String decompress(String text) throws IOException {
if (text == null || text.length() == 0) {
return text;
}
// byte[] bytes = new BASE64Decoder().decodeBuffer(text);
byte[] bytes = Base64.decodeBase64(text);
try (GZIPInputStream gis = new GZIPInputStr... | [
"public",
"static",
"String",
"decompress",
"(",
"String",
"text",
")",
"throws",
"IOException",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"text",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"text",
";",
"}",
"// byte[] bytes = new BASE64Deco... | The method decompresses the string using gzip.
@param text The string to decompress.
@return The decompressed string.
@throws java.io.IOException Does some thing in old style.
@deprecated use {@link #decompressString(String)} instead. | [
"The",
"method",
"decompresses",
"the",
"string",
"using",
"gzip",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L102-L119 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.compressString | public static void compressString(InputStream inputStream, OutputStream outputStream) throws IOException {
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
fillExportStreamCompress(inputStream, byteArrayOutputStream);
// to do -> make it in chunks
... | java | public static void compressString(InputStream inputStream, OutputStream outputStream) throws IOException {
try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
fillExportStreamCompress(inputStream, byteArrayOutputStream);
// to do -> make it in chunks
... | [
"public",
"static",
"void",
"compressString",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
")",
"... | The method compresses the big strings using gzip - low memory via Streams
@param inputStream
@param outputStream
@throws IOException | [
"The",
"method",
"compresses",
"the",
"big",
"strings",
"using",
"gzip",
"-",
"low",
"memory",
"via",
"Streams"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L180-L189 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.decompressString | public static void decompressString(InputStream inputStream, OutputStream outputStream) throws IOException {
try (InputStream bufferedInputStream = new BufferedInputStream(inputStream);
PrintWriter printWriter = new PrintWriter(outputStream);) {
byte[] buffer = new byte[BYTES_BUFFER_SIZ... | java | public static void decompressString(InputStream inputStream, OutputStream outputStream) throws IOException {
try (InputStream bufferedInputStream = new BufferedInputStream(inputStream);
PrintWriter printWriter = new PrintWriter(outputStream);) {
byte[] buffer = new byte[BYTES_BUFFER_SIZ... | [
"public",
"static",
"void",
"decompressString",
"(",
"InputStream",
"inputStream",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"bufferedInputStream",
"=",
"new",
"BufferedInputStream",
"(",
"inputStream",
")",
";"... | The method decompresses the big strings using gzip - low memory via Streams
@param inputStream
@param outputStream
@throws IOException | [
"The",
"method",
"decompresses",
"the",
"big",
"strings",
"using",
"gzip",
"-",
"low",
"memory",
"via",
"Streams"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L205-L216 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.compressChunks | public static String compressChunks(String text) throws IOException {
Path tempFolder = Paths.get(JAVA_TEMP_DIR, ZIP_UTILS);
File tempFileIn = File.createTempFile(TMP_IN_, ZIP_UTILS_SUFFIX, tempFolder.toFile());
File tempFileOut = File.createTempFile(TMP_OUT_, ZIP_UTILS_SUFFIX, tempFolder.toFile... | java | public static String compressChunks(String text) throws IOException {
Path tempFolder = Paths.get(JAVA_TEMP_DIR, ZIP_UTILS);
File tempFileIn = File.createTempFile(TMP_IN_, ZIP_UTILS_SUFFIX, tempFolder.toFile());
File tempFileOut = File.createTempFile(TMP_OUT_, ZIP_UTILS_SUFFIX, tempFolder.toFile... | [
"public",
"static",
"String",
"compressChunks",
"(",
"String",
"text",
")",
"throws",
"IOException",
"{",
"Path",
"tempFolder",
"=",
"Paths",
".",
"get",
"(",
"JAVA_TEMP_DIR",
",",
"ZIP_UTILS",
")",
";",
"File",
"tempFileIn",
"=",
"File",
".",
"createTempFile"... | The method compresses the big strings using gzip - low memory via the File system
@param text The string to compress.
@return The compressed string.
@throws java.io.IOException | [
"The",
"method",
"compresses",
"the",
"big",
"strings",
"using",
"gzip",
"-",
"low",
"memory",
"via",
"the",
"File",
"system"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L225-L259 | train |
whitesource/agents | wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java | ZipUtils.writeChunkBytes | private static void writeChunkBytes(String text, File tempFileIn) throws IOException {
try (FileOutputStream writer = new FileOutputStream(tempFileIn)) {
int chunk = text.length();
if (text.length() > STRING_MAX_SIZE) {
chunk = text.length() / STRING_MAX_SIZE;
... | java | private static void writeChunkBytes(String text, File tempFileIn) throws IOException {
try (FileOutputStream writer = new FileOutputStream(tempFileIn)) {
int chunk = text.length();
if (text.length() > STRING_MAX_SIZE) {
chunk = text.length() / STRING_MAX_SIZE;
... | [
"private",
"static",
"void",
"writeChunkBytes",
"(",
"String",
"text",
",",
"File",
"tempFileIn",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"writer",
"=",
"new",
"FileOutputStream",
"(",
"tempFileIn",
")",
")",
"{",
"int",
"chunk",
"="... | Writes a string piece by piece to file
@param text to input
@param tempFileIn input
@throws IOException exception when writing | [
"Writes",
"a",
"string",
"piece",
"by",
"piece",
"to",
"file"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-utils/src/main/java/org/whitesource/agent/utils/ZipUtils.java#L477-L495 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java | PolicyCheckReport.createTemplateEngine | protected VelocityEngine createTemplateEngine(Properties properties) {
Properties actualProperties = properties;
if (actualProperties == null) {
actualProperties = new Properties();
}
String resourceLoader = actualProperties.getProperty(VelocityEngine.RESOURCE_LOADER);... | java | protected VelocityEngine createTemplateEngine(Properties properties) {
Properties actualProperties = properties;
if (actualProperties == null) {
actualProperties = new Properties();
}
String resourceLoader = actualProperties.getProperty(VelocityEngine.RESOURCE_LOADER);... | [
"protected",
"VelocityEngine",
"createTemplateEngine",
"(",
"Properties",
"properties",
")",
"{",
"Properties",
"actualProperties",
"=",
"properties",
";",
"if",
"(",
"actualProperties",
"==",
"null",
")",
"{",
"actualProperties",
"=",
"new",
"Properties",
"(",
")",... | Create and initialize a template engine to use for generating reports.
@param properties properties to use for engine initialization. May be null.
@return A new instance of th template engine to use. | [
"Create",
"and",
"initialize",
"a",
"template",
"engine",
"to",
"use",
"for",
"generating",
"reports",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java#L198-L220 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java | PolicyCheckReport.createTemplateContext | protected VelocityContext createTemplateContext() {
VelocityContext context = new VelocityContext();
context.put("result", result);
context.put("hasRejections", result.hasRejections());
context.put("licenses", createLicenseHistogram(result));
context.put("creationTime", new ... | java | protected VelocityContext createTemplateContext() {
VelocityContext context = new VelocityContext();
context.put("result", result);
context.put("hasRejections", result.hasRejections());
context.put("licenses", createLicenseHistogram(result));
context.put("creationTime", new ... | [
"protected",
"VelocityContext",
"createTemplateContext",
"(",
")",
"{",
"VelocityContext",
"context",
"=",
"new",
"VelocityContext",
"(",
")",
";",
"context",
".",
"put",
"(",
"\"result\"",
",",
"result",
")",
";",
"context",
".",
"put",
"(",
"\"hasRejections\""... | Create the context holding all the information of the report.
@return the velocity context | [
"Create",
"the",
"context",
"holding",
"all",
"the",
"information",
"of",
"the",
"report",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java#L226-L240 | train |
whitesource/agents | wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java | PolicyCheckReport.copyReportResources | protected void copyReportResources(File workDir) throws IOException {
FileUtils.copyResource(TEMPLATE_FOLDER + CSS_FILE, new File(workDir, CSS_FILE));
} | java | protected void copyReportResources(File workDir) throws IOException {
FileUtils.copyResource(TEMPLATE_FOLDER + CSS_FILE, new File(workDir, CSS_FILE));
} | [
"protected",
"void",
"copyReportResources",
"(",
"File",
"workDir",
")",
"throws",
"IOException",
"{",
"FileUtils",
".",
"copyResource",
"(",
"TEMPLATE_FOLDER",
"+",
"CSS_FILE",
",",
"new",
"File",
"(",
"workDir",
",",
"CSS_FILE",
")",
")",
";",
"}"
] | Copy required resources for the report.
@param workDir Report work directory.
@throws IOException exception5 | [
"Copy",
"required",
"resources",
"for",
"the",
"report",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-report/src/main/java/org/whitesource/agent/report/PolicyCheckReport.java#L249-L251 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/parser/JavaScriptParser.java | JavaScriptParser.parse | public ParseResult parse(String fileContent) {
ParseResult result = null;
// setup environment and initialize the parser.
CompilerEnvirons environment = new CompilerEnvirons();
environment.setLanguageVersion(180);
environment.setStrictMode(false);
environment.setRecordin... | java | public ParseResult parse(String fileContent) {
ParseResult result = null;
// setup environment and initialize the parser.
CompilerEnvirons environment = new CompilerEnvirons();
environment.setLanguageVersion(180);
environment.setStrictMode(false);
environment.setRecordin... | [
"public",
"ParseResult",
"parse",
"(",
"String",
"fileContent",
")",
"{",
"ParseResult",
"result",
"=",
"null",
";",
"// setup environment and initialize the parser.",
"CompilerEnvirons",
"environment",
"=",
"new",
"CompilerEnvirons",
"(",
")",
";",
"environment",
".",
... | Parse the file content and return variants of the file.
@param fileContent to parse
@return the parsing result | [
"Parse",
"the",
"file",
"content",
"and",
"return",
"variants",
"of",
"the",
"file",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/parser/JavaScriptParser.java#L36-L66 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/parser/JavaScriptParser.java | JavaScriptParser.removeHeaderComments | private String removeHeaderComments(String fileContent, SortedSet<Comment> comments) {
String headerlessFileContent = fileContent;
for (Comment comment : comments) {
String commentValue = comment.getValue();
if (headerlessFileContent.startsWith(commentValue)) {
he... | java | private String removeHeaderComments(String fileContent, SortedSet<Comment> comments) {
String headerlessFileContent = fileContent;
for (Comment comment : comments) {
String commentValue = comment.getValue();
if (headerlessFileContent.startsWith(commentValue)) {
he... | [
"private",
"String",
"removeHeaderComments",
"(",
"String",
"fileContent",
",",
"SortedSet",
"<",
"Comment",
">",
"comments",
")",
"{",
"String",
"headerlessFileContent",
"=",
"fileContent",
";",
"for",
"(",
"Comment",
"comment",
":",
"comments",
")",
"{",
"Stri... | Go over each comment and remove from content until reaching the beginning of the actual code. | [
"Go",
"over",
"each",
"comment",
"and",
"remove",
"from",
"content",
"until",
"reaching",
"the",
"beginning",
"of",
"the",
"actual",
"code",
"."
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/parser/JavaScriptParser.java#L73-L89 | train |
whitesource/agents | wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HintUtils.java | HintUtils.executePowerShellCommand | private static String executePowerShellCommand(String command) {
try {
String[] commandList = {POWER_SHELL, POWER_SHELL_COMMAND, command};
ProcessBuilder pb = new ProcessBuilder(commandList);
Process process = pb.start();
InputStream is = process.getInputStream()... | java | private static String executePowerShellCommand(String command) {
try {
String[] commandList = {POWER_SHELL, POWER_SHELL_COMMAND, command};
ProcessBuilder pb = new ProcessBuilder(commandList);
Process process = pb.start();
InputStream is = process.getInputStream()... | [
"private",
"static",
"String",
"executePowerShellCommand",
"(",
"String",
"command",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"commandList",
"=",
"{",
"POWER_SHELL",
",",
"POWER_SHELL_COMMAND",
",",
"command",
"}",
";",
"ProcessBuilder",
"pb",
"=",
"new",
"Pr... | Get the signature from file by execute process from power shell | [
"Get",
"the",
"signature",
"from",
"file",
"by",
"execute",
"process",
"from",
"power",
"shell"
] | 8a947a3dbad257aff70f23f79fb3a55ca90b765f | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-hash-calculator/src/main/java/org/whitesource/agent/hash/HintUtils.java#L148-L169 | train |
hazelcast/hazelcast-client-protocol | hazelcast-code-generator/src/main/java/com/hazelcast/client/protocol/generator/CodeGenerationUtils.java | CodeGenerationUtils.getGenericTypeParameters | private static List<String> getGenericTypeParameters(String parameters) {
List<String> paramList = new ArrayList<String>();
int balanced = 0;
StringBuilder current = new StringBuilder();
for (int i = 0; i < parameters.length(); i++) {
char c = parameters.charAt(i);
... | java | private static List<String> getGenericTypeParameters(String parameters) {
List<String> paramList = new ArrayList<String>();
int balanced = 0;
StringBuilder current = new StringBuilder();
for (int i = 0; i < parameters.length(); i++) {
char c = parameters.charAt(i);
... | [
"private",
"static",
"List",
"<",
"String",
">",
"getGenericTypeParameters",
"(",
"String",
"parameters",
")",
"{",
"List",
"<",
"String",
">",
"paramList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"int",
"balanced",
"=",
"0",
";",
"St... | parse generic type parameters, making sure nested generics are taken into account | [
"parse",
"generic",
"type",
"parameters",
"making",
"sure",
"nested",
"generics",
"are",
"taken",
"into",
"account"
] | 8087190e3a2032b668281168d21f95de23aab516 | https://github.com/hazelcast/hazelcast-client-protocol/blob/8087190e3a2032b668281168d21f95de23aab516/hazelcast-code-generator/src/main/java/com/hazelcast/client/protocol/generator/CodeGenerationUtils.java#L389-L408 | train |
peholmst/vaadin4spring | addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarItemDescriptor.java | SideBarItemDescriptor.findAnnotationOnBean | public <A extends Annotation> A findAnnotationOnBean(Class<A> annotationType) {
return applicationContext.findAnnotationOnBean(beanName, annotationType);
} | java | public <A extends Annotation> A findAnnotationOnBean(Class<A> annotationType) {
return applicationContext.findAnnotationOnBean(beanName, annotationType);
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"findAnnotationOnBean",
"(",
"Class",
"<",
"A",
">",
"annotationType",
")",
"{",
"return",
"applicationContext",
".",
"findAnnotationOnBean",
"(",
"beanName",
",",
"annotationType",
")",
";",
"}"
] | Attempts to find and return an annotation of the specified type declared on this side bar item.
@param annotationType the type of the annotation to look for.
@return the annotation, or {@code null} if not found. | [
"Attempts",
"to",
"find",
"and",
"return",
"an",
"annotation",
"of",
"the",
"specified",
"type",
"declared",
"on",
"this",
"side",
"bar",
"item",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarItemDescriptor.java#L64-L66 | train |
peholmst/vaadin4spring | addons/i18n/src/main/java/org/vaadin/spring/i18n/MessageProviderCacheCleanupExecutor.java | MessageProviderCacheCleanupExecutor.destroy | @PreDestroy
public void destroy() {
if (executorService != null) {
LOGGER.info("Shutting down message provider cache cleanup thread");
cleanupJob.cancel(true);
executorService.shutdown();
}
} | java | @PreDestroy
public void destroy() {
if (executorService != null) {
LOGGER.info("Shutting down message provider cache cleanup thread");
cleanupJob.cancel(true);
executorService.shutdown();
}
} | [
"@",
"PreDestroy",
"public",
"void",
"destroy",
"(",
")",
"{",
"if",
"(",
"executorService",
"!=",
"null",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Shutting down message provider cache cleanup thread\"",
")",
";",
"cleanupJob",
".",
"cancel",
"(",
"true",
")",
... | Shuts down the cleanup thread. | [
"Shuts",
"down",
"the",
"cleanup",
"thread",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/i18n/src/main/java/org/vaadin/spring/i18n/MessageProviderCacheCleanupExecutor.java#L84-L91 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.