id
int32 0
165k
| 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
11,000
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.setCompartmentRefForComplexMembers
|
private void setCompartmentRefForComplexMembers(final Glyph glyph, final Glyph compartment,
final Set<Glyph> visited)
{
if(!visited.add(glyph))
return;
glyph.setCompartmentRef(compartment);
if(glyph.getGlyph().size() > 0) {
for(Glyph g: glyph.getGlyph() ) {
setCompartmentRefForComplexMembers(g, compartment, visited);
}
}
}
|
java
|
private void setCompartmentRefForComplexMembers(final Glyph glyph, final Glyph compartment,
final Set<Glyph> visited)
{
if(!visited.add(glyph))
return;
glyph.setCompartmentRef(compartment);
if(glyph.getGlyph().size() > 0) {
for(Glyph g: glyph.getGlyph() ) {
setCompartmentRefForComplexMembers(g, compartment, visited);
}
}
}
|
[
"private",
"void",
"setCompartmentRefForComplexMembers",
"(",
"final",
"Glyph",
"glyph",
",",
"final",
"Glyph",
"compartment",
",",
"final",
"Set",
"<",
"Glyph",
">",
"visited",
")",
"{",
"if",
"(",
"!",
"visited",
".",
"add",
"(",
"glyph",
")",
")",
"return",
";",
"glyph",
".",
"setCompartmentRef",
"(",
"compartment",
")",
";",
"if",
"(",
"glyph",
".",
"getGlyph",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"Glyph",
"g",
":",
"glyph",
".",
"getGlyph",
"(",
")",
")",
"{",
"setCompartmentRefForComplexMembers",
"(",
"g",
",",
"compartment",
",",
"visited",
")",
";",
"}",
"}",
"}"
] |
Recursively sets compartmentRef fields of members of a complex glyph
to the same value as complex's compartment.
@param glyph target glyph where compartmentRef(compartment parameter) will be set.
@param compartment compartmentRef value that will be set.
@param visited (initially an empty set of) previously processed glyphs, to escape infinite loops
|
[
"Recursively",
"sets",
"compartmentRef",
"fields",
"of",
"members",
"of",
"a",
"complex",
"glyph",
"to",
"the",
"same",
"value",
"as",
"complex",
"s",
"compartment",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L502-L514
|
11,001
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.removePortsFromArcs
|
private void removePortsFromArcs(List<Arc> arcs)
{
for(Arc arc: arcs )
{
// If source is port, first clear port indicators else retrieve it from hashmaps
if (arc.getSource() instanceof Port )
{
Glyph source = portIDToOwnerGlyph.get(((Port)arc.getSource()).getId());
arc.setSource(source);
}
// If target is port, first clear port indicators else retrieve it from hashmaps
if (arc.getTarget() instanceof Port)
{
Glyph target = portIDToOwnerGlyph.get(((Port)arc.getTarget()).getId());
arc.setTarget(target);
}
}
}
|
java
|
private void removePortsFromArcs(List<Arc> arcs)
{
for(Arc arc: arcs )
{
// If source is port, first clear port indicators else retrieve it from hashmaps
if (arc.getSource() instanceof Port )
{
Glyph source = portIDToOwnerGlyph.get(((Port)arc.getSource()).getId());
arc.setSource(source);
}
// If target is port, first clear port indicators else retrieve it from hashmaps
if (arc.getTarget() instanceof Port)
{
Glyph target = portIDToOwnerGlyph.get(((Port)arc.getTarget()).getId());
arc.setTarget(target);
}
}
}
|
[
"private",
"void",
"removePortsFromArcs",
"(",
"List",
"<",
"Arc",
">",
"arcs",
")",
"{",
"for",
"(",
"Arc",
"arc",
":",
"arcs",
")",
"{",
"// If source is port, first clear port indicators else retrieve it from hashmaps",
"if",
"(",
"arc",
".",
"getSource",
"(",
")",
"instanceof",
"Port",
")",
"{",
"Glyph",
"source",
"=",
"portIDToOwnerGlyph",
".",
"get",
"(",
"(",
"(",
"Port",
")",
"arc",
".",
"getSource",
"(",
")",
")",
".",
"getId",
"(",
")",
")",
";",
"arc",
".",
"setSource",
"(",
"source",
")",
";",
"}",
"// If target is port, first clear port indicators else retrieve it from hashmaps",
"if",
"(",
"arc",
".",
"getTarget",
"(",
")",
"instanceof",
"Port",
")",
"{",
"Glyph",
"target",
"=",
"portIDToOwnerGlyph",
".",
"get",
"(",
"(",
"(",
"Port",
")",
"arc",
".",
"getTarget",
"(",
")",
")",
".",
"getId",
"(",
")",
")",
";",
"arc",
".",
"setTarget",
"(",
"target",
")",
";",
"}",
"}",
"}"
] |
This method replaces ports of arc objects with their owners.
@param arcs Arc list of SBGN model
|
[
"This",
"method",
"replaces",
"ports",
"of",
"arc",
"objects",
"with",
"their",
"owners",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L520-L538
|
11,002
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java
|
SBGNLayoutManager.initPortIdToGlyphMap
|
private void initPortIdToGlyphMap(List<Glyph> glyphs)
{
for(Glyph glyph: glyphs)
{
for(Port p: glyph.getPort())
{
portIDToOwnerGlyph.put(p.getId(), glyph );
}
if(glyph.getGlyph().size() > 0)
initPortIdToGlyphMap(glyph.getGlyph());
}
}
|
java
|
private void initPortIdToGlyphMap(List<Glyph> glyphs)
{
for(Glyph glyph: glyphs)
{
for(Port p: glyph.getPort())
{
portIDToOwnerGlyph.put(p.getId(), glyph );
}
if(glyph.getGlyph().size() > 0)
initPortIdToGlyphMap(glyph.getGlyph());
}
}
|
[
"private",
"void",
"initPortIdToGlyphMap",
"(",
"List",
"<",
"Glyph",
">",
"glyphs",
")",
"{",
"for",
"(",
"Glyph",
"glyph",
":",
"glyphs",
")",
"{",
"for",
"(",
"Port",
"p",
":",
"glyph",
".",
"getPort",
"(",
")",
")",
"{",
"portIDToOwnerGlyph",
".",
"put",
"(",
"p",
".",
"getId",
"(",
")",
",",
"glyph",
")",
";",
"}",
"if",
"(",
"glyph",
".",
"getGlyph",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"initPortIdToGlyphMap",
"(",
"glyph",
".",
"getGlyph",
"(",
")",
")",
";",
"}",
"}"
] |
This method initializes map for glyphs and their respective ports.
@param glyphs Glyph list of SBGN model
|
[
"This",
"method",
"initializes",
"map",
"for",
"glyphs",
"and",
"their",
"respective",
"ports",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/SBGNLayoutManager.java#L544-L555
|
11,003
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java
|
CycleBreaker.isSafe
|
public boolean isSafe(Node node, Edge edge)
{
initMaps();
setColor(node, BLACK);
setLabel(node, 0);
setLabel(edge, 0);
labelEquivRecursive(node, UPWARD, 0, false, false);
labelEquivRecursive(node, DOWNWARD, 0, false, false);
// Initialize dist and color of source set
Node neigh = edge.getTargetNode();
if (getColor(neigh) != WHITE) return false;
setColor(neigh, GRAY);
setLabel(neigh, 0);
queue.add(neigh);
labelEquivRecursive(neigh, UPWARD, 0, true, false);
labelEquivRecursive(neigh, DOWNWARD, 0, true, false);
// Process the queue
while (!queue.isEmpty())
{
Node current = queue.remove(0);
if (ST.contains(current)) return true;
boolean safe = processNode2(current);
if (safe) return true;
// Current node is processed
setColor(current, BLACK);
}
return false;
}
|
java
|
public boolean isSafe(Node node, Edge edge)
{
initMaps();
setColor(node, BLACK);
setLabel(node, 0);
setLabel(edge, 0);
labelEquivRecursive(node, UPWARD, 0, false, false);
labelEquivRecursive(node, DOWNWARD, 0, false, false);
// Initialize dist and color of source set
Node neigh = edge.getTargetNode();
if (getColor(neigh) != WHITE) return false;
setColor(neigh, GRAY);
setLabel(neigh, 0);
queue.add(neigh);
labelEquivRecursive(neigh, UPWARD, 0, true, false);
labelEquivRecursive(neigh, DOWNWARD, 0, true, false);
// Process the queue
while (!queue.isEmpty())
{
Node current = queue.remove(0);
if (ST.contains(current)) return true;
boolean safe = processNode2(current);
if (safe) return true;
// Current node is processed
setColor(current, BLACK);
}
return false;
}
|
[
"public",
"boolean",
"isSafe",
"(",
"Node",
"node",
",",
"Edge",
"edge",
")",
"{",
"initMaps",
"(",
")",
";",
"setColor",
"(",
"node",
",",
"BLACK",
")",
";",
"setLabel",
"(",
"node",
",",
"0",
")",
";",
"setLabel",
"(",
"edge",
",",
"0",
")",
";",
"labelEquivRecursive",
"(",
"node",
",",
"UPWARD",
",",
"0",
",",
"false",
",",
"false",
")",
";",
"labelEquivRecursive",
"(",
"node",
",",
"DOWNWARD",
",",
"0",
",",
"false",
",",
"false",
")",
";",
"// Initialize dist and color of source set",
"Node",
"neigh",
"=",
"edge",
".",
"getTargetNode",
"(",
")",
";",
"if",
"(",
"getColor",
"(",
"neigh",
")",
"!=",
"WHITE",
")",
"return",
"false",
";",
"setColor",
"(",
"neigh",
",",
"GRAY",
")",
";",
"setLabel",
"(",
"neigh",
",",
"0",
")",
";",
"queue",
".",
"add",
"(",
"neigh",
")",
";",
"labelEquivRecursive",
"(",
"neigh",
",",
"UPWARD",
",",
"0",
",",
"true",
",",
"false",
")",
";",
"labelEquivRecursive",
"(",
"neigh",
",",
"DOWNWARD",
",",
"0",
",",
"true",
",",
"false",
")",
";",
"// Process the queue",
"while",
"(",
"!",
"queue",
".",
"isEmpty",
"(",
")",
")",
"{",
"Node",
"current",
"=",
"queue",
".",
"remove",
"(",
"0",
")",
";",
"if",
"(",
"ST",
".",
"contains",
"(",
"current",
")",
")",
"return",
"true",
";",
"boolean",
"safe",
"=",
"processNode2",
"(",
"current",
")",
";",
"if",
"(",
"safe",
")",
"return",
"true",
";",
"// Current node is processed",
"setColor",
"(",
"current",
",",
"BLACK",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks whether an edge is on an unwanted cycle.
@param node Node that the edge is bound
@param edge The edge to check
@return True if no cycle is detected, false otherwise
|
[
"Checks",
"whether",
"an",
"edge",
"is",
"on",
"an",
"unwanted",
"cycle",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java#L72-L114
|
11,004
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java
|
CycleBreaker.processNode2
|
protected boolean processNode2(Node current)
{
return processEdges(current, current.getDownstream()) ||
processEdges(current, current.getUpstream());
}
|
java
|
protected boolean processNode2(Node current)
{
return processEdges(current, current.getDownstream()) ||
processEdges(current, current.getUpstream());
}
|
[
"protected",
"boolean",
"processNode2",
"(",
"Node",
"current",
")",
"{",
"return",
"processEdges",
"(",
"current",
",",
"current",
".",
"getDownstream",
"(",
")",
")",
"||",
"processEdges",
"(",
"current",
",",
"current",
".",
"getUpstream",
"(",
")",
")",
";",
"}"
] |
Continue the search from the node. 2 is added because a name clash in the parent class.
@param current The node to traverse
@return False if a cycle is detected
|
[
"Continue",
"the",
"search",
"from",
"the",
"node",
".",
"2",
"is",
"added",
"because",
"a",
"name",
"clash",
"in",
"the",
"parent",
"class",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java#L121-L125
|
11,005
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java
|
CycleBreaker.processEdges
|
private boolean processEdges(Node current, Collection<Edge> edges)
{
for (Edge edge : edges)
{
if (!result.contains(edge)) continue;
// Label the edge considering direction of traversal and type of current node
setLabel(edge, getLabel(current));
// Get the other end of the edge
Node neigh = edge.getSourceNode() == current ?
edge.getTargetNode() : edge.getSourceNode();
// Process the neighbor if not processed or not in queue
if (getColor(neigh) == WHITE)
{
// Label the neighbor according to the search direction and node type
if (neigh.isBreadthNode())
{
setLabel(neigh, getLabel(current) + 1);
}
else
{
setLabel(neigh, getLabel(edge));
}
// Check if we need to stop traversing the neighbor, enqueue otherwise
if (getLabel(neigh) == limit || isEquivalentInTheSet(neigh, ST))
{
return true;
}
setColor(neigh, GRAY);
// Enqueue the node according to its type
if (neigh.isBreadthNode())
{
queue.addLast(neigh);
}
else
{
// Non-breadth nodes are added in front of the queue
queue.addFirst(neigh);
}
labelEquivRecursive(neigh, UPWARD, getLabel(neigh), true, !neigh.isBreadthNode());
labelEquivRecursive(neigh, DOWNWARD, getLabel(neigh), true, !neigh.isBreadthNode());
}
}
return false;
}
|
java
|
private boolean processEdges(Node current, Collection<Edge> edges)
{
for (Edge edge : edges)
{
if (!result.contains(edge)) continue;
// Label the edge considering direction of traversal and type of current node
setLabel(edge, getLabel(current));
// Get the other end of the edge
Node neigh = edge.getSourceNode() == current ?
edge.getTargetNode() : edge.getSourceNode();
// Process the neighbor if not processed or not in queue
if (getColor(neigh) == WHITE)
{
// Label the neighbor according to the search direction and node type
if (neigh.isBreadthNode())
{
setLabel(neigh, getLabel(current) + 1);
}
else
{
setLabel(neigh, getLabel(edge));
}
// Check if we need to stop traversing the neighbor, enqueue otherwise
if (getLabel(neigh) == limit || isEquivalentInTheSet(neigh, ST))
{
return true;
}
setColor(neigh, GRAY);
// Enqueue the node according to its type
if (neigh.isBreadthNode())
{
queue.addLast(neigh);
}
else
{
// Non-breadth nodes are added in front of the queue
queue.addFirst(neigh);
}
labelEquivRecursive(neigh, UPWARD, getLabel(neigh), true, !neigh.isBreadthNode());
labelEquivRecursive(neigh, DOWNWARD, getLabel(neigh), true, !neigh.isBreadthNode());
}
}
return false;
}
|
[
"private",
"boolean",
"processEdges",
"(",
"Node",
"current",
",",
"Collection",
"<",
"Edge",
">",
"edges",
")",
"{",
"for",
"(",
"Edge",
"edge",
":",
"edges",
")",
"{",
"if",
"(",
"!",
"result",
".",
"contains",
"(",
"edge",
")",
")",
"continue",
";",
"// Label the edge considering direction of traversal and type of current node",
"setLabel",
"(",
"edge",
",",
"getLabel",
"(",
"current",
")",
")",
";",
"// Get the other end of the edge",
"Node",
"neigh",
"=",
"edge",
".",
"getSourceNode",
"(",
")",
"==",
"current",
"?",
"edge",
".",
"getTargetNode",
"(",
")",
":",
"edge",
".",
"getSourceNode",
"(",
")",
";",
"// Process the neighbor if not processed or not in queue",
"if",
"(",
"getColor",
"(",
"neigh",
")",
"==",
"WHITE",
")",
"{",
"// Label the neighbor according to the search direction and node type",
"if",
"(",
"neigh",
".",
"isBreadthNode",
"(",
")",
")",
"{",
"setLabel",
"(",
"neigh",
",",
"getLabel",
"(",
"current",
")",
"+",
"1",
")",
";",
"}",
"else",
"{",
"setLabel",
"(",
"neigh",
",",
"getLabel",
"(",
"edge",
")",
")",
";",
"}",
"// Check if we need to stop traversing the neighbor, enqueue otherwise",
"if",
"(",
"getLabel",
"(",
"neigh",
")",
"==",
"limit",
"||",
"isEquivalentInTheSet",
"(",
"neigh",
",",
"ST",
")",
")",
"{",
"return",
"true",
";",
"}",
"setColor",
"(",
"neigh",
",",
"GRAY",
")",
";",
"// Enqueue the node according to its type",
"if",
"(",
"neigh",
".",
"isBreadthNode",
"(",
")",
")",
"{",
"queue",
".",
"addLast",
"(",
"neigh",
")",
";",
"}",
"else",
"{",
"// Non-breadth nodes are added in front of the queue",
"queue",
".",
"addFirst",
"(",
"neigh",
")",
";",
"}",
"labelEquivRecursive",
"(",
"neigh",
",",
"UPWARD",
",",
"getLabel",
"(",
"neigh",
")",
",",
"true",
",",
"!",
"neigh",
".",
"isBreadthNode",
"(",
")",
")",
";",
"labelEquivRecursive",
"(",
"neigh",
",",
"DOWNWARD",
",",
"getLabel",
"(",
"neigh",
")",
",",
"true",
",",
"!",
"neigh",
".",
"isBreadthNode",
"(",
")",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Continue evaluating the next edge.
@param current Current node
@param edges The edge to evaluate
@return False if a cycle is detected
|
[
"Continue",
"evaluating",
"the",
"next",
"edge",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/CycleBreaker.java#L133-L188
|
11,006
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java
|
BioPAXIOHandlerAdapter.createAndAdd
|
protected void createAndAdd(Model model, String id, String localName)
{
BioPAXElement bpe = this.getFactory().create(localName, id);
if (log.isTraceEnabled())
{
log.trace("id:" + id + " " + localName + " : " + bpe);
}
/* null might occur here,
* so the following is to prevent the NullPointerException
* and to continue the model assembling.
*/
if (bpe != null)
{
model.add(bpe);
} else
{
log.warn("null object created during reading. It might not be an official BioPAX class.ID: " + id +
" Class " +
"name " + localName);
}
}
|
java
|
protected void createAndAdd(Model model, String id, String localName)
{
BioPAXElement bpe = this.getFactory().create(localName, id);
if (log.isTraceEnabled())
{
log.trace("id:" + id + " " + localName + " : " + bpe);
}
/* null might occur here,
* so the following is to prevent the NullPointerException
* and to continue the model assembling.
*/
if (bpe != null)
{
model.add(bpe);
} else
{
log.warn("null object created during reading. It might not be an official BioPAX class.ID: " + id +
" Class " +
"name " + localName);
}
}
|
[
"protected",
"void",
"createAndAdd",
"(",
"Model",
"model",
",",
"String",
"id",
",",
"String",
"localName",
")",
"{",
"BioPAXElement",
"bpe",
"=",
"this",
".",
"getFactory",
"(",
")",
".",
"create",
"(",
"localName",
",",
"id",
")",
";",
"if",
"(",
"log",
".",
"isTraceEnabled",
"(",
")",
")",
"{",
"log",
".",
"trace",
"(",
"\"id:\"",
"+",
"id",
"+",
"\" \"",
"+",
"localName",
"+",
"\" : \"",
"+",
"bpe",
")",
";",
"}",
"/* null might occur here,\n\t\t * so the following is to prevent the NullPointerException\n\t\t * and to continue the model assembling.\n\t\t */",
"if",
"(",
"bpe",
"!=",
"null",
")",
"{",
"model",
".",
"add",
"(",
"bpe",
")",
";",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"null object created during reading. It might not be an official BioPAX class.ID: \"",
"+",
"id",
"+",
"\" Class \"",
"+",
"\"name \"",
"+",
"localName",
")",
";",
"}",
"}"
] |
This method is called by the reader for each OWL instance in the OWL model. It creates a POJO instance, with
the given id and inserts it into the model. The inserted object is "clean" in the sense that its properties are
not set yet.
Implementers of this abstract class can override this method to inject code during object creation.
@param model to be inserted
@param id of the new object. The model should not contain another object with the same ID.
@param localName of the class to be instantiated.
|
[
"This",
"method",
"is",
"called",
"by",
"the",
"reader",
"for",
"each",
"OWL",
"instance",
"in",
"the",
"OWL",
"model",
".",
"It",
"creates",
"a",
"POJO",
"instance",
"with",
"the",
"given",
"id",
"and",
"inserts",
"it",
"into",
"the",
"model",
".",
"The",
"inserted",
"object",
"is",
"clean",
"in",
"the",
"sense",
"that",
"its",
"properties",
"are",
"not",
"set",
"yet",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java#L244-L265
|
11,007
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java
|
BioPAXIOHandlerAdapter.resourceFixes
|
protected Object resourceFixes(BioPAXElement bpe, Object value)
{
if (this.isFixReusedPEPs() && value instanceof physicalEntityParticipant)
{
value = this.getReusedPEPHelper().fixReusedPEP((physicalEntityParticipant) value, bpe);
}
return value;
}
|
java
|
protected Object resourceFixes(BioPAXElement bpe, Object value)
{
if (this.isFixReusedPEPs() && value instanceof physicalEntityParticipant)
{
value = this.getReusedPEPHelper().fixReusedPEP((physicalEntityParticipant) value, bpe);
}
return value;
}
|
[
"protected",
"Object",
"resourceFixes",
"(",
"BioPAXElement",
"bpe",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"this",
".",
"isFixReusedPEPs",
"(",
")",
"&&",
"value",
"instanceof",
"physicalEntityParticipant",
")",
"{",
"value",
"=",
"this",
".",
"getReusedPEPHelper",
"(",
")",
".",
"fixReusedPEP",
"(",
"(",
"physicalEntityParticipant",
")",
"value",
",",
"bpe",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
This method currently only fixes reusedPEPs if the option is set. As L2 is becoming obsolete this method will be
slated for deprecation.
@param bpe to be bound
@param value to be assigned.
@return a "fixed" value.
|
[
"This",
"method",
"currently",
"only",
"fixes",
"reusedPEPs",
"if",
"the",
"option",
"is",
"set",
".",
"As",
"L2",
"is",
"becoming",
"obsolete",
"this",
"method",
"will",
"be",
"slated",
"for",
"deprecation",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java#L295-L302
|
11,008
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java
|
BioPAXIOHandlerAdapter.bindValue
|
protected void bindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model)
{
if (log.isDebugEnabled())
{
log.debug("Binding: " + bpe + '(' + bpe.getModelInterface() + " has " + editor + ' ' + valueString);
}
Object value = (valueString==null)?null:valueString.trim();
if (editor instanceof ObjectPropertyEditor)
{
value = model.getByID(valueString);
value = resourceFixes(bpe, value);
if (value == null)
{
throw new IllegalBioPAXArgumentException(
"Illegal or Dangling Value/Reference: " + valueString + " (element: " + bpe.getUri() +
" property: " + editor.getProperty() + ")");
}
}
if (editor == null)
{
log.error("Editor is null. This probably means an invalid BioPAX property. Failed to set " + valueString);
} else //is either EnumeratedPropertyEditor or DataPropertyEditor
{
editor.setValueToBean(value, bpe);
}
}
|
java
|
protected void bindValue(String valueString, PropertyEditor editor, BioPAXElement bpe, Model model)
{
if (log.isDebugEnabled())
{
log.debug("Binding: " + bpe + '(' + bpe.getModelInterface() + " has " + editor + ' ' + valueString);
}
Object value = (valueString==null)?null:valueString.trim();
if (editor instanceof ObjectPropertyEditor)
{
value = model.getByID(valueString);
value = resourceFixes(bpe, value);
if (value == null)
{
throw new IllegalBioPAXArgumentException(
"Illegal or Dangling Value/Reference: " + valueString + " (element: " + bpe.getUri() +
" property: " + editor.getProperty() + ")");
}
}
if (editor == null)
{
log.error("Editor is null. This probably means an invalid BioPAX property. Failed to set " + valueString);
} else //is either EnumeratedPropertyEditor or DataPropertyEditor
{
editor.setValueToBean(value, bpe);
}
}
|
[
"protected",
"void",
"bindValue",
"(",
"String",
"valueString",
",",
"PropertyEditor",
"editor",
",",
"BioPAXElement",
"bpe",
",",
"Model",
"model",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Binding: \"",
"+",
"bpe",
"+",
"'",
"'",
"+",
"bpe",
".",
"getModelInterface",
"(",
")",
"+",
"\" has \"",
"+",
"editor",
"+",
"'",
"'",
"+",
"valueString",
")",
";",
"}",
"Object",
"value",
"=",
"(",
"valueString",
"==",
"null",
")",
"?",
"null",
":",
"valueString",
".",
"trim",
"(",
")",
";",
"if",
"(",
"editor",
"instanceof",
"ObjectPropertyEditor",
")",
"{",
"value",
"=",
"model",
".",
"getByID",
"(",
"valueString",
")",
";",
"value",
"=",
"resourceFixes",
"(",
"bpe",
",",
"value",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalBioPAXArgumentException",
"(",
"\"Illegal or Dangling Value/Reference: \"",
"+",
"valueString",
"+",
"\" (element: \"",
"+",
"bpe",
".",
"getUri",
"(",
")",
"+",
"\" property: \"",
"+",
"editor",
".",
"getProperty",
"(",
")",
"+",
"\")\"",
")",
";",
"}",
"}",
"if",
"(",
"editor",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Editor is null. This probably means an invalid BioPAX property. Failed to set \"",
"+",
"valueString",
")",
";",
"}",
"else",
"//is either EnumeratedPropertyEditor or DataPropertyEditor",
"{",
"editor",
".",
"setValueToBean",
"(",
"value",
",",
"bpe",
")",
";",
"}",
"}"
] |
This method binds the value to the bpe. Actual assignment is handled by the editor - but this method performs
most of the workarounds and also error handling due to invalid parameters.
@param valueString to be assigned
@param editor that maps to the property
@param bpe to be bound
@param model to be populated.
|
[
"This",
"method",
"binds",
"the",
"value",
"to",
"the",
"bpe",
".",
"Actual",
"assignment",
"is",
"handled",
"by",
"the",
"editor",
"-",
"but",
"this",
"method",
"performs",
"most",
"of",
"the",
"workarounds",
"and",
"also",
"error",
"handling",
"due",
"to",
"invalid",
"parameters",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/io/BioPAXIOHandlerAdapter.java#L312-L339
|
11,009
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.containsNull
|
private boolean containsNull(PhysicalEntity[] pes)
{
for (PhysicalEntity pe : pes)
{
if (pe == null) return true;
}
return false;
}
|
java
|
private boolean containsNull(PhysicalEntity[] pes)
{
for (PhysicalEntity pe : pes)
{
if (pe == null) return true;
}
return false;
}
|
[
"private",
"boolean",
"containsNull",
"(",
"PhysicalEntity",
"[",
"]",
"pes",
")",
"{",
"for",
"(",
"PhysicalEntity",
"pe",
":",
"pes",
")",
"{",
"if",
"(",
"pe",
"==",
"null",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks if any element in the chain is null.
@param pes element array
@return true if null found
|
[
"Checks",
"if",
"any",
"element",
"in",
"the",
"chain",
"is",
"null",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L60-L67
|
11,010
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.fillArray
|
protected PhysicalEntity[] fillArray(PhysicalEntity parent, PhysicalEntity target, int depth,
int dir)
{
if (parent == target)
{
PhysicalEntity[] pes = new PhysicalEntity[depth];
pes[0] = target;
return pes;
}
if (parent instanceof Complex)
{
for (PhysicalEntity mem : ((Complex) parent).getComponent())
{
PhysicalEntity[] pes = fillArray(mem, target, depth + 1, 0);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
}
if (dir <= 0)
for (PhysicalEntity mem : parent.getMemberPhysicalEntity())
{
PhysicalEntity[] pes = fillArray(mem, target, depth + 1, -1);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
if (dir >= 0)
for (PhysicalEntity grand : parent.getMemberPhysicalEntityOf())
{
PhysicalEntity[] pes = fillArray(grand, target, depth + 1, 1);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
return null;
}
|
java
|
protected PhysicalEntity[] fillArray(PhysicalEntity parent, PhysicalEntity target, int depth,
int dir)
{
if (parent == target)
{
PhysicalEntity[] pes = new PhysicalEntity[depth];
pes[0] = target;
return pes;
}
if (parent instanceof Complex)
{
for (PhysicalEntity mem : ((Complex) parent).getComponent())
{
PhysicalEntity[] pes = fillArray(mem, target, depth + 1, 0);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
}
if (dir <= 0)
for (PhysicalEntity mem : parent.getMemberPhysicalEntity())
{
PhysicalEntity[] pes = fillArray(mem, target, depth + 1, -1);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
if (dir >= 0)
for (PhysicalEntity grand : parent.getMemberPhysicalEntityOf())
{
PhysicalEntity[] pes = fillArray(grand, target, depth + 1, 1);
if (pes != null)
{
pes[pes.length - depth] = parent;
return pes;
}
}
return null;
}
|
[
"protected",
"PhysicalEntity",
"[",
"]",
"fillArray",
"(",
"PhysicalEntity",
"parent",
",",
"PhysicalEntity",
"target",
",",
"int",
"depth",
",",
"int",
"dir",
")",
"{",
"if",
"(",
"parent",
"==",
"target",
")",
"{",
"PhysicalEntity",
"[",
"]",
"pes",
"=",
"new",
"PhysicalEntity",
"[",
"depth",
"]",
";",
"pes",
"[",
"0",
"]",
"=",
"target",
";",
"return",
"pes",
";",
"}",
"if",
"(",
"parent",
"instanceof",
"Complex",
")",
"{",
"for",
"(",
"PhysicalEntity",
"mem",
":",
"(",
"(",
"Complex",
")",
"parent",
")",
".",
"getComponent",
"(",
")",
")",
"{",
"PhysicalEntity",
"[",
"]",
"pes",
"=",
"fillArray",
"(",
"mem",
",",
"target",
",",
"depth",
"+",
"1",
",",
"0",
")",
";",
"if",
"(",
"pes",
"!=",
"null",
")",
"{",
"pes",
"[",
"pes",
".",
"length",
"-",
"depth",
"]",
"=",
"parent",
";",
"return",
"pes",
";",
"}",
"}",
"}",
"if",
"(",
"dir",
"<=",
"0",
")",
"for",
"(",
"PhysicalEntity",
"mem",
":",
"parent",
".",
"getMemberPhysicalEntity",
"(",
")",
")",
"{",
"PhysicalEntity",
"[",
"]",
"pes",
"=",
"fillArray",
"(",
"mem",
",",
"target",
",",
"depth",
"+",
"1",
",",
"-",
"1",
")",
";",
"if",
"(",
"pes",
"!=",
"null",
")",
"{",
"pes",
"[",
"pes",
".",
"length",
"-",
"depth",
"]",
"=",
"parent",
";",
"return",
"pes",
";",
"}",
"}",
"if",
"(",
"dir",
">=",
"0",
")",
"for",
"(",
"PhysicalEntity",
"grand",
":",
"parent",
".",
"getMemberPhysicalEntityOf",
"(",
")",
")",
"{",
"PhysicalEntity",
"[",
"]",
"pes",
"=",
"fillArray",
"(",
"grand",
",",
"target",
",",
"depth",
"+",
"1",
",",
"1",
")",
";",
"if",
"(",
"pes",
"!=",
"null",
")",
"{",
"pes",
"[",
"pes",
".",
"length",
"-",
"depth",
"]",
"=",
"parent",
";",
"return",
"pes",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Creates the chain that links the given endpoints.
@param parent current element
@param target target at the member end
@param depth current depth
@param dir current direction to traverse homologies
@return array of entities
|
[
"Creates",
"the",
"chain",
"that",
"links",
"the",
"given",
"endpoints",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L77-L123
|
11,011
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.getCellularLocations
|
public Set<String> getCellularLocations()
{
Set<String> locs = new HashSet<String>();
for (PhysicalEntity pe : pes)
{
CellularLocationVocabulary voc = pe.getCellularLocation();
if (voc != null)
{
for (String term : voc.getTerm())
{
if (term != null && term.length() > 0) locs.add(term);
}
}
}
return locs;
}
|
java
|
public Set<String> getCellularLocations()
{
Set<String> locs = new HashSet<String>();
for (PhysicalEntity pe : pes)
{
CellularLocationVocabulary voc = pe.getCellularLocation();
if (voc != null)
{
for (String term : voc.getTerm())
{
if (term != null && term.length() > 0) locs.add(term);
}
}
}
return locs;
}
|
[
"public",
"Set",
"<",
"String",
">",
"getCellularLocations",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"locs",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"PhysicalEntity",
"pe",
":",
"pes",
")",
"{",
"CellularLocationVocabulary",
"voc",
"=",
"pe",
".",
"getCellularLocation",
"(",
")",
";",
"if",
"(",
"voc",
"!=",
"null",
")",
"{",
"for",
"(",
"String",
"term",
":",
"voc",
".",
"getTerm",
"(",
")",
")",
"{",
"if",
"(",
"term",
"!=",
"null",
"&&",
"term",
".",
"length",
"(",
")",
">",
"0",
")",
"locs",
".",
"add",
"(",
"term",
")",
";",
"}",
"}",
"}",
"return",
"locs",
";",
"}"
] |
Retrieves the cellular location of the PhysicalEntity.
@return cellular location of the PhysicalEntity
|
[
"Retrieves",
"the",
"cellular",
"location",
"of",
"the",
"PhysicalEntity",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L129-L144
|
11,012
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.intersects
|
public boolean intersects(PhysicalEntityChain rpeh, boolean ignoreEndPoints)
{
for (PhysicalEntity pe1 : pes)
{
for (PhysicalEntity pe2 : rpeh.pes)
{
if (pe1 == pe2)
{
if (ignoreEndPoints)
{
if ((pes[0] == pe1 || pes[pes.length-1] == pe1) &&
(rpeh.pes[0] == pe2 || rpeh.pes[rpeh.pes.length-1] == pe2))
{
continue;
}
}
return true;
}
}
}
return false;
}
|
java
|
public boolean intersects(PhysicalEntityChain rpeh, boolean ignoreEndPoints)
{
for (PhysicalEntity pe1 : pes)
{
for (PhysicalEntity pe2 : rpeh.pes)
{
if (pe1 == pe2)
{
if (ignoreEndPoints)
{
if ((pes[0] == pe1 || pes[pes.length-1] == pe1) &&
(rpeh.pes[0] == pe2 || rpeh.pes[rpeh.pes.length-1] == pe2))
{
continue;
}
}
return true;
}
}
}
return false;
}
|
[
"public",
"boolean",
"intersects",
"(",
"PhysicalEntityChain",
"rpeh",
",",
"boolean",
"ignoreEndPoints",
")",
"{",
"for",
"(",
"PhysicalEntity",
"pe1",
":",
"pes",
")",
"{",
"for",
"(",
"PhysicalEntity",
"pe2",
":",
"rpeh",
".",
"pes",
")",
"{",
"if",
"(",
"pe1",
"==",
"pe2",
")",
"{",
"if",
"(",
"ignoreEndPoints",
")",
"{",
"if",
"(",
"(",
"pes",
"[",
"0",
"]",
"==",
"pe1",
"||",
"pes",
"[",
"pes",
".",
"length",
"-",
"1",
"]",
"==",
"pe1",
")",
"&&",
"(",
"rpeh",
".",
"pes",
"[",
"0",
"]",
"==",
"pe2",
"||",
"rpeh",
".",
"pes",
"[",
"rpeh",
".",
"pes",
".",
"length",
"-",
"1",
"]",
"==",
"pe2",
")",
")",
"{",
"continue",
";",
"}",
"}",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks if two chains intersect.
@param rpeh second chain
@param ignoreEndPoints flag to ignore intersections at the endpoints of the chains
@return true if they intersect
|
[
"Checks",
"if",
"two",
"chains",
"intersect",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L162-L184
|
11,013
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.checkActivityLabel
|
public Activity checkActivityLabel()
{
boolean active = false;
boolean inactive = false;
for (PhysicalEntity pe : pes)
{
for (Object o : PE2TERM.getValueFromBean(pe))
{
String s = (String) o;
if (s.contains("inactiv")) inactive = true;
else if (s.contains("activ")) active = true;
}
for (String s : pe.getName())
{
if (s.contains("inactiv")) inactive = true;
else if (s.contains("activ")) active = true;
}
}
if (active) if (inactive) return Activity.BOTH; else return Activity.ACTIVE;
else if (inactive) return Activity.INACTIVE; else return Activity.NONE;
}
|
java
|
public Activity checkActivityLabel()
{
boolean active = false;
boolean inactive = false;
for (PhysicalEntity pe : pes)
{
for (Object o : PE2TERM.getValueFromBean(pe))
{
String s = (String) o;
if (s.contains("inactiv")) inactive = true;
else if (s.contains("activ")) active = true;
}
for (String s : pe.getName())
{
if (s.contains("inactiv")) inactive = true;
else if (s.contains("activ")) active = true;
}
}
if (active) if (inactive) return Activity.BOTH; else return Activity.ACTIVE;
else if (inactive) return Activity.INACTIVE; else return Activity.NONE;
}
|
[
"public",
"Activity",
"checkActivityLabel",
"(",
")",
"{",
"boolean",
"active",
"=",
"false",
";",
"boolean",
"inactive",
"=",
"false",
";",
"for",
"(",
"PhysicalEntity",
"pe",
":",
"pes",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"PE2TERM",
".",
"getValueFromBean",
"(",
"pe",
")",
")",
"{",
"String",
"s",
"=",
"(",
"String",
")",
"o",
";",
"if",
"(",
"s",
".",
"contains",
"(",
"\"inactiv\"",
")",
")",
"inactive",
"=",
"true",
";",
"else",
"if",
"(",
"s",
".",
"contains",
"(",
"\"activ\"",
")",
")",
"active",
"=",
"true",
";",
"}",
"for",
"(",
"String",
"s",
":",
"pe",
".",
"getName",
"(",
")",
")",
"{",
"if",
"(",
"s",
".",
"contains",
"(",
"\"inactiv\"",
")",
")",
"inactive",
"=",
"true",
";",
"else",
"if",
"(",
"s",
".",
"contains",
"(",
"\"activ\"",
")",
")",
"active",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"active",
")",
"if",
"(",
"inactive",
")",
"return",
"Activity",
".",
"BOTH",
";",
"else",
"return",
"Activity",
".",
"ACTIVE",
";",
"else",
"if",
"(",
"inactive",
")",
"return",
"Activity",
".",
"INACTIVE",
";",
"else",
"return",
"Activity",
".",
"NONE",
";",
"}"
] |
Checks if the chain has a member with an activity label.
@return the activity status found
|
[
"Checks",
"if",
"the",
"chain",
"has",
"a",
"member",
"with",
"an",
"activity",
"label",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L190-L213
|
11,014
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
|
PhysicalEntityChain.getModifications
|
public Set<ModificationFeature> getModifications()
{
Set<ModificationFeature> set = new HashSet<ModificationFeature>();
for (PhysicalEntity pe : pes)
{
set.addAll(PE2FEAT.getValueFromBean(pe));
}
return set;
}
|
java
|
public Set<ModificationFeature> getModifications()
{
Set<ModificationFeature> set = new HashSet<ModificationFeature>();
for (PhysicalEntity pe : pes)
{
set.addAll(PE2FEAT.getValueFromBean(pe));
}
return set;
}
|
[
"public",
"Set",
"<",
"ModificationFeature",
">",
"getModifications",
"(",
")",
"{",
"Set",
"<",
"ModificationFeature",
">",
"set",
"=",
"new",
"HashSet",
"<",
"ModificationFeature",
">",
"(",
")",
";",
"for",
"(",
"PhysicalEntity",
"pe",
":",
"pes",
")",
"{",
"set",
".",
"addAll",
"(",
"PE2FEAT",
".",
"getValueFromBean",
"(",
"pe",
")",
")",
";",
"}",
"return",
"set",
";",
"}"
] |
Collects modifications from the elements of the chain.
@return modifications
|
[
"Collects",
"modifications",
"from",
"the",
"elements",
"of",
"the",
"chain",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L230-L239
|
11,015
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Size.java
|
Size.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
Collection<BioPAXElement> set = con.generate(match, ind);
switch (type)
{
case EQUAL: return set.size() == size;
case GREATER: return set.size() > size;
case GREATER_OR_EQUAL: return set.size() >= size;
case LESS: return set.size() < size;
case LESS_OR_EQUAL: return set.size() <= size;
default: throw new RuntimeException(
"Should not reach here. Did somebody modify Type enum?");
}
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
Collection<BioPAXElement> set = con.generate(match, ind);
switch (type)
{
case EQUAL: return set.size() == size;
case GREATER: return set.size() > size;
case GREATER_OR_EQUAL: return set.size() >= size;
case LESS: return set.size() < size;
case LESS_OR_EQUAL: return set.size() <= size;
default: throw new RuntimeException(
"Should not reach here. Did somebody modify Type enum?");
}
}
|
[
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"Collection",
"<",
"BioPAXElement",
">",
"set",
"=",
"con",
".",
"generate",
"(",
"match",
",",
"ind",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"EQUAL",
":",
"return",
"set",
".",
"size",
"(",
")",
"==",
"size",
";",
"case",
"GREATER",
":",
"return",
"set",
".",
"size",
"(",
")",
">",
"size",
";",
"case",
"GREATER_OR_EQUAL",
":",
"return",
"set",
".",
"size",
"(",
")",
">=",
"size",
";",
"case",
"LESS",
":",
"return",
"set",
".",
"size",
"(",
")",
"<",
"size",
";",
"case",
"LESS_OR_EQUAL",
":",
"return",
"set",
".",
"size",
"(",
")",
"<=",
"size",
";",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Should not reach here. Did somebody modify Type enum?\"",
")",
";",
"}",
"}"
] |
Checks if generated element size is in limits.
@param match current pattern match
@param ind mapped indices
@return true if generated element size is in limits
|
[
"Checks",
"if",
"generated",
"element",
"size",
"is",
"in",
"limits",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Size.java#L63-L78
|
11,016
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java
|
ControlsStateChangeDetailedMiner.writeResult
|
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultDetailed(matches, out, 5);
}
|
java
|
public void writeResult(Map<BioPAXElement, List<Match>> matches, OutputStream out)
throws IOException
{
writeResultDetailed(matches, out, 5);
}
|
[
"public",
"void",
"writeResult",
"(",
"Map",
"<",
"BioPAXElement",
",",
"List",
"<",
"Match",
">",
">",
"matches",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"writeResultDetailed",
"(",
"matches",
",",
"out",
",",
"5",
")",
";",
"}"
] |
Writes the result as "A modifications-of-A B gains-of-B loss-of-B", where A and B are gene
symbols, and whitespace is tab. Modifications are comma separated.
@param matches pattern search result
@param out output stream
|
[
"Writes",
"the",
"result",
"as",
"A",
"modifications",
"-",
"of",
"-",
"A",
"B",
"gains",
"-",
"of",
"-",
"B",
"loss",
"-",
"of",
"-",
"B",
"where",
"A",
"and",
"B",
"are",
"gene",
"symbols",
"and",
"whitespace",
"is",
"tab",
".",
"Modifications",
"are",
"comma",
"separated",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java#L49-L53
|
11,017
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java
|
ControlsStateChangeDetailedMiner.getValue
|
@Override
public String getValue(Match m, int col)
{
switch(col)
{
case 0:
{
return getGeneSymbol(m, "controller ER");
}
case 1:
{
return concat(getModifications(m, "controller simple PE", "controller PE"), " ");
}
case 2:
{
return getGeneSymbol(m, "changed ER");
}
case 3:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[0], " ");
}
case 4:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[1], " ");
}
default: throw new RuntimeException("Invalid col number: " + col);
}
}
|
java
|
@Override
public String getValue(Match m, int col)
{
switch(col)
{
case 0:
{
return getGeneSymbol(m, "controller ER");
}
case 1:
{
return concat(getModifications(m, "controller simple PE", "controller PE"), " ");
}
case 2:
{
return getGeneSymbol(m, "changed ER");
}
case 3:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[0], " ");
}
case 4:
{
return concat(getDeltaModifications(m,
"input simple PE", "input PE", "output simple PE", "output PE")[1], " ");
}
default: throw new RuntimeException("Invalid col number: " + col);
}
}
|
[
"@",
"Override",
"public",
"String",
"getValue",
"(",
"Match",
"m",
",",
"int",
"col",
")",
"{",
"switch",
"(",
"col",
")",
"{",
"case",
"0",
":",
"{",
"return",
"getGeneSymbol",
"(",
"m",
",",
"\"controller ER\"",
")",
";",
"}",
"case",
"1",
":",
"{",
"return",
"concat",
"(",
"getModifications",
"(",
"m",
",",
"\"controller simple PE\"",
",",
"\"controller PE\"",
")",
",",
"\" \"",
")",
";",
"}",
"case",
"2",
":",
"{",
"return",
"getGeneSymbol",
"(",
"m",
",",
"\"changed ER\"",
")",
";",
"}",
"case",
"3",
":",
"{",
"return",
"concat",
"(",
"getDeltaModifications",
"(",
"m",
",",
"\"input simple PE\"",
",",
"\"input PE\"",
",",
"\"output simple PE\"",
",",
"\"output PE\"",
")",
"[",
"0",
"]",
",",
"\" \"",
")",
";",
"}",
"case",
"4",
":",
"{",
"return",
"concat",
"(",
"getDeltaModifications",
"(",
"m",
",",
"\"input simple PE\"",
",",
"\"input PE\"",
",",
"\"output simple PE\"",
",",
"\"output PE\"",
")",
"[",
"1",
"]",
",",
"\" \"",
")",
";",
"}",
"default",
":",
"throw",
"new",
"RuntimeException",
"(",
"\"Invalid col number: \"",
"+",
"col",
")",
";",
"}",
"}"
] |
Creates values for the result file columns.
@param m current match
@param col current column
@return value of the given match at the given column
|
[
"Creates",
"values",
"for",
"the",
"result",
"file",
"columns",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/ControlsStateChangeDetailedMiner.java#L71-L100
|
11,018
|
lightoze/gwt-i18n-server
|
src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java
|
LocaleFactory.get
|
@SuppressWarnings({"unchecked"})
public static <T extends LocalizableResource> T get(Class<T> cls, String locale) {
Map<String, LocalizableResource> localeCache = getLocaleCache(cls);
T m = (T) localeCache.get(locale);
if (m != null) {
return m;
}
synchronized (cache) {
m = (T) localeCache.get(locale);
if (m != null) {
return m;
}
m = provider.create(cls, locale);
put(cls, locale, m);
return m;
}
}
|
java
|
@SuppressWarnings({"unchecked"})
public static <T extends LocalizableResource> T get(Class<T> cls, String locale) {
Map<String, LocalizableResource> localeCache = getLocaleCache(cls);
T m = (T) localeCache.get(locale);
if (m != null) {
return m;
}
synchronized (cache) {
m = (T) localeCache.get(locale);
if (m != null) {
return m;
}
m = provider.create(cls, locale);
put(cls, locale, m);
return m;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"static",
"<",
"T",
"extends",
"LocalizableResource",
">",
"T",
"get",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"String",
"locale",
")",
"{",
"Map",
"<",
"String",
",",
"LocalizableResource",
">",
"localeCache",
"=",
"getLocaleCache",
"(",
"cls",
")",
";",
"T",
"m",
"=",
"(",
"T",
")",
"localeCache",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"return",
"m",
";",
"}",
"synchronized",
"(",
"cache",
")",
"{",
"m",
"=",
"(",
"T",
")",
"localeCache",
".",
"get",
"(",
"locale",
")",
";",
"if",
"(",
"m",
"!=",
"null",
")",
"{",
"return",
"m",
";",
"}",
"m",
"=",
"provider",
".",
"create",
"(",
"cls",
",",
"locale",
")",
";",
"put",
"(",
"cls",
",",
"locale",
",",
"m",
")",
";",
"return",
"m",
";",
"}",
"}"
] |
Get localization object for the specified locale.
@param cls localization interface class
@param locale locale string
@param <T> localization interface class
@return object implementing specified class
|
[
"Get",
"localization",
"object",
"for",
"the",
"specified",
"locale",
"."
] |
96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83
|
https://github.com/lightoze/gwt-i18n-server/blob/96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83/src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java#L58-L74
|
11,019
|
lightoze/gwt-i18n-server
|
src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java
|
LocaleFactory.put
|
public static <T extends LocalizableResource> void put(Class<T> cls, String locale, T m) {
Map<String, LocalizableResource> localeCache = getLocaleCache(cls);
synchronized (cache) {
localeCache.put(locale, m);
}
}
|
java
|
public static <T extends LocalizableResource> void put(Class<T> cls, String locale, T m) {
Map<String, LocalizableResource> localeCache = getLocaleCache(cls);
synchronized (cache) {
localeCache.put(locale, m);
}
}
|
[
"public",
"static",
"<",
"T",
"extends",
"LocalizableResource",
">",
"void",
"put",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"String",
"locale",
",",
"T",
"m",
")",
"{",
"Map",
"<",
"String",
",",
"LocalizableResource",
">",
"localeCache",
"=",
"getLocaleCache",
"(",
"cls",
")",
";",
"synchronized",
"(",
"cache",
")",
"{",
"localeCache",
".",
"put",
"(",
"locale",
",",
"m",
")",
";",
"}",
"}"
] |
Populate localization object cache for the specified locale.
@param cls localization interface class
@param locale locale string
@param m localization object
@param <T> localization interface class
|
[
"Populate",
"localization",
"object",
"cache",
"for",
"the",
"specified",
"locale",
"."
] |
96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83
|
https://github.com/lightoze/gwt-i18n-server/blob/96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83/src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java#L95-L100
|
11,020
|
BioPAX/Paxtools
|
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/CommonFeatureStringGenerator.java
|
CommonFeatureStringGenerator.createStateVar
|
public Glyph.State createStateVar(EntityFeature ef, ObjectFactory factory)
{
if (ef instanceof FragmentFeature)
{
FragmentFeature ff = (FragmentFeature) ef;
SequenceLocation loc = ff.getFeatureLocation();
if (loc instanceof SequenceInterval)
{
SequenceInterval si = (SequenceInterval) loc;
SequenceSite begin = si.getSequenceIntervalBegin();
SequenceSite end = si.getSequenceIntervalEnd();
if (begin != null && end != null)
{
Glyph.State state = factory.createGlyphState();
state.setValue("x[" + begin.getSequencePosition() + " - " +
end.getSequencePosition() + "]");
return state;
}
}
}
else if (ef instanceof ModificationFeature)
{
ModificationFeature mf = (ModificationFeature) ef;
SequenceModificationVocabulary modType = mf.getModificationType();
if (modType != null)
{
Set<String> terms = modType.getTerm();
if (terms != null && !terms.isEmpty())
{
String orig = terms.iterator().next();
String term = orig.toLowerCase();
String s = symbolMapping.containsKey(term) ? symbolMapping.get(term) : orig;
Glyph.State state = factory.createGlyphState();
state.setValue(s);
SequenceLocation loc = mf.getFeatureLocation();
if (locMapping.containsKey(term))
{
state.setVariable(locMapping.get(term));
}
if (loc instanceof SequenceSite)
{
SequenceSite ss = (SequenceSite) loc;
if (ss.getSequencePosition() > 0)
{
state.setVariable(
(state.getVariable() != null ? state.getVariable() : "") +
ss.getSequencePosition());
}
}
return state;
}
}
}
// Binding features are ignored
return null;
}
|
java
|
public Glyph.State createStateVar(EntityFeature ef, ObjectFactory factory)
{
if (ef instanceof FragmentFeature)
{
FragmentFeature ff = (FragmentFeature) ef;
SequenceLocation loc = ff.getFeatureLocation();
if (loc instanceof SequenceInterval)
{
SequenceInterval si = (SequenceInterval) loc;
SequenceSite begin = si.getSequenceIntervalBegin();
SequenceSite end = si.getSequenceIntervalEnd();
if (begin != null && end != null)
{
Glyph.State state = factory.createGlyphState();
state.setValue("x[" + begin.getSequencePosition() + " - " +
end.getSequencePosition() + "]");
return state;
}
}
}
else if (ef instanceof ModificationFeature)
{
ModificationFeature mf = (ModificationFeature) ef;
SequenceModificationVocabulary modType = mf.getModificationType();
if (modType != null)
{
Set<String> terms = modType.getTerm();
if (terms != null && !terms.isEmpty())
{
String orig = terms.iterator().next();
String term = orig.toLowerCase();
String s = symbolMapping.containsKey(term) ? symbolMapping.get(term) : orig;
Glyph.State state = factory.createGlyphState();
state.setValue(s);
SequenceLocation loc = mf.getFeatureLocation();
if (locMapping.containsKey(term))
{
state.setVariable(locMapping.get(term));
}
if (loc instanceof SequenceSite)
{
SequenceSite ss = (SequenceSite) loc;
if (ss.getSequencePosition() > 0)
{
state.setVariable(
(state.getVariable() != null ? state.getVariable() : "") +
ss.getSequencePosition());
}
}
return state;
}
}
}
// Binding features are ignored
return null;
}
|
[
"public",
"Glyph",
".",
"State",
"createStateVar",
"(",
"EntityFeature",
"ef",
",",
"ObjectFactory",
"factory",
")",
"{",
"if",
"(",
"ef",
"instanceof",
"FragmentFeature",
")",
"{",
"FragmentFeature",
"ff",
"=",
"(",
"FragmentFeature",
")",
"ef",
";",
"SequenceLocation",
"loc",
"=",
"ff",
".",
"getFeatureLocation",
"(",
")",
";",
"if",
"(",
"loc",
"instanceof",
"SequenceInterval",
")",
"{",
"SequenceInterval",
"si",
"=",
"(",
"SequenceInterval",
")",
"loc",
";",
"SequenceSite",
"begin",
"=",
"si",
".",
"getSequenceIntervalBegin",
"(",
")",
";",
"SequenceSite",
"end",
"=",
"si",
".",
"getSequenceIntervalEnd",
"(",
")",
";",
"if",
"(",
"begin",
"!=",
"null",
"&&",
"end",
"!=",
"null",
")",
"{",
"Glyph",
".",
"State",
"state",
"=",
"factory",
".",
"createGlyphState",
"(",
")",
";",
"state",
".",
"setValue",
"(",
"\"x[\"",
"+",
"begin",
".",
"getSequencePosition",
"(",
")",
"+",
"\" - \"",
"+",
"end",
".",
"getSequencePosition",
"(",
")",
"+",
"\"]\"",
")",
";",
"return",
"state",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"ef",
"instanceof",
"ModificationFeature",
")",
"{",
"ModificationFeature",
"mf",
"=",
"(",
"ModificationFeature",
")",
"ef",
";",
"SequenceModificationVocabulary",
"modType",
"=",
"mf",
".",
"getModificationType",
"(",
")",
";",
"if",
"(",
"modType",
"!=",
"null",
")",
"{",
"Set",
"<",
"String",
">",
"terms",
"=",
"modType",
".",
"getTerm",
"(",
")",
";",
"if",
"(",
"terms",
"!=",
"null",
"&&",
"!",
"terms",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"orig",
"=",
"terms",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"String",
"term",
"=",
"orig",
".",
"toLowerCase",
"(",
")",
";",
"String",
"s",
"=",
"symbolMapping",
".",
"containsKey",
"(",
"term",
")",
"?",
"symbolMapping",
".",
"get",
"(",
"term",
")",
":",
"orig",
";",
"Glyph",
".",
"State",
"state",
"=",
"factory",
".",
"createGlyphState",
"(",
")",
";",
"state",
".",
"setValue",
"(",
"s",
")",
";",
"SequenceLocation",
"loc",
"=",
"mf",
".",
"getFeatureLocation",
"(",
")",
";",
"if",
"(",
"locMapping",
".",
"containsKey",
"(",
"term",
")",
")",
"{",
"state",
".",
"setVariable",
"(",
"locMapping",
".",
"get",
"(",
"term",
")",
")",
";",
"}",
"if",
"(",
"loc",
"instanceof",
"SequenceSite",
")",
"{",
"SequenceSite",
"ss",
"=",
"(",
"SequenceSite",
")",
"loc",
";",
"if",
"(",
"ss",
".",
"getSequencePosition",
"(",
")",
">",
"0",
")",
"{",
"state",
".",
"setVariable",
"(",
"(",
"state",
".",
"getVariable",
"(",
")",
"!=",
"null",
"?",
"state",
".",
"getVariable",
"(",
")",
":",
"\"\"",
")",
"+",
"ss",
".",
"getSequencePosition",
"(",
")",
")",
";",
"}",
"}",
"return",
"state",
";",
"}",
"}",
"}",
"// Binding features are ignored",
"return",
"null",
";",
"}"
] |
Creates State to represent the entity feature.
@param ef feature to represent
@param factory factory that can create the State class
@return State representing the feature
|
[
"Creates",
"State",
"to",
"represent",
"the",
"entity",
"feature",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/CommonFeatureStringGenerator.java#L38-L101
|
11,021
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/MappedConst.java
|
MappedConst.translate
|
protected int[] translate(int[] outer)
{
int[] t = new int[inds.length];
for (int i = 0; i < t.length; i++)
{
t[i] = outer[inds[i]];
}
return t;
}
|
java
|
protected int[] translate(int[] outer)
{
int[] t = new int[inds.length];
for (int i = 0; i < t.length; i++)
{
t[i] = outer[inds[i]];
}
return t;
}
|
[
"protected",
"int",
"[",
"]",
"translate",
"(",
"int",
"[",
"]",
"outer",
")",
"{",
"int",
"[",
"]",
"t",
"=",
"new",
"int",
"[",
"inds",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t",
".",
"length",
";",
"i",
"++",
")",
"{",
"t",
"[",
"i",
"]",
"=",
"outer",
"[",
"inds",
"[",
"i",
"]",
"]",
";",
"}",
"return",
"t",
";",
"}"
] |
This methods translates the indexes of outer constraint, to this inner constraint.
@param outer mapped indices for the outer constraints
@return translated indices
|
[
"This",
"methods",
"translates",
"the",
"indexes",
"of",
"outer",
"constraint",
"to",
"this",
"inner",
"constraint",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/MappedConst.java#L73-L81
|
11,022
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/MappedConst.java
|
MappedConst.generate
|
@Override
public Collection<BioPAXElement> generate(Match match, int... outer)
{
return constr.generate(match, translate(outer));
}
|
java
|
@Override
public Collection<BioPAXElement> generate(Match match, int... outer)
{
return constr.generate(match, translate(outer));
}
|
[
"@",
"Override",
"public",
"Collection",
"<",
"BioPAXElement",
">",
"generate",
"(",
"Match",
"match",
",",
"int",
"...",
"outer",
")",
"{",
"return",
"constr",
".",
"generate",
"(",
"match",
",",
"translate",
"(",
"outer",
")",
")",
";",
"}"
] |
Calls generate method of the constraint with index translation.
@param match current pattern match
@param outer untranslated indices
@return generated satisfying elements
|
[
"Calls",
"generate",
"method",
"of",
"the",
"constraint",
"with",
"index",
"translation",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/MappedConst.java#L98-L102
|
11,023
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/PathConstraint.java
|
PathConstraint.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
BioPAXElement ele0 = match.get(ind[0]);
BioPAXElement ele1 = match.get(ind[1]);
if (ele1 == null) return false;
Set vals = pa.getValueFromBean(ele0);
return vals.contains(ele1);
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
BioPAXElement ele0 = match.get(ind[0]);
BioPAXElement ele1 = match.get(ind[1]);
if (ele1 == null) return false;
Set vals = pa.getValueFromBean(ele0);
return vals.contains(ele1);
}
|
[
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"BioPAXElement",
"ele0",
"=",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
"]",
")",
";",
"BioPAXElement",
"ele1",
"=",
"match",
".",
"get",
"(",
"ind",
"[",
"1",
"]",
")",
";",
"if",
"(",
"ele1",
"==",
"null",
")",
"return",
"false",
";",
"Set",
"vals",
"=",
"pa",
".",
"getValueFromBean",
"(",
"ele0",
")",
";",
"return",
"vals",
".",
"contains",
"(",
"ele1",
")",
";",
"}"
] |
Checks if the PathAccessor is generating the second mapped element.
@param match current pattern match
@param ind mapped indices
@return true if second element is generated by PathAccessor
|
[
"Checks",
"if",
"the",
"PathAccessor",
"is",
"generating",
"the",
"second",
"mapped",
"element",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/PathConstraint.java#L41-L51
|
11,024
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/PathConstraint.java
|
PathConstraint.generate
|
@Override
public Collection<BioPAXElement> generate(Match match, int ... ind)
{
BioPAXElement ele0 = match.get(ind[0]);
if (ele0 == null)
throw new RuntimeException("Constraint cannot generate based on null value");
Set vals = pa.getValueFromBean(ele0);
List<BioPAXElement> list = new ArrayList<BioPAXElement>(vals.size());
for (Object o : vals)
{
assert o instanceof BioPAXElement;
list.add((BioPAXElement) o);
}
return list;
}
|
java
|
@Override
public Collection<BioPAXElement> generate(Match match, int ... ind)
{
BioPAXElement ele0 = match.get(ind[0]);
if (ele0 == null)
throw new RuntimeException("Constraint cannot generate based on null value");
Set vals = pa.getValueFromBean(ele0);
List<BioPAXElement> list = new ArrayList<BioPAXElement>(vals.size());
for (Object o : vals)
{
assert o instanceof BioPAXElement;
list.add((BioPAXElement) o);
}
return list;
}
|
[
"@",
"Override",
"public",
"Collection",
"<",
"BioPAXElement",
">",
"generate",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"BioPAXElement",
"ele0",
"=",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
"]",
")",
";",
"if",
"(",
"ele0",
"==",
"null",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Constraint cannot generate based on null value\"",
")",
";",
"Set",
"vals",
"=",
"pa",
".",
"getValueFromBean",
"(",
"ele0",
")",
";",
"List",
"<",
"BioPAXElement",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"BioPAXElement",
">",
"(",
"vals",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Object",
"o",
":",
"vals",
")",
"{",
"assert",
"o",
"instanceof",
"BioPAXElement",
";",
"list",
".",
"add",
"(",
"(",
"BioPAXElement",
")",
"o",
")",
";",
"}",
"return",
"list",
";",
"}"
] |
Uses the encapsulated PAthAccessor to generate satisfying elements.
@param match current pattern match
@param ind mapped indices
@return generated elements
|
[
"Uses",
"the",
"encapsulated",
"PAthAccessor",
"to",
"generate",
"satisfying",
"elements",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/PathConstraint.java#L69-L86
|
11,025
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Equality.java
|
Equality.satisfies
|
@Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 2;
return (match.get(ind[0]) == match.get(ind[1])) == equals;
}
|
java
|
@Override
public boolean satisfies(Match match, int... ind)
{
assert ind.length == 2;
return (match.get(ind[0]) == match.get(ind[1])) == equals;
}
|
[
"@",
"Override",
"public",
"boolean",
"satisfies",
"(",
"Match",
"match",
",",
"int",
"...",
"ind",
")",
"{",
"assert",
"ind",
".",
"length",
"==",
"2",
";",
"return",
"(",
"match",
".",
"get",
"(",
"ind",
"[",
"0",
"]",
")",
"==",
"match",
".",
"get",
"(",
"ind",
"[",
"1",
"]",
")",
")",
"==",
"equals",
";",
"}"
] |
Checks if the two elements are identical or not identical as desired.
@param match current pattern match
@param ind mapped indices
@return true if identity checks equals the desired value
|
[
"Checks",
"if",
"the",
"two",
"elements",
"are",
"identical",
"or",
"not",
"identical",
"as",
"desired",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/Equality.java#L35-L41
|
11,026
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/StringFieldFilter.java
|
StringFieldFilter.addValidValue
|
protected void addValidValue(String value)
{
if(value!=null && !value.isEmpty())
validValues.add(value.toLowerCase());
}
|
java
|
protected void addValidValue(String value)
{
if(value!=null && !value.isEmpty())
validValues.add(value.toLowerCase());
}
|
[
"protected",
"void",
"addValidValue",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isEmpty",
"(",
")",
")",
"validValues",
".",
"add",
"(",
"value",
".",
"toLowerCase",
"(",
")",
")",
";",
"}"
] |
Adds the given valid value to the set of valid values.
@param value a valid value
|
[
"Adds",
"the",
"given",
"valid",
"value",
"to",
"the",
"set",
"of",
"valid",
"values",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/StringFieldFilter.java#L95-L99
|
11,027
|
BioPAX/Paxtools
|
paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/StringFieldFilter.java
|
StringFieldFilter.okToTraverse
|
@Override
public boolean okToTraverse(Level3Element ele)
{
if(validValues.isEmpty())
return true;
boolean empty = true;
boolean objectRelevant = false;
for (PathAccessor acc : accessors.keySet())
{
Class clazz = accessors.get(acc);
if (!clazz.isAssignableFrom(ele.getClass())) continue;
objectRelevant = true;
Set values = acc.getValueFromBean(ele);
if (empty) empty = values.isEmpty();
for (Object o : values)
//ignoring capitalization (case)
if (validValues.contains(o.toString().toLowerCase()))
return true;
}
return !objectRelevant || (empty && isEmptyOK());
}
|
java
|
@Override
public boolean okToTraverse(Level3Element ele)
{
if(validValues.isEmpty())
return true;
boolean empty = true;
boolean objectRelevant = false;
for (PathAccessor acc : accessors.keySet())
{
Class clazz = accessors.get(acc);
if (!clazz.isAssignableFrom(ele.getClass())) continue;
objectRelevant = true;
Set values = acc.getValueFromBean(ele);
if (empty) empty = values.isEmpty();
for (Object o : values)
//ignoring capitalization (case)
if (validValues.contains(o.toString().toLowerCase()))
return true;
}
return !objectRelevant || (empty && isEmptyOK());
}
|
[
"@",
"Override",
"public",
"boolean",
"okToTraverse",
"(",
"Level3Element",
"ele",
")",
"{",
"if",
"(",
"validValues",
".",
"isEmpty",
"(",
")",
")",
"return",
"true",
";",
"boolean",
"empty",
"=",
"true",
";",
"boolean",
"objectRelevant",
"=",
"false",
";",
"for",
"(",
"PathAccessor",
"acc",
":",
"accessors",
".",
"keySet",
"(",
")",
")",
"{",
"Class",
"clazz",
"=",
"accessors",
".",
"get",
"(",
"acc",
")",
";",
"if",
"(",
"!",
"clazz",
".",
"isAssignableFrom",
"(",
"ele",
".",
"getClass",
"(",
")",
")",
")",
"continue",
";",
"objectRelevant",
"=",
"true",
";",
"Set",
"values",
"=",
"acc",
".",
"getValueFromBean",
"(",
"ele",
")",
";",
"if",
"(",
"empty",
")",
"empty",
"=",
"values",
".",
"isEmpty",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"values",
")",
"//ignoring capitalization (case)",
"if",
"(",
"validValues",
".",
"contains",
"(",
"o",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
")",
"return",
"true",
";",
"}",
"return",
"!",
"objectRelevant",
"||",
"(",
"empty",
"&&",
"isEmptyOK",
"(",
")",
")",
";",
"}"
] |
Checks if the related values of the object are among valid values. Returns true if none of
the accessors is applicable to the given object.
@param ele level 3 element to check
@return true if ok to traverse
|
[
"Checks",
"if",
"the",
"related",
"values",
"of",
"the",
"object",
"are",
"among",
"valid",
"values",
".",
"Returns",
"true",
"if",
"none",
"of",
"the",
"accessors",
"is",
"applicable",
"to",
"the",
"given",
"object",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/wrapperL3/StringFieldFilter.java#L107-L134
|
11,028
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/util/ChemicalNameNormalizer.java
|
ChemicalNameNormalizer.getName
|
public String getName(SmallMoleculeReference smr)
{
if (map.containsKey(smr)) return map.get(smr).getDisplayName();
else return smr.getDisplayName();
}
|
java
|
public String getName(SmallMoleculeReference smr)
{
if (map.containsKey(smr)) return map.get(smr).getDisplayName();
else return smr.getDisplayName();
}
|
[
"public",
"String",
"getName",
"(",
"SmallMoleculeReference",
"smr",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"smr",
")",
")",
"return",
"map",
".",
"get",
"(",
"smr",
")",
".",
"getDisplayName",
"(",
")",
";",
"else",
"return",
"smr",
".",
"getDisplayName",
"(",
")",
";",
"}"
] |
Gets the standard name of the small molecule.
@param smr the molecule to check standard name
@return standard name
|
[
"Gets",
"the",
"standard",
"name",
"of",
"the",
"small",
"molecule",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/ChemicalNameNormalizer.java#L41-L45
|
11,029
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ActivityModificationChangeConstraint.java
|
ActivityModificationChangeConstraint.extractModifNames
|
protected Map<EntityReference, Set<String>> extractModifNames(Map mfMap)
{
Map<EntityReference, Set<String>> map = new HashMap<EntityReference, Set<String>>();
for (Object o : mfMap.keySet())
{
EntityReference er = (EntityReference) o;
map.put(er, extractModifNames((Set) mfMap.get(er)));
}
return map;
}
|
java
|
protected Map<EntityReference, Set<String>> extractModifNames(Map mfMap)
{
Map<EntityReference, Set<String>> map = new HashMap<EntityReference, Set<String>>();
for (Object o : mfMap.keySet())
{
EntityReference er = (EntityReference) o;
map.put(er, extractModifNames((Set) mfMap.get(er)));
}
return map;
}
|
[
"protected",
"Map",
"<",
"EntityReference",
",",
"Set",
"<",
"String",
">",
">",
"extractModifNames",
"(",
"Map",
"mfMap",
")",
"{",
"Map",
"<",
"EntityReference",
",",
"Set",
"<",
"String",
">",
">",
"map",
"=",
"new",
"HashMap",
"<",
"EntityReference",
",",
"Set",
"<",
"String",
">",
">",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"mfMap",
".",
"keySet",
"(",
")",
")",
"{",
"EntityReference",
"er",
"=",
"(",
"EntityReference",
")",
"o",
";",
"map",
".",
"put",
"(",
"er",
",",
"extractModifNames",
"(",
"(",
"Set",
")",
"mfMap",
".",
"get",
"(",
"er",
")",
")",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
Extracts the modification terms from the moficiation features.
@param mfMap map for the features
@return map from EntityReference to the set of the extracted terms
|
[
"Extracts",
"the",
"modification",
"terms",
"from",
"the",
"moficiation",
"features",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ActivityModificationChangeConstraint.java#L174-L185
|
11,030
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ActivityModificationChangeConstraint.java
|
ActivityModificationChangeConstraint.extractModifNames
|
protected Set<String> extractModifNames(Set mfSet)
{
Set<String> set = new HashSet<String>();
for (Object o : mfSet)
{
ModificationFeature mf = (ModificationFeature) o;
if (mf.getModificationType() != null && !mf.getModificationType().getTerm().isEmpty())
{
set.add(mf.getModificationType().getTerm().iterator().next());
}
}
return set;
}
|
java
|
protected Set<String> extractModifNames(Set mfSet)
{
Set<String> set = new HashSet<String>();
for (Object o : mfSet)
{
ModificationFeature mf = (ModificationFeature) o;
if (mf.getModificationType() != null && !mf.getModificationType().getTerm().isEmpty())
{
set.add(mf.getModificationType().getTerm().iterator().next());
}
}
return set;
}
|
[
"protected",
"Set",
"<",
"String",
">",
"extractModifNames",
"(",
"Set",
"mfSet",
")",
"{",
"Set",
"<",
"String",
">",
"set",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":",
"mfSet",
")",
"{",
"ModificationFeature",
"mf",
"=",
"(",
"ModificationFeature",
")",
"o",
";",
"if",
"(",
"mf",
".",
"getModificationType",
"(",
")",
"!=",
"null",
"&&",
"!",
"mf",
".",
"getModificationType",
"(",
")",
".",
"getTerm",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"set",
".",
"add",
"(",
"mf",
".",
"getModificationType",
"(",
")",
".",
"getTerm",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
")",
";",
"}",
"}",
"return",
"set",
";",
"}"
] |
Extracts terms of the modification features.
@param mfSet set of modification features
@return set of extracted terms
|
[
"Extracts",
"terms",
"of",
"the",
"modification",
"features",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ActivityModificationChangeConstraint.java#L192-L205
|
11,031
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/util/BiopaxSafeSet.java
|
BiopaxSafeSet.get
|
public E get(String uri) {
if(map==empty)
return null;
synchronized (map) {
return map.get(uri);
}
}
|
java
|
public E get(String uri) {
if(map==empty)
return null;
synchronized (map) {
return map.get(uri);
}
}
|
[
"public",
"E",
"get",
"(",
"String",
"uri",
")",
"{",
"if",
"(",
"map",
"==",
"empty",
")",
"return",
"null",
";",
"synchronized",
"(",
"map",
")",
"{",
"return",
"map",
".",
"get",
"(",
"uri",
")",
";",
"}",
"}"
] |
Gets a BioPAX element by URI.
@param uri absolute URI of a BioPAX individual
@return BioPAX object or null
|
[
"Gets",
"a",
"BioPAX",
"element",
"by",
"URI",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/util/BiopaxSafeSet.java#L90-L98
|
11,032
|
BioPAX/Paxtools
|
paxtools-core/src/main/java/org/biopax/paxtools/impl/ModelImpl.java
|
ModelImpl.replace
|
public synchronized void replace(final BioPAXElement existing, final BioPAXElement replacement)
{
ModelUtils.replace(this, Collections.singletonMap(existing, replacement));
remove(existing);
if(replacement != null)
add(replacement);
}
|
java
|
public synchronized void replace(final BioPAXElement existing, final BioPAXElement replacement)
{
ModelUtils.replace(this, Collections.singletonMap(existing, replacement));
remove(existing);
if(replacement != null)
add(replacement);
}
|
[
"public",
"synchronized",
"void",
"replace",
"(",
"final",
"BioPAXElement",
"existing",
",",
"final",
"BioPAXElement",
"replacement",
")",
"{",
"ModelUtils",
".",
"replace",
"(",
"this",
",",
"Collections",
".",
"singletonMap",
"(",
"existing",
",",
"replacement",
")",
")",
";",
"remove",
"(",
"existing",
")",
";",
"if",
"(",
"replacement",
"!=",
"null",
")",
"add",
"(",
"replacement",
")",
";",
"}"
] |
It does not automatically replace or clean up the old
element's object properties, therefore, some child
elements may become "dangling" if they were used by
the replaced element only.
Can also clear object properties (- replace with null).
|
[
"It",
"does",
"not",
"automatically",
"replace",
"or",
"clean",
"up",
"the",
"old",
"element",
"s",
"object",
"properties",
"therefore",
"some",
"child",
"elements",
"may",
"become",
"dangling",
"if",
"they",
"were",
"used",
"by",
"the",
"replaced",
"element",
"only",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/impl/ModelImpl.java#L294-L300
|
11,033
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java
|
Dialog.getMaxMemory
|
private int getMaxMemory()
{
int total = 0;
for (MemoryPoolMXBean mpBean: ManagementFactory.getMemoryPoolMXBeans())
{
if (mpBean.getType() == MemoryType.HEAP)
{
total += mpBean.getUsage().getMax() >> 20;
}
}
return total;
}
|
java
|
private int getMaxMemory()
{
int total = 0;
for (MemoryPoolMXBean mpBean: ManagementFactory.getMemoryPoolMXBeans())
{
if (mpBean.getType() == MemoryType.HEAP)
{
total += mpBean.getUsage().getMax() >> 20;
}
}
return total;
}
|
[
"private",
"int",
"getMaxMemory",
"(",
")",
"{",
"int",
"total",
"=",
"0",
";",
"for",
"(",
"MemoryPoolMXBean",
"mpBean",
":",
"ManagementFactory",
".",
"getMemoryPoolMXBeans",
"(",
")",
")",
"{",
"if",
"(",
"mpBean",
".",
"getType",
"(",
")",
"==",
"MemoryType",
".",
"HEAP",
")",
"{",
"total",
"+=",
"mpBean",
".",
"getUsage",
"(",
")",
".",
"getMax",
"(",
")",
">>",
"20",
";",
"}",
"}",
"return",
"total",
";",
"}"
] |
Gets the maximum memory heap size for the application. This size can be modified by passing
-Xmx option to the virtual machine, like "java -Xmx5G MyClass.java".
@return maximum memory heap size in megabytes
|
[
"Gets",
"the",
"maximum",
"memory",
"heap",
"size",
"for",
"the",
"application",
".",
"This",
"size",
"can",
"be",
"modified",
"by",
"passing",
"-",
"Xmx",
"option",
"to",
"the",
"virtual",
"machine",
"like",
"java",
"-",
"Xmx5G",
"MyClass",
".",
"java",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java#L337-L348
|
11,034
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java
|
Dialog.actionPerformed
|
@Override
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == pcRadio ||
e.getSource() == customFileRadio ||
e.getSource() == customURLRadio)
{
pcCombo.setEnabled(pcRadio.isSelected());
modelField.setEnabled(customFileRadio.isSelected());
loadButton.setEnabled(customFileRadio.isSelected());
urlField.setEnabled(customURLRadio.isSelected());
}
else if (e.getSource() == loadButton)
{
String current = modelField.getText();
String initial = current.trim().length() > 0 ? current : ".";
JFileChooser fc = new JFileChooser(initial);
fc.setFileFilter(new FileNameExtensionFilter("BioPAX file (*.owl)", "owl"));
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
modelField.setText(file.getPath());
}
}
else if (e.getSource() == patternCombo)
{
Miner m = (Miner) patternCombo.getSelectedItem();
descArea.setText(m.getDescription());
// Update output file name
String text = outputField.getText();
if (text.contains("/")) text = text.substring(0, text.lastIndexOf("/") + 1);
else text = "";
text += m.getName() + ".txt";
outputField.setText(text);
}
else if (e.getSource() == runButton)
{
run();
}
checkRunButton();
}
|
java
|
@Override
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == pcRadio ||
e.getSource() == customFileRadio ||
e.getSource() == customURLRadio)
{
pcCombo.setEnabled(pcRadio.isSelected());
modelField.setEnabled(customFileRadio.isSelected());
loadButton.setEnabled(customFileRadio.isSelected());
urlField.setEnabled(customURLRadio.isSelected());
}
else if (e.getSource() == loadButton)
{
String current = modelField.getText();
String initial = current.trim().length() > 0 ? current : ".";
JFileChooser fc = new JFileChooser(initial);
fc.setFileFilter(new FileNameExtensionFilter("BioPAX file (*.owl)", "owl"));
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
{
File file = fc.getSelectedFile();
modelField.setText(file.getPath());
}
}
else if (e.getSource() == patternCombo)
{
Miner m = (Miner) patternCombo.getSelectedItem();
descArea.setText(m.getDescription());
// Update output file name
String text = outputField.getText();
if (text.contains("/")) text = text.substring(0, text.lastIndexOf("/") + 1);
else text = "";
text += m.getName() + ".txt";
outputField.setText(text);
}
else if (e.getSource() == runButton)
{
run();
}
checkRunButton();
}
|
[
"@",
"Override",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"pcRadio",
"||",
"e",
".",
"getSource",
"(",
")",
"==",
"customFileRadio",
"||",
"e",
".",
"getSource",
"(",
")",
"==",
"customURLRadio",
")",
"{",
"pcCombo",
".",
"setEnabled",
"(",
"pcRadio",
".",
"isSelected",
"(",
")",
")",
";",
"modelField",
".",
"setEnabled",
"(",
"customFileRadio",
".",
"isSelected",
"(",
")",
")",
";",
"loadButton",
".",
"setEnabled",
"(",
"customFileRadio",
".",
"isSelected",
"(",
")",
")",
";",
"urlField",
".",
"setEnabled",
"(",
"customURLRadio",
".",
"isSelected",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"loadButton",
")",
"{",
"String",
"current",
"=",
"modelField",
".",
"getText",
"(",
")",
";",
"String",
"initial",
"=",
"current",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
"?",
"current",
":",
"\".\"",
";",
"JFileChooser",
"fc",
"=",
"new",
"JFileChooser",
"(",
"initial",
")",
";",
"fc",
".",
"setFileFilter",
"(",
"new",
"FileNameExtensionFilter",
"(",
"\"BioPAX file (*.owl)\"",
",",
"\"owl\"",
")",
")",
";",
"if",
"(",
"fc",
".",
"showOpenDialog",
"(",
"this",
")",
"==",
"JFileChooser",
".",
"APPROVE_OPTION",
")",
"{",
"File",
"file",
"=",
"fc",
".",
"getSelectedFile",
"(",
")",
";",
"modelField",
".",
"setText",
"(",
"file",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"patternCombo",
")",
"{",
"Miner",
"m",
"=",
"(",
"Miner",
")",
"patternCombo",
".",
"getSelectedItem",
"(",
")",
";",
"descArea",
".",
"setText",
"(",
"m",
".",
"getDescription",
"(",
")",
")",
";",
"// Update output file name",
"String",
"text",
"=",
"outputField",
".",
"getText",
"(",
")",
";",
"if",
"(",
"text",
".",
"contains",
"(",
"\"/\"",
")",
")",
"text",
"=",
"text",
".",
"substring",
"(",
"0",
",",
"text",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
"+",
"1",
")",
";",
"else",
"text",
"=",
"\"\"",
";",
"text",
"+=",
"m",
".",
"getName",
"(",
")",
"+",
"\".txt\"",
";",
"outputField",
".",
"setText",
"(",
"text",
")",
";",
"}",
"else",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"runButton",
")",
"{",
"run",
"(",
")",
";",
"}",
"checkRunButton",
"(",
")",
";",
"}"
] |
Performs interactive operations.
@param e current event
|
[
"Performs",
"interactive",
"operations",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java#L354-L397
|
11,035
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java
|
Dialog.checkRunButton
|
private void checkRunButton()
{
runButton.setEnabled((pcRadio.isSelected() ||
(customFileRadio.isSelected() && !modelField.getText().trim().isEmpty()) ||
(customURLRadio.isSelected() && !urlField.getText().trim().isEmpty()))
&& !outputField.getText().trim().isEmpty());
}
|
java
|
private void checkRunButton()
{
runButton.setEnabled((pcRadio.isSelected() ||
(customFileRadio.isSelected() && !modelField.getText().trim().isEmpty()) ||
(customURLRadio.isSelected() && !urlField.getText().trim().isEmpty()))
&& !outputField.getText().trim().isEmpty());
}
|
[
"private",
"void",
"checkRunButton",
"(",
")",
"{",
"runButton",
".",
"setEnabled",
"(",
"(",
"pcRadio",
".",
"isSelected",
"(",
")",
"||",
"(",
"customFileRadio",
".",
"isSelected",
"(",
")",
"&&",
"!",
"modelField",
".",
"getText",
"(",
")",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"customURLRadio",
".",
"isSelected",
"(",
")",
"&&",
"!",
"urlField",
".",
"getText",
"(",
")",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
")",
"&&",
"!",
"outputField",
".",
"getText",
"(",
")",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
";",
"}"
] |
Checks if the run button should be enabled.
|
[
"Checks",
"if",
"the",
"run",
"button",
"should",
"be",
"enabled",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java#L402-L408
|
11,036
|
BioPAX/Paxtools
|
pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java
|
Dialog.getAvailablePatterns
|
private Object[] getAvailablePatterns()
{
List<Miner> minerList = new ArrayList<Miner>();
if (miners != null && miners.length > 0)
{
minerList.addAll(Arrays.asList(miners));
}
else
{
minerList.add(new DirectedRelationMiner());
minerList.add(new ControlsStateChangeOfMiner());
minerList.add(new CSCOButIsParticipantMiner());
minerList.add(new CSCOBothControllerAndParticipantMiner());
minerList.add(new CSCOThroughControllingSmallMoleculeMiner());
minerList.add(new CSCOThroughBindingSmallMoleculeMiner());
minerList.add(new ControlsStateChangeDetailedMiner());
minerList.add(new ControlsPhosphorylationMiner());
minerList.add(new ControlsTransportMiner());
minerList.add(new ControlsExpressionMiner());
minerList.add(new ControlsExpressionWithConvMiner());
minerList.add(new CSCOThroughDegradationMiner());
minerList.add(new ControlsDegradationIndirectMiner());
minerList.add(new ConsumptionControlledByMiner());
minerList.add(new ControlsProductionOfMiner());
minerList.add(new CatalysisPrecedesMiner());
minerList.add(new ChemicalAffectsThroughBindingMiner());
minerList.add(new ChemicalAffectsThroughControlMiner());
minerList.add(new ControlsTransportOfChemicalMiner());
minerList.add(new InComplexWithMiner());
minerList.add(new InteractsWithMiner());
minerList.add(new NeighborOfMiner());
minerList.add(new ReactsWithMiner());
minerList.add(new UsedToProduceMiner());
minerList.add(new RelatedGenesOfInteractionsMiner());
minerList.add(new UbiquitousIDMiner());
}
for (Miner miner : minerList)
{
if (miner instanceof MinerAdapter) ((MinerAdapter) miner).setBlacklist(blacklist);
}
return minerList.toArray(new Object[minerList.size()]);
}
|
java
|
private Object[] getAvailablePatterns()
{
List<Miner> minerList = new ArrayList<Miner>();
if (miners != null && miners.length > 0)
{
minerList.addAll(Arrays.asList(miners));
}
else
{
minerList.add(new DirectedRelationMiner());
minerList.add(new ControlsStateChangeOfMiner());
minerList.add(new CSCOButIsParticipantMiner());
minerList.add(new CSCOBothControllerAndParticipantMiner());
minerList.add(new CSCOThroughControllingSmallMoleculeMiner());
minerList.add(new CSCOThroughBindingSmallMoleculeMiner());
minerList.add(new ControlsStateChangeDetailedMiner());
minerList.add(new ControlsPhosphorylationMiner());
minerList.add(new ControlsTransportMiner());
minerList.add(new ControlsExpressionMiner());
minerList.add(new ControlsExpressionWithConvMiner());
minerList.add(new CSCOThroughDegradationMiner());
minerList.add(new ControlsDegradationIndirectMiner());
minerList.add(new ConsumptionControlledByMiner());
minerList.add(new ControlsProductionOfMiner());
minerList.add(new CatalysisPrecedesMiner());
minerList.add(new ChemicalAffectsThroughBindingMiner());
minerList.add(new ChemicalAffectsThroughControlMiner());
minerList.add(new ControlsTransportOfChemicalMiner());
minerList.add(new InComplexWithMiner());
minerList.add(new InteractsWithMiner());
minerList.add(new NeighborOfMiner());
minerList.add(new ReactsWithMiner());
minerList.add(new UsedToProduceMiner());
minerList.add(new RelatedGenesOfInteractionsMiner());
minerList.add(new UbiquitousIDMiner());
}
for (Miner miner : minerList)
{
if (miner instanceof MinerAdapter) ((MinerAdapter) miner).setBlacklist(blacklist);
}
return minerList.toArray(new Object[minerList.size()]);
}
|
[
"private",
"Object",
"[",
"]",
"getAvailablePatterns",
"(",
")",
"{",
"List",
"<",
"Miner",
">",
"minerList",
"=",
"new",
"ArrayList",
"<",
"Miner",
">",
"(",
")",
";",
"if",
"(",
"miners",
"!=",
"null",
"&&",
"miners",
".",
"length",
">",
"0",
")",
"{",
"minerList",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"miners",
")",
")",
";",
"}",
"else",
"{",
"minerList",
".",
"add",
"(",
"new",
"DirectedRelationMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsStateChangeOfMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CSCOButIsParticipantMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CSCOBothControllerAndParticipantMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CSCOThroughControllingSmallMoleculeMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CSCOThroughBindingSmallMoleculeMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsStateChangeDetailedMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsPhosphorylationMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsTransportMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsExpressionMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsExpressionWithConvMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CSCOThroughDegradationMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsDegradationIndirectMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ConsumptionControlledByMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsProductionOfMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"CatalysisPrecedesMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ChemicalAffectsThroughBindingMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ChemicalAffectsThroughControlMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ControlsTransportOfChemicalMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"InComplexWithMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"InteractsWithMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"NeighborOfMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"ReactsWithMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"UsedToProduceMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"RelatedGenesOfInteractionsMiner",
"(",
")",
")",
";",
"minerList",
".",
"add",
"(",
"new",
"UbiquitousIDMiner",
"(",
")",
")",
";",
"}",
"for",
"(",
"Miner",
"miner",
":",
"minerList",
")",
"{",
"if",
"(",
"miner",
"instanceof",
"MinerAdapter",
")",
"(",
"(",
"MinerAdapter",
")",
"miner",
")",
".",
"setBlacklist",
"(",
"blacklist",
")",
";",
"}",
"return",
"minerList",
".",
"toArray",
"(",
"new",
"Object",
"[",
"minerList",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Gets the available pattern miners. First lists the parameter miners, then adds the known
miners in the package.
@return pattern miners
|
[
"Gets",
"the",
"available",
"pattern",
"miners",
".",
"First",
"lists",
"the",
"parameter",
"miners",
"then",
"adds",
"the",
"known",
"miners",
"in",
"the",
"package",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/Dialog.java#L430-L473
|
11,037
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/client/BiopaxValidatorClient.java
|
BiopaxValidatorClient.unmarshal
|
public static ValidatorResponse unmarshal(String xml) throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance("org.biopax.validator.jaxb");
Unmarshaller un = jaxbContext.createUnmarshaller();
Source src = new StreamSource(new StringReader(xml));
ValidatorResponse resp = un.unmarshal(src, ValidatorResponse.class).getValue();
return resp;
}
|
java
|
public static ValidatorResponse unmarshal(String xml) throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance("org.biopax.validator.jaxb");
Unmarshaller un = jaxbContext.createUnmarshaller();
Source src = new StreamSource(new StringReader(xml));
ValidatorResponse resp = un.unmarshal(src, ValidatorResponse.class).getValue();
return resp;
}
|
[
"public",
"static",
"ValidatorResponse",
"unmarshal",
"(",
"String",
"xml",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"jaxbContext",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"\"org.biopax.validator.jaxb\"",
")",
";",
"Unmarshaller",
"un",
"=",
"jaxbContext",
".",
"createUnmarshaller",
"(",
")",
";",
"Source",
"src",
"=",
"new",
"StreamSource",
"(",
"new",
"StringReader",
"(",
"xml",
")",
")",
";",
"ValidatorResponse",
"resp",
"=",
"un",
".",
"unmarshal",
"(",
"src",
",",
"ValidatorResponse",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"return",
"resp",
";",
"}"
] |
Converts a biopax-validator XML response to the java object.
@param xml input XML data - validation report - to import
@return validation report object
@throws JAXBException when there is an JAXB unmarshalling error
|
[
"Converts",
"a",
"biopax",
"-",
"validator",
"XML",
"response",
"to",
"the",
"java",
"object",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/client/BiopaxValidatorClient.java#L204-L210
|
11,038
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java
|
UseOfReflection.getObjectBiopaxPropertyValues
|
public static Set<? extends BioPAXElement> getObjectBiopaxPropertyValues(BioPAXElement bpe, String property) {
Set<BioPAXElement> values = new HashSet<BioPAXElement>();
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, BioPAXElement> editor
= (PropertyEditor<BioPAXElement, BioPAXElement>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return values;
}
|
java
|
public static Set<? extends BioPAXElement> getObjectBiopaxPropertyValues(BioPAXElement bpe, String property) {
Set<BioPAXElement> values = new HashSet<BioPAXElement>();
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, BioPAXElement> editor
= (PropertyEditor<BioPAXElement, BioPAXElement>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return values;
}
|
[
"public",
"static",
"Set",
"<",
"?",
"extends",
"BioPAXElement",
">",
"getObjectBiopaxPropertyValues",
"(",
"BioPAXElement",
"bpe",
",",
"String",
"property",
")",
"{",
"Set",
"<",
"BioPAXElement",
">",
"values",
"=",
"new",
"HashSet",
"<",
"BioPAXElement",
">",
"(",
")",
";",
"// get the BioPAX L3 property editors map",
"EditorMap",
"em",
"=",
"SimpleEditorMap",
".",
"L3",
";",
"// get the 'organism' biopax property editor, ",
"// if exists for this type of bpe",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"PropertyEditor",
"<",
"BioPAXElement",
",",
"BioPAXElement",
">",
"editor",
"=",
"(",
"PropertyEditor",
"<",
"BioPAXElement",
",",
"BioPAXElement",
">",
")",
"em",
".",
"getEditorForProperty",
"(",
"property",
",",
"bpe",
".",
"getModelInterface",
"(",
")",
")",
";",
"// if the biopax object does have such property, get values",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"return",
"editor",
".",
"getValueFromBean",
"(",
"bpe",
")",
";",
"}",
"else",
"return",
"values",
";",
"}"
] |
Example 1.
How to get values from an object biopax property if the type of the biopax object
is not known at runtime, and you do not want to always remember the
domain and range of the property nor write many if-else statements to
find out.
@param bpe BioPAX object
@param property BioPAX property
@return the BioPAX object property values or empty set
|
[
"Example",
"1",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java#L35-L52
|
11,039
|
BioPAX/Paxtools
|
paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java
|
UseOfReflection.getBiopaxPropertyValues
|
public static Set getBiopaxPropertyValues(BioPAXElement bpe, String property) {
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, Object> editor
= (PropertyEditor<BioPAXElement, Object>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return null;
}
|
java
|
public static Set getBiopaxPropertyValues(BioPAXElement bpe, String property) {
// get the BioPAX L3 property editors map
EditorMap em = SimpleEditorMap.L3;
// get the 'organism' biopax property editor,
// if exists for this type of bpe
@SuppressWarnings("unchecked") PropertyEditor<BioPAXElement, Object> editor
= (PropertyEditor<BioPAXElement, Object>) em
.getEditorForProperty(property, bpe.getModelInterface());
// if the biopax object does have such property, get values
if (editor != null) {
return editor.getValueFromBean(bpe);
} else
return null;
}
|
[
"public",
"static",
"Set",
"getBiopaxPropertyValues",
"(",
"BioPAXElement",
"bpe",
",",
"String",
"property",
")",
"{",
"// get the BioPAX L3 property editors map",
"EditorMap",
"em",
"=",
"SimpleEditorMap",
".",
"L3",
";",
"// get the 'organism' biopax property editor, ",
"// if exists for this type of bpe",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"PropertyEditor",
"<",
"BioPAXElement",
",",
"Object",
">",
"editor",
"=",
"(",
"PropertyEditor",
"<",
"BioPAXElement",
",",
"Object",
">",
")",
"em",
".",
"getEditorForProperty",
"(",
"property",
",",
"bpe",
".",
"getModelInterface",
"(",
")",
")",
";",
"// if the biopax object does have such property, get values",
"if",
"(",
"editor",
"!=",
"null",
")",
"{",
"return",
"editor",
".",
"getValueFromBean",
"(",
"bpe",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
Example 2.
How to get values from a biopax property if the type of the biopax object
is not known at runtime, and you do not want to always remember the
domain and range of the property nor write many if-else statements to
find out.
@param bpe BioPAX object
@param property BioPAX property
@return the BioPAX property values or null
|
[
"Example",
"2",
"."
] |
2f93afa94426bf8b5afc2e0e61cd4b269a83288d
|
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-console/src/main/java/org/biopax/paxtools/examples/UseOfReflection.java#L68-L84
|
11,040
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/authentication/impl/LogoutSuccessHandlerImpl.java
|
LogoutSuccessHandlerImpl.handle
|
@Override
public void handle(RequestContext context) throws SecurityProviderException, IOException {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), getTargetUrl());
}
|
java
|
@Override
public void handle(RequestContext context) throws SecurityProviderException, IOException {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), getTargetUrl());
}
|
[
"@",
"Override",
"public",
"void",
"handle",
"(",
"RequestContext",
"context",
")",
"throws",
"SecurityProviderException",
",",
"IOException",
"{",
"RedirectUtils",
".",
"redirect",
"(",
"context",
".",
"getRequest",
"(",
")",
",",
"context",
".",
"getResponse",
"(",
")",
",",
"getTargetUrl",
"(",
")",
")",
";",
"}"
] |
Redirects to the target URL.
@param context the request context
|
[
"Redirects",
"to",
"the",
"target",
"URL",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/authentication/impl/LogoutSuccessHandlerImpl.java#L51-L54
|
11,041
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.addEnumValue
|
public void addEnumValue(final String enumName, final String enumValue) {
for (MetadataEnum instance : enumList) {
if (instance.getName().equals(enumName) && instance.getNamespace().equals(getCurrentNamespace())) {
instance.addValue(enumValue);
return;
}
}
final MetadataEnum newEnum = new MetadataEnum(enumName);
newEnum.addValue(enumValue);
newEnum.setNamespace(getCurrentNamespace());
newEnum.setSchemaName(getCurrentSchmema());
newEnum.setPackageApi(getCurrentPackageApi());
enumList.add(newEnum);
}
|
java
|
public void addEnumValue(final String enumName, final String enumValue) {
for (MetadataEnum instance : enumList) {
if (instance.getName().equals(enumName) && instance.getNamespace().equals(getCurrentNamespace())) {
instance.addValue(enumValue);
return;
}
}
final MetadataEnum newEnum = new MetadataEnum(enumName);
newEnum.addValue(enumValue);
newEnum.setNamespace(getCurrentNamespace());
newEnum.setSchemaName(getCurrentSchmema());
newEnum.setPackageApi(getCurrentPackageApi());
enumList.add(newEnum);
}
|
[
"public",
"void",
"addEnumValue",
"(",
"final",
"String",
"enumName",
",",
"final",
"String",
"enumValue",
")",
"{",
"for",
"(",
"MetadataEnum",
"instance",
":",
"enumList",
")",
"{",
"if",
"(",
"instance",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"enumName",
")",
"&&",
"instance",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"getCurrentNamespace",
"(",
")",
")",
")",
"{",
"instance",
".",
"addValue",
"(",
"enumValue",
")",
";",
"return",
";",
"}",
"}",
"final",
"MetadataEnum",
"newEnum",
"=",
"new",
"MetadataEnum",
"(",
"enumName",
")",
";",
"newEnum",
".",
"addValue",
"(",
"enumValue",
")",
";",
"newEnum",
".",
"setNamespace",
"(",
"getCurrentNamespace",
"(",
")",
")",
";",
"newEnum",
".",
"setSchemaName",
"(",
"getCurrentSchmema",
"(",
")",
")",
";",
"newEnum",
".",
"setPackageApi",
"(",
"getCurrentPackageApi",
"(",
")",
")",
";",
"enumList",
".",
"add",
"(",
"newEnum",
")",
";",
"}"
] |
Adds a enumeration value to the specified enumeration name. If no enumeration class is found, then a new
enumeration class will be created.
@param enumName
the enumeration class name.
@param enumValue
the new enumeration value.
|
[
"Adds",
"a",
"enumeration",
"value",
"to",
"the",
"specified",
"enumeration",
"name",
".",
"If",
"no",
"enumeration",
"class",
"is",
"found",
"then",
"a",
"new",
"enumeration",
"class",
"will",
"be",
"created",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L118-L132
|
11,042
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.addGroupElement
|
public void addGroupElement(final String groupName, final MetadataElement groupElement) {
for (MetadataItem item : groupList) {
if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) {
item.getElements().add(groupElement);
return;
}
}
final MetadataItem newItem = new MetadataItem(groupName);
newItem.getElements().add(groupElement);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
groupList.add(newItem);
}
|
java
|
public void addGroupElement(final String groupName, final MetadataElement groupElement) {
for (MetadataItem item : groupList) {
if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) {
item.getElements().add(groupElement);
return;
}
}
final MetadataItem newItem = new MetadataItem(groupName);
newItem.getElements().add(groupElement);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
groupList.add(newItem);
}
|
[
"public",
"void",
"addGroupElement",
"(",
"final",
"String",
"groupName",
",",
"final",
"MetadataElement",
"groupElement",
")",
"{",
"for",
"(",
"MetadataItem",
"item",
":",
"groupList",
")",
"{",
"if",
"(",
"item",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"groupName",
")",
"&&",
"item",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"getCurrentNamespace",
"(",
")",
")",
")",
"{",
"item",
".",
"getElements",
"(",
")",
".",
"add",
"(",
"groupElement",
")",
";",
"return",
";",
"}",
"}",
"final",
"MetadataItem",
"newItem",
"=",
"new",
"MetadataItem",
"(",
"groupName",
")",
";",
"newItem",
".",
"getElements",
"(",
")",
".",
"add",
"(",
"groupElement",
")",
";",
"newItem",
".",
"setNamespace",
"(",
"getCurrentNamespace",
"(",
")",
")",
";",
"newItem",
".",
"setSchemaName",
"(",
"getCurrentSchmema",
"(",
")",
")",
";",
"newItem",
".",
"setPackageApi",
"(",
"getCurrentPackageApi",
"(",
")",
")",
";",
"newItem",
".",
"setPackageImpl",
"(",
"getCurrentPackageImpl",
"(",
")",
")",
";",
"groupList",
".",
"add",
"(",
"newItem",
")",
";",
"}"
] |
Adds a new element to the specific group element class. If no group element class is found, then a new group
element class. will be created.
@param groupName
the group class name of
@param groupElement
the new element to be added.
|
[
"Adds",
"a",
"new",
"element",
"to",
"the",
"specific",
"group",
"element",
"class",
".",
"If",
"no",
"group",
"element",
"class",
"is",
"found",
"then",
"a",
"new",
"group",
"element",
"class",
".",
"will",
"be",
"created",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L143-L158
|
11,043
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.addGroupReference
|
public void addGroupReference(final String groupName, final MetadataElement groupReference) {
groupReference.setRef(getNamespaceValue(groupReference.getRef()));
for (MetadataItem item : groupList) {
if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) {
item.getReferences().add(groupReference);
return;
}
}
final MetadataItem newItem = new MetadataItem(groupName);
newItem.getReferences().add(groupReference);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
groupList.add(newItem);
}
|
java
|
public void addGroupReference(final String groupName, final MetadataElement groupReference) {
groupReference.setRef(getNamespaceValue(groupReference.getRef()));
for (MetadataItem item : groupList) {
if (item.getName().equals(groupName) && item.getNamespace().equals(getCurrentNamespace())) {
item.getReferences().add(groupReference);
return;
}
}
final MetadataItem newItem = new MetadataItem(groupName);
newItem.getReferences().add(groupReference);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
groupList.add(newItem);
}
|
[
"public",
"void",
"addGroupReference",
"(",
"final",
"String",
"groupName",
",",
"final",
"MetadataElement",
"groupReference",
")",
"{",
"groupReference",
".",
"setRef",
"(",
"getNamespaceValue",
"(",
"groupReference",
".",
"getRef",
"(",
")",
")",
")",
";",
"for",
"(",
"MetadataItem",
"item",
":",
"groupList",
")",
"{",
"if",
"(",
"item",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"groupName",
")",
"&&",
"item",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"getCurrentNamespace",
"(",
")",
")",
")",
"{",
"item",
".",
"getReferences",
"(",
")",
".",
"add",
"(",
"groupReference",
")",
";",
"return",
";",
"}",
"}",
"final",
"MetadataItem",
"newItem",
"=",
"new",
"MetadataItem",
"(",
"groupName",
")",
";",
"newItem",
".",
"getReferences",
"(",
")",
".",
"add",
"(",
"groupReference",
")",
";",
"newItem",
".",
"setNamespace",
"(",
"getCurrentNamespace",
"(",
")",
")",
";",
"newItem",
".",
"setSchemaName",
"(",
"getCurrentSchmema",
"(",
")",
")",
";",
"newItem",
".",
"setPackageApi",
"(",
"getCurrentPackageApi",
"(",
")",
")",
";",
"newItem",
".",
"setPackageImpl",
"(",
"getCurrentPackageImpl",
"(",
")",
")",
";",
"groupList",
".",
"add",
"(",
"newItem",
")",
";",
"}"
] |
Adds a new reference to the specific group element class. If no group element class is found, then a new group
element class. will be created.
@param groupName
the group class name of
@param groupReference
the new reference to be added.
|
[
"Adds",
"a",
"new",
"reference",
"to",
"the",
"specific",
"group",
"element",
"class",
".",
"If",
"no",
"group",
"element",
"class",
"is",
"found",
"then",
"a",
"new",
"group",
"element",
"class",
".",
"will",
"be",
"created",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L169-L185
|
11,044
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.addClassElement
|
public void addClassElement(final String className, final MetadataElement classElement) {
classElement.setType(getNamespaceValue(classElement.getType()));
if (classElement.getMaxOccurs() != null && !classElement.getMaxOccurs().equals("1")) {
classElement.setMaxOccurs("unbounded");
}
for (MetadataItem item : classList) {
if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace())
&& item.getPackageApi().equals(getCurrentPackageApi())) {
// check for a element with the same name, if found then set 'maxOccurs = unbounded'
for (MetadataElement element : item.getElements()) {
if (element.getName().equals(classElement.getName()) && !classElement.getIsAttribute()) {
element.setMaxOccurs("unbounded");
return;
}
}
item.getElements().add(classElement);
return;
}
}
final MetadataItem newItem = new MetadataItem(className);
newItem.getElements().add(classElement);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
classList.add(newItem);
}
|
java
|
public void addClassElement(final String className, final MetadataElement classElement) {
classElement.setType(getNamespaceValue(classElement.getType()));
if (classElement.getMaxOccurs() != null && !classElement.getMaxOccurs().equals("1")) {
classElement.setMaxOccurs("unbounded");
}
for (MetadataItem item : classList) {
if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace())
&& item.getPackageApi().equals(getCurrentPackageApi())) {
// check for a element with the same name, if found then set 'maxOccurs = unbounded'
for (MetadataElement element : item.getElements()) {
if (element.getName().equals(classElement.getName()) && !classElement.getIsAttribute()) {
element.setMaxOccurs("unbounded");
return;
}
}
item.getElements().add(classElement);
return;
}
}
final MetadataItem newItem = new MetadataItem(className);
newItem.getElements().add(classElement);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
classList.add(newItem);
}
|
[
"public",
"void",
"addClassElement",
"(",
"final",
"String",
"className",
",",
"final",
"MetadataElement",
"classElement",
")",
"{",
"classElement",
".",
"setType",
"(",
"getNamespaceValue",
"(",
"classElement",
".",
"getType",
"(",
")",
")",
")",
";",
"if",
"(",
"classElement",
".",
"getMaxOccurs",
"(",
")",
"!=",
"null",
"&&",
"!",
"classElement",
".",
"getMaxOccurs",
"(",
")",
".",
"equals",
"(",
"\"1\"",
")",
")",
"{",
"classElement",
".",
"setMaxOccurs",
"(",
"\"unbounded\"",
")",
";",
"}",
"for",
"(",
"MetadataItem",
"item",
":",
"classList",
")",
"{",
"if",
"(",
"item",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"className",
")",
"&&",
"item",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"getCurrentNamespace",
"(",
")",
")",
"&&",
"item",
".",
"getPackageApi",
"(",
")",
".",
"equals",
"(",
"getCurrentPackageApi",
"(",
")",
")",
")",
"{",
"// check for a element with the same name, if found then set 'maxOccurs = unbounded'",
"for",
"(",
"MetadataElement",
"element",
":",
"item",
".",
"getElements",
"(",
")",
")",
"{",
"if",
"(",
"element",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"classElement",
".",
"getName",
"(",
")",
")",
"&&",
"!",
"classElement",
".",
"getIsAttribute",
"(",
")",
")",
"{",
"element",
".",
"setMaxOccurs",
"(",
"\"unbounded\"",
")",
";",
"return",
";",
"}",
"}",
"item",
".",
"getElements",
"(",
")",
".",
"add",
"(",
"classElement",
")",
";",
"return",
";",
"}",
"}",
"final",
"MetadataItem",
"newItem",
"=",
"new",
"MetadataItem",
"(",
"className",
")",
";",
"newItem",
".",
"getElements",
"(",
")",
".",
"add",
"(",
"classElement",
")",
";",
"newItem",
".",
"setNamespace",
"(",
"getCurrentNamespace",
"(",
")",
")",
";",
"newItem",
".",
"setSchemaName",
"(",
"getCurrentSchmema",
"(",
")",
")",
";",
"newItem",
".",
"setPackageApi",
"(",
"getCurrentPackageApi",
"(",
")",
")",
";",
"newItem",
".",
"setPackageImpl",
"(",
"getCurrentPackageImpl",
"(",
")",
")",
";",
"classList",
".",
"add",
"(",
"newItem",
")",
";",
"}"
] |
Adds a new element to the specific element class. If no element class is found, then a new element class. will be
created.
@param className
the class name
@param classElement
the new element to be added.
|
[
"Adds",
"a",
"new",
"element",
"to",
"the",
"specific",
"element",
"class",
".",
"If",
"no",
"element",
"class",
"is",
"found",
"then",
"a",
"new",
"element",
"class",
".",
"will",
"be",
"created",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L196-L226
|
11,045
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.addClassReference
|
public void addClassReference(final String className, final MetadataElement classReference) {
classReference.setRef(getNamespaceValue(classReference.getRef()));
for (MetadataItem item : classList) {
if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace())
&& item.getPackageApi().equals(getCurrentPackageApi())) {
item.getReferences().add(classReference);
return;
}
}
final MetadataItem newItem = new MetadataItem(className);
newItem.getReferences().add(classReference);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
classList.add(newItem);
}
|
java
|
public void addClassReference(final String className, final MetadataElement classReference) {
classReference.setRef(getNamespaceValue(classReference.getRef()));
for (MetadataItem item : classList) {
if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace())
&& item.getPackageApi().equals(getCurrentPackageApi())) {
item.getReferences().add(classReference);
return;
}
}
final MetadataItem newItem = new MetadataItem(className);
newItem.getReferences().add(classReference);
newItem.setNamespace(getCurrentNamespace());
newItem.setSchemaName(getCurrentSchmema());
newItem.setPackageApi(getCurrentPackageApi());
newItem.setPackageImpl(getCurrentPackageImpl());
classList.add(newItem);
}
|
[
"public",
"void",
"addClassReference",
"(",
"final",
"String",
"className",
",",
"final",
"MetadataElement",
"classReference",
")",
"{",
"classReference",
".",
"setRef",
"(",
"getNamespaceValue",
"(",
"classReference",
".",
"getRef",
"(",
")",
")",
")",
";",
"for",
"(",
"MetadataItem",
"item",
":",
"classList",
")",
"{",
"if",
"(",
"item",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"className",
")",
"&&",
"item",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"getCurrentNamespace",
"(",
")",
")",
"&&",
"item",
".",
"getPackageApi",
"(",
")",
".",
"equals",
"(",
"getCurrentPackageApi",
"(",
")",
")",
")",
"{",
"item",
".",
"getReferences",
"(",
")",
".",
"add",
"(",
"classReference",
")",
";",
"return",
";",
"}",
"}",
"final",
"MetadataItem",
"newItem",
"=",
"new",
"MetadataItem",
"(",
"className",
")",
";",
"newItem",
".",
"getReferences",
"(",
")",
".",
"add",
"(",
"classReference",
")",
";",
"newItem",
".",
"setNamespace",
"(",
"getCurrentNamespace",
"(",
")",
")",
";",
"newItem",
".",
"setSchemaName",
"(",
"getCurrentSchmema",
"(",
")",
")",
";",
"newItem",
".",
"setPackageApi",
"(",
"getCurrentPackageApi",
"(",
")",
")",
";",
"newItem",
".",
"setPackageImpl",
"(",
"getCurrentPackageImpl",
"(",
")",
")",
";",
"classList",
".",
"add",
"(",
"newItem",
")",
";",
"}"
] |
Adds a new reference to the specific element class. If no element class is found, then a new element class. will
be created.
@param className
the class name
@param classReference
the new reference to be added.
|
[
"Adds",
"a",
"new",
"reference",
"to",
"the",
"specific",
"element",
"class",
".",
"If",
"no",
"element",
"class",
"is",
"found",
"then",
"a",
"new",
"element",
"class",
".",
"will",
"be",
"created",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L237-L254
|
11,046
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
|
Metadata.preResolveDataTypes
|
public void preResolveDataTypes() {
for (MetadataItem metadataClass : classList) {
preResolveDataTypeImpl(metadataClass);
}
for (MetadataItem metadataClass : groupList) {
preResolveDataTypeImpl(metadataClass);
}
}
|
java
|
public void preResolveDataTypes() {
for (MetadataItem metadataClass : classList) {
preResolveDataTypeImpl(metadataClass);
}
for (MetadataItem metadataClass : groupList) {
preResolveDataTypeImpl(metadataClass);
}
}
|
[
"public",
"void",
"preResolveDataTypes",
"(",
")",
"{",
"for",
"(",
"MetadataItem",
"metadataClass",
":",
"classList",
")",
"{",
"preResolveDataTypeImpl",
"(",
"metadataClass",
")",
";",
"}",
"for",
"(",
"MetadataItem",
"metadataClass",
":",
"groupList",
")",
"{",
"preResolveDataTypeImpl",
"(",
"metadataClass",
")",
";",
"}",
"}"
] |
Replaces all data type occurrences found in the element types for all classes with the simple data type. This
simplifies later the XSLT ddJavaAll step.
|
[
"Replaces",
"all",
"data",
"type",
"occurrences",
"found",
"in",
"the",
"element",
"types",
"for",
"all",
"classes",
"with",
"the",
"simple",
"data",
"type",
".",
"This",
"simplifies",
"later",
"the",
"XSLT",
"ddJavaAll",
"step",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L260-L268
|
11,047
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java
|
Shape.isItemInsideView
|
public final boolean isItemInsideView(int position) {
float x = (getXForItemAtPosition(position) + offsetX);
float y = (getYForItemAtPosition(position) + offsetY);
float itemSize = getNoxItemSize();
int viewWidth = shapeConfig.getViewWidth();
boolean matchesHorizontally = x + itemSize >= 0 && x <= viewWidth;
float viewHeight = shapeConfig.getViewHeight();
boolean matchesVertically = y + itemSize >= 0 && y <= viewHeight;
return matchesHorizontally && matchesVertically;
}
|
java
|
public final boolean isItemInsideView(int position) {
float x = (getXForItemAtPosition(position) + offsetX);
float y = (getYForItemAtPosition(position) + offsetY);
float itemSize = getNoxItemSize();
int viewWidth = shapeConfig.getViewWidth();
boolean matchesHorizontally = x + itemSize >= 0 && x <= viewWidth;
float viewHeight = shapeConfig.getViewHeight();
boolean matchesVertically = y + itemSize >= 0 && y <= viewHeight;
return matchesHorizontally && matchesVertically;
}
|
[
"public",
"final",
"boolean",
"isItemInsideView",
"(",
"int",
"position",
")",
"{",
"float",
"x",
"=",
"(",
"getXForItemAtPosition",
"(",
"position",
")",
"+",
"offsetX",
")",
";",
"float",
"y",
"=",
"(",
"getYForItemAtPosition",
"(",
"position",
")",
"+",
"offsetY",
")",
";",
"float",
"itemSize",
"=",
"getNoxItemSize",
"(",
")",
";",
"int",
"viewWidth",
"=",
"shapeConfig",
".",
"getViewWidth",
"(",
")",
";",
"boolean",
"matchesHorizontally",
"=",
"x",
"+",
"itemSize",
">=",
"0",
"&&",
"x",
"<=",
"viewWidth",
";",
"float",
"viewHeight",
"=",
"shapeConfig",
".",
"getViewHeight",
"(",
")",
";",
"boolean",
"matchesVertically",
"=",
"y",
"+",
"itemSize",
">=",
"0",
"&&",
"y",
"<=",
"viewHeight",
";",
"return",
"matchesHorizontally",
"&&",
"matchesVertically",
";",
"}"
] |
Returns true if the view should be rendered inside the view window taking into account the
offset applied by the scroll effect.
|
[
"Returns",
"true",
"if",
"the",
"view",
"should",
"be",
"rendered",
"inside",
"the",
"view",
"window",
"taking",
"into",
"account",
"the",
"offset",
"applied",
"by",
"the",
"scroll",
"effect",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java#L82-L91
|
11,048
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java
|
Shape.getNoxItemHit
|
public int getNoxItemHit(float x, float y) {
int noxItemPosition = -1;
for (int i = 0; i < getNumberOfElements(); i++) {
float noxItemX = getXForItemAtPosition(i) + offsetX;
float noxItemY = getYForItemAtPosition(i) + offsetY;
float itemSize = getNoxItemSize();
boolean matchesHorizontally = x >= noxItemX && x <= noxItemX + itemSize;
boolean matchesVertically = y >= noxItemY && y <= noxItemY + itemSize;
if (matchesHorizontally && matchesVertically) {
noxItemPosition = i;
break;
}
}
return noxItemPosition;
}
|
java
|
public int getNoxItemHit(float x, float y) {
int noxItemPosition = -1;
for (int i = 0; i < getNumberOfElements(); i++) {
float noxItemX = getXForItemAtPosition(i) + offsetX;
float noxItemY = getYForItemAtPosition(i) + offsetY;
float itemSize = getNoxItemSize();
boolean matchesHorizontally = x >= noxItemX && x <= noxItemX + itemSize;
boolean matchesVertically = y >= noxItemY && y <= noxItemY + itemSize;
if (matchesHorizontally && matchesVertically) {
noxItemPosition = i;
break;
}
}
return noxItemPosition;
}
|
[
"public",
"int",
"getNoxItemHit",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"int",
"noxItemPosition",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getNumberOfElements",
"(",
")",
";",
"i",
"++",
")",
"{",
"float",
"noxItemX",
"=",
"getXForItemAtPosition",
"(",
"i",
")",
"+",
"offsetX",
";",
"float",
"noxItemY",
"=",
"getYForItemAtPosition",
"(",
"i",
")",
"+",
"offsetY",
";",
"float",
"itemSize",
"=",
"getNoxItemSize",
"(",
")",
";",
"boolean",
"matchesHorizontally",
"=",
"x",
">=",
"noxItemX",
"&&",
"x",
"<=",
"noxItemX",
"+",
"itemSize",
";",
"boolean",
"matchesVertically",
"=",
"y",
">=",
"noxItemY",
"&&",
"y",
"<=",
"noxItemY",
"+",
"itemSize",
";",
"if",
"(",
"matchesHorizontally",
"&&",
"matchesVertically",
")",
"{",
"noxItemPosition",
"=",
"i",
";",
"break",
";",
"}",
"}",
"return",
"noxItemPosition",
";",
"}"
] |
Returns the position of the NoxView if any of the previously configured NoxItem instances is
hit. If there is no any NoxItem hit this method returns -1.
|
[
"Returns",
"the",
"position",
"of",
"the",
"NoxView",
"if",
"any",
"of",
"the",
"previously",
"configured",
"NoxItem",
"instances",
"is",
"hit",
".",
"If",
"there",
"is",
"no",
"any",
"NoxItem",
"hit",
"this",
"method",
"returns",
"-",
"1",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java#L149-L163
|
11,049
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java
|
Shape.setNoxItemXPosition
|
protected final void setNoxItemXPosition(int position, float x) {
noxItemsXPositions[position] = x;
minX = (int) Math.min(x, minX);
maxX = (int) Math.max(x, maxX);
}
|
java
|
protected final void setNoxItemXPosition(int position, float x) {
noxItemsXPositions[position] = x;
minX = (int) Math.min(x, minX);
maxX = (int) Math.max(x, maxX);
}
|
[
"protected",
"final",
"void",
"setNoxItemXPosition",
"(",
"int",
"position",
",",
"float",
"x",
")",
"{",
"noxItemsXPositions",
"[",
"position",
"]",
"=",
"x",
";",
"minX",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"x",
",",
"minX",
")",
";",
"maxX",
"=",
"(",
"int",
")",
"Math",
".",
"max",
"(",
"x",
",",
"maxX",
")",
";",
"}"
] |
Configures the X position for a given NoxItem indicated with the item position. This method
uses two counters to calculate the Shape minimum and maximum X position used to configure the
Shape scroll.
|
[
"Configures",
"the",
"X",
"position",
"for",
"a",
"given",
"NoxItem",
"indicated",
"with",
"the",
"item",
"position",
".",
"This",
"method",
"uses",
"two",
"counters",
"to",
"calculate",
"the",
"Shape",
"minimum",
"and",
"maximum",
"X",
"position",
"used",
"to",
"configure",
"the",
"Shape",
"scroll",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java#L180-L184
|
11,050
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java
|
Shape.setNoxItemYPosition
|
protected final void setNoxItemYPosition(int position, float y) {
noxItemsYPositions[position] = y;
minY = (int) Math.min(y, minY);
maxY = (int) Math.max(y, maxY);
}
|
java
|
protected final void setNoxItemYPosition(int position, float y) {
noxItemsYPositions[position] = y;
minY = (int) Math.min(y, minY);
maxY = (int) Math.max(y, maxY);
}
|
[
"protected",
"final",
"void",
"setNoxItemYPosition",
"(",
"int",
"position",
",",
"float",
"y",
")",
"{",
"noxItemsYPositions",
"[",
"position",
"]",
"=",
"y",
";",
"minY",
"=",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"y",
",",
"minY",
")",
";",
"maxY",
"=",
"(",
"int",
")",
"Math",
".",
"max",
"(",
"y",
",",
"maxY",
")",
";",
"}"
] |
Configures the Y position for a given NoxItem indicated with the item position. This method
uses two counters to calculate the Shape minimum and maximum Y position used to configure the
Shape scroll.
|
[
"Configures",
"the",
"Y",
"position",
"for",
"a",
"given",
"NoxItem",
"indicated",
"with",
"the",
"item",
"position",
".",
"This",
"method",
"uses",
"two",
"counters",
"to",
"calculate",
"the",
"Shape",
"minimum",
"and",
"maximum",
"Y",
"position",
"used",
"to",
"configure",
"the",
"Shape",
"scroll",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/shape/Shape.java#L191-L195
|
11,051
|
arquillian/arquillian-algeron
|
pact/consumer/core/src/main/java/org/arquillian/algeron/pact/consumer/core/util/ResolveClassAnnotation.java
|
ResolveClassAnnotation.getClassWithAnnotation
|
public static Optional<Class<?>> getClassWithAnnotation(final Class<?> source,
final Class<? extends Annotation> annotationClass) {
Class<?> nextSource = source;
while (nextSource != Object.class) {
if (nextSource.isAnnotationPresent(annotationClass)) {
return Optional.of(nextSource);
} else {
nextSource = nextSource.getSuperclass();
}
}
return Optional.empty();
}
|
java
|
public static Optional<Class<?>> getClassWithAnnotation(final Class<?> source,
final Class<? extends Annotation> annotationClass) {
Class<?> nextSource = source;
while (nextSource != Object.class) {
if (nextSource.isAnnotationPresent(annotationClass)) {
return Optional.of(nextSource);
} else {
nextSource = nextSource.getSuperclass();
}
}
return Optional.empty();
}
|
[
"public",
"static",
"Optional",
"<",
"Class",
"<",
"?",
">",
">",
"getClassWithAnnotation",
"(",
"final",
"Class",
"<",
"?",
">",
"source",
",",
"final",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationClass",
")",
"{",
"Class",
"<",
"?",
">",
"nextSource",
"=",
"source",
";",
"while",
"(",
"nextSource",
"!=",
"Object",
".",
"class",
")",
"{",
"if",
"(",
"nextSource",
".",
"isAnnotationPresent",
"(",
"annotationClass",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"nextSource",
")",
";",
"}",
"else",
"{",
"nextSource",
"=",
"nextSource",
".",
"getSuperclass",
"(",
")",
";",
"}",
"}",
"return",
"Optional",
".",
"empty",
"(",
")",
";",
"}"
] |
Class that returns if a class or any subclass is annotated with given annotation.
@param source
class.
@param annotationClass
to find.
@return Class containing the annotation.
|
[
"Class",
"that",
"returns",
"if",
"a",
"class",
"or",
"any",
"subclass",
"is",
"annotated",
"with",
"given",
"annotation",
"."
] |
ec79372defdafe99ab2f7bb696f1c1eabdbbacb6
|
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/pact/consumer/core/src/main/java/org/arquillian/algeron/pact/consumer/core/util/ResolveClassAnnotation.java#L21-L34
|
11,052
|
arquillian/arquillian-algeron
|
pact/provider/core/src/main/java/org/arquillian/algeron/pact/provider/core/httptarget/HttpTarget.java
|
HttpTarget.removeFinalSlash
|
private String removeFinalSlash(String path) {
if (path != null && !path.isEmpty() && path.endsWith("/")) {
return path.substring(0, path.length() -1);
}
return path;
}
|
java
|
private String removeFinalSlash(String path) {
if (path != null && !path.isEmpty() && path.endsWith("/")) {
return path.substring(0, path.length() -1);
}
return path;
}
|
[
"private",
"String",
"removeFinalSlash",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
"&&",
"!",
"path",
".",
"isEmpty",
"(",
")",
"&&",
"path",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"return",
"path",
".",
"substring",
"(",
"0",
",",
"path",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"return",
"path",
";",
"}"
] |
Due a bug in Pact we need to remove final slash character on path
|
[
"Due",
"a",
"bug",
"in",
"Pact",
"we",
"need",
"to",
"remove",
"final",
"slash",
"character",
"on",
"path"
] |
ec79372defdafe99ab2f7bb696f1c1eabdbbacb6
|
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/pact/provider/core/src/main/java/org/arquillian/algeron/pact/provider/core/httptarget/HttpTarget.java#L119-L125
|
11,053
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/filter/UnionFilter.java
|
UnionFilter.getDataType
|
private String getDataType(String[] items) {
for (String item : items) {
if (XsdDatatypeEnum.ENTITIES.isDataType(item)) {
return item;
}
}
return items[0];
}
|
java
|
private String getDataType(String[] items) {
for (String item : items) {
if (XsdDatatypeEnum.ENTITIES.isDataType(item)) {
return item;
}
}
return items[0];
}
|
[
"private",
"String",
"getDataType",
"(",
"String",
"[",
"]",
"items",
")",
"{",
"for",
"(",
"String",
"item",
":",
"items",
")",
"{",
"if",
"(",
"XsdDatatypeEnum",
".",
"ENTITIES",
".",
"isDataType",
"(",
"item",
")",
")",
"{",
"return",
"item",
";",
"}",
"}",
"return",
"items",
"[",
"0",
"]",
";",
"}"
] |
Returns first data type which is a standard xsd data type. If no such data type found, then the first one will be
returned.
@param items
@return
|
[
"Returns",
"first",
"data",
"type",
"which",
"is",
"a",
"standard",
"xsd",
"data",
"type",
".",
"If",
"no",
"such",
"data",
"type",
"found",
"then",
"the",
"first",
"one",
"will",
"be",
"returned",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/filter/UnionFilter.java#L66-L73
|
11,054
|
arquillian/arquillian-algeron
|
common/configuration/src/main/java/org/arquillian/algeron/configuration/HomeResolver.java
|
HomeResolver.resolveHomeDirectory
|
public static String resolveHomeDirectory(String path) {
if (path.startsWith("~")) {
return path.replace("~", System.getProperty("user.home"));
}
return path;
}
|
java
|
public static String resolveHomeDirectory(String path) {
if (path.startsWith("~")) {
return path.replace("~", System.getProperty("user.home"));
}
return path;
}
|
[
"public",
"static",
"String",
"resolveHomeDirectory",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
".",
"startsWith",
"(",
"\"~\"",
")",
")",
"{",
"return",
"path",
".",
"replace",
"(",
"\"~\"",
",",
"System",
".",
"getProperty",
"(",
"\"user.home\"",
")",
")",
";",
"}",
"return",
"path",
";",
"}"
] |
Method that changes any string starting with ~ to user.home property.
@param path
to change.
@return String with ~changed.
|
[
"Method",
"that",
"changes",
"any",
"string",
"starting",
"with",
"~",
"to",
"user",
".",
"home",
"property",
"."
] |
ec79372defdafe99ab2f7bb696f1c1eabdbbacb6
|
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/configuration/src/main/java/org/arquillian/algeron/configuration/HomeResolver.java#L13-L18
|
11,055
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationRequiredHandlerImpl.java
|
AuthenticationRequiredHandlerImpl.handle
|
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException,
IOException {
saveRequest(context);
String loginFormUrl = getLoginFormUrl();
if (StringUtils.isNotEmpty(loginFormUrl)) {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), loginFormUrl);
} else {
sendError(e, context);
}
}
|
java
|
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException,
IOException {
saveRequest(context);
String loginFormUrl = getLoginFormUrl();
if (StringUtils.isNotEmpty(loginFormUrl)) {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), loginFormUrl);
} else {
sendError(e, context);
}
}
|
[
"public",
"void",
"handle",
"(",
"RequestContext",
"context",
",",
"AuthenticationException",
"e",
")",
"throws",
"SecurityProviderException",
",",
"IOException",
"{",
"saveRequest",
"(",
"context",
")",
";",
"String",
"loginFormUrl",
"=",
"getLoginFormUrl",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"loginFormUrl",
")",
")",
"{",
"RedirectUtils",
".",
"redirect",
"(",
"context",
".",
"getRequest",
"(",
")",
",",
"context",
".",
"getResponse",
"(",
")",
",",
"loginFormUrl",
")",
";",
"}",
"else",
"{",
"sendError",
"(",
"e",
",",
"context",
")",
";",
"}",
"}"
] |
Saves the current request in the request cache and then redirects to the login form page.
@param context the request security context
@param e the exception with the reason for requiring authentication
|
[
"Saves",
"the",
"current",
"request",
"in",
"the",
"request",
"cache",
"and",
"then",
"redirects",
"to",
"the",
"login",
"form",
"page",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/authentication/impl/AuthenticationRequiredHandlerImpl.java#L82-L93
|
11,056
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/PackageInfo.java
|
PackageInfo.copyPackageInfo
|
public static void copyPackageInfo(final MetadataParserPath path, final Metadata metadata, final boolean verbose) throws IOException {
for (final MetadataDescriptor descriptor : metadata.getMetadataDescriptorList()) {
if (descriptor.getPathToPackageInfoApi() != null) {
final File sourceFile = new File(descriptor.getPathToPackageInfoApi());
final String destDirectory = path.pathToApi + File.separatorChar + descriptor.getPackageApi().replace('.', '/');
deleteExistingPackageInfo(destDirectory, verbose);
copy(sourceFile, destDirectory, verbose);
}
if (descriptor.getPathToPackageInfoImpl() != null) {
final File sourceFile = new File(descriptor.getPathToPackageInfoImpl());
final String destDirectory = path.pathToImpl + File.separatorChar + descriptor.getPackageImpl().replace('.', '/');
deleteExistingPackageInfo(destDirectory, verbose);
copy(sourceFile, destDirectory, verbose);
}
}
}
|
java
|
public static void copyPackageInfo(final MetadataParserPath path, final Metadata metadata, final boolean verbose) throws IOException {
for (final MetadataDescriptor descriptor : metadata.getMetadataDescriptorList()) {
if (descriptor.getPathToPackageInfoApi() != null) {
final File sourceFile = new File(descriptor.getPathToPackageInfoApi());
final String destDirectory = path.pathToApi + File.separatorChar + descriptor.getPackageApi().replace('.', '/');
deleteExistingPackageInfo(destDirectory, verbose);
copy(sourceFile, destDirectory, verbose);
}
if (descriptor.getPathToPackageInfoImpl() != null) {
final File sourceFile = new File(descriptor.getPathToPackageInfoImpl());
final String destDirectory = path.pathToImpl + File.separatorChar + descriptor.getPackageImpl().replace('.', '/');
deleteExistingPackageInfo(destDirectory, verbose);
copy(sourceFile, destDirectory, verbose);
}
}
}
|
[
"public",
"static",
"void",
"copyPackageInfo",
"(",
"final",
"MetadataParserPath",
"path",
",",
"final",
"Metadata",
"metadata",
",",
"final",
"boolean",
"verbose",
")",
"throws",
"IOException",
"{",
"for",
"(",
"final",
"MetadataDescriptor",
"descriptor",
":",
"metadata",
".",
"getMetadataDescriptorList",
"(",
")",
")",
"{",
"if",
"(",
"descriptor",
".",
"getPathToPackageInfoApi",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"File",
"sourceFile",
"=",
"new",
"File",
"(",
"descriptor",
".",
"getPathToPackageInfoApi",
"(",
")",
")",
";",
"final",
"String",
"destDirectory",
"=",
"path",
".",
"pathToApi",
"+",
"File",
".",
"separatorChar",
"+",
"descriptor",
".",
"getPackageApi",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"deleteExistingPackageInfo",
"(",
"destDirectory",
",",
"verbose",
")",
";",
"copy",
"(",
"sourceFile",
",",
"destDirectory",
",",
"verbose",
")",
";",
"}",
"if",
"(",
"descriptor",
".",
"getPathToPackageInfoImpl",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"File",
"sourceFile",
"=",
"new",
"File",
"(",
"descriptor",
".",
"getPathToPackageInfoImpl",
"(",
")",
")",
";",
"final",
"String",
"destDirectory",
"=",
"path",
".",
"pathToImpl",
"+",
"File",
".",
"separatorChar",
"+",
"descriptor",
".",
"getPackageImpl",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"deleteExistingPackageInfo",
"(",
"destDirectory",
",",
"verbose",
")",
";",
"copy",
"(",
"sourceFile",
",",
"destDirectory",
",",
"verbose",
")",
";",
"}",
"}",
"}"
] |
Copies the optional packageInfo files into the packages.
@param path
@param metadata
@throws IOException
|
[
"Copies",
"the",
"optional",
"packageInfo",
"files",
"into",
"the",
"packages",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/PackageInfo.java#L42-L58
|
11,057
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/PackageInfo.java
|
PackageInfo.deleteExistingPackageInfo
|
public static void deleteExistingPackageInfo(final String destDirectory, final boolean verbose) {
final File htmlFile = new File(destDirectory + File.separatorChar + PACKAGE_HTML_NAME);
final File javaFile = new File(destDirectory + File.separatorChar + PACKAGE_JAVA_NAME);
final Boolean isHtmlDeleted = FileUtils.deleteQuietly(htmlFile);
final Boolean isJavaDeleted = FileUtils.deleteQuietly(javaFile);
if (verbose) {
log.info(String.format("File %s deleted: %s", htmlFile.getAbsolutePath(), isHtmlDeleted.toString()));
log.info(String.format("File %s deleted: %s", javaFile.getAbsolutePath(), isJavaDeleted.toString()));
}
}
|
java
|
public static void deleteExistingPackageInfo(final String destDirectory, final boolean verbose) {
final File htmlFile = new File(destDirectory + File.separatorChar + PACKAGE_HTML_NAME);
final File javaFile = new File(destDirectory + File.separatorChar + PACKAGE_JAVA_NAME);
final Boolean isHtmlDeleted = FileUtils.deleteQuietly(htmlFile);
final Boolean isJavaDeleted = FileUtils.deleteQuietly(javaFile);
if (verbose) {
log.info(String.format("File %s deleted: %s", htmlFile.getAbsolutePath(), isHtmlDeleted.toString()));
log.info(String.format("File %s deleted: %s", javaFile.getAbsolutePath(), isJavaDeleted.toString()));
}
}
|
[
"public",
"static",
"void",
"deleteExistingPackageInfo",
"(",
"final",
"String",
"destDirectory",
",",
"final",
"boolean",
"verbose",
")",
"{",
"final",
"File",
"htmlFile",
"=",
"new",
"File",
"(",
"destDirectory",
"+",
"File",
".",
"separatorChar",
"+",
"PACKAGE_HTML_NAME",
")",
";",
"final",
"File",
"javaFile",
"=",
"new",
"File",
"(",
"destDirectory",
"+",
"File",
".",
"separatorChar",
"+",
"PACKAGE_JAVA_NAME",
")",
";",
"final",
"Boolean",
"isHtmlDeleted",
"=",
"FileUtils",
".",
"deleteQuietly",
"(",
"htmlFile",
")",
";",
"final",
"Boolean",
"isJavaDeleted",
"=",
"FileUtils",
".",
"deleteQuietly",
"(",
"javaFile",
")",
";",
"if",
"(",
"verbose",
")",
"{",
"log",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"File %s deleted: %s\"",
",",
"htmlFile",
".",
"getAbsolutePath",
"(",
")",
",",
"isHtmlDeleted",
".",
"toString",
"(",
")",
")",
")",
";",
"log",
".",
"info",
"(",
"String",
".",
"format",
"(",
"\"File %s deleted: %s\"",
",",
"javaFile",
".",
"getAbsolutePath",
"(",
")",
",",
"isJavaDeleted",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Deletes package.html or package-info.java from the given directory.
@param destDirectory
@param verbose
|
[
"Deletes",
"package",
".",
"html",
"or",
"package",
"-",
"info",
".",
"java",
"from",
"the",
"given",
"directory",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/PackageInfo.java#L91-L101
|
11,058
|
shrinkwrap/descriptors
|
ant/src/main/java/org/jboss/shrinkwrap/descriptor/extension/ant/task/MetadataParserTask.java
|
MetadataParserTask.execute
|
@Override
public void execute() throws BuildException {
if (path == null)
throw new BuildException("Path isn't defined");
if (descriptors == null)
throw new BuildException("Descriptors isn't defined");
if (descriptors.getData() == null)
throw new BuildException("No descriptor defined");
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try {
if (classpathRef != null || classpath != null) {
org.apache.tools.ant.types.Path p = new org.apache.tools.ant.types.Path(getProject());
if (classpathRef != null) {
org.apache.tools.ant.types.Reference reference = new org.apache.tools.ant.types.Reference(
getProject(), classpathRef);
p.setRefid(reference);
}
if (classpath != null) {
p.append(classpath);
}
ClassLoader cl = getProject().createClassLoader(oldCl, p);
Thread.currentThread().setContextClassLoader(cl);
}
final List<Descriptor> data = descriptors.getData();
for (Descriptor d : data) {
d.applyNamespaces();
}
List<Javadoc> javadoc = null;
if (javadocs != null) {
javadoc = javadocs.getData();
}
final MetadataParser metadataParser = new MetadataParser();
metadataParser.parse(path, data, javadoc, verbose);
} catch (Throwable t) {
throw new BuildException(t.getMessage(), t);
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
}
|
java
|
@Override
public void execute() throws BuildException {
if (path == null)
throw new BuildException("Path isn't defined");
if (descriptors == null)
throw new BuildException("Descriptors isn't defined");
if (descriptors.getData() == null)
throw new BuildException("No descriptor defined");
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try {
if (classpathRef != null || classpath != null) {
org.apache.tools.ant.types.Path p = new org.apache.tools.ant.types.Path(getProject());
if (classpathRef != null) {
org.apache.tools.ant.types.Reference reference = new org.apache.tools.ant.types.Reference(
getProject(), classpathRef);
p.setRefid(reference);
}
if (classpath != null) {
p.append(classpath);
}
ClassLoader cl = getProject().createClassLoader(oldCl, p);
Thread.currentThread().setContextClassLoader(cl);
}
final List<Descriptor> data = descriptors.getData();
for (Descriptor d : data) {
d.applyNamespaces();
}
List<Javadoc> javadoc = null;
if (javadocs != null) {
javadoc = javadocs.getData();
}
final MetadataParser metadataParser = new MetadataParser();
metadataParser.parse(path, data, javadoc, verbose);
} catch (Throwable t) {
throw new BuildException(t.getMessage(), t);
} finally {
Thread.currentThread().setContextClassLoader(oldCl);
}
}
|
[
"@",
"Override",
"public",
"void",
"execute",
"(",
")",
"throws",
"BuildException",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"throw",
"new",
"BuildException",
"(",
"\"Path isn't defined\"",
")",
";",
"if",
"(",
"descriptors",
"==",
"null",
")",
"throw",
"new",
"BuildException",
"(",
"\"Descriptors isn't defined\"",
")",
";",
"if",
"(",
"descriptors",
".",
"getData",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"BuildException",
"(",
"\"No descriptor defined\"",
")",
";",
"ClassLoader",
"oldCl",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"try",
"{",
"if",
"(",
"classpathRef",
"!=",
"null",
"||",
"classpath",
"!=",
"null",
")",
"{",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"p",
"=",
"new",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Path",
"(",
"getProject",
"(",
")",
")",
";",
"if",
"(",
"classpathRef",
"!=",
"null",
")",
"{",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Reference",
"reference",
"=",
"new",
"org",
".",
"apache",
".",
"tools",
".",
"ant",
".",
"types",
".",
"Reference",
"(",
"getProject",
"(",
")",
",",
"classpathRef",
")",
";",
"p",
".",
"setRefid",
"(",
"reference",
")",
";",
"}",
"if",
"(",
"classpath",
"!=",
"null",
")",
"{",
"p",
".",
"append",
"(",
"classpath",
")",
";",
"}",
"ClassLoader",
"cl",
"=",
"getProject",
"(",
")",
".",
"createClassLoader",
"(",
"oldCl",
",",
"p",
")",
";",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setContextClassLoader",
"(",
"cl",
")",
";",
"}",
"final",
"List",
"<",
"Descriptor",
">",
"data",
"=",
"descriptors",
".",
"getData",
"(",
")",
";",
"for",
"(",
"Descriptor",
"d",
":",
"data",
")",
"{",
"d",
".",
"applyNamespaces",
"(",
")",
";",
"}",
"List",
"<",
"Javadoc",
">",
"javadoc",
"=",
"null",
";",
"if",
"(",
"javadocs",
"!=",
"null",
")",
"{",
"javadoc",
"=",
"javadocs",
".",
"getData",
"(",
")",
";",
"}",
"final",
"MetadataParser",
"metadataParser",
"=",
"new",
"MetadataParser",
"(",
")",
";",
"metadataParser",
".",
"parse",
"(",
"path",
",",
"data",
",",
"javadoc",
",",
"verbose",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"throw",
"new",
"BuildException",
"(",
"t",
".",
"getMessage",
"(",
")",
",",
"t",
")",
";",
"}",
"finally",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"setContextClassLoader",
"(",
"oldCl",
")",
";",
"}",
"}"
] |
Execute Ant task
@throws BuildException
If an error occurs
|
[
"Execute",
"Ant",
"task"
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/ant/src/main/java/org/jboss/shrinkwrap/descriptor/extension/ant/task/MetadataParserTask.java#L132-L179
|
11,059
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java
|
RequestSecurityFilter.excludeRequest
|
protected boolean excludeRequest(HttpServletRequest request) {
if (ArrayUtils.isNotEmpty(urlsToExclude)) {
for (String pathPattern : urlsToExclude) {
if (pathMatcher.match(pathPattern, HttpUtils.getRequestUriWithoutContextPath(request))) {
return true;
}
}
}
return false;
}
|
java
|
protected boolean excludeRequest(HttpServletRequest request) {
if (ArrayUtils.isNotEmpty(urlsToExclude)) {
for (String pathPattern : urlsToExclude) {
if (pathMatcher.match(pathPattern, HttpUtils.getRequestUriWithoutContextPath(request))) {
return true;
}
}
}
return false;
}
|
[
"protected",
"boolean",
"excludeRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isNotEmpty",
"(",
"urlsToExclude",
")",
")",
"{",
"for",
"(",
"String",
"pathPattern",
":",
"urlsToExclude",
")",
"{",
"if",
"(",
"pathMatcher",
".",
"match",
"(",
"pathPattern",
",",
"HttpUtils",
".",
"getRequestUriWithoutContextPath",
"(",
"request",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns trues if the request should be excluded from processing.
|
[
"Returns",
"trues",
"if",
"the",
"request",
"should",
"be",
"excluded",
"from",
"processing",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java#L150-L160
|
11,060
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java
|
RequestSecurityFilter.includeRequest
|
protected boolean includeRequest(HttpServletRequest request) {
if (ArrayUtils.isNotEmpty(urlsToInclude)) {
for (String pathPattern : urlsToInclude) {
if (pathMatcher.match(pathPattern, HttpUtils.getRequestUriWithoutContextPath(request))) {
return true;
}
}
}
return false;
}
|
java
|
protected boolean includeRequest(HttpServletRequest request) {
if (ArrayUtils.isNotEmpty(urlsToInclude)) {
for (String pathPattern : urlsToInclude) {
if (pathMatcher.match(pathPattern, HttpUtils.getRequestUriWithoutContextPath(request))) {
return true;
}
}
}
return false;
}
|
[
"protected",
"boolean",
"includeRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"ArrayUtils",
".",
"isNotEmpty",
"(",
"urlsToInclude",
")",
")",
"{",
"for",
"(",
"String",
"pathPattern",
":",
"urlsToInclude",
")",
"{",
"if",
"(",
"pathMatcher",
".",
"match",
"(",
"pathPattern",
",",
"HttpUtils",
".",
"getRequestUriWithoutContextPath",
"(",
"request",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Returns trues if the request should be included for processing.
|
[
"Returns",
"trues",
"if",
"the",
"request",
"should",
"be",
"included",
"for",
"processing",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/servlet/filters/RequestSecurityFilter.java#L165-L175
|
11,061
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.setShape
|
public void setShape(Shape shape) {
validateShape(shape);
this.shape = shape;
this.shape.calculate();
initializeScroller();
resetScroll();
}
|
java
|
public void setShape(Shape shape) {
validateShape(shape);
this.shape = shape;
this.shape.calculate();
initializeScroller();
resetScroll();
}
|
[
"public",
"void",
"setShape",
"(",
"Shape",
"shape",
")",
"{",
"validateShape",
"(",
"shape",
")",
";",
"this",
".",
"shape",
"=",
"shape",
";",
"this",
".",
"shape",
".",
"calculate",
"(",
")",
";",
"initializeScroller",
"(",
")",
";",
"resetScroll",
"(",
")",
";",
"}"
] |
Changes the Shape used to the one passed as argument. This method will refresh the view.
|
[
"Changes",
"the",
"Shape",
"used",
"to",
"the",
"one",
"passed",
"as",
"argument",
".",
"This",
"method",
"will",
"refresh",
"the",
"view",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L138-L145
|
11,062
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.onTouchEvent
|
@Override public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
boolean clickCaptured = processTouchEvent(event);
boolean scrollCaptured = scroller != null && scroller.onTouchEvent(event);
boolean singleTapCaptured = getGestureDetectorCompat().onTouchEvent(event);
return clickCaptured || scrollCaptured || singleTapCaptured;
}
|
java
|
@Override public boolean onTouchEvent(MotionEvent event) {
super.onTouchEvent(event);
boolean clickCaptured = processTouchEvent(event);
boolean scrollCaptured = scroller != null && scroller.onTouchEvent(event);
boolean singleTapCaptured = getGestureDetectorCompat().onTouchEvent(event);
return clickCaptured || scrollCaptured || singleTapCaptured;
}
|
[
"@",
"Override",
"public",
"boolean",
"onTouchEvent",
"(",
"MotionEvent",
"event",
")",
"{",
"super",
".",
"onTouchEvent",
"(",
"event",
")",
";",
"boolean",
"clickCaptured",
"=",
"processTouchEvent",
"(",
"event",
")",
";",
"boolean",
"scrollCaptured",
"=",
"scroller",
"!=",
"null",
"&&",
"scroller",
".",
"onTouchEvent",
"(",
"event",
")",
";",
"boolean",
"singleTapCaptured",
"=",
"getGestureDetectorCompat",
"(",
")",
".",
"onTouchEvent",
"(",
"event",
")",
";",
"return",
"clickCaptured",
"||",
"scrollCaptured",
"||",
"singleTapCaptured",
";",
"}"
] |
Delegates touch events to the scroller instance initialized previously to implement the scroll
effect. If the scroller does not handle the MotionEvent NoxView will check if any NoxItem has
been clicked to notify a previously configured OnNoxItemClickListener.
|
[
"Delegates",
"touch",
"events",
"to",
"the",
"scroller",
"instance",
"initialized",
"previously",
"to",
"implement",
"the",
"scroll",
"effect",
".",
"If",
"the",
"scroller",
"does",
"not",
"handle",
"the",
"MotionEvent",
"NoxView",
"will",
"check",
"if",
"any",
"NoxItem",
"has",
"been",
"clicked",
"to",
"notify",
"a",
"previously",
"configured",
"OnNoxItemClickListener",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L152-L158
|
11,063
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.onVisibilityChanged
|
@Override protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (changedView != this) {
return;
}
if (visibility == View.VISIBLE) {
resume();
} else {
pause();
}
}
|
java
|
@Override protected void onVisibilityChanged(View changedView, int visibility) {
super.onVisibilityChanged(changedView, visibility);
if (changedView != this) {
return;
}
if (visibility == View.VISIBLE) {
resume();
} else {
pause();
}
}
|
[
"@",
"Override",
"protected",
"void",
"onVisibilityChanged",
"(",
"View",
"changedView",
",",
"int",
"visibility",
")",
"{",
"super",
".",
"onVisibilityChanged",
"(",
"changedView",
",",
"visibility",
")",
";",
"if",
"(",
"changedView",
"!=",
"this",
")",
"{",
"return",
";",
"}",
"if",
"(",
"visibility",
"==",
"View",
".",
"VISIBLE",
")",
"{",
"resume",
"(",
")",
";",
"}",
"else",
"{",
"pause",
"(",
")",
";",
"}",
"}"
] |
Controls visibility changes to pause or resume this custom view and avoid performance
problems.
|
[
"Controls",
"visibility",
"changes",
"to",
"pause",
"or",
"resume",
"this",
"custom",
"view",
"and",
"avoid",
"performance",
"problems",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L232-L243
|
11,064
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.updateShapeOffset
|
private void updateShapeOffset() {
int offsetX = scroller.getOffsetX();
int offsetY = scroller.getOffsetY();
shape.setOffset(offsetX, offsetY);
}
|
java
|
private void updateShapeOffset() {
int offsetX = scroller.getOffsetX();
int offsetY = scroller.getOffsetY();
shape.setOffset(offsetX, offsetY);
}
|
[
"private",
"void",
"updateShapeOffset",
"(",
")",
"{",
"int",
"offsetX",
"=",
"scroller",
".",
"getOffsetX",
"(",
")",
";",
"int",
"offsetY",
"=",
"scroller",
".",
"getOffsetY",
"(",
")",
";",
"shape",
".",
"setOffset",
"(",
"offsetX",
",",
"offsetY",
")",
";",
"}"
] |
Checks the X and Y scroll offset to update that values into the Shape configured previously.
|
[
"Checks",
"the",
"X",
"and",
"Y",
"scroll",
"offset",
"to",
"update",
"that",
"values",
"into",
"the",
"Shape",
"configured",
"previously",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L327-L331
|
11,065
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.drawNoxItem
|
private void drawNoxItem(Canvas canvas, int position, float left, float top) {
if (noxItemCatalog.isBitmapReady(position)) {
Bitmap bitmap = noxItemCatalog.getBitmap(position);
canvas.drawBitmap(bitmap, left, top, paint);
} else if (noxItemCatalog.isDrawableReady(position)) {
Drawable drawable = noxItemCatalog.getDrawable(position);
drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
} else if (noxItemCatalog.isPlaceholderReady(position)) {
Drawable drawable = noxItemCatalog.getPlaceholder(position);
drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
}
}
|
java
|
private void drawNoxItem(Canvas canvas, int position, float left, float top) {
if (noxItemCatalog.isBitmapReady(position)) {
Bitmap bitmap = noxItemCatalog.getBitmap(position);
canvas.drawBitmap(bitmap, left, top, paint);
} else if (noxItemCatalog.isDrawableReady(position)) {
Drawable drawable = noxItemCatalog.getDrawable(position);
drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
} else if (noxItemCatalog.isPlaceholderReady(position)) {
Drawable drawable = noxItemCatalog.getPlaceholder(position);
drawNoxItemDrawable(canvas, (int) left, (int) top, drawable);
}
}
|
[
"private",
"void",
"drawNoxItem",
"(",
"Canvas",
"canvas",
",",
"int",
"position",
",",
"float",
"left",
",",
"float",
"top",
")",
"{",
"if",
"(",
"noxItemCatalog",
".",
"isBitmapReady",
"(",
"position",
")",
")",
"{",
"Bitmap",
"bitmap",
"=",
"noxItemCatalog",
".",
"getBitmap",
"(",
"position",
")",
";",
"canvas",
".",
"drawBitmap",
"(",
"bitmap",
",",
"left",
",",
"top",
",",
"paint",
")",
";",
"}",
"else",
"if",
"(",
"noxItemCatalog",
".",
"isDrawableReady",
"(",
"position",
")",
")",
"{",
"Drawable",
"drawable",
"=",
"noxItemCatalog",
".",
"getDrawable",
"(",
"position",
")",
";",
"drawNoxItemDrawable",
"(",
"canvas",
",",
"(",
"int",
")",
"left",
",",
"(",
"int",
")",
"top",
",",
"drawable",
")",
";",
"}",
"else",
"if",
"(",
"noxItemCatalog",
".",
"isPlaceholderReady",
"(",
"position",
")",
")",
"{",
"Drawable",
"drawable",
"=",
"noxItemCatalog",
".",
"getPlaceholder",
"(",
"position",
")",
";",
"drawNoxItemDrawable",
"(",
"canvas",
",",
"(",
"int",
")",
"left",
",",
"(",
"int",
")",
"top",
",",
"drawable",
")",
";",
"}",
"}"
] |
Draws a NoxItem during the onDraw method.
|
[
"Draws",
"a",
"NoxItem",
"during",
"the",
"onDraw",
"method",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L336-L347
|
11,066
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.drawNoxItemDrawable
|
private void drawNoxItemDrawable(Canvas canvas, int left, int top, Drawable drawable) {
if (drawable != null) {
int itemSize = (int) noxConfig.getNoxItemSize();
drawable.setBounds(left, top, left + itemSize, top + itemSize);
drawable.draw(canvas);
}
}
|
java
|
private void drawNoxItemDrawable(Canvas canvas, int left, int top, Drawable drawable) {
if (drawable != null) {
int itemSize = (int) noxConfig.getNoxItemSize();
drawable.setBounds(left, top, left + itemSize, top + itemSize);
drawable.draw(canvas);
}
}
|
[
"private",
"void",
"drawNoxItemDrawable",
"(",
"Canvas",
"canvas",
",",
"int",
"left",
",",
"int",
"top",
",",
"Drawable",
"drawable",
")",
"{",
"if",
"(",
"drawable",
"!=",
"null",
")",
"{",
"int",
"itemSize",
"=",
"(",
"int",
")",
"noxConfig",
".",
"getNoxItemSize",
"(",
")",
";",
"drawable",
".",
"setBounds",
"(",
"left",
",",
"top",
",",
"left",
"+",
"itemSize",
",",
"top",
"+",
"itemSize",
")",
";",
"drawable",
".",
"draw",
"(",
"canvas",
")",
";",
"}",
"}"
] |
Draws a NoxItem drawable during the onDraw method given a canvas object and all the
information needed to draw the Drawable passed as parameter.
|
[
"Draws",
"a",
"NoxItem",
"drawable",
"during",
"the",
"onDraw",
"method",
"given",
"a",
"canvas",
"object",
"and",
"all",
"the",
"information",
"needed",
"to",
"draw",
"the",
"Drawable",
"passed",
"as",
"parameter",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L353-L359
|
11,067
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.createShape
|
private void createShape() {
if (shape == null) {
float firstItemMargin = noxConfig.getNoxItemMargin();
float firstItemSize = noxConfig.getNoxItemSize();
int viewHeight = getMeasuredHeight();
int viewWidth = getMeasuredWidth();
int numberOfElements = noxItemCatalog.size();
ShapeConfig shapeConfig =
new ShapeConfig(numberOfElements, viewWidth, viewHeight, firstItemSize, firstItemMargin);
shape = ShapeFactory.getShapeByKey(defaultShapeKey, shapeConfig);
} else {
shape.setNumberOfElements(noxItemCatalog.size());
}
shape.calculate();
}
|
java
|
private void createShape() {
if (shape == null) {
float firstItemMargin = noxConfig.getNoxItemMargin();
float firstItemSize = noxConfig.getNoxItemSize();
int viewHeight = getMeasuredHeight();
int viewWidth = getMeasuredWidth();
int numberOfElements = noxItemCatalog.size();
ShapeConfig shapeConfig =
new ShapeConfig(numberOfElements, viewWidth, viewHeight, firstItemSize, firstItemMargin);
shape = ShapeFactory.getShapeByKey(defaultShapeKey, shapeConfig);
} else {
shape.setNumberOfElements(noxItemCatalog.size());
}
shape.calculate();
}
|
[
"private",
"void",
"createShape",
"(",
")",
"{",
"if",
"(",
"shape",
"==",
"null",
")",
"{",
"float",
"firstItemMargin",
"=",
"noxConfig",
".",
"getNoxItemMargin",
"(",
")",
";",
"float",
"firstItemSize",
"=",
"noxConfig",
".",
"getNoxItemSize",
"(",
")",
";",
"int",
"viewHeight",
"=",
"getMeasuredHeight",
"(",
")",
";",
"int",
"viewWidth",
"=",
"getMeasuredWidth",
"(",
")",
";",
"int",
"numberOfElements",
"=",
"noxItemCatalog",
".",
"size",
"(",
")",
";",
"ShapeConfig",
"shapeConfig",
"=",
"new",
"ShapeConfig",
"(",
"numberOfElements",
",",
"viewWidth",
",",
"viewHeight",
",",
"firstItemSize",
",",
"firstItemMargin",
")",
";",
"shape",
"=",
"ShapeFactory",
".",
"getShapeByKey",
"(",
"defaultShapeKey",
",",
"shapeConfig",
")",
";",
"}",
"else",
"{",
"shape",
".",
"setNumberOfElements",
"(",
"noxItemCatalog",
".",
"size",
"(",
")",
")",
";",
"}",
"shape",
".",
"calculate",
"(",
")",
";",
"}"
] |
Initializes a Shape instance given the NoxView configuration provided programmatically or
using XML styleable attributes.
|
[
"Initializes",
"a",
"Shape",
"instance",
"given",
"the",
"NoxView",
"configuration",
"provided",
"programmatically",
"or",
"using",
"XML",
"styleable",
"attributes",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L365-L379
|
11,068
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeNoxViewConfig
|
private void initializeNoxViewConfig(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
noxConfig = new NoxConfig();
TypedArray attributes = context.getTheme()
.obtainStyledAttributes(attrs, R.styleable.nox, defStyleAttr, defStyleRes);
initializeNoxItemSize(attributes);
initializeNoxItemMargin(attributes);
initializeNoxItemPlaceholder(attributes);
initializeShapeConfig(attributes);
initializeTransformationConfig(attributes);
attributes.recycle();
}
|
java
|
private void initializeNoxViewConfig(Context context, AttributeSet attrs, int defStyleAttr,
int defStyleRes) {
noxConfig = new NoxConfig();
TypedArray attributes = context.getTheme()
.obtainStyledAttributes(attrs, R.styleable.nox, defStyleAttr, defStyleRes);
initializeNoxItemSize(attributes);
initializeNoxItemMargin(attributes);
initializeNoxItemPlaceholder(attributes);
initializeShapeConfig(attributes);
initializeTransformationConfig(attributes);
attributes.recycle();
}
|
[
"private",
"void",
"initializeNoxViewConfig",
"(",
"Context",
"context",
",",
"AttributeSet",
"attrs",
",",
"int",
"defStyleAttr",
",",
"int",
"defStyleRes",
")",
"{",
"noxConfig",
"=",
"new",
"NoxConfig",
"(",
")",
";",
"TypedArray",
"attributes",
"=",
"context",
".",
"getTheme",
"(",
")",
".",
"obtainStyledAttributes",
"(",
"attrs",
",",
"R",
".",
"styleable",
".",
"nox",
",",
"defStyleAttr",
",",
"defStyleRes",
")",
";",
"initializeNoxItemSize",
"(",
"attributes",
")",
";",
"initializeNoxItemMargin",
"(",
"attributes",
")",
";",
"initializeNoxItemPlaceholder",
"(",
"attributes",
")",
";",
"initializeShapeConfig",
"(",
"attributes",
")",
";",
"initializeTransformationConfig",
"(",
"attributes",
")",
";",
"attributes",
".",
"recycle",
"(",
")",
";",
"}"
] |
Initializes a NoxConfig instance given the NoxView configuration provided programmatically or
using XML styleable attributes.
|
[
"Initializes",
"a",
"NoxConfig",
"instance",
"given",
"the",
"NoxView",
"configuration",
"provided",
"programmatically",
"or",
"using",
"XML",
"styleable",
"attributes",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L385-L396
|
11,069
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeNoxItemSize
|
private void initializeNoxItemSize(TypedArray attributes) {
float noxItemSizeDefaultValue = getResources().getDimension(R.dimen.default_nox_item_size);
float noxItemSize = attributes.getDimension(R.styleable.nox_item_size, noxItemSizeDefaultValue);
noxConfig.setNoxItemSize(noxItemSize);
}
|
java
|
private void initializeNoxItemSize(TypedArray attributes) {
float noxItemSizeDefaultValue = getResources().getDimension(R.dimen.default_nox_item_size);
float noxItemSize = attributes.getDimension(R.styleable.nox_item_size, noxItemSizeDefaultValue);
noxConfig.setNoxItemSize(noxItemSize);
}
|
[
"private",
"void",
"initializeNoxItemSize",
"(",
"TypedArray",
"attributes",
")",
"{",
"float",
"noxItemSizeDefaultValue",
"=",
"getResources",
"(",
")",
".",
"getDimension",
"(",
"R",
".",
"dimen",
".",
"default_nox_item_size",
")",
";",
"float",
"noxItemSize",
"=",
"attributes",
".",
"getDimension",
"(",
"R",
".",
"styleable",
".",
"nox_item_size",
",",
"noxItemSizeDefaultValue",
")",
";",
"noxConfig",
".",
"setNoxItemSize",
"(",
"noxItemSize",
")",
";",
"}"
] |
Configures the nox item default size used in NoxConfig, Shape and NoxItemCatalog to draw nox
item instances during the onDraw execution.
|
[
"Configures",
"the",
"nox",
"item",
"default",
"size",
"used",
"in",
"NoxConfig",
"Shape",
"and",
"NoxItemCatalog",
"to",
"draw",
"nox",
"item",
"instances",
"during",
"the",
"onDraw",
"execution",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L402-L406
|
11,070
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeNoxItemMargin
|
private void initializeNoxItemMargin(TypedArray attributes) {
float noxItemMarginDefaultValue = getResources().getDimension(R.dimen.default_nox_item_margin);
float noxItemMargin =
attributes.getDimension(R.styleable.nox_item_margin, noxItemMarginDefaultValue);
noxConfig.setNoxItemMargin(noxItemMargin);
}
|
java
|
private void initializeNoxItemMargin(TypedArray attributes) {
float noxItemMarginDefaultValue = getResources().getDimension(R.dimen.default_nox_item_margin);
float noxItemMargin =
attributes.getDimension(R.styleable.nox_item_margin, noxItemMarginDefaultValue);
noxConfig.setNoxItemMargin(noxItemMargin);
}
|
[
"private",
"void",
"initializeNoxItemMargin",
"(",
"TypedArray",
"attributes",
")",
"{",
"float",
"noxItemMarginDefaultValue",
"=",
"getResources",
"(",
")",
".",
"getDimension",
"(",
"R",
".",
"dimen",
".",
"default_nox_item_margin",
")",
";",
"float",
"noxItemMargin",
"=",
"attributes",
".",
"getDimension",
"(",
"R",
".",
"styleable",
".",
"nox_item_margin",
",",
"noxItemMarginDefaultValue",
")",
";",
"noxConfig",
".",
"setNoxItemMargin",
"(",
"noxItemMargin",
")",
";",
"}"
] |
Configures the nox item default margin used in NoxConfig, Shape and NoxItemCatalog to draw nox
item instances during the onDraw execution.
|
[
"Configures",
"the",
"nox",
"item",
"default",
"margin",
"used",
"in",
"NoxConfig",
"Shape",
"and",
"NoxItemCatalog",
"to",
"draw",
"nox",
"item",
"instances",
"during",
"the",
"onDraw",
"execution",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L412-L417
|
11,071
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeNoxItemPlaceholder
|
private void initializeNoxItemPlaceholder(TypedArray attributes) {
Drawable placeholder = attributes.getDrawable(R.styleable.nox_item_placeholder);
if (placeholder == null) {
placeholder = getContext().getResources().getDrawable(R.drawable.ic_nox);
}
noxConfig.setPlaceholder(placeholder);
}
|
java
|
private void initializeNoxItemPlaceholder(TypedArray attributes) {
Drawable placeholder = attributes.getDrawable(R.styleable.nox_item_placeholder);
if (placeholder == null) {
placeholder = getContext().getResources().getDrawable(R.drawable.ic_nox);
}
noxConfig.setPlaceholder(placeholder);
}
|
[
"private",
"void",
"initializeNoxItemPlaceholder",
"(",
"TypedArray",
"attributes",
")",
"{",
"Drawable",
"placeholder",
"=",
"attributes",
".",
"getDrawable",
"(",
"R",
".",
"styleable",
".",
"nox_item_placeholder",
")",
";",
"if",
"(",
"placeholder",
"==",
"null",
")",
"{",
"placeholder",
"=",
"getContext",
"(",
")",
".",
"getResources",
"(",
")",
".",
"getDrawable",
"(",
"R",
".",
"drawable",
".",
"ic_nox",
")",
";",
"}",
"noxConfig",
".",
"setPlaceholder",
"(",
"placeholder",
")",
";",
"}"
] |
Configures the placeholder used if there is no another placeholder configured in the NoxItem
instances during the onDraw execution.
|
[
"Configures",
"the",
"placeholder",
"used",
"if",
"there",
"is",
"no",
"another",
"placeholder",
"configured",
"in",
"the",
"NoxItem",
"instances",
"during",
"the",
"onDraw",
"execution",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L423-L429
|
11,072
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeShapeConfig
|
private void initializeShapeConfig(TypedArray attributes) {
defaultShapeKey =
attributes.getInteger(R.styleable.nox_shape, ShapeFactory.FIXED_CIRCULAR_SHAPE_KEY);
}
|
java
|
private void initializeShapeConfig(TypedArray attributes) {
defaultShapeKey =
attributes.getInteger(R.styleable.nox_shape, ShapeFactory.FIXED_CIRCULAR_SHAPE_KEY);
}
|
[
"private",
"void",
"initializeShapeConfig",
"(",
"TypedArray",
"attributes",
")",
"{",
"defaultShapeKey",
"=",
"attributes",
".",
"getInteger",
"(",
"R",
".",
"styleable",
".",
"nox_shape",
",",
"ShapeFactory",
".",
"FIXED_CIRCULAR_SHAPE_KEY",
")",
";",
"}"
] |
Configures the Shape used to show the list of NoxItems.
|
[
"Configures",
"the",
"Shape",
"used",
"to",
"show",
"the",
"list",
"of",
"NoxItems",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L434-L437
|
11,073
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.initializeTransformationConfig
|
private void initializeTransformationConfig(TypedArray attributes) {
useCircularTransformation =
attributes.getBoolean(R.styleable.nox_use_circular_transformation, true);
}
|
java
|
private void initializeTransformationConfig(TypedArray attributes) {
useCircularTransformation =
attributes.getBoolean(R.styleable.nox_use_circular_transformation, true);
}
|
[
"private",
"void",
"initializeTransformationConfig",
"(",
"TypedArray",
"attributes",
")",
"{",
"useCircularTransformation",
"=",
"attributes",
".",
"getBoolean",
"(",
"R",
".",
"styleable",
".",
"nox_use_circular_transformation",
",",
"true",
")",
";",
"}"
] |
Configures the visual transformation applied to the NoxItem resources loaded, images
downloaded from the internet and resources loaded from the system.
|
[
"Configures",
"the",
"visual",
"transformation",
"applied",
"to",
"the",
"NoxItem",
"resources",
"loaded",
"images",
"downloaded",
"from",
"the",
"internet",
"and",
"resources",
"loaded",
"from",
"the",
"system",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L443-L446
|
11,074
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxView.java
|
NoxView.getGestureDetectorCompat
|
private GestureDetectorCompat getGestureDetectorCompat() {
if (gestureDetector == null) {
GestureDetector.OnGestureListener gestureListener = new SimpleOnGestureListener() {
@Override public boolean onSingleTapUp(MotionEvent e) {
boolean handled = false;
int position = shape.getNoxItemHit(e.getX(), e.getY());
if (position >= 0) {
handled = true;
NoxItem noxItem = noxItemCatalog.getNoxItem(position);
listener.onNoxItemClicked(position, noxItem);
}
return handled;
}
};
gestureDetector = new GestureDetectorCompat(getContext(), gestureListener);
}
return gestureDetector;
}
|
java
|
private GestureDetectorCompat getGestureDetectorCompat() {
if (gestureDetector == null) {
GestureDetector.OnGestureListener gestureListener = new SimpleOnGestureListener() {
@Override public boolean onSingleTapUp(MotionEvent e) {
boolean handled = false;
int position = shape.getNoxItemHit(e.getX(), e.getY());
if (position >= 0) {
handled = true;
NoxItem noxItem = noxItemCatalog.getNoxItem(position);
listener.onNoxItemClicked(position, noxItem);
}
return handled;
}
};
gestureDetector = new GestureDetectorCompat(getContext(), gestureListener);
}
return gestureDetector;
}
|
[
"private",
"GestureDetectorCompat",
"getGestureDetectorCompat",
"(",
")",
"{",
"if",
"(",
"gestureDetector",
"==",
"null",
")",
"{",
"GestureDetector",
".",
"OnGestureListener",
"gestureListener",
"=",
"new",
"SimpleOnGestureListener",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"onSingleTapUp",
"(",
"MotionEvent",
"e",
")",
"{",
"boolean",
"handled",
"=",
"false",
";",
"int",
"position",
"=",
"shape",
".",
"getNoxItemHit",
"(",
"e",
".",
"getX",
"(",
")",
",",
"e",
".",
"getY",
"(",
")",
")",
";",
"if",
"(",
"position",
">=",
"0",
")",
"{",
"handled",
"=",
"true",
";",
"NoxItem",
"noxItem",
"=",
"noxItemCatalog",
".",
"getNoxItem",
"(",
"position",
")",
";",
"listener",
".",
"onNoxItemClicked",
"(",
"position",
",",
"noxItem",
")",
";",
"}",
"return",
"handled",
";",
"}",
"}",
";",
"gestureDetector",
"=",
"new",
"GestureDetectorCompat",
"(",
"getContext",
"(",
")",
",",
"gestureListener",
")",
";",
"}",
"return",
"gestureDetector",
";",
"}"
] |
Returns a GestureDetectorCompat lazy instantiated created to handle single tap events and
detect if a NoxItem has been clicked to notify the previously configured listener.
|
[
"Returns",
"a",
"GestureDetectorCompat",
"lazy",
"instantiated",
"created",
"to",
"handle",
"single",
"tap",
"events",
"and",
"detect",
"if",
"a",
"NoxItem",
"has",
"been",
"clicked",
"to",
"notify",
"the",
"previously",
"configured",
"listener",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxView.java#L470-L488
|
11,075
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java
|
FilterChain.traverseAndFilter
|
public void traverseAndFilter(final TreeWalker walker, final String indent, final Metadata metadata,
final StringBuilder sb) {
final Node parend = walker.getCurrentNode();
final boolean isLogged = appendText(indent, (Element) parend, sb);
for (final Filter filter : filterList) {
if (filter.filter(metadata, walker)) {
appendText(" catched by: " + filter.getClass().getSimpleName(), sb);
break;
}
}
if (isLogged) {
appendText("\n", sb);
}
for (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) {
traverseAndFilter(walker, indent + " ", metadata, sb);
}
walker.setCurrentNode(parend);
}
|
java
|
public void traverseAndFilter(final TreeWalker walker, final String indent, final Metadata metadata,
final StringBuilder sb) {
final Node parend = walker.getCurrentNode();
final boolean isLogged = appendText(indent, (Element) parend, sb);
for (final Filter filter : filterList) {
if (filter.filter(metadata, walker)) {
appendText(" catched by: " + filter.getClass().getSimpleName(), sb);
break;
}
}
if (isLogged) {
appendText("\n", sb);
}
for (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) {
traverseAndFilter(walker, indent + " ", metadata, sb);
}
walker.setCurrentNode(parend);
}
|
[
"public",
"void",
"traverseAndFilter",
"(",
"final",
"TreeWalker",
"walker",
",",
"final",
"String",
"indent",
",",
"final",
"Metadata",
"metadata",
",",
"final",
"StringBuilder",
"sb",
")",
"{",
"final",
"Node",
"parend",
"=",
"walker",
".",
"getCurrentNode",
"(",
")",
";",
"final",
"boolean",
"isLogged",
"=",
"appendText",
"(",
"indent",
",",
"(",
"Element",
")",
"parend",
",",
"sb",
")",
";",
"for",
"(",
"final",
"Filter",
"filter",
":",
"filterList",
")",
"{",
"if",
"(",
"filter",
".",
"filter",
"(",
"metadata",
",",
"walker",
")",
")",
"{",
"appendText",
"(",
"\" catched by: \"",
"+",
"filter",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
",",
"sb",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"isLogged",
")",
"{",
"appendText",
"(",
"\"\\n\"",
",",
"sb",
")",
";",
"}",
"for",
"(",
"Node",
"n",
"=",
"walker",
".",
"firstChild",
"(",
")",
";",
"n",
"!=",
"null",
";",
"n",
"=",
"walker",
".",
"nextSibling",
"(",
")",
")",
"{",
"traverseAndFilter",
"(",
"walker",
",",
"indent",
"+",
"\" \"",
",",
"metadata",
",",
"sb",
")",
";",
"}",
"walker",
".",
"setCurrentNode",
"(",
"parend",
")",
";",
"}"
] |
Traverses the DOM and applies the filters for each visited node.
@param walker
@param indent
@param sb
Optional {@link StringBuilder} used to track progress for logging purposes.
|
[
"Traverses",
"the",
"DOM",
"and",
"applies",
"the",
"filters",
"for",
"each",
"visited",
"node",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java#L57-L80
|
11,076
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java
|
FilterChain.appendText
|
private boolean appendText(final String text, final StringBuilder sb) {
if (sb != null) {
if (text != null && text.indexOf(":annotation") < 0 && text.indexOf(":documentation") < 0) {
sb.append(text);
return true;
}
}
return false;
}
|
java
|
private boolean appendText(final String text, final StringBuilder sb) {
if (sb != null) {
if (text != null && text.indexOf(":annotation") < 0 && text.indexOf(":documentation") < 0) {
sb.append(text);
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"appendText",
"(",
"final",
"String",
"text",
",",
"final",
"StringBuilder",
"sb",
")",
"{",
"if",
"(",
"sb",
"!=",
"null",
")",
"{",
"if",
"(",
"text",
"!=",
"null",
"&&",
"text",
".",
"indexOf",
"(",
"\":annotation\"",
")",
"<",
"0",
"&&",
"text",
".",
"indexOf",
"(",
"\":documentation\"",
")",
"<",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"text",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Appends the given text.
|
[
"Appends",
"the",
"given",
"text",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java#L89-L97
|
11,077
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java
|
FilterChain.appendText
|
private boolean appendText(final String indent, final Element element, final StringBuilder sb) {
if (sb != null) {
if (element.getTagName().indexOf(":annotation") < 0 && element.getTagName().indexOf(":documentation") < 0) {
sb.append(String.format(ELEMENT_LOG, indent, element.getTagName(), element.getAttribute("name")));
return true;
}
}
return false;
}
|
java
|
private boolean appendText(final String indent, final Element element, final StringBuilder sb) {
if (sb != null) {
if (element.getTagName().indexOf(":annotation") < 0 && element.getTagName().indexOf(":documentation") < 0) {
sb.append(String.format(ELEMENT_LOG, indent, element.getTagName(), element.getAttribute("name")));
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"appendText",
"(",
"final",
"String",
"indent",
",",
"final",
"Element",
"element",
",",
"final",
"StringBuilder",
"sb",
")",
"{",
"if",
"(",
"sb",
"!=",
"null",
")",
"{",
"if",
"(",
"element",
".",
"getTagName",
"(",
")",
".",
"indexOf",
"(",
"\":annotation\"",
")",
"<",
"0",
"&&",
"element",
".",
"getTagName",
"(",
")",
".",
"indexOf",
"(",
"\":documentation\"",
")",
"<",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"String",
".",
"format",
"(",
"ELEMENT_LOG",
",",
"indent",
",",
"element",
".",
"getTagName",
"(",
")",
",",
"element",
".",
"getAttribute",
"(",
"\"name\"",
")",
")",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Appends the given element.
|
[
"Appends",
"the",
"given",
"element",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/FilterChain.java#L102-L110
|
11,078
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java
|
ConnectionUtils.addProviderProfileInfo
|
public static void addProviderProfileInfo(Profile profile, UserProfile providerProfile) {
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
}
|
java
|
public static void addProviderProfileInfo(Profile profile, UserProfile providerProfile) {
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
}
|
[
"public",
"static",
"void",
"addProviderProfileInfo",
"(",
"Profile",
"profile",
",",
"UserProfile",
"providerProfile",
")",
"{",
"String",
"email",
"=",
"providerProfile",
".",
"getEmail",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"email",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No email included in provider profile\"",
")",
";",
"}",
"String",
"username",
"=",
"providerProfile",
".",
"getUsername",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"username",
")",
")",
"{",
"username",
"=",
"email",
";",
"}",
"String",
"firstName",
"=",
"providerProfile",
".",
"getFirstName",
"(",
")",
";",
"String",
"lastName",
"=",
"providerProfile",
".",
"getLastName",
"(",
")",
";",
"profile",
".",
"setUsername",
"(",
"username",
")",
";",
"profile",
".",
"setEmail",
"(",
"email",
")",
";",
"profile",
".",
"setAttribute",
"(",
"FIRST_NAME_ATTRIBUTE_NAME",
",",
"firstName",
")",
";",
"profile",
".",
"setAttribute",
"(",
"LAST_NAME_ATTRIBUTE_NAME",
",",
"lastName",
")",
";",
"}"
] |
Adds the info from the provider profile to the specified profile.
@param profile the target profile
@param providerProfile the provider profile where to get the info
|
[
"Adds",
"the",
"info",
"from",
"the",
"provider",
"profile",
"to",
"the",
"specified",
"profile",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java#L217-L235
|
11,079
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java
|
ConnectionUtils.createProfile
|
public static Profile createProfile(Connection<?> connection) {
Profile profile = new Profile();
UserProfile providerProfile = connection.fetchUserProfile();
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
String displayName;
if (StringUtils.isNotEmpty(connection.getDisplayName())) {
displayName = connection.getDisplayName();
} else {
displayName = firstName + " " + lastName;
}
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
profile.setAttribute(DISPLAY_NAME_ATTRIBUTE_NAME, displayName);
if (StringUtils.isNotEmpty(connection.getImageUrl())) {
profile.setAttribute(AVATAR_LINK_ATTRIBUTE_NAME, connection.getImageUrl());
}
return profile;
}
|
java
|
public static Profile createProfile(Connection<?> connection) {
Profile profile = new Profile();
UserProfile providerProfile = connection.fetchUserProfile();
String email = providerProfile.getEmail();
if (StringUtils.isEmpty(email)) {
throw new IllegalStateException("No email included in provider profile");
}
String username = providerProfile.getUsername();
if (StringUtils.isEmpty(username)) {
username = email;
}
String firstName = providerProfile.getFirstName();
String lastName = providerProfile.getLastName();
String displayName;
if (StringUtils.isNotEmpty(connection.getDisplayName())) {
displayName = connection.getDisplayName();
} else {
displayName = firstName + " " + lastName;
}
profile.setUsername(username);
profile.setEmail(email);
profile.setAttribute(FIRST_NAME_ATTRIBUTE_NAME, firstName);
profile.setAttribute(LAST_NAME_ATTRIBUTE_NAME, lastName);
profile.setAttribute(DISPLAY_NAME_ATTRIBUTE_NAME, displayName);
if (StringUtils.isNotEmpty(connection.getImageUrl())) {
profile.setAttribute(AVATAR_LINK_ATTRIBUTE_NAME, connection.getImageUrl());
}
return profile;
}
|
[
"public",
"static",
"Profile",
"createProfile",
"(",
"Connection",
"<",
"?",
">",
"connection",
")",
"{",
"Profile",
"profile",
"=",
"new",
"Profile",
"(",
")",
";",
"UserProfile",
"providerProfile",
"=",
"connection",
".",
"fetchUserProfile",
"(",
")",
";",
"String",
"email",
"=",
"providerProfile",
".",
"getEmail",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"email",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No email included in provider profile\"",
")",
";",
"}",
"String",
"username",
"=",
"providerProfile",
".",
"getUsername",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"username",
")",
")",
"{",
"username",
"=",
"email",
";",
"}",
"String",
"firstName",
"=",
"providerProfile",
".",
"getFirstName",
"(",
")",
";",
"String",
"lastName",
"=",
"providerProfile",
".",
"getLastName",
"(",
")",
";",
"String",
"displayName",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"connection",
".",
"getDisplayName",
"(",
")",
")",
")",
"{",
"displayName",
"=",
"connection",
".",
"getDisplayName",
"(",
")",
";",
"}",
"else",
"{",
"displayName",
"=",
"firstName",
"+",
"\" \"",
"+",
"lastName",
";",
"}",
"profile",
".",
"setUsername",
"(",
"username",
")",
";",
"profile",
".",
"setEmail",
"(",
"email",
")",
";",
"profile",
".",
"setAttribute",
"(",
"FIRST_NAME_ATTRIBUTE_NAME",
",",
"firstName",
")",
";",
"profile",
".",
"setAttribute",
"(",
"LAST_NAME_ATTRIBUTE_NAME",
",",
"lastName",
")",
";",
"profile",
".",
"setAttribute",
"(",
"DISPLAY_NAME_ATTRIBUTE_NAME",
",",
"displayName",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"connection",
".",
"getImageUrl",
"(",
")",
")",
")",
"{",
"profile",
".",
"setAttribute",
"(",
"AVATAR_LINK_ATTRIBUTE_NAME",
",",
"connection",
".",
"getImageUrl",
"(",
")",
")",
";",
"}",
"return",
"profile",
";",
"}"
] |
Creates a profile from the specified connection.
@param connection the connection where to retrieve the profile info from
@return the created profile
|
[
"Creates",
"a",
"profile",
"from",
"the",
"specified",
"connection",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/social/ConnectionUtils.java#L244-L279
|
11,080
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/authorization/impl/AccessDeniedHandlerImpl.java
|
AccessDeniedHandlerImpl.handle
|
@Override
public void handle(RequestContext context, AccessDeniedException e) throws SecurityProviderException, IOException {
saveException(context, e);
if (StringUtils.isNotEmpty(getErrorPageUrl())) {
forwardToErrorPage(context);
} else {
sendError(e, context);
}
}
|
java
|
@Override
public void handle(RequestContext context, AccessDeniedException e) throws SecurityProviderException, IOException {
saveException(context, e);
if (StringUtils.isNotEmpty(getErrorPageUrl())) {
forwardToErrorPage(context);
} else {
sendError(e, context);
}
}
|
[
"@",
"Override",
"public",
"void",
"handle",
"(",
"RequestContext",
"context",
",",
"AccessDeniedException",
"e",
")",
"throws",
"SecurityProviderException",
",",
"IOException",
"{",
"saveException",
"(",
"context",
",",
"e",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"getErrorPageUrl",
"(",
")",
")",
")",
"{",
"forwardToErrorPage",
"(",
"context",
")",
";",
"}",
"else",
"{",
"sendError",
"(",
"e",
",",
"context",
")",
";",
"}",
"}"
] |
Forwards to the error page, but if not error page was specified, a 403 error is sent.
@param context the request context
@param e the exception with the reason of the access deny
|
[
"Forwards",
"to",
"the",
"error",
"page",
"but",
"if",
"not",
"error",
"page",
"was",
"specified",
"a",
"403",
"error",
"is",
"sent",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/authorization/impl/AccessDeniedHandlerImpl.java#L67-L76
|
11,081
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/authentication/impl/LoginFailureHandlerImpl.java
|
LoginFailureHandlerImpl.handle
|
@Override
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException,
IOException {
String targetUrl = getTargetUrl();
if (StringUtils.isNotEmpty(targetUrl)) {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), targetUrl);
} else {
sendError(e, context);
}
}
|
java
|
@Override
public void handle(RequestContext context, AuthenticationException e) throws SecurityProviderException,
IOException {
String targetUrl = getTargetUrl();
if (StringUtils.isNotEmpty(targetUrl)) {
RedirectUtils.redirect(context.getRequest(), context.getResponse(), targetUrl);
} else {
sendError(e, context);
}
}
|
[
"@",
"Override",
"public",
"void",
"handle",
"(",
"RequestContext",
"context",
",",
"AuthenticationException",
"e",
")",
"throws",
"SecurityProviderException",
",",
"IOException",
"{",
"String",
"targetUrl",
"=",
"getTargetUrl",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"targetUrl",
")",
")",
"{",
"RedirectUtils",
".",
"redirect",
"(",
"context",
".",
"getRequest",
"(",
")",
",",
"context",
".",
"getResponse",
"(",
")",
",",
"targetUrl",
")",
";",
"}",
"else",
"{",
"sendError",
"(",
"e",
",",
"context",
")",
";",
"}",
"}"
] |
Redirects the response to target URL if target URL is not empty. If not, a 401 UNAUTHORIZED error is sent.
@param context the request context
@param e the exception that caused the login to fail.
|
[
"Redirects",
"the",
"response",
"to",
"target",
"URL",
"if",
"target",
"URL",
"is",
"not",
"empty",
".",
"If",
"not",
"a",
"401",
"UNAUTHORIZED",
"error",
"is",
"sent",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/authentication/impl/LoginFailureHandlerImpl.java#L61-L70
|
11,082
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.getBitmap
|
Bitmap getBitmap(int position) {
return bitmaps[position] != null ? bitmaps[position].get() : null;
}
|
java
|
Bitmap getBitmap(int position) {
return bitmaps[position] != null ? bitmaps[position].get() : null;
}
|
[
"Bitmap",
"getBitmap",
"(",
"int",
"position",
")",
"{",
"return",
"bitmaps",
"[",
"position",
"]",
"!=",
"null",
"?",
"bitmaps",
"[",
"position",
"]",
".",
"get",
"(",
")",
":",
"null",
";",
"}"
] |
Returns the bitmap associated to a NoxItem instance given a position or null if the resource
wasn't downloaded.
|
[
"Returns",
"the",
"bitmap",
"associated",
"to",
"a",
"NoxItem",
"instance",
"given",
"a",
"position",
"or",
"null",
"if",
"the",
"resource",
"wasn",
"t",
"downloaded",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L98-L100
|
11,083
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.getPlaceholder
|
Drawable getPlaceholder(int position) {
Drawable placeholder = placeholders[position];
if (placeholder == null && defaultPlaceholder != null) {
Drawable clone = defaultPlaceholder.getConstantState().newDrawable();
placeholders[position] = clone;
placeholder = clone;
}
return placeholder;
}
|
java
|
Drawable getPlaceholder(int position) {
Drawable placeholder = placeholders[position];
if (placeholder == null && defaultPlaceholder != null) {
Drawable clone = defaultPlaceholder.getConstantState().newDrawable();
placeholders[position] = clone;
placeholder = clone;
}
return placeholder;
}
|
[
"Drawable",
"getPlaceholder",
"(",
"int",
"position",
")",
"{",
"Drawable",
"placeholder",
"=",
"placeholders",
"[",
"position",
"]",
";",
"if",
"(",
"placeholder",
"==",
"null",
"&&",
"defaultPlaceholder",
"!=",
"null",
")",
"{",
"Drawable",
"clone",
"=",
"defaultPlaceholder",
".",
"getConstantState",
"(",
")",
".",
"newDrawable",
"(",
")",
";",
"placeholders",
"[",
"position",
"]",
"=",
"clone",
";",
"placeholder",
"=",
"clone",
";",
"}",
"return",
"placeholder",
";",
"}"
] |
Returns the defaultPlaceholder associated to a NoxItem instance given a position or null if
the resource wasn't downloaded or previously configured.
|
[
"Returns",
"the",
"defaultPlaceholder",
"associated",
"to",
"a",
"NoxItem",
"instance",
"given",
"a",
"position",
"or",
"null",
"if",
"the",
"resource",
"wasn",
"t",
"downloaded",
"or",
"previously",
"configured",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L114-L122
|
11,084
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.load
|
void load(int position, boolean useCircularTransformation) {
if (isDownloading(position)) {
return;
}
NoxItem noxItem = noxItems.get(position);
if ((noxItem.hasUrl() && !isBitmapReady(position))
|| noxItem.hasResourceId() && !isDrawableReady(position)) {
loading[position] = true;
loadNoxItem(position, noxItem, useCircularTransformation);
}
}
|
java
|
void load(int position, boolean useCircularTransformation) {
if (isDownloading(position)) {
return;
}
NoxItem noxItem = noxItems.get(position);
if ((noxItem.hasUrl() && !isBitmapReady(position))
|| noxItem.hasResourceId() && !isDrawableReady(position)) {
loading[position] = true;
loadNoxItem(position, noxItem, useCircularTransformation);
}
}
|
[
"void",
"load",
"(",
"int",
"position",
",",
"boolean",
"useCircularTransformation",
")",
"{",
"if",
"(",
"isDownloading",
"(",
"position",
")",
")",
"{",
"return",
";",
"}",
"NoxItem",
"noxItem",
"=",
"noxItems",
".",
"get",
"(",
"position",
")",
";",
"if",
"(",
"(",
"noxItem",
".",
"hasUrl",
"(",
")",
"&&",
"!",
"isBitmapReady",
"(",
"position",
")",
")",
"||",
"noxItem",
".",
"hasResourceId",
"(",
")",
"&&",
"!",
"isDrawableReady",
"(",
"position",
")",
")",
"{",
"loading",
"[",
"position",
"]",
"=",
"true",
";",
"loadNoxItem",
"(",
"position",
",",
"noxItem",
",",
"useCircularTransformation",
")",
";",
"}",
"}"
] |
Given a position associated to a NoxItem starts the NoxItem resources download. This load will
download the resources associated to the NoxItem only if wasn't previously downloaded or the
download is not being performed.
|
[
"Given",
"a",
"position",
"associated",
"to",
"a",
"NoxItem",
"starts",
"the",
"NoxItem",
"resources",
"download",
".",
"This",
"load",
"will",
"download",
"the",
"resources",
"associated",
"to",
"the",
"NoxItem",
"only",
"if",
"wasn",
"t",
"previously",
"downloaded",
"or",
"the",
"download",
"is",
"not",
"being",
"performed",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L137-L147
|
11,085
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.recreate
|
public void recreate() {
int newSize = noxItems.size();
WeakReference<Bitmap> newBitmaps[] = new WeakReference[newSize];
Drawable newDrawables[] = new Drawable[newSize];
Drawable newPlaceholders[] = new Drawable[newSize];
boolean newLoadings[] = new boolean[newSize];
ImageLoader.Listener newListeners[] = new ImageLoader.Listener[newSize];
float length = Math.min(bitmaps.length, newSize);
for (int i = 0; i < length; i++) {
newBitmaps[i] = bitmaps[i];
newDrawables[i] = drawables[i];
newPlaceholders[i] = placeholders[i];
newLoadings[i] = loading[i];
newListeners[i] = listeners[i];
}
bitmaps = newBitmaps;
drawables = newDrawables;
placeholders = newPlaceholders;
loading = newLoadings;
listeners = newListeners;
}
|
java
|
public void recreate() {
int newSize = noxItems.size();
WeakReference<Bitmap> newBitmaps[] = new WeakReference[newSize];
Drawable newDrawables[] = new Drawable[newSize];
Drawable newPlaceholders[] = new Drawable[newSize];
boolean newLoadings[] = new boolean[newSize];
ImageLoader.Listener newListeners[] = new ImageLoader.Listener[newSize];
float length = Math.min(bitmaps.length, newSize);
for (int i = 0; i < length; i++) {
newBitmaps[i] = bitmaps[i];
newDrawables[i] = drawables[i];
newPlaceholders[i] = placeholders[i];
newLoadings[i] = loading[i];
newListeners[i] = listeners[i];
}
bitmaps = newBitmaps;
drawables = newDrawables;
placeholders = newPlaceholders;
loading = newLoadings;
listeners = newListeners;
}
|
[
"public",
"void",
"recreate",
"(",
")",
"{",
"int",
"newSize",
"=",
"noxItems",
".",
"size",
"(",
")",
";",
"WeakReference",
"<",
"Bitmap",
">",
"newBitmaps",
"[",
"]",
"=",
"new",
"WeakReference",
"[",
"newSize",
"]",
";",
"Drawable",
"newDrawables",
"[",
"]",
"=",
"new",
"Drawable",
"[",
"newSize",
"]",
";",
"Drawable",
"newPlaceholders",
"[",
"]",
"=",
"new",
"Drawable",
"[",
"newSize",
"]",
";",
"boolean",
"newLoadings",
"[",
"]",
"=",
"new",
"boolean",
"[",
"newSize",
"]",
";",
"ImageLoader",
".",
"Listener",
"newListeners",
"[",
"]",
"=",
"new",
"ImageLoader",
".",
"Listener",
"[",
"newSize",
"]",
";",
"float",
"length",
"=",
"Math",
".",
"min",
"(",
"bitmaps",
".",
"length",
",",
"newSize",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"newBitmaps",
"[",
"i",
"]",
"=",
"bitmaps",
"[",
"i",
"]",
";",
"newDrawables",
"[",
"i",
"]",
"=",
"drawables",
"[",
"i",
"]",
";",
"newPlaceholders",
"[",
"i",
"]",
"=",
"placeholders",
"[",
"i",
"]",
";",
"newLoadings",
"[",
"i",
"]",
"=",
"loading",
"[",
"i",
"]",
";",
"newListeners",
"[",
"i",
"]",
"=",
"listeners",
"[",
"i",
"]",
";",
"}",
"bitmaps",
"=",
"newBitmaps",
";",
"drawables",
"=",
"newDrawables",
";",
"placeholders",
"=",
"newPlaceholders",
";",
"loading",
"=",
"newLoadings",
";",
"listeners",
"=",
"newListeners",
";",
"}"
] |
Regenerates all the internal data structures. This method should be called when the number of
nox items in the catalog has changed externally.
|
[
"Regenerates",
"all",
"the",
"internal",
"data",
"structures",
".",
"This",
"method",
"should",
"be",
"called",
"when",
"the",
"number",
"of",
"nox",
"items",
"in",
"the",
"catalog",
"has",
"changed",
"externally",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L212-L232
|
11,086
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.loadNoxItem
|
private void loadNoxItem(final int position, NoxItem noxItem, boolean useCircularTransformation) {
imageLoader.load(noxItem.getUrl())
.load(noxItem.getResourceId())
.withPlaceholder(noxItem.getPlaceholderId())
.size(noxItemSize)
.useCircularTransformation(useCircularTransformation)
.notify(getImageLoaderListener(position));
}
|
java
|
private void loadNoxItem(final int position, NoxItem noxItem, boolean useCircularTransformation) {
imageLoader.load(noxItem.getUrl())
.load(noxItem.getResourceId())
.withPlaceholder(noxItem.getPlaceholderId())
.size(noxItemSize)
.useCircularTransformation(useCircularTransformation)
.notify(getImageLoaderListener(position));
}
|
[
"private",
"void",
"loadNoxItem",
"(",
"final",
"int",
"position",
",",
"NoxItem",
"noxItem",
",",
"boolean",
"useCircularTransformation",
")",
"{",
"imageLoader",
".",
"load",
"(",
"noxItem",
".",
"getUrl",
"(",
")",
")",
".",
"load",
"(",
"noxItem",
".",
"getResourceId",
"(",
")",
")",
".",
"withPlaceholder",
"(",
"noxItem",
".",
"getPlaceholderId",
"(",
")",
")",
".",
"size",
"(",
"noxItemSize",
")",
".",
"useCircularTransformation",
"(",
"useCircularTransformation",
")",
".",
"notify",
"(",
"getImageLoaderListener",
"(",
"position",
")",
")",
";",
"}"
] |
Starts the resource download given a NoxItem instance and a given position.
|
[
"Starts",
"the",
"resource",
"download",
"given",
"a",
"NoxItem",
"instance",
"and",
"a",
"given",
"position",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L237-L244
|
11,087
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
|
NoxItemCatalog.getImageLoaderListener
|
private ImageLoader.Listener getImageLoaderListener(final int position) {
if (listeners[position] == null) {
listeners[position] = new NoxItemCatalogImageLoaderListener(position, this);
}
return listeners[position];
}
|
java
|
private ImageLoader.Listener getImageLoaderListener(final int position) {
if (listeners[position] == null) {
listeners[position] = new NoxItemCatalogImageLoaderListener(position, this);
}
return listeners[position];
}
|
[
"private",
"ImageLoader",
".",
"Listener",
"getImageLoaderListener",
"(",
"final",
"int",
"position",
")",
"{",
"if",
"(",
"listeners",
"[",
"position",
"]",
"==",
"null",
")",
"{",
"listeners",
"[",
"position",
"]",
"=",
"new",
"NoxItemCatalogImageLoaderListener",
"(",
"position",
",",
"this",
")",
";",
"}",
"return",
"listeners",
"[",
"position",
"]",
";",
"}"
] |
Returns the ImageLoader.Listener associated to a NoxItem given a position. If the
ImageLoader.Listener wasn't previously created, creates a new instance.
|
[
"Returns",
"the",
"ImageLoader",
".",
"Listener",
"associated",
"to",
"a",
"NoxItem",
"given",
"a",
"position",
".",
"If",
"the",
"ImageLoader",
".",
"Listener",
"wasn",
"t",
"previously",
"created",
"creates",
"a",
"new",
"instance",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L250-L255
|
11,088
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataParser.java
|
MetadataParser.checkArguments
|
private void checkArguments(final MetadataParserPath path, final List<?> confList) {
if (path == null) {
throw new IllegalArgumentException("Invalid configuration. The 'path' element missing!");
} else if (confList == null) {
throw new IllegalArgumentException(
"Invalid configuration. At least one 'descriptor' element has to be defined!");
} else if (confList.isEmpty()) {
throw new IllegalArgumentException(
"Invalid configuration. At least one 'descriptor' element has to be defined!");
}
}
|
java
|
private void checkArguments(final MetadataParserPath path, final List<?> confList) {
if (path == null) {
throw new IllegalArgumentException("Invalid configuration. The 'path' element missing!");
} else if (confList == null) {
throw new IllegalArgumentException(
"Invalid configuration. At least one 'descriptor' element has to be defined!");
} else if (confList.isEmpty()) {
throw new IllegalArgumentException(
"Invalid configuration. At least one 'descriptor' element has to be defined!");
}
}
|
[
"private",
"void",
"checkArguments",
"(",
"final",
"MetadataParserPath",
"path",
",",
"final",
"List",
"<",
"?",
">",
"confList",
")",
"{",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid configuration. The 'path' element missing!\"",
")",
";",
"}",
"else",
"if",
"(",
"confList",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid configuration. At least one 'descriptor' element has to be defined!\"",
")",
";",
"}",
"else",
"if",
"(",
"confList",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid configuration. At least one 'descriptor' element has to be defined!\"",
")",
";",
"}",
"}"
] |
Validates the given arguments.
@param path
@param confList
|
[
"Validates",
"the",
"given",
"arguments",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataParser.java#L236-L247
|
11,089
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/utils/tenant/TenantUtils.java
|
TenantUtils.getTenantNames
|
public static List<String> getTenantNames(TenantService tenantService) throws ProfileException {
List<Tenant> tenants = tenantService.getAllTenants();
List<String> tenantNames = new ArrayList<>(tenants.size());
if (CollectionUtils.isNotEmpty(tenants)) {
for (Tenant tenant : tenants) {
tenantNames.add(tenant.getName());
}
}
return tenantNames;
}
|
java
|
public static List<String> getTenantNames(TenantService tenantService) throws ProfileException {
List<Tenant> tenants = tenantService.getAllTenants();
List<String> tenantNames = new ArrayList<>(tenants.size());
if (CollectionUtils.isNotEmpty(tenants)) {
for (Tenant tenant : tenants) {
tenantNames.add(tenant.getName());
}
}
return tenantNames;
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"getTenantNames",
"(",
"TenantService",
"tenantService",
")",
"throws",
"ProfileException",
"{",
"List",
"<",
"Tenant",
">",
"tenants",
"=",
"tenantService",
".",
"getAllTenants",
"(",
")",
";",
"List",
"<",
"String",
">",
"tenantNames",
"=",
"new",
"ArrayList",
"<>",
"(",
"tenants",
".",
"size",
"(",
")",
")",
";",
"if",
"(",
"CollectionUtils",
".",
"isNotEmpty",
"(",
"tenants",
")",
")",
"{",
"for",
"(",
"Tenant",
"tenant",
":",
"tenants",
")",
"{",
"tenantNames",
".",
"add",
"(",
"tenant",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"return",
"tenantNames",
";",
"}"
] |
Returns a list with the names of all tenants.
@param tenantService the service that retrieves the {@link org.craftercms.profile.api.Tenant}s.
@return the list of tenant names
|
[
"Returns",
"a",
"list",
"with",
"the",
"names",
"of",
"all",
"tenants",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/tenant/TenantUtils.java#L47-L58
|
11,090
|
craftercms/profile
|
security-provider/src/main/java/org/craftercms/security/utils/tenant/TenantUtils.java
|
TenantUtils.getCurrentTenantName
|
public static String getCurrentTenantName() {
Profile profile = SecurityUtils.getCurrentProfile();
if (profile != null) {
return profile.getTenant();
} else {
return null;
}
}
|
java
|
public static String getCurrentTenantName() {
Profile profile = SecurityUtils.getCurrentProfile();
if (profile != null) {
return profile.getTenant();
} else {
return null;
}
}
|
[
"public",
"static",
"String",
"getCurrentTenantName",
"(",
")",
"{",
"Profile",
"profile",
"=",
"SecurityUtils",
".",
"getCurrentProfile",
"(",
")",
";",
"if",
"(",
"profile",
"!=",
"null",
")",
"{",
"return",
"profile",
".",
"getTenant",
"(",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Returns the current tenant name, which is the tenant of the currently authenticated profile.
@return the current tenant name.
|
[
"Returns",
"the",
"current",
"tenant",
"name",
"which",
"is",
"the",
"tenant",
"of",
"the",
"currently",
"authenticated",
"profile",
"."
] |
d829c1136b0fd21d87dc925cb7046cbd38a300a4
|
https://github.com/craftercms/profile/blob/d829c1136b0fd21d87dc925cb7046cbd38a300a4/security-provider/src/main/java/org/craftercms/security/utils/tenant/TenantUtils.java#L65-L72
|
11,091
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
|
MetadataUtil.getAttributeValue
|
public static String getAttributeValue(final Element element, final String name) {
final Node node = element.getAttributes().getNamedItem(name);
if (node != null) {
return node.getNodeValue();
}
return null;
}
|
java
|
public static String getAttributeValue(final Element element, final String name) {
final Node node = element.getAttributes().getNamedItem(name);
if (node != null) {
return node.getNodeValue();
}
return null;
}
|
[
"public",
"static",
"String",
"getAttributeValue",
"(",
"final",
"Element",
"element",
",",
"final",
"String",
"name",
")",
"{",
"final",
"Node",
"node",
"=",
"element",
".",
"getAttributes",
"(",
")",
".",
"getNamedItem",
"(",
"name",
")",
";",
"if",
"(",
"node",
"!=",
"null",
")",
"{",
"return",
"node",
".",
"getNodeValue",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the attribute value for the given attribute name.
@param element
the w3c dom element.
@param name
the attribute name
@return if present, the the extracted attribute value, otherwise null.
|
[
"Returns",
"the",
"attribute",
"value",
"for",
"the",
"given",
"attribute",
"name",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L46-L53
|
11,092
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
|
MetadataUtil.getNextParentNodeWithAttr
|
public static Node getNextParentNodeWithAttr(final Node parent, final String attrName) {
Node parentNode = parent;
Element parendElement = (Element) parentNode;
Node valueNode = parendElement.getAttributes().getNamedItem(attrName);
while (valueNode == null) {
parentNode = parentNode.getParentNode();
if (parentNode != null) {
if (parentNode.getNodeType() == Node.ELEMENT_NODE) {
parendElement = (Element) parentNode;
valueNode = parendElement.getAttributes().getNamedItem(attrName);
}
} else {
break;
}
}
return parendElement;
}
|
java
|
public static Node getNextParentNodeWithAttr(final Node parent, final String attrName) {
Node parentNode = parent;
Element parendElement = (Element) parentNode;
Node valueNode = parendElement.getAttributes().getNamedItem(attrName);
while (valueNode == null) {
parentNode = parentNode.getParentNode();
if (parentNode != null) {
if (parentNode.getNodeType() == Node.ELEMENT_NODE) {
parendElement = (Element) parentNode;
valueNode = parendElement.getAttributes().getNamedItem(attrName);
}
} else {
break;
}
}
return parendElement;
}
|
[
"public",
"static",
"Node",
"getNextParentNodeWithAttr",
"(",
"final",
"Node",
"parent",
",",
"final",
"String",
"attrName",
")",
"{",
"Node",
"parentNode",
"=",
"parent",
";",
"Element",
"parendElement",
"=",
"(",
"Element",
")",
"parentNode",
";",
"Node",
"valueNode",
"=",
"parendElement",
".",
"getAttributes",
"(",
")",
".",
"getNamedItem",
"(",
"attrName",
")",
";",
"while",
"(",
"valueNode",
"==",
"null",
")",
"{",
"parentNode",
"=",
"parentNode",
".",
"getParentNode",
"(",
")",
";",
"if",
"(",
"parentNode",
"!=",
"null",
")",
"{",
"if",
"(",
"parentNode",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"parendElement",
"=",
"(",
"Element",
")",
"parentNode",
";",
"valueNode",
"=",
"parendElement",
".",
"getAttributes",
"(",
")",
".",
"getNamedItem",
"(",
"attrName",
")",
";",
"}",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"return",
"parendElement",
";",
"}"
] |
Returns the next parent node which has the specific attribute name defined.
@param parent
the w3c node from which the search will start.
@param attrName
the attribute name which is searched for.
@return a parent node, if the attribute is found, otherwise null.
|
[
"Returns",
"the",
"next",
"parent",
"node",
"which",
"has",
"the",
"specific",
"attribute",
"name",
"defined",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L64-L81
|
11,093
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
|
MetadataUtil.hasChildsOf
|
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) {
NodeList nodeList = parentElement.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
final Node childNode = nodeList.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
final Element childElement = (Element) childNode;
if (child.isTagNameEqual(childElement.getTagName())) {
return true;
}
if (childElement.hasChildNodes()) {
if (hasChildsOf(childElement, child)) {
return true;
}
}
}
}
return false;
}
|
java
|
public static boolean hasChildsOf(final Element parentElement, XsdElementEnum child) {
NodeList nodeList = parentElement.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
final Node childNode = nodeList.item(i);
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
final Element childElement = (Element) childNode;
if (child.isTagNameEqual(childElement.getTagName())) {
return true;
}
if (childElement.hasChildNodes()) {
if (hasChildsOf(childElement, child)) {
return true;
}
}
}
}
return false;
}
|
[
"public",
"static",
"boolean",
"hasChildsOf",
"(",
"final",
"Element",
"parentElement",
",",
"XsdElementEnum",
"child",
")",
"{",
"NodeList",
"nodeList",
"=",
"parentElement",
".",
"getChildNodes",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nodeList",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"Node",
"childNode",
"=",
"nodeList",
".",
"item",
"(",
"i",
")",
";",
"if",
"(",
"childNode",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"final",
"Element",
"childElement",
"=",
"(",
"Element",
")",
"childNode",
";",
"if",
"(",
"child",
".",
"isTagNameEqual",
"(",
"childElement",
".",
"getTagName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"childElement",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"if",
"(",
"hasChildsOf",
"(",
"childElement",
",",
"child",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks the existence of a w3c child element.
@param parentElement
the element from which the search starts.
@param child
the <code>XsdElementEnum</code> specifying the child element.
@return true, if found, otherwise false.
|
[
"Checks",
"the",
"existence",
"of",
"a",
"w3c",
"child",
"element",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L115-L133
|
11,094
|
shrinkwrap/descriptors
|
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java
|
MetadataUtil.hasParentOf
|
public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) {
Node parent = parentElement.getParentNode();
while (parent != null) {
if (parent.getNodeType() == Node.ELEMENT_NODE) {
final Element parentElm = (Element) parent;
if (parentEnum.isTagNameEqual(parentElm.getTagName())) {
return true;
}
}
parent = parent.getParentNode();
}
return false;
}
|
java
|
public static boolean hasParentOf(final Element parentElement, XsdElementEnum parentEnum) {
Node parent = parentElement.getParentNode();
while (parent != null) {
if (parent.getNodeType() == Node.ELEMENT_NODE) {
final Element parentElm = (Element) parent;
if (parentEnum.isTagNameEqual(parentElm.getTagName())) {
return true;
}
}
parent = parent.getParentNode();
}
return false;
}
|
[
"public",
"static",
"boolean",
"hasParentOf",
"(",
"final",
"Element",
"parentElement",
",",
"XsdElementEnum",
"parentEnum",
")",
"{",
"Node",
"parent",
"=",
"parentElement",
".",
"getParentNode",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
".",
"getNodeType",
"(",
")",
"==",
"Node",
".",
"ELEMENT_NODE",
")",
"{",
"final",
"Element",
"parentElm",
"=",
"(",
"Element",
")",
"parent",
";",
"if",
"(",
"parentEnum",
".",
"isTagNameEqual",
"(",
"parentElm",
".",
"getTagName",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"parent",
"=",
"parent",
".",
"getParentNode",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks for the first parent node occurrence of the a w3c parentEnum element.
@param parentElement
the element from which the search starts.
@param parentEnum
the <code>XsdElementEnum</code> specifying the parent element.
@return true, if found, otherwise false.
|
[
"Checks",
"for",
"the",
"first",
"parent",
"node",
"occurrence",
"of",
"the",
"a",
"w3c",
"parentEnum",
"element",
"."
] |
023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba
|
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/MetadataUtil.java#L144-L156
|
11,095
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/Scroller.java
|
Scroller.computeScroll
|
void computeScroll() {
if (!overScroller.computeScrollOffset()) {
isScrollingFast = false;
return;
}
int distanceX = overScroller.getCurrX() - view.getScrollX();
int distanceY = overScroller.getCurrY() - view.getScrollY();
int dX = (int) calculateDx(distanceX);
int dY = (int) calculateDy(distanceY);
boolean stopScrolling = dX == 0 && dY == 0;
if (stopScrolling) {
isScrollingFast = false;
}
view.scrollBy(dX, dY);
}
|
java
|
void computeScroll() {
if (!overScroller.computeScrollOffset()) {
isScrollingFast = false;
return;
}
int distanceX = overScroller.getCurrX() - view.getScrollX();
int distanceY = overScroller.getCurrY() - view.getScrollY();
int dX = (int) calculateDx(distanceX);
int dY = (int) calculateDy(distanceY);
boolean stopScrolling = dX == 0 && dY == 0;
if (stopScrolling) {
isScrollingFast = false;
}
view.scrollBy(dX, dY);
}
|
[
"void",
"computeScroll",
"(",
")",
"{",
"if",
"(",
"!",
"overScroller",
".",
"computeScrollOffset",
"(",
")",
")",
"{",
"isScrollingFast",
"=",
"false",
";",
"return",
";",
"}",
"int",
"distanceX",
"=",
"overScroller",
".",
"getCurrX",
"(",
")",
"-",
"view",
".",
"getScrollX",
"(",
")",
";",
"int",
"distanceY",
"=",
"overScroller",
".",
"getCurrY",
"(",
")",
"-",
"view",
".",
"getScrollY",
"(",
")",
";",
"int",
"dX",
"=",
"(",
"int",
")",
"calculateDx",
"(",
"distanceX",
")",
";",
"int",
"dY",
"=",
"(",
"int",
")",
"calculateDy",
"(",
"distanceY",
")",
";",
"boolean",
"stopScrolling",
"=",
"dX",
"==",
"0",
"&&",
"dY",
"==",
"0",
";",
"if",
"(",
"stopScrolling",
")",
"{",
"isScrollingFast",
"=",
"false",
";",
"}",
"view",
".",
"scrollBy",
"(",
"dX",
",",
"dY",
")",
";",
"}"
] |
Computes the current scroll using a OverScroller instance and the time lapsed from the
previous call. Also controls if the view is performing a fast scroll after a fling gesture.
|
[
"Computes",
"the",
"current",
"scroll",
"using",
"a",
"OverScroller",
"instance",
"and",
"the",
"time",
"lapsed",
"from",
"the",
"previous",
"call",
".",
"Also",
"controls",
"if",
"the",
"view",
"is",
"performing",
"a",
"fast",
"scroll",
"after",
"a",
"fling",
"gesture",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/Scroller.java#L85-L100
|
11,096
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/Scroller.java
|
Scroller.getGestureDetector
|
private GestureDetectorCompat getGestureDetector() {
if (gestureDetector == null) {
gestureDetector = new GestureDetectorCompat(view.getContext(), gestureListener);
}
return gestureDetector;
}
|
java
|
private GestureDetectorCompat getGestureDetector() {
if (gestureDetector == null) {
gestureDetector = new GestureDetectorCompat(view.getContext(), gestureListener);
}
return gestureDetector;
}
|
[
"private",
"GestureDetectorCompat",
"getGestureDetector",
"(",
")",
"{",
"if",
"(",
"gestureDetector",
"==",
"null",
")",
"{",
"gestureDetector",
"=",
"new",
"GestureDetectorCompat",
"(",
"view",
".",
"getContext",
"(",
")",
",",
"gestureListener",
")",
";",
"}",
"return",
"gestureDetector",
";",
"}"
] |
Returns the GestureDetectorCompat instance where the view should delegate touch events.
|
[
"Returns",
"the",
"GestureDetectorCompat",
"instance",
"where",
"the",
"view",
"should",
"delegate",
"touch",
"events",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/Scroller.java#L154-L159
|
11,097
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/Scroller.java
|
Scroller.calculateDx
|
private float calculateDx(float distanceX) {
int currentX = view.getScrollX();
float nextX = distanceX + currentX;
boolean isInsideHorizontally = nextX >= minX && nextX <= maxX;
return isInsideHorizontally ? distanceX : 0;
}
|
java
|
private float calculateDx(float distanceX) {
int currentX = view.getScrollX();
float nextX = distanceX + currentX;
boolean isInsideHorizontally = nextX >= minX && nextX <= maxX;
return isInsideHorizontally ? distanceX : 0;
}
|
[
"private",
"float",
"calculateDx",
"(",
"float",
"distanceX",
")",
"{",
"int",
"currentX",
"=",
"view",
".",
"getScrollX",
"(",
")",
";",
"float",
"nextX",
"=",
"distanceX",
"+",
"currentX",
";",
"boolean",
"isInsideHorizontally",
"=",
"nextX",
">=",
"minX",
"&&",
"nextX",
"<=",
"maxX",
";",
"return",
"isInsideHorizontally",
"?",
"distanceX",
":",
"0",
";",
"}"
] |
Returns the distance in the X axes to perform the scroll taking into account the view
boundary.
|
[
"Returns",
"the",
"distance",
"in",
"the",
"X",
"axes",
"to",
"perform",
"the",
"scroll",
"taking",
"into",
"account",
"the",
"view",
"boundary",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/Scroller.java#L198-L203
|
11,098
|
pedrovgs/Nox
|
nox/src/main/java/com/github/pedrovgs/nox/Scroller.java
|
Scroller.calculateDy
|
private float calculateDy(float distanceY) {
int currentY = view.getScrollY();
float nextY = distanceY + currentY;
boolean isInsideVertically = nextY >= minY && nextY <= maxY;
return isInsideVertically ? distanceY : 0;
}
|
java
|
private float calculateDy(float distanceY) {
int currentY = view.getScrollY();
float nextY = distanceY + currentY;
boolean isInsideVertically = nextY >= minY && nextY <= maxY;
return isInsideVertically ? distanceY : 0;
}
|
[
"private",
"float",
"calculateDy",
"(",
"float",
"distanceY",
")",
"{",
"int",
"currentY",
"=",
"view",
".",
"getScrollY",
"(",
")",
";",
"float",
"nextY",
"=",
"distanceY",
"+",
"currentY",
";",
"boolean",
"isInsideVertically",
"=",
"nextY",
">=",
"minY",
"&&",
"nextY",
"<=",
"maxY",
";",
"return",
"isInsideVertically",
"?",
"distanceY",
":",
"0",
";",
"}"
] |
Returns the distance in the Y axes to perform the scroll taking into account the view
boundary.
|
[
"Returns",
"the",
"distance",
"in",
"the",
"Y",
"axes",
"to",
"perform",
"the",
"scroll",
"taking",
"into",
"account",
"the",
"view",
"boundary",
"."
] |
b4dfe37895e1b7bf2084d60139931dd4fb12f3f4
|
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/Scroller.java#L209-L214
|
11,099
|
arquillian/arquillian-algeron
|
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
|
GitOperations.isValidGitRepository
|
public boolean isValidGitRepository(Path folder) {
if (Files.exists(folder) && Files.isDirectory(folder)) {
// If it has been at least initialized
if (RepositoryCache.FileKey.isGitRepository(folder.toFile(), FS.DETECTED)) {
// we are assuming that the clone worked at that time, caller should call hasAtLeastOneReference
return true;
} else {
return false;
}
} else {
return false;
}
}
|
java
|
public boolean isValidGitRepository(Path folder) {
if (Files.exists(folder) && Files.isDirectory(folder)) {
// If it has been at least initialized
if (RepositoryCache.FileKey.isGitRepository(folder.toFile(), FS.DETECTED)) {
// we are assuming that the clone worked at that time, caller should call hasAtLeastOneReference
return true;
} else {
return false;
}
} else {
return false;
}
}
|
[
"public",
"boolean",
"isValidGitRepository",
"(",
"Path",
"folder",
")",
"{",
"if",
"(",
"Files",
".",
"exists",
"(",
"folder",
")",
"&&",
"Files",
".",
"isDirectory",
"(",
"folder",
")",
")",
"{",
"// If it has been at least initialized",
"if",
"(",
"RepositoryCache",
".",
"FileKey",
".",
"isGitRepository",
"(",
"folder",
".",
"toFile",
"(",
")",
",",
"FS",
".",
"DETECTED",
")",
")",
"{",
"// we are assuming that the clone worked at that time, caller should call hasAtLeastOneReference",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Checks if given folder is a git repository
@param folder
to check
@return true if it is a git repository, false otherwise.
|
[
"Checks",
"if",
"given",
"folder",
"is",
"a",
"git",
"repository"
] |
ec79372defdafe99ab2f7bb696f1c1eabdbbacb6
|
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L38-L52
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.