repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/core/model/internal/VdmValue.java
VdmValue.hasChildrenValuesLoaded
protected boolean hasChildrenValuesLoaded() { for (int i = 0; i < variables.length; ++i) { if (variables[i] != null) { return true; } } return false; }
java
protected boolean hasChildrenValuesLoaded() { for (int i = 0; i < variables.length; ++i) { if (variables[i] != null) { return true; } } return false; }
[ "protected", "boolean", "hasChildrenValuesLoaded", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "variables", ".", "length", ";", "++", "i", ")", "{", "if", "(", "variables", "[", "i", "]", "!=", "null", ")", "{", "return", "true"...
Tests that some of the children are already created. @return
[ "Tests", "that", "some", "of", "the", "children", "are", "already", "created", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/core/model/internal/VdmValue.java#L379-L389
train
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/ClassContext.java
ClassContext.check
@Override public Value check(ILexNameToken name) { // A RootContext stops the name search from continuing down the // context chain. It first checks any local context, then it // checks the "class" context, then it goes down to the global level. Value v = get(name); // Local variables if (v != null) { ...
java
@Override public Value check(ILexNameToken name) { // A RootContext stops the name search from continuing down the // context chain. It first checks any local context, then it // checks the "class" context, then it goes down to the global level. Value v = get(name); // Local variables if (v != null) { ...
[ "@", "Override", "public", "Value", "check", "(", "ILexNameToken", "name", ")", "{", "// A RootContext stops the name search from continuing down the", "// context chain. It first checks any local context, then it", "// checks the \"class\" context, then it goes down to the global level.", ...
Check for the name in the current context and classdef, and if not present search the global context. Note that the context chain is not followed. @see Context#check(ILexNameToken)
[ "Check", "for", "the", "name", "in", "the", "current", "context", "and", "classdef", "and", "if", "not", "present", "search", "the", "global", "context", ".", "Note", "that", "the", "context", "chain", "is", "not", "followed", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/ClassContext.java#L60-L99
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.compatible
public synchronized boolean compatible(PType to, PType from) { done.clear(); return searchCompatible(to, from, false) == Result.Yes; }
java
public synchronized boolean compatible(PType to, PType from) { done.clear(); return searchCompatible(to, from, false) == Result.Yes; }
[ "public", "synchronized", "boolean", "compatible", "(", "PType", "to", ",", "PType", "from", ")", "{", "done", ".", "clear", "(", ")", ";", "return", "searchCompatible", "(", "to", ",", "from", ",", "false", ")", "==", "Result", ".", "Yes", ";", "}" ]
Test whether the two types are compatible. This means that, at runtime, it is possible that the two types are the same, or sufficiently similar that the "from" value can be assigned to the "to" value. @param to @param from @return True if types "a" and "b" are compatible.
[ "Test", "whether", "the", "two", "types", "are", "compatible", ".", "This", "means", "that", "at", "runtime", "it", "is", "possible", "that", "the", "two", "types", "are", "the", "same", "or", "sufficiently", "similar", "that", "the", "from", "value", "can...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L135-L139
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.allCompatible
private Result allCompatible(List<PType> to, List<PType> from, boolean paramOnly) { if (to.size() != from.size()) { return Result.No; } else { for (int i = 0; i < to.size(); i++) { if (searchCompatible(to.get(i), from.get(i), paramOnly) == Result.No) { return Result.No; } } } ...
java
private Result allCompatible(List<PType> to, List<PType> from, boolean paramOnly) { if (to.size() != from.size()) { return Result.No; } else { for (int i = 0; i < to.size(); i++) { if (searchCompatible(to.get(i), from.get(i), paramOnly) == Result.No) { return Result.No; } } } ...
[ "private", "Result", "allCompatible", "(", "List", "<", "PType", ">", "to", ",", "List", "<", "PType", ">", "from", ",", "boolean", "paramOnly", ")", "{", "if", "(", "to", ".", "size", "(", ")", "!=", "from", ".", "size", "(", ")", ")", "{", "ret...
Compare two type lists for placewise compatibility. This is used to check ordered lists of types such as those in a ProductType or parameters to a function or operation. @param to @param from @return Yes or No.
[ "Compare", "two", "type", "lists", "for", "placewise", "compatibility", ".", "This", "is", "used", "to", "check", "ordered", "lists", "of", "types", "such", "as", "those", "in", "a", "ProductType", "or", "parameters", "to", "a", "function", "or", "operation"...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L171-L189
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.allSubTypes
private Result allSubTypes(List<PType> sub, List<PType> sup, boolean invignore) { if (sub.size() != sup.size()) { return Result.No; } else { for (int i = 0; i < sub.size(); i++) { if (searchSubType(sub.get(i), sup.get(i), invignore) == Result.No) { return Result.No; } } } r...
java
private Result allSubTypes(List<PType> sub, List<PType> sup, boolean invignore) { if (sub.size() != sup.size()) { return Result.No; } else { for (int i = 0; i < sub.size(); i++) { if (searchSubType(sub.get(i), sup.get(i), invignore) == Result.No) { return Result.No; } } } r...
[ "private", "Result", "allSubTypes", "(", "List", "<", "PType", ">", "sub", ",", "List", "<", "PType", ">", "sup", ",", "boolean", "invignore", ")", "{", "if", "(", "sub", ".", "size", "(", ")", "!=", "sup", ".", "size", "(", ")", ")", "{", "retur...
Compare two type lists for placewise subtype compatibility. This is used to check ordered lists of types such as those in a ProductType or parameters to a function or operation. @param sub @param sup @return Yes or No.
[ "Compare", "two", "type", "lists", "for", "placewise", "subtype", "compatibility", ".", "This", "is", "used", "to", "check", "ordered", "lists", "of", "types", "such", "as", "those", "in", "a", "ProductType", "or", "parameters", "to", "a", "function", "or", ...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L556-L574
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.checkComposeTypes
public PTypeList checkComposeTypes(PType type, Environment env, boolean newTypes) { PTypeList undefined = new PTypeList(); for (PType compose : env.af.createPTypeAssistant().getComposeTypes(type)) { ARecordInvariantType composeType = (ARecordInvariantType) compose; PDefinition existing = env.findType(c...
java
public PTypeList checkComposeTypes(PType type, Environment env, boolean newTypes) { PTypeList undefined = new PTypeList(); for (PType compose : env.af.createPTypeAssistant().getComposeTypes(type)) { ARecordInvariantType composeType = (ARecordInvariantType) compose; PDefinition existing = env.findType(c...
[ "public", "PTypeList", "checkComposeTypes", "(", "PType", "type", ",", "Environment", "env", ",", "boolean", "newTypes", ")", "{", "PTypeList", "undefined", "=", "new", "PTypeList", "(", ")", ";", "for", "(", "PType", "compose", ":", "env", ".", "af", ".",...
Check that the compose types that are referred to in a type have a matching definition in the environment. The method returns a list of types that do not exist if the newTypes parameter is passed. @param type @param env @param newTypes @return
[ "Check", "that", "the", "compose", "types", "that", "are", "referred", "to", "in", "a", "type", "have", "a", "matching", "definition", "in", "the", "environment", ".", "The", "method", "returns", "a", "list", "of", "types", "that", "do", "not", "exist", ...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L937-L1015
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java
TypeComparator.intersect
public PType intersect(PType a, PType b) { Set<PType> tsa = new HashSet<PType>(); Set<PType> tsb = new HashSet<PType>(); // Obtain the fundamental type of BracketTypes, NamedTypes and OptionalTypes. boolean resolved = false; while (!resolved) { if (a instanceof ABracketType) { a = ((ABracketTyp...
java
public PType intersect(PType a, PType b) { Set<PType> tsa = new HashSet<PType>(); Set<PType> tsb = new HashSet<PType>(); // Obtain the fundamental type of BracketTypes, NamedTypes and OptionalTypes. boolean resolved = false; while (!resolved) { if (a instanceof ABracketType) { a = ((ABracketTyp...
[ "public", "PType", "intersect", "(", "PType", "a", ",", "PType", "b", ")", "{", "Set", "<", "PType", ">", "tsa", "=", "new", "HashSet", "<", "PType", ">", "(", ")", ";", "Set", "<", "PType", ">", "tsb", "=", "new", "HashSet", "<", "PType", ">", ...
Calculate the intersection of two types. @param a @param b @return
[ "Calculate", "the", "intersection", "of", "two", "types", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeComparator.java#L1024-L1122
train
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/assistant/statement/PStmAssistantInterpreter.java
PStmAssistantInterpreter.findStatement
public PStm findStatement(PStm stm, int lineno) { try { return stm.apply(af.getStatementFinder(), lineno);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return null; // Most have none } }
java
public PStm findStatement(PStm stm, int lineno) { try { return stm.apply(af.getStatementFinder(), lineno);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return null; // Most have none } }
[ "public", "PStm", "findStatement", "(", "PStm", "stm", ",", "int", "lineno", ")", "{", "try", "{", "return", "stm", ".", "apply", "(", "af", ".", "getStatementFinder", "(", ")", ",", "lineno", ")", ";", "// FIXME: should we handle exceptions like this", "}", ...
Find a statement starting on the given line. Single statements just compare their location to lineno, but block statements and statements with sub-statements iterate over their branches. @param stm the statement @param lineno The line number to locate. @return A statement starting on the line, or null.
[ "Find", "a", "statement", "starting", "on", "the", "given", "line", ".", "Single", "statements", "just", "compare", "their", "location", "to", "lineno", "but", "block", "statements", "and", "statements", "with", "sub", "-", "statements", "iterate", "over", "th...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/assistant/statement/PStmAssistantInterpreter.java#L41-L51
train
overturetool/overture
core/isapog/src/main/java/org/overture/isapog/IsaPog.java
IsaPog.writeThyFiles
public Boolean writeThyFiles(String path) throws IOException { File modelThyFile = new File(path + modelThyName); FileUtils.writeStringToFile(modelThyFile, modelThy.getContent()); File posThyFile = new File(path + posThyName); FileUtils.writeStringToFile(posThyFile, posThy); return true; }
java
public Boolean writeThyFiles(String path) throws IOException { File modelThyFile = new File(path + modelThyName); FileUtils.writeStringToFile(modelThyFile, modelThy.getContent()); File posThyFile = new File(path + posThyName); FileUtils.writeStringToFile(posThyFile, posThy); return true; }
[ "public", "Boolean", "writeThyFiles", "(", "String", "path", ")", "throws", "IOException", "{", "File", "modelThyFile", "=", "new", "File", "(", "path", "+", "modelThyName", ")", ";", "FileUtils", ".", "writeStringToFile", "(", "modelThyFile", ",", "modelThy", ...
Write Isabelle theory files to disk for the model and proof obligations @param path Path to the directory to write the files to. Must end with the {@link File#separatorChar} @return true if write is successful @throws IOException
[ "Write", "Isabelle", "theory", "files", "to", "disk", "for", "the", "model", "and", "proof", "obligations" ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/isapog/src/main/java/org/overture/isapog/IsaPog.java#L106-L115
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java
AClassTypeAssistantTC.hasSupertype
public boolean hasSupertype(AClassType sclass, PType other) { return af.createSClassDefinitionAssistant().hasSupertype(sclass.getClassdef(), other); }
java
public boolean hasSupertype(AClassType sclass, PType other) { return af.createSClassDefinitionAssistant().hasSupertype(sclass.getClassdef(), other); }
[ "public", "boolean", "hasSupertype", "(", "AClassType", "sclass", ",", "PType", "other", ")", "{", "return", "af", ".", "createSClassDefinitionAssistant", "(", ")", ".", "hasSupertype", "(", "sclass", ".", "getClassdef", "(", ")", ",", "other", ")", ";", "}"...
Used in the SClassDefinitionAssistantTC.
[ "Used", "in", "the", "SClassDefinitionAssistantTC", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java#L63-L66
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java
AClassTypeAssistantTC.isConstructor
public boolean isConstructor(PDefinition def) { if (def instanceof AExplicitOperationDefinition) { AExplicitOperationDefinition op = (AExplicitOperationDefinition)def; return op.getIsConstructor(); } else if (def instanceof AImplicitOperationDefinition) { AImplicitOperationDefinition op = (AImplicit...
java
public boolean isConstructor(PDefinition def) { if (def instanceof AExplicitOperationDefinition) { AExplicitOperationDefinition op = (AExplicitOperationDefinition)def; return op.getIsConstructor(); } else if (def instanceof AImplicitOperationDefinition) { AImplicitOperationDefinition op = (AImplicit...
[ "public", "boolean", "isConstructor", "(", "PDefinition", "def", ")", "{", "if", "(", "def", "instanceof", "AExplicitOperationDefinition", ")", "{", "AExplicitOperationDefinition", "op", "=", "(", "AExplicitOperationDefinition", ")", "def", ";", "return", "op", ".",...
Test whether a definition is a class constructor.
[ "Test", "whether", "a", "definition", "is", "a", "class", "constructor", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java#L71-L90
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java
AClassTypeAssistantTC.inConstructor
public boolean inConstructor(Environment env) { PDefinition encl = env.getEnclosingDefinition(); if (encl != null) { return isConstructor(encl); } return false; }
java
public boolean inConstructor(Environment env) { PDefinition encl = env.getEnclosingDefinition(); if (encl != null) { return isConstructor(encl); } return false; }
[ "public", "boolean", "inConstructor", "(", "Environment", "env", ")", "{", "PDefinition", "encl", "=", "env", ".", "getEnclosingDefinition", "(", ")", ";", "if", "(", "encl", "!=", "null", ")", "{", "return", "isConstructor", "(", "encl", ")", ";", "}", ...
Test whether the calling environment indicates that we are within a constructor.
[ "Test", "whether", "the", "calling", "environment", "indicates", "that", "we", "are", "within", "a", "constructor", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/assistant/type/AClassTypeAssistantTC.java#L95-L105
train
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/internal/viewsupport/VdmElementImageProvider.java
VdmElementImageProvider.getCUResourceImageDescriptor
public ImageDescriptor getCUResourceImageDescriptor(IFile file, int flags) { Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE; return new VdmElementImageDescriptor( VdmPluginImages.DESC_OBJS_CUNIT_RESOURCE, 0, size); }
java
public ImageDescriptor getCUResourceImageDescriptor(IFile file, int flags) { Point size = useSmallSize(flags) ? SMALL_SIZE : BIG_SIZE; return new VdmElementImageDescriptor( VdmPluginImages.DESC_OBJS_CUNIT_RESOURCE, 0, size); }
[ "public", "ImageDescriptor", "getCUResourceImageDescriptor", "(", "IFile", "file", ",", "int", "flags", ")", "{", "Point", "size", "=", "useSmallSize", "(", "flags", ")", "?", "SMALL_SIZE", ":", "BIG_SIZE", ";", "return", "new", "VdmElementImageDescriptor", "(", ...
Returns an image descriptor for a compilation unit not on the class path. The descriptor includes overlays, if specified. @param file the cu resource file @param flags the image flags @return returns the image descriptor
[ "Returns", "an", "image", "descriptor", "for", "a", "compilation", "unit", "not", "on", "the", "class", "path", ".", "The", "descriptor", "includes", "overlays", "if", "specified", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/viewsupport/VdmElementImageProvider.java#L577-L581
train
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java
SWTUtil.getStandardDisplay
public static Display getStandardDisplay() { Display display; display= Display.getCurrent(); if (display == null) display= Display.getDefault(); return display; }
java
public static Display getStandardDisplay() { Display display; display= Display.getCurrent(); if (display == null) display= Display.getDefault(); return display; }
[ "public", "static", "Display", "getStandardDisplay", "(", ")", "{", "Display", "display", ";", "display", "=", "Display", ".", "getCurrent", "(", ")", ";", "if", "(", "display", "==", "null", ")", "display", "=", "Display", ".", "getDefault", "(", ")", "...
Returns the standard display to be used. The method first checks, if the thread calling this method has an associated display. If so, this display is returned. Otherwise the method returns the default display. @return returns the standard display to be used
[ "Returns", "the", "standard", "display", "to", "be", "used", ".", "The", "method", "first", "checks", "if", "the", "thread", "calling", "this", "method", "has", "an", "associated", "display", ".", "If", "so", "this", "display", "is", "returned", ".", "Othe...
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java#L69-L75
train
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java
SWTUtil.getButtonWidthHint
public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAUL...
java
public static int getButtonWidthHint(Button button) { button.setFont(JFaceResources.getDialogFont()); PixelConverter converter= new PixelConverter(button); int widthHint= converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); return Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAUL...
[ "public", "static", "int", "getButtonWidthHint", "(", "Button", "button", ")", "{", "button", ".", "setFont", "(", "JFaceResources", ".", "getDialogFont", "(", ")", ")", ";", "PixelConverter", "converter", "=", "new", "PixelConverter", "(", "button", ")", ";",...
Returns a width hint for a button control. @param button the button @return the width hint
[ "Returns", "a", "width", "hint", "for", "a", "button", "control", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java#L107-L112
train
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java
SWTUtil.setAccessibilityText
public static void setAccessibilityText(Control control, final String text) { control.getAccessible().addAccessibleListener(new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result= text; } }); }
java
public static void setAccessibilityText(Control control, final String text) { control.getAccessible().addAccessibleListener(new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result= text; } }); }
[ "public", "static", "void", "setAccessibilityText", "(", "Control", "control", ",", "final", "String", "text", ")", "{", "control", ".", "getAccessible", "(", ")", ".", "addAccessibleListener", "(", "new", "AccessibleAdapter", "(", ")", "{", "public", "void", ...
Adds an accessibility listener returning the given fixed name. @param control the control to add the accessibility support to @param text the name
[ "Adds", "an", "accessibility", "listener", "returning", "the", "given", "fixed", "name", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/internal/util/SWTUtil.java#L145-L151
train
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/BreakpointConditionEditor.java
BreakpointConditionEditor.valueChanged
protected void valueChanged() { String newValue = fViewer.getDocument().get(); if (!newValue.equals(fOldValue)) { fOldValue = newValue; } refreshValidState(); }
java
protected void valueChanged() { String newValue = fViewer.getDocument().get(); if (!newValue.equals(fOldValue)) { fOldValue = newValue; } refreshValidState(); }
[ "protected", "void", "valueChanged", "(", ")", "{", "String", "newValue", "=", "fViewer", ".", "getDocument", "(", ")", ".", "get", "(", ")", ";", "if", "(", "!", "newValue", ".", "equals", "(", "fOldValue", ")", ")", "{", "fOldValue", "=", "newValue",...
Handle that the value changed
[ "Handle", "that", "the", "value", "changed" ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/BreakpointConditionEditor.java#L246-L255
train
overturetool/overture
core/pog/src/main/java/org/overture/pog/obligation/FiniteMapObligation.java
FiniteMapObligation.getSetBindList
private List<PMultipleBind> getSetBindList(ILexNameToken finmap, ILexNameToken findex) { AMapDomainUnaryExp domExp = new AMapDomainUnaryExp(); domExp.setType(new ABooleanBasicType()); domExp.setExp(getVarExp(finmap)); return getMultipleSetBindList(domExp, findex); }
java
private List<PMultipleBind> getSetBindList(ILexNameToken finmap, ILexNameToken findex) { AMapDomainUnaryExp domExp = new AMapDomainUnaryExp(); domExp.setType(new ABooleanBasicType()); domExp.setExp(getVarExp(finmap)); return getMultipleSetBindList(domExp, findex); }
[ "private", "List", "<", "PMultipleBind", ">", "getSetBindList", "(", "ILexNameToken", "finmap", ",", "ILexNameToken", "findex", ")", "{", "AMapDomainUnaryExp", "domExp", "=", "new", "AMapDomainUnaryExp", "(", ")", ";", "domExp", ".", "setType", "(", "new", "ABoo...
idx in set dom m
[ "idx", "in", "set", "dom", "m" ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/obligation/FiniteMapObligation.java#L123-L130
train
overturetool/overture
core/pog/src/main/java/org/overture/pog/visitors/VariableSubVisitor.java
VariableSubVisitor.defaultSBinaryExp
@Override public PExp defaultSBinaryExp(SBinaryExp node, Substitution question) throws AnalysisException { PExp subl = node.getLeft().clone().apply(main, question); PExp subr = node.getRight().clone().apply(main, question); node.setLeft(subl.clone()); node.setRight(subr.clone()); return node; }
java
@Override public PExp defaultSBinaryExp(SBinaryExp node, Substitution question) throws AnalysisException { PExp subl = node.getLeft().clone().apply(main, question); PExp subr = node.getRight().clone().apply(main, question); node.setLeft(subl.clone()); node.setRight(subr.clone()); return node; }
[ "@", "Override", "public", "PExp", "defaultSBinaryExp", "(", "SBinaryExp", "node", ",", "Substitution", "question", ")", "throws", "AnalysisException", "{", "PExp", "subl", "=", "node", ".", "getLeft", "(", ")", ".", "clone", "(", ")", ".", "apply", "(", "...
Let's try to do most stuff with S family
[ "Let", "s", "try", "to", "do", "most", "stuff", "with", "S", "family" ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/visitors/VariableSubVisitor.java#L40-L49
train
overturetool/overture
core/pog/src/main/java/org/overture/pog/visitors/VariableSubVisitor.java
VariableSubVisitor.caseAExistsExp
@Override public PExp caseAExistsExp(AExistsExp node, Substitution question) throws AnalysisException { PExp sub = node.getPredicate().clone().apply(main, question); node.setPredicate(sub.clone()); return node; }
java
@Override public PExp caseAExistsExp(AExistsExp node, Substitution question) throws AnalysisException { PExp sub = node.getPredicate().clone().apply(main, question); node.setPredicate(sub.clone()); return node; }
[ "@", "Override", "public", "PExp", "caseAExistsExp", "(", "AExistsExp", "node", ",", "Substitution", "question", ")", "throws", "AnalysisException", "{", "PExp", "sub", "=", "node", ".", "getPredicate", "(", ")", ".", "clone", "(", ")", ".", "apply", "(", ...
cases here for what we need
[ "cases", "here", "for", "what", "we", "need" ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/pog/src/main/java/org/overture/pog/visitors/VariableSubVisitor.java#L62-L70
train
overturetool/overture
core/typechecker/src/main/java/org/overture/typechecker/assistant/module/AModuleImportsAssistantTC.java
AModuleImportsAssistantTC.typeCheck
public void typeCheck(AFromModuleImports ifm, ModuleEnvironment env) throws AnalysisException { TypeCheckVisitor tc = new TypeCheckVisitor(); TypeCheckInfo question = new TypeCheckInfo(af, env, null, null); for (List<PImport> ofType : ifm.getSignatures()) { for (PImport imp : ofType) { imp.apply(...
java
public void typeCheck(AFromModuleImports ifm, ModuleEnvironment env) throws AnalysisException { TypeCheckVisitor tc = new TypeCheckVisitor(); TypeCheckInfo question = new TypeCheckInfo(af, env, null, null); for (List<PImport> ofType : ifm.getSignatures()) { for (PImport imp : ofType) { imp.apply(...
[ "public", "void", "typeCheck", "(", "AFromModuleImports", "ifm", ",", "ModuleEnvironment", "env", ")", "throws", "AnalysisException", "{", "TypeCheckVisitor", "tc", "=", "new", "TypeCheckVisitor", "(", ")", ";", "TypeCheckInfo", "question", "=", "new", "TypeCheckInf...
Overloads the typeCheck method of this class.
[ "Overloads", "the", "typeCheck", "method", "of", "this", "class", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/assistant/module/AModuleImportsAssistantTC.java#L107-L121
train
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java
VdmRuntimeError.abort
public static Value abort(LocatedException e, Context ctxt) { throw new ContextException(e.number, e.getMessage(), e.location, ctxt); }
java
public static Value abort(LocatedException e, Context ctxt) { throw new ContextException(e.number, e.getMessage(), e.location, ctxt); }
[ "public", "static", "Value", "abort", "(", "LocatedException", "e", ",", "Context", "ctxt", ")", "{", "throw", "new", "ContextException", "(", "e", ".", "number", ",", "e", ".", "getMessage", "(", ")", ",", "e", ".", "location", ",", "ctxt", ")", ";", ...
Abort the runtime interpretation of the definition, throwing a ContextException to indicate the call stack. The information is based on that in the Exception passed. @param e The Exception that caused the problem. @param ctxt The runtime context that caught the exception. @return
[ "Abort", "the", "runtime", "interpretation", "of", "the", "definition", "throwing", "a", "ContextException", "to", "indicate", "the", "call", "stack", ".", "The", "information", "is", "based", "on", "that", "in", "the", "Exception", "passed", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java#L32-L35
train
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java
VdmRuntimeError.patternFail
public static void patternFail(int number, String msg, ILexLocation location) throws PatternMatchException { throw new PatternMatchException(number, msg, location); }
java
public static void patternFail(int number, String msg, ILexLocation location) throws PatternMatchException { throw new PatternMatchException(number, msg, location); }
[ "public", "static", "void", "patternFail", "(", "int", "number", ",", "String", "msg", ",", "ILexLocation", "location", ")", "throws", "PatternMatchException", "{", "throw", "new", "PatternMatchException", "(", "number", ",", "msg", ",", "location", ")", ";", ...
Throw a PatternMatchException with the given message. @param number @param msg @param location @throws PatternMatchException
[ "Throw", "a", "PatternMatchException", "with", "the", "given", "message", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java#L45-L49
train
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java
VdmRuntimeError.patternFail
public static Value patternFail(ValueException ve, ILexLocation location) throws PatternMatchException { throw new PatternMatchException(ve.number, ve.getMessage(), location); }
java
public static Value patternFail(ValueException ve, ILexLocation location) throws PatternMatchException { throw new PatternMatchException(ve.number, ve.getMessage(), location); }
[ "public", "static", "Value", "patternFail", "(", "ValueException", "ve", ",", "ILexLocation", "location", ")", "throws", "PatternMatchException", "{", "throw", "new", "PatternMatchException", "(", "ve", ".", "number", ",", "ve", ".", "getMessage", "(", ")", ",",...
Throw a PatternMatchException with a message from the ValueException. @param ve @param location @return @throws PatternMatchException
[ "Throw", "a", "PatternMatchException", "with", "a", "message", "from", "the", "ValueException", "." ]
83175dc6c24fa171cde4fcf61ecb648eba3bdbc1
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/VdmRuntimeError.java#L60-L64
train
WileyLabs/teasy
src/main/java/com/wiley/driver/WebDriverFactory.java
WebDriverFactory.isBrowserDead
private static boolean isBrowserDead() { try { if (((FramesTransparentWebDriver) getDriver()).getWrappedDriver() instanceof AppiumDriver) { getDriver().getPageSource(); } else { getDriver().getCurrentUrl(); } return false; }...
java
private static boolean isBrowserDead() { try { if (((FramesTransparentWebDriver) getDriver()).getWrappedDriver() instanceof AppiumDriver) { getDriver().getPageSource(); } else { getDriver().getCurrentUrl(); } return false; }...
[ "private", "static", "boolean", "isBrowserDead", "(", ")", "{", "try", "{", "if", "(", "(", "(", "FramesTransparentWebDriver", ")", "getDriver", "(", ")", ")", ".", "getWrappedDriver", "(", ")", "instanceof", "AppiumDriver", ")", "{", "getDriver", "(", ")", ...
Checks whether browser is dead. Used to catch situations like "Error communicating with the remote browser. It may have died." exceptions @return true if browser is dead
[ "Checks", "whether", "browser", "is", "dead", ".", "Used", "to", "catch", "situations", "like", "Error", "communicating", "with", "the", "remote", "browser", ".", "It", "may", "have", "died", ".", "exceptions" ]
94489ac8e6a6680b52dfa6cdbc9d8535333bef42
https://github.com/WileyLabs/teasy/blob/94489ac8e6a6680b52dfa6cdbc9d8535333bef42/src/main/java/com/wiley/driver/WebDriverFactory.java#L101-L113
train
WileyLabs/teasy
src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java
TeasyExpectedConditions.visibilityOfFirstElements
public static ExpectedCondition<List<WebElement>> visibilityOfFirstElements(final By locator) { return new ExpectedCondition<List<WebElement>>() { @Override public List<WebElement> apply(final WebDriver driver) { return getFirstVisibleWebElements(driver, null, locator); ...
java
public static ExpectedCondition<List<WebElement>> visibilityOfFirstElements(final By locator) { return new ExpectedCondition<List<WebElement>>() { @Override public List<WebElement> apply(final WebDriver driver) { return getFirstVisibleWebElements(driver, null, locator); ...
[ "public", "static", "ExpectedCondition", "<", "List", "<", "WebElement", ">", ">", "visibilityOfFirstElements", "(", "final", "By", "locator", ")", "{", "return", "new", "ExpectedCondition", "<", "List", "<", "WebElement", ">", ">", "(", ")", "{", "@", "Over...
Expected condition to look for elements in frames that will return as soon as elements are found in any frame @param locator @return
[ "Expected", "condition", "to", "look", "for", "elements", "in", "frames", "that", "will", "return", "as", "soon", "as", "elements", "are", "found", "in", "any", "frame" ]
94489ac8e6a6680b52dfa6cdbc9d8535333bef42
https://github.com/WileyLabs/teasy/blob/94489ac8e6a6680b52dfa6cdbc9d8535333bef42/src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java#L145-L157
train
WileyLabs/teasy
src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java
TeasyExpectedConditions.isAvailable
private static boolean isAvailable(WebElement element) { return element.isDisplayed() || isElementHiddenUnderScroll(element) && !element.getCssValue("visibility").equals("hidden"); }
java
private static boolean isAvailable(WebElement element) { return element.isDisplayed() || isElementHiddenUnderScroll(element) && !element.getCssValue("visibility").equals("hidden"); }
[ "private", "static", "boolean", "isAvailable", "(", "WebElement", "element", ")", "{", "return", "element", ".", "isDisplayed", "(", ")", "||", "isElementHiddenUnderScroll", "(", "element", ")", "&&", "!", "element", ".", "getCssValue", "(", "\"visibility\"", ")...
Defines whether it's possible to work with element i.e. is displayed or located under scroll. @param element - our element @return - true if element is available for the user.
[ "Defines", "whether", "it", "s", "possible", "to", "work", "with", "element", "i", ".", "e", ".", "is", "displayed", "or", "located", "under", "scroll", "." ]
94489ac8e6a6680b52dfa6cdbc9d8535333bef42
https://github.com/WileyLabs/teasy/blob/94489ac8e6a6680b52dfa6cdbc9d8535333bef42/src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java#L279-L282
train
WileyLabs/teasy
src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java
TeasyExpectedConditions.isElementHiddenUnderScroll
private static boolean isElementHiddenUnderScroll(WebElement element) { return ExecutionUtils.isFF() && element.getLocation().getX() > 0 && element.getLocation() .getY() > 0; }
java
private static boolean isElementHiddenUnderScroll(WebElement element) { return ExecutionUtils.isFF() && element.getLocation().getX() > 0 && element.getLocation() .getY() > 0; }
[ "private", "static", "boolean", "isElementHiddenUnderScroll", "(", "WebElement", "element", ")", "{", "return", "ExecutionUtils", ".", "isFF", "(", ")", "&&", "element", ".", "getLocation", "(", ")", ".", "getX", "(", ")", ">", "0", "&&", "element", ".", "...
Trick with zero coordinates for not-displayed element works only in FF
[ "Trick", "with", "zero", "coordinates", "for", "not", "-", "displayed", "element", "works", "only", "in", "FF" ]
94489ac8e6a6680b52dfa6cdbc9d8535333bef42
https://github.com/WileyLabs/teasy/blob/94489ac8e6a6680b52dfa6cdbc9d8535333bef42/src/main/java/com/wiley/elements/conditions/TeasyExpectedConditions.java#L334-L337
train
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/util/CommittableFileLog.java
CommittableFileLog.append
public void append(byte[] toWrite) throws BitsyException { ByteBuffer buf = ByteBuffer.wrap(toWrite); append(buf); }
java
public void append(byte[] toWrite) throws BitsyException { ByteBuffer buf = ByteBuffer.wrap(toWrite); append(buf); }
[ "public", "void", "append", "(", "byte", "[", "]", "toWrite", ")", "throws", "BitsyException", "{", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "wrap", "(", "toWrite", ")", ";", "append", "(", "buf", ")", ";", "}" ]
This method appends a line to the file channel
[ "This", "method", "appends", "a", "line", "to", "the", "file", "channel" ]
c0dd4b6c9d6dc9987d0168c91417eb04d80bf712
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/util/CommittableFileLog.java#L321-L325
train
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/tx/BitsyTransactionContext.java
BitsyTransactionContext.removeEdgeOnVertexDelete
private IEdge removeEdgeOnVertexDelete(UUID edgeId) throws BitsyException { // This is called from remove on adjMap, which means that the edge was added in this Tx BitsyEdge edge = changedEdges.remove(edgeId); // Only an edge that is present in this Tx can be removed by the IEdgeRemover...
java
private IEdge removeEdgeOnVertexDelete(UUID edgeId) throws BitsyException { // This is called from remove on adjMap, which means that the edge was added in this Tx BitsyEdge edge = changedEdges.remove(edgeId); // Only an edge that is present in this Tx can be removed by the IEdgeRemover...
[ "private", "IEdge", "removeEdgeOnVertexDelete", "(", "UUID", "edgeId", ")", "throws", "BitsyException", "{", "// This is called from remove on adjMap, which means that the edge was added in this Tx", "BitsyEdge", "edge", "=", "changedEdges", ".", "remove", "(", "edgeId", ")", ...
This method is called to remove an edge through the IEdgeRemover
[ "This", "method", "is", "called", "to", "remove", "an", "edge", "through", "the", "IEdgeRemover" ]
c0dd4b6c9d6dc9987d0168c91417eb04d80bf712
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/tx/BitsyTransactionContext.java#L55-L63
train
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/ads/set/CompactMultiSetMax.java
CompactMultiSetMax.sizeBiggerThan24
public boolean sizeBiggerThan24() { int currentSize = 0; for (int i=0; i < elements.length; i++) { Object elem = elements[i]; if (elem == null) { // Empty cell continue; } else if (elem instanceof ArraySet) { // Don't re...
java
public boolean sizeBiggerThan24() { int currentSize = 0; for (int i=0; i < elements.length; i++) { Object elem = elements[i]; if (elem == null) { // Empty cell continue; } else if (elem instanceof ArraySet) { // Don't re...
[ "public", "boolean", "sizeBiggerThan24", "(", ")", "{", "int", "currentSize", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "elements", ".", "length", ";", "i", "++", ")", "{", "Object", "elem", "=", "elements", "[", "i", "]", "...
This method goes over the elements to see if this compact set can be fit inside a Set24
[ "This", "method", "goes", "over", "the", "elements", "to", "see", "if", "this", "compact", "set", "can", "be", "fit", "inside", "a", "Set24" ]
c0dd4b6c9d6dc9987d0168c91417eb04d80bf712
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/ads/set/CompactMultiSetMax.java#L138-L161
train
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/store/Endpoint.java
Endpoint.isMatch
public boolean isMatch(Endpoint other) { assert isMarker() : "isMatch can only be used on marker end-points"; // Same structure as compareTo, except that nulls 'match' IDs (not <) int ans = 0; // A null edgeLabel implies that all endpoints of that vertex must be // matched ...
java
public boolean isMatch(Endpoint other) { assert isMarker() : "isMatch can only be used on marker end-points"; // Same structure as compareTo, except that nulls 'match' IDs (not <) int ans = 0; // A null edgeLabel implies that all endpoints of that vertex must be // matched ...
[ "public", "boolean", "isMatch", "(", "Endpoint", "other", ")", "{", "assert", "isMarker", "(", ")", ":", "\"isMatch can only be used on marker end-points\"", ";", "// Same structure as compareTo, except that nulls 'match' IDs (not <)", "int", "ans", "=", "0", ";", "// A nul...
This method must only be called on marker endpoints, i.e., end-points used for matching existing Endpoints in the B-Tree. It returns true if the given Endpoint matches this marker
[ "This", "method", "must", "only", "be", "called", "on", "marker", "endpoints", "i", ".", "e", ".", "end", "-", "points", "used", "for", "matching", "existing", "Endpoints", "in", "the", "B", "-", "Tree", ".", "It", "returns", "true", "if", "the", "give...
c0dd4b6c9d6dc9987d0168c91417eb04d80bf712
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/store/Endpoint.java#L114-L144
train
lambdazen/bitsy
src/main/java/com/lambdazen/bitsy/store/Record.java
Record.checkObsolete
public boolean checkObsolete(IGraphStore store, boolean isReorg, int lineNo, String fileName) { if (type == RecordType.T) { // Transaction boundaries are obsolete during reorg return isReorg; } else if (type == RecordType.L) { // A log is always obsolete ...
java
public boolean checkObsolete(IGraphStore store, boolean isReorg, int lineNo, String fileName) { if (type == RecordType.T) { // Transaction boundaries are obsolete during reorg return isReorg; } else if (type == RecordType.L) { // A log is always obsolete ...
[ "public", "boolean", "checkObsolete", "(", "IGraphStore", "store", ",", "boolean", "isReorg", ",", "int", "lineNo", ",", "String", "fileName", ")", "{", "if", "(", "type", "==", "RecordType", ".", "T", ")", "{", "// Transaction boundaries are obsolete during reorg...
This method checks to see if a record is obsolete, i.e., its version is not present in the store
[ "This", "method", "checks", "to", "see", "if", "a", "record", "is", "obsolete", "i", ".", "e", ".", "its", "version", "is", "not", "present", "in", "the", "store" ]
c0dd4b6c9d6dc9987d0168c91417eb04d80bf712
https://github.com/lambdazen/bitsy/blob/c0dd4b6c9d6dc9987d0168c91417eb04d80bf712/src/main/java/com/lambdazen/bitsy/store/Record.java#L150-L234
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritSendCommandQueue.java
GerritSendCommandQueue.getQueueSize
public static int getQueueSize() { if (instance != null && instance.executor != null) { return instance.executor.getQueue().size(); } else { return 0; } }
java
public static int getQueueSize() { if (instance != null && instance.executor != null) { return instance.executor.getQueue().size(); } else { return 0; } }
[ "public", "static", "int", "getQueueSize", "(", ")", "{", "if", "(", "instance", "!=", "null", "&&", "instance", ".", "executor", "!=", "null", ")", "{", "return", "instance", ".", "executor", ".", "getQueue", "(", ")", ".", "size", "(", ")", ";", "}...
Returns the current queue size. @return the queue size, @see java.util.concurrent.ThreadPoolExecutor#getQueue()
[ "Returns", "the", "current", "queue", "size", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritSendCommandQueue.java#L127-L133
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritSendCommandQueue.java
GerritSendCommandQueue.initialize
public static synchronized void initialize(GerritWorkersConfig config) { if (instance == null) { instance = new GerritSendCommandQueue(); } getInstance().startQueue(config); }
java
public static synchronized void initialize(GerritWorkersConfig config) { if (instance == null) { instance = new GerritSendCommandQueue(); } getInstance().startQueue(config); }
[ "public", "static", "synchronized", "void", "initialize", "(", "GerritWorkersConfig", "config", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "instance", "=", "new", "GerritSendCommandQueue", "(", ")", ";", "}", "getInstance", "(", ")", ".", "star...
Initializes the singleton instance and configures it. @param config the configuration.
[ "Initializes", "the", "singleton", "instance", "and", "configures", "it", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritSendCommandQueue.java#L236-L241
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/rest/ChangeId.java
ChangeId.asUrlPart
public String asUrlPart() { try { return encode(projectName) + "~" + encode(branchName) + "~" + id; } catch (UnsupportedEncodingException e) { String parameter = projectName + "~" + branchName + "~" + id; logger.error("Failed to encode ChangeId {}, falling back to une...
java
public String asUrlPart() { try { return encode(projectName) + "~" + encode(branchName) + "~" + id; } catch (UnsupportedEncodingException e) { String parameter = projectName + "~" + branchName + "~" + id; logger.error("Failed to encode ChangeId {}, falling back to une...
[ "public", "String", "asUrlPart", "(", ")", "{", "try", "{", "return", "encode", "(", "projectName", ")", "+", "\"~\"", "+", "encode", "(", "branchName", ")", "+", "\"~\"", "+", "id", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", ...
As the part of the URL. @return the url part.
[ "As", "the", "part", "of", "the", "URL", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/rest/ChangeId.java#L73-L81
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java
AbstractSendCommandJob.sendCommand
@Override public boolean sendCommand(String command) { try { sendCommand2(command); } catch (Exception ex) { logger.error("Could not run command " + command, ex); return false; } return true; }
java
@Override public boolean sendCommand(String command) { try { sendCommand2(command); } catch (Exception ex) { logger.error("Could not run command " + command, ex); return false; } return true; }
[ "@", "Override", "public", "boolean", "sendCommand", "(", "String", "command", ")", "{", "try", "{", "sendCommand2", "(", "command", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", ".", "error", "(", "\"Could not run command \"", "+", "...
Sends a command to the Gerrit server. @param command the command. @return true if there were no exceptions when sending.
[ "Sends", "a", "command", "to", "the", "Gerrit", "server", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java#L76-L85
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java
AbstractSendCommandJob.sendCommandStr
@Override public String sendCommandStr(String command) { String str = null; try { str = sendCommand2(command); } catch (Exception ex) { logger.error("Could not run command " + command, ex); } return str; }
java
@Override public String sendCommandStr(String command) { String str = null; try { str = sendCommand2(command); } catch (Exception ex) { logger.error("Could not run command " + command, ex); } return str; }
[ "@", "Override", "public", "String", "sendCommandStr", "(", "String", "command", ")", "{", "String", "str", "=", "null", ";", "try", "{", "str", "=", "sendCommand2", "(", "command", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", "....
Sends a command to the Gerrit server, returning the output from the command. @param command the command. @return the output from the command.
[ "Sends", "a", "command", "to", "the", "Gerrit", "server", "returning", "the", "output", "from", "the", "command", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java#L92-L101
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java
AbstractSendCommandJob.sendCommand2
@Override public String sendCommand2(String command) throws IOException { String str = null; SshConnection ssh = null; try { ssh = SshConnectionFactory.getConnection(config.getGerritHostName(), config.getGerritSshPort(), config.getGerritProxy(), config.getGerr...
java
@Override public String sendCommand2(String command) throws IOException { String str = null; SshConnection ssh = null; try { ssh = SshConnectionFactory.getConnection(config.getGerritHostName(), config.getGerritSshPort(), config.getGerritProxy(), config.getGerr...
[ "@", "Override", "public", "String", "sendCommand2", "(", "String", "command", ")", "throws", "IOException", "{", "String", "str", "=", "null", ";", "SshConnection", "ssh", "=", "null", ";", "try", "{", "ssh", "=", "SshConnectionFactory", ".", "getConnection",...
Runs a command on the gerrit server and returns the output from the command. @param command the command. @return the output of the command, or null if something went wrong. @throws IOException if error.
[ "Runs", "a", "command", "on", "the", "gerrit", "server", "and", "returns", "the", "output", "from", "the", "command", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/cmd/AbstractSendCommandJob.java#L109-L125
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java
SshUtil.parsePrivateKeyFile
private static KeyPair parsePrivateKeyFile(File keyFile) { if (keyFile == null) { return null; } try { JSch jsch = new JSch(); KeyPair key = KeyPair.load(jsch, keyFile.getAbsolutePath()); return key; } catch (JSchException ex) { ...
java
private static KeyPair parsePrivateKeyFile(File keyFile) { if (keyFile == null) { return null; } try { JSch jsch = new JSch(); KeyPair key = KeyPair.load(jsch, keyFile.getAbsolutePath()); return key; } catch (JSchException ex) { ...
[ "private", "static", "KeyPair", "parsePrivateKeyFile", "(", "File", "keyFile", ")", "{", "if", "(", "keyFile", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "JSch", "jsch", "=", "new", "JSch", "(", ")", ";", "KeyPair", "key", "=", "...
Parses the keyFile hiding any Exceptions that might occur. @param keyFile the file. @return the "parsed" file.
[ "Parses", "the", "keyFile", "hiding", "any", "Exceptions", "that", "might", "occur", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java#L59-L71
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java
SshUtil.checkPassPhrase
public static boolean checkPassPhrase(File keyFilePath, String passPhrase) { KeyPair key = parsePrivateKeyFile(keyFilePath); boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty(); if (key == null) { return false; } else if (key.isEncrypted() != isValidPhr...
java
public static boolean checkPassPhrase(File keyFilePath, String passPhrase) { KeyPair key = parsePrivateKeyFile(keyFilePath); boolean isValidPhrase = passPhrase != null && !passPhrase.trim().isEmpty(); if (key == null) { return false; } else if (key.isEncrypted() != isValidPhr...
[ "public", "static", "boolean", "checkPassPhrase", "(", "File", "keyFilePath", ",", "String", "passPhrase", ")", "{", "KeyPair", "key", "=", "parsePrivateKeyFile", "(", "keyFilePath", ")", ";", "boolean", "isValidPhrase", "=", "passPhrase", "!=", "null", "&&", "!...
Checks to see if the passPhrase is valid for the private key file. @param keyFilePath the private key file. @param passPhrase the password for the file. @return true if it is valid.
[ "Checks", "to", "see", "if", "the", "passPhrase", "is", "valid", "for", "the", "private", "key", "file", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshUtil.java#L79-L90
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob2.java
AbstractRestCommandJob2.createHttpPostEntity
private HttpPost createHttpPostEntity(ReviewInput reviewInput, String reviewEndpoint) { HttpPost httpPost = new HttpPost(reviewEndpoint); String asJson = GSON.toJson(reviewInput); StringEntity entity = null; try { entity = new StringEntity(asJson); } catch (Unsuppor...
java
private HttpPost createHttpPostEntity(ReviewInput reviewInput, String reviewEndpoint) { HttpPost httpPost = new HttpPost(reviewEndpoint); String asJson = GSON.toJson(reviewInput); StringEntity entity = null; try { entity = new StringEntity(asJson); } catch (Unsuppor...
[ "private", "HttpPost", "createHttpPostEntity", "(", "ReviewInput", "reviewInput", ",", "String", "reviewEndpoint", ")", "{", "HttpPost", "httpPost", "=", "new", "HttpPost", "(", "reviewEndpoint", ")", ";", "String", "asJson", "=", "GSON", ".", "toJson", "(", "re...
Construct the post. @param reviewInput input @param reviewEndpoint end point @return the entity
[ "Construct", "the", "post", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob2.java#L176-L194
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
SshConnectionImpl.connect
@Override public synchronized void connect() throws IOException { logger.debug("connecting..."); Authentication auth = authentication; if (updater != null) { Authentication updatedAuth = updater.updateAuthentication(authentication); if (updatedAuth != null && auth != ...
java
@Override public synchronized void connect() throws IOException { logger.debug("connecting..."); Authentication auth = authentication; if (updater != null) { Authentication updatedAuth = updater.updateAuthentication(authentication); if (updatedAuth != null && auth != ...
[ "@", "Override", "public", "synchronized", "void", "connect", "(", ")", "throws", "IOException", "{", "logger", ".", "debug", "(", "\"connecting...\"", ")", ";", "Authentication", "auth", "=", "authentication", ";", "if", "(", "updater", "!=", "null", ")", "...
Connects the connection. @throws IOException if the unfortunate happens.
[ "Connects", "the", "connection", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L155-L202
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
SshConnectionImpl.executeCommand
@Override public synchronized String executeCommand(String command) throws SshException { if (!isConnected()) { throw new IllegalStateException("Not connected!"); } Channel channel = null; try { logger.debug("Opening channel"); channel = connectSe...
java
@Override public synchronized String executeCommand(String command) throws SshException { if (!isConnected()) { throw new IllegalStateException("Not connected!"); } Channel channel = null; try { logger.debug("Opening channel"); channel = connectSe...
[ "@", "Override", "public", "synchronized", "String", "executeCommand", "(", "String", "command", ")", "throws", "SshException", "{", "if", "(", "!", "isConnected", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Not connected!\"", ")", ";", ...
Execute an ssh command on the server. After the command is sent the used channel is disconnected. @param command the command to execute. @return a String containing the output from the command. @throws SshException if so.
[ "Execute", "an", "ssh", "command", "on", "the", "server", ".", "After", "the", "command", "is", "sent", "the", "used", "channel", "is", "disconnected", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L233-L292
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
SshConnectionImpl.waitForChannelClosure
private static void waitForChannelClosure(Channel channel, long timoutInMs) { final long start = System.currentTimeMillis(); final long until = start + timoutInMs; try { while (!channel.isClosed() && System.currentTimeMillis() < until) { Thread.sleep(CLOSURE_WAIT_INTE...
java
private static void waitForChannelClosure(Channel channel, long timoutInMs) { final long start = System.currentTimeMillis(); final long until = start + timoutInMs; try { while (!channel.isClosed() && System.currentTimeMillis() < until) { Thread.sleep(CLOSURE_WAIT_INTE...
[ "private", "static", "void", "waitForChannelClosure", "(", "Channel", "channel", ",", "long", "timoutInMs", ")", "{", "final", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "long", "until", "=", "start", "+", "timoutInMs", ...
Blocks until the given channel is close or the timout is reached @param channel the channel to wait for @param timoutInMs the timeout
[ "Blocks", "until", "the", "given", "channel", "is", "close", "or", "the", "timout", "is", "reached" ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L300-L314
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
SshConnectionImpl.executeCommandReader
@Override public synchronized Reader executeCommandReader(String command) throws SshException, IOException { if (!isConnected()) { throw new IllegalStateException("Not connected!"); } try { Channel channel = connectSession.openChannel("exec"); ((ChannelExe...
java
@Override public synchronized Reader executeCommandReader(String command) throws SshException, IOException { if (!isConnected()) { throw new IllegalStateException("Not connected!"); } try { Channel channel = connectSession.openChannel("exec"); ((ChannelExe...
[ "@", "Override", "public", "synchronized", "Reader", "executeCommandReader", "(", "String", "command", ")", "throws", "SshException", ",", "IOException", "{", "if", "(", "!", "isConnected", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Not...
Execute an ssh command on the server, without closing the session so that a Reader can be returned with streaming data from the server. @param command the command to execute. @return a Reader with streaming data from the server. @throws IOException if it is so. @throws SshException if there are any ssh problems.
[ "Execute", "an", "ssh", "command", "on", "the", "server", "without", "closing", "the", "session", "so", "that", "a", "Reader", "can", "be", "returned", "with", "streaming", "data", "from", "the", "server", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L327-L341
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java
SshConnectionImpl.disconnect
@Override public synchronized void disconnect() { if (connectSession != null) { logger.debug("Disconnecting client connection."); connectSession.disconnect(); connectSession = null; } }
java
@Override public synchronized void disconnect() { if (connectSession != null) { logger.debug("Disconnecting client connection."); connectSession.disconnect(); connectSession = null; } }
[ "@", "Override", "public", "synchronized", "void", "disconnect", "(", ")", "{", "if", "(", "connectSession", "!=", "null", ")", "{", "logger", ".", "debug", "(", "\"Disconnecting client connection.\"", ")", ";", "connectSession", ".", "disconnect", "(", ")", "...
Disconnects the connection.
[ "Disconnects", "the", "connection", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/ssh/SshConnectionImpl.java#L397-L404
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getEventIfInteresting
public static GerritJsonEvent getEventIfInteresting(String jsonString) { logger.trace("finding event for jsonString: {}", jsonString); try { JSONObject jsonObject = getJsonObjectIfInterestingAndUsable(jsonString); if (jsonObject != null) { return getEvent(jsonObje...
java
public static GerritJsonEvent getEventIfInteresting(String jsonString) { logger.trace("finding event for jsonString: {}", jsonString); try { JSONObject jsonObject = getJsonObjectIfInterestingAndUsable(jsonString); if (jsonObject != null) { return getEvent(jsonObje...
[ "public", "static", "GerritJsonEvent", "getEventIfInteresting", "(", "String", "jsonString", ")", "{", "logger", ".", "trace", "(", "\"finding event for jsonString: {}\"", ",", "jsonString", ")", ";", "try", "{", "JSONObject", "jsonObject", "=", "getJsonObjectIfInterest...
Tries to parse the provided string into a GerritJsonEvent DTO if it is interesting and usable. @param jsonString the JSON formatted string. @return the Event. @see #getJsonObjectIfInterestingAndUsable(String)
[ "Tries", "to", "parse", "the", "provided", "string", "into", "a", "GerritJsonEvent", "DTO", "if", "it", "is", "interesting", "and", "usable", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L184-L196
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getString
public static String getString(JSONObject json, String key, String defaultValue) { if (json.containsKey(key)) { return json.getString(key); } else { return defaultValue; } }
java
public static String getString(JSONObject json, String key, String defaultValue) { if (json.containsKey(key)) { return json.getString(key); } else { return defaultValue; } }
[ "public", "static", "String", "getString", "(", "JSONObject", "json", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "if", "(", "json", ".", "containsKey", "(", "key", ")", ")", "{", "return", "json", ".", "getString", "(", "key", ")", ...
Returns the value of a JSON property as a String if it exists otherwise returns the defaultValue. @param json the JSONObject to check. @param key the key. @param defaultValue the value to return if the key is missing. @return the value for the key as a string.
[ "Returns", "the", "value", "of", "a", "JSON", "property", "as", "a", "String", "if", "it", "exists", "otherwise", "returns", "the", "defaultValue", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L205-L211
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getBoolean
public static boolean getBoolean(JSONObject json, String key, boolean defaultValue) { if (json.containsKey(key)) { boolean result; try { result = json.getBoolean(key); } catch (JSONException ex) { result = defaultValue; } ...
java
public static boolean getBoolean(JSONObject json, String key, boolean defaultValue) { if (json.containsKey(key)) { boolean result; try { result = json.getBoolean(key); } catch (JSONException ex) { result = defaultValue; } ...
[ "public", "static", "boolean", "getBoolean", "(", "JSONObject", "json", ",", "String", "key", ",", "boolean", "defaultValue", ")", "{", "if", "(", "json", ".", "containsKey", "(", "key", ")", ")", "{", "boolean", "result", ";", "try", "{", "result", "=",...
Returns the value of a JSON property as a boolean if it exists and boolean value otherwise returns the defaultValue. @param json the JSONObject to check. @param key the key. @param defaultValue the value to return if the key is missing or not boolean value. @return the value for the key as a boolean.
[ "Returns", "the", "value", "of", "a", "JSON", "property", "as", "a", "boolean", "if", "it", "exists", "and", "boolean", "value", "otherwise", "returns", "the", "defaultValue", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L233-L245
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getDate
public static Date getDate(JSONObject json, String key) { return getDate(json, key, null); }
java
public static Date getDate(JSONObject json, String key) { return getDate(json, key, null); }
[ "public", "static", "Date", "getDate", "(", "JSONObject", "json", ",", "String", "key", ")", "{", "return", "getDate", "(", "json", ",", "key", ",", "null", ")", ";", "}" ]
Returns the value of a JSON property as a Date if it exists otherwise returns null. @param json the JSONObject to check. @param key the key. @return the value for the key as a Date.
[ "Returns", "the", "value", "of", "a", "JSON", "property", "as", "a", "Date", "if", "it", "exists", "otherwise", "returns", "null", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L263-L265
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java
GerritJsonEventFactory.getDate
public static Date getDate(JSONObject json, String key, Date defaultValue) { Date result = defaultValue; if (json.containsKey(key)) { try { String secondsString = json.getString(key); //In gerrit, time is written in seconds, not milliseconds. L...
java
public static Date getDate(JSONObject json, String key, Date defaultValue) { Date result = defaultValue; if (json.containsKey(key)) { try { String secondsString = json.getString(key); //In gerrit, time is written in seconds, not milliseconds. L...
[ "public", "static", "Date", "getDate", "(", "JSONObject", "json", ",", "String", "key", ",", "Date", "defaultValue", ")", "{", "Date", "result", "=", "defaultValue", ";", "if", "(", "json", ".", "containsKey", "(", "key", ")", ")", "{", "try", "{", "St...
Returns the value of a JSON property as a Date if it exists otherwise returns the defaultValue. @param json the JSONObject to check. @param key the key. @param defaultValue the value to return if the key is missing. @return the value for the key as a Date.
[ "Returns", "the", "value", "of", "a", "JSON", "property", "as", "a", "Date", "if", "it", "exists", "otherwise", "returns", "the", "defaultValue", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritJsonEventFactory.java#L274-L288
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/GerritTriggeredEvent.java
GerritTriggeredEvent.setEventCreatedOn
public void setEventCreatedOn(String eventCreatedOn) { Long milliseconds = TimeUnit.SECONDS.toMillis(Long.parseLong(eventCreatedOn)); this.eventCreatedOn = new Date(milliseconds); }
java
public void setEventCreatedOn(String eventCreatedOn) { Long milliseconds = TimeUnit.SECONDS.toMillis(Long.parseLong(eventCreatedOn)); this.eventCreatedOn = new Date(milliseconds); }
[ "public", "void", "setEventCreatedOn", "(", "String", "eventCreatedOn", ")", "{", "Long", "milliseconds", "=", "TimeUnit", ".", "SECONDS", ".", "toMillis", "(", "Long", ".", "parseLong", "(", "eventCreatedOn", ")", ")", ";", "this", ".", "eventCreatedOn", "=",...
Gerrit server-based time stamp when the event was created by Gerrit Server. ONLY USE FOR UNIT TESTS! @param eventCreatedOn the eventCreatedOn to set
[ "Gerrit", "server", "-", "based", "time", "stamp", "when", "the", "event", "was", "created", "by", "Gerrit", "Server", ".", "ONLY", "USE", "FOR", "UNIT", "TESTS!" ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/GerritTriggeredEvent.java#L141-L144
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java
WatchTimeExceptionData.isExceptionAtThisTime
public boolean isExceptionAtThisTime() { Time now = new Time(); for (TimeSpan span : timesOfDay) { if (span.isWithin(now)) { return true; } } return false; }
java
public boolean isExceptionAtThisTime() { Time now = new Time(); for (TimeSpan span : timesOfDay) { if (span.isWithin(now)) { return true; } } return false; }
[ "public", "boolean", "isExceptionAtThisTime", "(", ")", "{", "Time", "now", "=", "new", "Time", "(", ")", ";", "for", "(", "TimeSpan", "span", ":", "timesOfDay", ")", "{", "if", "(", "span", ".", "isWithin", "(", "now", ")", ")", "{", "return", "true...
If the current time is configured as an exception. @return true if so. @see #timesOfDay
[ "If", "the", "current", "time", "is", "configured", "as", "an", "exception", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java#L106-L114
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java
WatchTimeExceptionData.isExceptionToday
public boolean isExceptionToday() { if (daysOfWeek != null && daysOfWeek.length > 0) { int dayOfWeekNow = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); for (int exceptionDay : daysOfWeek) { if (exceptionDay == dayOfWeekNow) { return true; ...
java
public boolean isExceptionToday() { if (daysOfWeek != null && daysOfWeek.length > 0) { int dayOfWeekNow = Calendar.getInstance().get(Calendar.DAY_OF_WEEK); for (int exceptionDay : daysOfWeek) { if (exceptionDay == dayOfWeekNow) { return true; ...
[ "public", "boolean", "isExceptionToday", "(", ")", "{", "if", "(", "daysOfWeek", "!=", "null", "&&", "daysOfWeek", ".", "length", ">", "0", ")", "{", "int", "dayOfWeekNow", "=", "Calendar", ".", "getInstance", "(", ")", ".", "get", "(", "Calendar", ".", ...
If today is a day configured as an exception. @return true if so. @see #daysOfWeek
[ "If", "today", "is", "a", "day", "configured", "as", "an", "exception", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java#L122-L132
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java
WatchTimeExceptionData.isEnabled
public boolean isEnabled() { if (daysOfWeek != null && daysOfWeek.length > 0) { return true; } if (timesOfDay != null && timesOfDay.size() > 0) { return true; } return false; }
java
public boolean isEnabled() { if (daysOfWeek != null && daysOfWeek.length > 0) { return true; } if (timesOfDay != null && timesOfDay.size() > 0) { return true; } return false; }
[ "public", "boolean", "isEnabled", "(", ")", "{", "if", "(", "daysOfWeek", "!=", "null", "&&", "daysOfWeek", ".", "length", ">", "0", ")", "{", "return", "true", ";", "}", "if", "(", "timesOfDay", "!=", "null", "&&", "timesOfDay", ".", "size", "(", ")...
Returns true if any exception data has been added, either days or time. @return true if any exception data has been added, either days or time.
[ "Returns", "true", "if", "any", "exception", "data", "has", "been", "added", "either", "days", "or", "time", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/watchdog/WatchTimeExceptionData.java#L139-L147
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/HashtagsChanged.java
HashtagsChanged.hashtagsFromArray
private List<String> hashtagsFromArray(JSONObject json, String array) { if (json.containsKey(array)) { JSONArray hashtagsArray = json.getJSONArray(array); List<String> result = new ArrayList<String>(hashtagsArray.size()); for (Object tag : hashtagsArray) { res...
java
private List<String> hashtagsFromArray(JSONObject json, String array) { if (json.containsKey(array)) { JSONArray hashtagsArray = json.getJSONArray(array); List<String> result = new ArrayList<String>(hashtagsArray.size()); for (Object tag : hashtagsArray) { res...
[ "private", "List", "<", "String", ">", "hashtagsFromArray", "(", "JSONObject", "json", ",", "String", "array", ")", "{", "if", "(", "json", ".", "containsKey", "(", "array", ")", ")", "{", "JSONArray", "hashtagsArray", "=", "json", ".", "getJSONArray", "("...
Converts an array key from JSON into a list of the strings it contains. @param json The json object. @param array The array name within the json object. @return A list of strings contained in the array or an empty list if the array is not present.
[ "Converts", "an", "array", "key", "from", "JSON", "into", "a", "list", "of", "the", "strings", "it", "contains", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/HashtagsChanged.java#L98-L108
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/ChangeBasedEvent.java
ChangeBasedEvent.fromJson
public void fromJson(JSONObject json) { super.fromJson(json); if (json.containsKey(CHANGE)) { change = new Change(json.getJSONObject(CHANGE)); } if (json.containsKey(PATCH_SET)) { patchSet = new PatchSet(json.getJSONObject(PATCH_SET)); } else if (json.cont...
java
public void fromJson(JSONObject json) { super.fromJson(json); if (json.containsKey(CHANGE)) { change = new Change(json.getJSONObject(CHANGE)); } if (json.containsKey(PATCH_SET)) { patchSet = new PatchSet(json.getJSONObject(PATCH_SET)); } else if (json.cont...
[ "public", "void", "fromJson", "(", "JSONObject", "json", ")", "{", "super", ".", "fromJson", "(", "json", ")", ";", "if", "(", "json", ".", "containsKey", "(", "CHANGE", ")", ")", "{", "change", "=", "new", "Change", "(", "json", ".", "getJSONObject", ...
Takes a JSON object and fills its internal data-structure. @param json the JSON Object.
[ "Takes", "a", "JSON", "object", "and", "fills", "its", "internal", "data", "-", "structure", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/events/ChangeBasedEvent.java#L132-L142
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.getLine
private String getLine(CharBuffer cb) { String line = null; int pos = cb.position(); int limit = cb.limit(); cb.flip(); for (int i = 0; i < cb.length(); i++) { if (cb.charAt(i) == '\n') { line = getSubSequence(cb, 0, i).toString(); cb.p...
java
private String getLine(CharBuffer cb) { String line = null; int pos = cb.position(); int limit = cb.limit(); cb.flip(); for (int i = 0; i < cb.length(); i++) { if (cb.charAt(i) == '\n') { line = getSubSequence(cb, 0, i).toString(); cb.p...
[ "private", "String", "getLine", "(", "CharBuffer", "cb", ")", "{", "String", "line", "=", "null", ";", "int", "pos", "=", "cb", ".", "position", "(", ")", ";", "int", "limit", "=", "cb", ".", "limit", "(", ")", ";", "cb", ".", "flip", "(", ")", ...
Offers lines in buffer to queue. @param cb a buffer to have received text data. @return the line string. null if no EOL, otherwise buffer is compacted.
[ "Offers", "lines", "in", "buffer", "to", "queue", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L340-L378
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.getSubSequence
@IgnoreJRERequirement private CharSequence getSubSequence(CharBuffer cb, int start, int end) { return cb.subSequence(start, end); }
java
@IgnoreJRERequirement private CharSequence getSubSequence(CharBuffer cb, int start, int end) { return cb.subSequence(start, end); }
[ "@", "IgnoreJRERequirement", "private", "CharSequence", "getSubSequence", "(", "CharBuffer", "cb", ",", "int", "start", ",", "int", "end", ")", "{", "return", "cb", ".", "subSequence", "(", "start", ",", "end", ")", ";", "}" ]
Get sub sequence of buffer. This method avoids error in java-api-check. animal-sniffer is confused by the signature of CharBuffer.subSequence() due to declaration of this method has been changed since Java7. (abstract -> non-abstract) @param cb a buffer @param start start of sub sequence @param end end of sub sequenc...
[ "Get", "sub", "sequence", "of", "buffer", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L393-L396
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.connect
private SshConnection connect() { if (sshConnection != null && sshConnection.isConnected()) { return sshConnection; } while (!shutdownInProgress) { SshConnection ssh = null; try { logger.debug("Connecting..."); ssh = SshConnecti...
java
private SshConnection connect() { if (sshConnection != null && sshConnection.isConnected()) { return sshConnection; } while (!shutdownInProgress) { SshConnection ssh = null; try { logger.debug("Connecting..."); ssh = SshConnecti...
[ "private", "SshConnection", "connect", "(", ")", "{", "if", "(", "sshConnection", "!=", "null", "&&", "sshConnection", ".", "isConnected", "(", ")", ")", "{", "return", "sshConnection", ";", "}", "while", "(", "!", "shutdownInProgress", ")", "{", "SshConnect...
Connects to the Gerrit server and authenticates as the specified user. @return not null if everything is well, null if connect and reconnect failed.
[ "Connects", "to", "the", "Gerrit", "server", "and", "authenticates", "as", "the", "specified", "user", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L491-L550
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.formatVersion
private String formatVersion(String version) { if (version == null) { return version; } String[] split = version.split(GERRIT_VERSION_PREFIX); if (split.length < 2) { return version.trim(); } return split[1].trim(); }
java
private String formatVersion(String version) { if (version == null) { return version; } String[] split = version.split(GERRIT_VERSION_PREFIX); if (split.length < 2) { return version.trim(); } return split[1].trim(); }
[ "private", "String", "formatVersion", "(", "String", "version", ")", "{", "if", "(", "version", "==", "null", ")", "{", "return", "version", ";", "}", "String", "[", "]", "split", "=", "version", ".", "split", "(", "GERRIT_VERSION_PREFIX", ")", ";", "if"...
Removes the "gerrit version " from the start of the response from gerrit. @param version the response from gerrit. @return the input string with "gerrit version " removed.
[ "Removes", "the", "gerrit", "version", "from", "the", "start", "of", "the", "response", "from", "gerrit", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L557-L566
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java
GerritConnection.notifyListeners
public void notifyListeners(GerritConnectionEvent event) { for (ConnectionListener listener : listeners) { try { switch(event) { case GERRIT_CONNECTION_ESTABLISHED: listener.connectionEstablished(); break; case G...
java
public void notifyListeners(GerritConnectionEvent event) { for (ConnectionListener listener : listeners) { try { switch(event) { case GERRIT_CONNECTION_ESTABLISHED: listener.connectionEstablished(); break; case G...
[ "public", "void", "notifyListeners", "(", "GerritConnectionEvent", "event", ")", "{", "for", "(", "ConnectionListener", "listener", ":", "listeners", ")", "{", "try", "{", "switch", "(", "event", ")", "{", "case", "GERRIT_CONNECTION_ESTABLISHED", ":", "listener", ...
Notifies all listeners of a Gerrit connection event. @param event the event.
[ "Notifies", "all", "listeners", "of", "a", "Gerrit", "connection", "event", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritConnection.java#L723-L740
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandlerWithPersistedConnection.java
GerritQueryHandlerWithPersistedConnection.getConnection
@Override protected SshConnection getConnection() throws IOException { if (!isPersistedConnectionValid()) { activeConnection = super.getConnection(); logger.trace("SSH connection is not valid anymore, a new one was created."); } return activeConnection; }
java
@Override protected SshConnection getConnection() throws IOException { if (!isPersistedConnectionValid()) { activeConnection = super.getConnection(); logger.trace("SSH connection is not valid anymore, a new one was created."); } return activeConnection; }
[ "@", "Override", "protected", "SshConnection", "getConnection", "(", ")", "throws", "IOException", "{", "if", "(", "!", "isPersistedConnectionValid", "(", ")", ")", "{", "activeConnection", "=", "super", ".", "getConnection", "(", ")", ";", "logger", ".", "tra...
Returns a fresh SSH connection if the persisted one is not valid. Otherwise returns the existing connection. @return an active SSH connection @throws IOException for IO issues
[ "Returns", "a", "fresh", "SSH", "connection", "if", "the", "persisted", "one", "is", "not", "valid", ".", "Otherwise", "returns", "the", "existing", "connection", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandlerWithPersistedConnection.java#L38-L45
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/rest/Topic.java
Topic.getChanges
public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (StringUtils.isEmpty(name)) { logger.error("Topic name can not be empty"); return Collections.emptyMap(); } if (changes == null) { Map<Change, PatchSet> temp = new HashMap<Cha...
java
public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (StringUtils.isEmpty(name)) { logger.error("Topic name can not be empty"); return Collections.emptyMap(); } if (changes == null) { Map<Change, PatchSet> temp = new HashMap<Cha...
[ "public", "Map", "<", "Change", ",", "PatchSet", ">", "getChanges", "(", "GerritQueryHandler", "gerritQueryHandler", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "name", ")", ")", "{", "logger", ".", "error", "(", "\"Topic name can not be empty\"", ...
Gets all change-patchset pairs related to this topic. After first call data is cached. @param gerritQueryHandler the query handler, responsible for the queries to gerrit. @return the map of pairs change-patchset related to this topic.
[ "Gets", "all", "change", "-", "patchset", "pairs", "related", "to", "this", "topic", ".", "After", "first", "call", "data", "is", "cached", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/rest/Topic.java#L75-L102
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob.java
AbstractRestCommandJob.resolveEndpointURL
private String resolveEndpointURL() { String gerritFrontEndUrl = config.getGerritFrontEndUrl(); if (!gerritFrontEndUrl.endsWith("/")) { gerritFrontEndUrl = gerritFrontEndUrl + "/"; } ChangeId changeId = new ChangeId(event.getChange().getProject(), event.getChange().getBranch...
java
private String resolveEndpointURL() { String gerritFrontEndUrl = config.getGerritFrontEndUrl(); if (!gerritFrontEndUrl.endsWith("/")) { gerritFrontEndUrl = gerritFrontEndUrl + "/"; } ChangeId changeId = new ChangeId(event.getChange().getProject(), event.getChange().getBranch...
[ "private", "String", "resolveEndpointURL", "(", ")", "{", "String", "gerritFrontEndUrl", "=", "config", ".", "getGerritFrontEndUrl", "(", ")", ";", "if", "(", "!", "gerritFrontEndUrl", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "gerritFrontEndUrl", "=", "ge...
What it says resolve Endpoint URL. @return the url.
[ "What", "it", "says", "resolve", "Endpoint", "URL", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/workers/rest/AbstractRestCommandJob.java#L181-L192
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Change.java
Change.getChangeInfo
public String getChangeInfo(String preText) { StringBuilder s = new StringBuilder(); s.append(preText + "\n"); s.append("Subject: " + getSubject() + "\n"); s.append("Project: " + getProject() + " " + getBranch() + " " + getId() + "\n"); s.append("Link: " + getUrl() + "\n"); ...
java
public String getChangeInfo(String preText) { StringBuilder s = new StringBuilder(); s.append(preText + "\n"); s.append("Subject: " + getSubject() + "\n"); s.append("Project: " + getProject() + " " + getBranch() + " " + getId() + "\n"); s.append("Link: " + getUrl() + "\n"); ...
[ "public", "String", "getChangeInfo", "(", "String", "preText", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "s", ".", "append", "(", "preText", "+", "\"\\n\"", ")", ";", "s", ".", "append", "(", "\"Subject: \"", "+", "getSu...
Returns change's info in string format. @param preText the text before change info. @return change info.
[ "Returns", "change", "s", "info", "in", "string", "format", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Change.java#L506-L513
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/helpers/FileHelper.java
FileHelper.getFilesByChange
public static List<String> getFilesByChange(GerritQueryHandler gerritQueryHandler, String changeId) { try { List<JSONObject> jsonList = gerritQueryHandler.queryFiles("change:" + changeId); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase...
java
public static List<String> getFilesByChange(GerritQueryHandler gerritQueryHandler, String changeId) { try { List<JSONObject> jsonList = gerritQueryHandler.queryFiles("change:" + changeId); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase...
[ "public", "static", "List", "<", "String", ">", "getFilesByChange", "(", "GerritQueryHandler", "gerritQueryHandler", ",", "String", "changeId", ")", "{", "try", "{", "List", "<", "JSONObject", ">", "jsonList", "=", "gerritQueryHandler", ".", "queryFiles", "(", "...
Provides list of files related to the change. @param gerritQueryHandler the query handler, responsible for the queries to gerrit. @param changeId the Gerrit change id. @return list of files from the change, null in case of errors
[ "Provides", "list", "of", "files", "related", "to", "the", "change", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/helpers/FileHelper.java#L33-L65
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/RefUpdate.java
RefUpdate.getRefName
public String getRefName() { // We need to take into consideration whether // the event contains the long or short name for Ref // Gerrit 2.12 will no longer have short branch names in the // RefUpdated event. if (refName.startsWith(REFS_HEADS)) { return refName.subst...
java
public String getRefName() { // We need to take into consideration whether // the event contains the long or short name for Ref // Gerrit 2.12 will no longer have short branch names in the // RefUpdated event. if (refName.startsWith(REFS_HEADS)) { return refName.subst...
[ "public", "String", "getRefName", "(", ")", "{", "// We need to take into consideration whether", "// the event contains the long or short name for Ref", "// Gerrit 2.12 will no longer have short branch names in the", "// RefUpdated event.", "if", "(", "refName", ".", "startsWith", "("...
Ref name within project. @return the ref.
[ "Ref", "name", "within", "project", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/RefUpdate.java#L102-L111
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Provider.java
Provider.getUrl
public String getUrl() { String frontUrl = this.url; if (frontUrl != null && !frontUrl.isEmpty() && !frontUrl.endsWith("/")) { frontUrl += '/'; } return frontUrl; }
java
public String getUrl() { String frontUrl = this.url; if (frontUrl != null && !frontUrl.isEmpty() && !frontUrl.endsWith("/")) { frontUrl += '/'; } return frontUrl; }
[ "public", "String", "getUrl", "(", ")", "{", "String", "frontUrl", "=", "this", ".", "url", ";", "if", "(", "frontUrl", "!=", "null", "&&", "!", "frontUrl", ".", "isEmpty", "(", ")", "&&", "!", "frontUrl", ".", "endsWith", "(", "\"/\"", ")", ")", "...
Get url. @return the url
[ "Get", "url", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Provider.java#L219-L225
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Provider.java
Provider.readResolve
protected Object readResolve() { if (proto != null && scheme == null) { scheme = proto; proto = null; } else if (scheme == null && proto == null) { scheme = GerritConnection.GERRIT_PROTOCOL_SCHEME_NAME; //The default for old stuff } return this; }
java
protected Object readResolve() { if (proto != null && scheme == null) { scheme = proto; proto = null; } else if (scheme == null && proto == null) { scheme = GerritConnection.GERRIT_PROTOCOL_SCHEME_NAME; //The default for old stuff } return this; }
[ "protected", "Object", "readResolve", "(", ")", "{", "if", "(", "proto", "!=", "null", "&&", "scheme", "==", "null", ")", "{", "scheme", "=", "proto", ";", "proto", "=", "null", ";", "}", "else", "if", "(", "scheme", "==", "null", "&&", "proto", "=...
Deserialization handling. @return itself
[ "Deserialization", "handling", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/dto/attr/Provider.java#L324-L332
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.queryCurrentPatchSets
public List<JSONObject> queryCurrentPatchSets(String queryString) throws SshException, IOException, GerritQueryException { return queryJava(queryString, false, true, false, false); }
java
public List<JSONObject> queryCurrentPatchSets(String queryString) throws SshException, IOException, GerritQueryException { return queryJava(queryString, false, true, false, false); }
[ "public", "List", "<", "JSONObject", ">", "queryCurrentPatchSets", "(", "String", "queryString", ")", "throws", "SshException", ",", "IOException", ",", "GerritQueryException", "{", "return", "queryJava", "(", "queryString", ",", "false", ",", "true", ",", "false"...
Runs the query and returns the result as a list of Java JSONObjects. @param queryString the query. @return the query result as a List of JSONObjects. @throws GerritQueryException if Gerrit reports an error with the query. @throws SshException if there is an error in the SSH Connection. @throws IOException for some othe...
[ "Runs", "the", "query", "and", "returns", "the", "result", "as", "a", "list", "of", "Java", "JSONObjects", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L255-L258
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.runQuery
private void runQuery(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles, boolean getCommitMessage, boolean getComments, LineVisitor visitor) throws GerritQueryException, SshException, IOException { StringBuilder str = new StringBuilder(Q...
java
private void runQuery(String queryString, boolean getPatchSets, boolean getCurrentPatchSet, boolean getFiles, boolean getCommitMessage, boolean getComments, LineVisitor visitor) throws GerritQueryException, SshException, IOException { StringBuilder str = new StringBuilder(Q...
[ "private", "void", "runQuery", "(", "String", "queryString", ",", "boolean", "getPatchSets", ",", "boolean", "getCurrentPatchSet", ",", "boolean", "getFiles", ",", "boolean", "getCommitMessage", ",", "boolean", "getComments", ",", "LineVisitor", "visitor", ")", "thr...
Runs the query on the Gerrit server and lets the provided visitor handle each line in the result. @param queryString the query. @param getPatchSets if all patch-sets of the projects found should be included in the result. Meaning if --patch-sets should be appended to the command call. @param getCurrentPatchSet if the c...
[ "Runs", "the", "query", "on", "the", "Gerrit", "server", "and", "lets", "the", "provided", "visitor", "handle", "each", "line", "in", "the", "result", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L351-L387
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java
GerritQueryHandler.getConnection
protected SshConnection getConnection() throws IOException { return SshConnectionFactory.getConnection(gerritHostName, gerritSshPort, gerritProxy, authentication, connectionTimeout); }
java
protected SshConnection getConnection() throws IOException { return SshConnectionFactory.getConnection(gerritHostName, gerritSshPort, gerritProxy, authentication, connectionTimeout); }
[ "protected", "SshConnection", "getConnection", "(", ")", "throws", "IOException", "{", "return", "SshConnectionFactory", ".", "getConnection", "(", "gerritHostName", ",", "gerritSshPort", ",", "gerritProxy", ",", "authentication", ",", "connectionTimeout", ")", ";", "...
Creates a new SSH connection used to execute the queries. @return a fresh instance of {@link SshConnection} @throws IOException for IO issues
[ "Creates", "a", "new", "SSH", "connection", "used", "to", "execute", "the", "queries", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritQueryHandler.java#L395-L398
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.getIgnoreEMail
public String getIgnoreEMail(String serverName) { if (serverName != null) { return ignoreEMails.get(serverName); } else { return null; } }
java
public String getIgnoreEMail(String serverName) { if (serverName != null) { return ignoreEMails.get(serverName); } else { return null; } }
[ "public", "String", "getIgnoreEMail", "(", "String", "serverName", ")", "{", "if", "(", "serverName", "!=", "null", ")", "{", "return", "ignoreEMails", ".", "get", "(", "serverName", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Standard getter for the ignoreEMail. @param serverName the server name. @return the e-mail address to ignore CommentAdded events from.
[ "Standard", "getter", "for", "the", "ignoreEMail", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L209-L215
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.setIgnoreEMail
public void setIgnoreEMail(String serverName, String ignoreEMail) { if (serverName != null) { if (ignoreEMail != null) { ignoreEMails.put(serverName, ignoreEMail); } else { ignoreEMails.remove(serverName); } } }
java
public void setIgnoreEMail(String serverName, String ignoreEMail) { if (serverName != null) { if (ignoreEMail != null) { ignoreEMails.put(serverName, ignoreEMail); } else { ignoreEMails.remove(serverName); } } }
[ "public", "void", "setIgnoreEMail", "(", "String", "serverName", ",", "String", "ignoreEMail", ")", "{", "if", "(", "serverName", "!=", "null", ")", "{", "if", "(", "ignoreEMail", "!=", "null", ")", "{", "ignoreEMails", ".", "put", "(", "serverName", ",", ...
Standard setter for the ignoreEMail. @param serverName the server name. @param ignoreEMail the e-mail address to ignore CommentAdded events from. If you want to remove, please set null.
[ "Standard", "setter", "for", "the", "ignoreEMail", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L224-L232
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.queueWork
private void queueWork(Work work) { try { logger.debug("Queueing work {}", work); executor.submit(new EventWorker(work, this)); } catch (RejectedExecutionException e) { logger.error("Unable to queue a received event! ", e); } checkQueueSize(); }
java
private void queueWork(Work work) { try { logger.debug("Queueing work {}", work); executor.submit(new EventWorker(work, this)); } catch (RejectedExecutionException e) { logger.error("Unable to queue a received event! ", e); } checkQueueSize(); }
[ "private", "void", "queueWork", "(", "Work", "work", ")", "{", "try", "{", "logger", ".", "debug", "(", "\"Queueing work {}\"", ",", "work", ")", ";", "executor", ".", "submit", "(", "new", "EventWorker", "(", "work", ",", "this", ")", ")", ";", "}", ...
puts work in the queue @param work the work to do
[ "puts", "work", "in", "the", "queue" ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L310-L318
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.removeAllEventListeners
public Collection<GerritEventListener> removeAllEventListeners() { synchronized (this) { HashSet<GerritEventListener> listeners = new HashSet<GerritEventListener>(gerritEventListeners); gerritEventListeners.clear(); return listeners; } }
java
public Collection<GerritEventListener> removeAllEventListeners() { synchronized (this) { HashSet<GerritEventListener> listeners = new HashSet<GerritEventListener>(gerritEventListeners); gerritEventListeners.clear(); return listeners; } }
[ "public", "Collection", "<", "GerritEventListener", ">", "removeAllEventListeners", "(", ")", "{", "synchronized", "(", "this", ")", "{", "HashSet", "<", "GerritEventListener", ">", "listeners", "=", "new", "HashSet", "<", "GerritEventListener", ">", "(", "gerritE...
Removes all event listeners and returns those that where removed. @return the former list of listeners.
[ "Removes", "all", "event", "listeners", "and", "returns", "those", "that", "where", "removed", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L376-L382
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.setThreadKeepAliveTime
public void setThreadKeepAliveTime(int threadKeepAliveTime) { this.threadKeepAliveTime = Math.max(MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME, threadKeepAliveTime); executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }
java
public void setThreadKeepAliveTime(int threadKeepAliveTime) { this.threadKeepAliveTime = Math.max(MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME, threadKeepAliveTime); executor.setKeepAliveTime(threadKeepAliveTime, TimeUnit.SECONDS); }
[ "public", "void", "setThreadKeepAliveTime", "(", "int", "threadKeepAliveTime", ")", "{", "this", ".", "threadKeepAliveTime", "=", "Math", ".", "max", "(", "MIN_RECEIVE_THREAD_KEEP_ALIVE_TIME", ",", "threadKeepAliveTime", ")", ";", "executor", ".", "setKeepAliveTime", ...
Sets the number of seconds threads well be kept alive. @param threadKeepAliveTime number of seconds
[ "Sets", "the", "number", "of", "seconds", "threads", "well", "be", "kept", "alive", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L435-L438
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.getWorkQueue
@Override public BlockingQueue<Work> getWorkQueue() { BlockingQueue<Work> queue = new LinkedBlockingQueue<Work>(); BlockingQueue<Runnable> workQueue = executor.getQueue(); for (Runnable r: workQueue) { if (r instanceof EventWorker) { queue.add(((EventWorker)r).wo...
java
@Override public BlockingQueue<Work> getWorkQueue() { BlockingQueue<Work> queue = new LinkedBlockingQueue<Work>(); BlockingQueue<Runnable> workQueue = executor.getQueue(); for (Runnable r: workQueue) { if (r instanceof EventWorker) { queue.add(((EventWorker)r).wo...
[ "@", "Override", "public", "BlockingQueue", "<", "Work", ">", "getWorkQueue", "(", ")", "{", "BlockingQueue", "<", "Work", ">", "queue", "=", "new", "LinkedBlockingQueue", "<", "Work", ">", "(", ")", ";", "BlockingQueue", "<", "Runnable", ">", "workQueue", ...
Returns a snapshot of the current state of the queue in the executor and not the Queue itself. {@inheritDoc}
[ "Returns", "a", "snapshot", "of", "the", "current", "state", "of", "the", "queue", "in", "the", "executor", "and", "not", "the", "Queue", "itself", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L445-L457
train
sonyxperiadev/gerrit-events
src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java
GerritHandler.ignoreEvent
private boolean ignoreEvent(CommentAdded event) { Account account = event.getAccount(); if (account == null) { return false; } String accountEmail = account.getEmail(); if (StringUtils.isEmpty(accountEmail)) { return false; } Provider pro...
java
private boolean ignoreEvent(CommentAdded event) { Account account = event.getAccount(); if (account == null) { return false; } String accountEmail = account.getEmail(); if (StringUtils.isEmpty(accountEmail)) { return false; } Provider pro...
[ "private", "boolean", "ignoreEvent", "(", "CommentAdded", "event", ")", "{", "Account", "account", "=", "event", ".", "getAccount", "(", ")", ";", "if", "(", "account", "==", "null", ")", "{", "return", "false", ";", "}", "String", "accountEmail", "=", "...
Checks if the event should be ignored. @param event the event to check. @return true if it should be ignored, false if not.
[ "Checks", "if", "the", "event", "should", "be", "ignored", "." ]
9a443d13dded85cc4709136ac33989f2bbb34fe2
https://github.com/sonyxperiadev/gerrit-events/blob/9a443d13dded85cc4709136ac33989f2bbb34fe2/src/main/java/com/sonymobile/tools/gerrit/gerritevents/GerritHandler.java#L521-L540
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.recoverInline
public Token recoverInline(Parser recognizer) throws RecognitionException { throw new RecognitionException(recognizer, recognizer.getInputStream(), recognizer.getContext()); }
java
public Token recoverInline(Parser recognizer) throws RecognitionException { throw new RecognitionException(recognizer, recognizer.getInputStream(), recognizer.getContext()); }
[ "public", "Token", "recoverInline", "(", "Parser", "recognizer", ")", "throws", "RecognitionException", "{", "throw", "new", "RecognitionException", "(", "recognizer", ",", "recognizer", ".", "getInputStream", "(", ")", ",", "recognizer", ".", "getContext", "(", "...
throws RecognitionException to handle in parser's catch block
[ "throws", "RecognitionException", "to", "handle", "in", "parser", "s", "catch", "block" ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L49-L51
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.consumeUntilGreedy
protected void consumeUntilGreedy(Parser recognizer, IntervalSet follow) { logger.trace("CONSUME UNTIL GREEDY {}", follow.toString()); for (int ttype = recognizer.getInputStream().LA(1); ttype != -1 && !follow.contains(ttype); ttype = recognizer.getInputStream().LA(1)) { Token t = recognizer...
java
protected void consumeUntilGreedy(Parser recognizer, IntervalSet follow) { logger.trace("CONSUME UNTIL GREEDY {}", follow.toString()); for (int ttype = recognizer.getInputStream().LA(1); ttype != -1 && !follow.contains(ttype); ttype = recognizer.getInputStream().LA(1)) { Token t = recognizer...
[ "protected", "void", "consumeUntilGreedy", "(", "Parser", "recognizer", ",", "IntervalSet", "follow", ")", "{", "logger", ".", "trace", "(", "\"CONSUME UNTIL GREEDY {}\"", ",", "follow", ".", "toString", "(", ")", ")", ";", "for", "(", "int", "ttype", "=", "...
Consumes token until lexer state is balanced and token from follow is matched. Matched token is also consumed
[ "Consumes", "token", "until", "lexer", "state", "is", "balanced", "and", "token", "from", "follow", "is", "matched", ".", "Matched", "token", "is", "also", "consumed" ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L57-L66
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.consumeUntilGreedy
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) { CSSToken t; do { Token next = recognizer.getInputStream().LT(1); if (next instanceof CSSToken) { t = (CSSToken) recognizer.getInputStream().LT(1); ...
java
protected void consumeUntilGreedy(Parser recognizer, IntervalSet set, CSSLexerState.RecoveryMode mode) { CSSToken t; do { Token next = recognizer.getInputStream().LT(1); if (next instanceof CSSToken) { t = (CSSToken) recognizer.getInputStream().LT(1); ...
[ "protected", "void", "consumeUntilGreedy", "(", "Parser", "recognizer", ",", "IntervalSet", "set", ",", "CSSLexerState", ".", "RecoveryMode", "mode", ")", "{", "CSSToken", "t", ";", "do", "{", "Token", "next", "=", "recognizer", ".", "getInputStream", "(", ")"...
Consumes token until lexer state is function-balanced and token from follow is matched. Matched token is also consumed
[ "Consumes", "token", "until", "lexer", "state", "is", "function", "-", "balanced", "and", "token", "from", "follow", "is", "matched", ".", "Matched", "token", "is", "also", "consumed" ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L72-L89
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.consumeUntilGreedy
public void consumeUntilGreedy(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { consumeUntil(recognizer, follow, mode, ls); recognizer.getInputStream().consume(); }
java
public void consumeUntilGreedy(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { consumeUntil(recognizer, follow, mode, ls); recognizer.getInputStream().consume(); }
[ "public", "void", "consumeUntilGreedy", "(", "Parser", "recognizer", ",", "IntervalSet", "follow", ",", "CSSLexerState", ".", "RecoveryMode", "mode", ",", "CSSLexerState", "ls", ")", "{", "consumeUntil", "(", "recognizer", ",", "follow", ",", "mode", ",", "ls", ...
Consumes token until lexer state is function-balanced and token from follow is matched. Matched token is also consumed.
[ "Consumes", "token", "until", "lexer", "state", "is", "function", "-", "balanced", "and", "token", "from", "follow", "is", "matched", ".", "Matched", "token", "is", "also", "consumed", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L95-L98
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java
CSSErrorStrategy.consumeUntil
public void consumeUntil(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { CSSToken t; boolean finish; TokenStream input = recognizer.getInputStream(); do { Token next = input.LT(1); if (next instanceof CSSToken) { ...
java
public void consumeUntil(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) { CSSToken t; boolean finish; TokenStream input = recognizer.getInputStream(); do { Token next = input.LT(1); if (next instanceof CSSToken) { ...
[ "public", "void", "consumeUntil", "(", "Parser", "recognizer", ",", "IntervalSet", "follow", ",", "CSSLexerState", ".", "RecoveryMode", "mode", ",", "CSSLexerState", "ls", ")", "{", "CSSToken", "t", ";", "boolean", "finish", ";", "TokenStream", "input", "=", "...
Consumes token until lexer state is function-balanced and token from follow is matched.
[ "Consumes", "token", "until", "lexer", "state", "is", "function", "-", "balanced", "and", "token", "from", "follow", "is", "matched", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L104-L125
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/OutputUtil.java
OutputUtil.appendTimes
public static StringBuilder appendTimes(StringBuilder sb, String append, int times) { for(;times>0; times--) sb.append(append); return sb; }
java
public static StringBuilder appendTimes(StringBuilder sb, String append, int times) { for(;times>0; times--) sb.append(append); return sb; }
[ "public", "static", "StringBuilder", "appendTimes", "(", "StringBuilder", "sb", ",", "String", "append", ",", "int", "times", ")", "{", "for", "(", ";", "times", ">", "0", ";", "times", "--", ")", "sb", ".", "append", "(", "append", ")", ";", "return",...
Appends string multiple times to buffer @param sb StringBuilder to be modified @param append String to be added @param times Number of times <code>append</code> is added @return Modified StringBuilder <code>sb</code> to allow chaining
[ "Appends", "string", "multiple", "times", "to", "buffer" ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/OutputUtil.java#L68-L74
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/OutputUtil.java
OutputUtil.appendFunctionArgs
public static StringBuilder appendFunctionArgs(StringBuilder sb, List<Term<?>> list) { Term<?> prev = null, pprev = null; for (Term<?> elem : list) { boolean sep = true; if (elem instanceof TermOperator && ((TermOperator) elem).getValue() == ',') sep = f...
java
public static StringBuilder appendFunctionArgs(StringBuilder sb, List<Term<?>> list) { Term<?> prev = null, pprev = null; for (Term<?> elem : list) { boolean sep = true; if (elem instanceof TermOperator && ((TermOperator) elem).getValue() == ',') sep = f...
[ "public", "static", "StringBuilder", "appendFunctionArgs", "(", "StringBuilder", "sb", ",", "List", "<", "Term", "<", "?", ">", ">", "list", ")", "{", "Term", "<", "?", ">", "prev", "=", "null", ",", "pprev", "=", "null", ";", "for", "(", "Term", "<"...
Appends the formatted list of function arguments to a string builder. The individual arguments are separated by spaces with the exception of commas. @param sb the string builder to be modified @param list the list of function arguments @return Modified <code>sb</code> to allow chaining
[ "Appends", "the", "formatted", "list", "of", "function", "arguments", "to", "a", "string", "builder", ".", "The", "individual", "arguments", "are", "separated", "by", "spaces", "with", "the", "exception", "of", "commas", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/OutputUtil.java#L179-L199
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSToken.java
CSSToken.getText
@Override public String getText() { // sets text from input if not text directly available text = super.getText(); int t; try { t = typeMapper.inverse().get(type); } catch (NullPointerException e) { return text; } switch (t) { case FUNCTION: return text.substring(0, text.length()-1); ca...
java
@Override public String getText() { // sets text from input if not text directly available text = super.getText(); int t; try { t = typeMapper.inverse().get(type); } catch (NullPointerException e) { return text; } switch (t) { case FUNCTION: return text.substring(0, text.length()-1); ca...
[ "@", "Override", "public", "String", "getText", "(", ")", "{", "// sets text from input if not text directly available", "text", "=", "super", ".", "getText", "(", ")", ";", "int", "t", ";", "try", "{", "t", "=", "typeMapper", ".", "inverse", "(", ")", ".", ...
Returns common text stored in token. Content is not modified. @return Model view of text in token
[ "Returns", "common", "text", "stored", "in", "token", ".", "Content", "is", "not", "modified", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSToken.java#L214-L245
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/csskit/antlr4/CSSToken.java
CSSToken.extractCHARSET
public static String extractCHARSET(String charset){ final String arg = charset.replace("@charset","").replace(";","").trim(); if (arg.length() > 2) return extractSTRING(arg); else return ""; }
java
public static String extractCHARSET(String charset){ final String arg = charset.replace("@charset","").replace(";","").trim(); if (arg.length() > 2) return extractSTRING(arg); else return ""; }
[ "public", "static", "String", "extractCHARSET", "(", "String", "charset", ")", "{", "final", "String", "arg", "=", "charset", ".", "replace", "(", "\"@charset\"", ",", "\"\"", ")", ".", "replace", "(", "\";\"", ",", "\"\"", ")", ".", "trim", "(", ")", ...
extract charset value from CHARSET token
[ "extract", "charset", "value", "from", "CHARSET", "token" ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSToken.java#L301-L307
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.parentNode
public Node parentNode() { if (currentNode == null) return null; Node node = getParentNode(currentNode); if (node != null) currentNode = node; return node; }
java
public Node parentNode() { if (currentNode == null) return null; Node node = getParentNode(currentNode); if (node != null) currentNode = node; return node; }
[ "public", "Node", "parentNode", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "node", "=", "getParentNode", "(", "currentNode", ")", ";", "if", "(", "node", "!=", "null", ")", "currentNode", "=", "node", ";"...
Return the parent Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "parent", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L123-L135
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.firstChild
public Node firstChild() { if (currentNode == null) return null; Node node = getFirstChild(currentNode); if (node != null) currentNode = node; return node; }
java
public Node firstChild() { if (currentNode == null) return null; Node node = getFirstChild(currentNode); if (node != null) currentNode = node; return node; }
[ "public", "Node", "firstChild", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "node", "=", "getFirstChild", "(", "currentNode", ")", ";", "if", "(", "node", "!=", "null", ")", "currentNode", "=", "node", ";"...
Return the first child Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "first", "child", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L141-L152
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.lastChild
public Node lastChild() { if (currentNode == null) return null; Node node = getLastChild(currentNode); if (node != null) currentNode = node; return node; }
java
public Node lastChild() { if (currentNode == null) return null; Node node = getLastChild(currentNode); if (node != null) currentNode = node; return node; }
[ "public", "Node", "lastChild", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "node", "=", "getLastChild", "(", "currentNode", ")", ";", "if", "(", "node", "!=", "null", ")", "currentNode", "=", "node", ";", ...
Return the last child Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "last", "child", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L158-L169
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.previousSibling
public Node previousSibling() { if (currentNode == null) return null; Node node = getPreviousSibling(currentNode); if (node != null) currentNode = node; return node; }
java
public Node previousSibling() { if (currentNode == null) return null; Node node = getPreviousSibling(currentNode); if (node != null) currentNode = node; return node; }
[ "public", "Node", "previousSibling", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "node", "=", "getPreviousSibling", "(", "currentNode", ")", ";", "if", "(", "node", "!=", "null", ")", "currentNode", "=", "no...
Return the previous sibling Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "previous", "sibling", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L175-L185
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.nextSibling
public Node nextSibling() { if (currentNode == null) return null; Node node = getNextSibling(currentNode); if (node != null) currentNode = node; return node; }
java
public Node nextSibling() { if (currentNode == null) return null; Node node = getNextSibling(currentNode); if (node != null) currentNode = node; return node; }
[ "public", "Node", "nextSibling", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "node", "=", "getNextSibling", "(", "currentNode", ")", ";", "if", "(", "node", "!=", "null", ")", "currentNode", "=", "node", "...
Return the next sibling Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "next", "sibling", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L191-L201
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.previousNode
public Node previousNode() { if (currentNode == null) return null; // get sibling Node result = getPreviousSibling(currentNode); if (result == null) { result = getParentNode(currentNode); if (result != null) { currentNode = result; return result; } return null; } // get the lastChi...
java
public Node previousNode() { if (currentNode == null) return null; // get sibling Node result = getPreviousSibling(currentNode); if (result == null) { result = getParentNode(currentNode); if (result != null) { currentNode = result; return result; } return null; } // get the lastChi...
[ "public", "Node", "previousNode", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "// get sibling", "Node", "result", "=", "getPreviousSibling", "(", "currentNode", ")", ";", "if", "(", "result", "==", "null", ")", "{", ...
Return the previous Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "previous", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L207-L243
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.nextNode
public Node nextNode() { if (currentNode == null) return null; Node result = getFirstChild(currentNode); if (result != null) { currentNode = result; return result; } result = getNextSibling(currentNode); if (result != null) { currentNode = result; return result; } // return parent's...
java
public Node nextNode() { if (currentNode == null) return null; Node result = getFirstChild(currentNode); if (result != null) { currentNode = result; return result; } result = getNextSibling(currentNode); if (result != null) { currentNode = result; return result; } // return parent's...
[ "public", "Node", "nextNode", "(", ")", "{", "if", "(", "currentNode", "==", "null", ")", "return", "null", ";", "Node", "result", "=", "getFirstChild", "(", "currentNode", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "currentNode", "=", "res...
Return the next Node from the current node, after applying filter, whatToshow. If result is not null, set the current Node.
[ "Return", "the", "next", "Node", "from", "the", "current", "node", "after", "applying", "filter", "whatToshow", ".", "If", "result", "is", "not", "null", "set", "the", "current", "Node", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L249-L282
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.getParentNode
private Node getParentNode(Node node) { if (node == null || node == root) return null; Node newNode = node.getParentNode(); if (newNode == null) return null; int accept = acceptNode(newNode); if (accept == NodeFilter.FILTER_ACCEPT) return newNode; else // if (accept == NodeFilter.SKIP_NODE) ...
java
private Node getParentNode(Node node) { if (node == null || node == root) return null; Node newNode = node.getParentNode(); if (newNode == null) return null; int accept = acceptNode(newNode); if (accept == NodeFilter.FILTER_ACCEPT) return newNode; else // if (accept == NodeFilter.SKIP_NODE) ...
[ "private", "Node", "getParentNode", "(", "Node", "node", ")", "{", "if", "(", "node", "==", "null", "||", "node", "==", "root", ")", "return", "null", ";", "Node", "newNode", "=", "node", ".", "getParentNode", "(", ")", ";", "if", "(", "newNode", "==...
Internal function. Return the parent Node, from the input node after applying filter, whatToshow. The current node is not consulted or set.
[ "Internal", "function", ".", "Return", "the", "parent", "Node", "from", "the", "input", "node", "after", "applying", "filter", "whatToshow", ".", "The", "current", "node", "is", "not", "consulted", "or", "set", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L288-L306
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.getNextSibling
private Node getNextSibling(Node node) { if (node == null || node == root) return null; Node newNode = node.getNextSibling(); if (newNode == null) { newNode = node.getParentNode(); if (newNode == null || node == root) return null; int parentAccept = acceptNode(newNode); if (parentAccept == No...
java
private Node getNextSibling(Node node) { if (node == null || node == root) return null; Node newNode = node.getNextSibling(); if (newNode == null) { newNode = node.getParentNode(); if (newNode == null || node == root) return null; int parentAccept = acceptNode(newNode); if (parentAccept == No...
[ "private", "Node", "getNextSibling", "(", "Node", "node", ")", "{", "if", "(", "node", "==", "null", "||", "node", "==", "root", ")", "return", "null", ";", "Node", "newNode", "=", "node", ".", "getNextSibling", "(", ")", ";", "if", "(", "newNode", "...
Internal function. Return the nextSibling Node, from the input node after applying filter, whatToshow. The current node is not consulted or set.
[ "Internal", "function", ".", "Return", "the", "nextSibling", "Node", "from", "the", "input", "node", "after", "applying", "filter", "whatToshow", ".", "The", "current", "node", "is", "not", "consulted", "or", "set", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L312-L343
train
radkovo/jStyleParser
src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java
GenericTreeWalker.getPreviousSibling
private Node getPreviousSibling(Node node) { if (node == null || node == root) return null; Node newNode = node.getPreviousSibling(); if (newNode == null) { newNode = node.getParentNode(); if (newNode == null || node == root) return null; int parentAccept = acceptNode(newNode); if (parentAcce...
java
private Node getPreviousSibling(Node node) { if (node == null || node == root) return null; Node newNode = node.getPreviousSibling(); if (newNode == null) { newNode = node.getParentNode(); if (newNode == null || node == root) return null; int parentAccept = acceptNode(newNode); if (parentAcce...
[ "private", "Node", "getPreviousSibling", "(", "Node", "node", ")", "{", "if", "(", "node", "==", "null", "||", "node", "==", "root", ")", "return", "null", ";", "Node", "newNode", "=", "node", ".", "getPreviousSibling", "(", ")", ";", "if", "(", "newNo...
Internal function. Return the previous sibling Node, from the input node after applying filter, whatToshow. The current node is not consulted or set.
[ "Internal", "function", ".", "Return", "the", "previous", "sibling", "Node", "from", "the", "input", "node", "after", "applying", "filter", "whatToshow", ".", "The", "current", "node", "is", "not", "consulted", "or", "set", "." ]
8ab049ac6866aa52c4d7deee25c9e294e7191957
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/GenericTreeWalker.java#L350-L381
train