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
i-net-software/jlessc
src/com/inet/lib/less/LessExtendMap.java
LessExtendMap.concatenateExtendsRecursive
private void concatenateExtendsRecursive( String selector, boolean isReference, String allSelector ) { List<String[]> list = exact.get( selector ); if( list != null ) { for( String[] lessExtend : list ) { for( String sel : lessExtend ) { boolean needRecurs...
java
private void concatenateExtendsRecursive( String selector, boolean isReference, String allSelector ) { List<String[]> list = exact.get( selector ); if( list != null ) { for( String[] lessExtend : list ) { for( String sel : lessExtend ) { boolean needRecurs...
[ "private", "void", "concatenateExtendsRecursive", "(", "String", "selector", ",", "boolean", "isReference", ",", "String", "allSelector", ")", "{", "List", "<", "String", "[", "]", ">", "list", "=", "exact", ".", "get", "(", "selector", ")", ";", "if", "("...
Add to the given selector all possible extends to the internal selectorList. This method is call recursive. @param selector current selector @param isReference if the current rule is in a less file which was import with "reference" keyword @param allSelector selector that should match with the "all" keyword. By defaul...
[ "Add", "to", "the", "given", "selector", "all", "possible", "extends", "to", "the", "internal", "selectorList", ".", "This", "method", "is", "call", "recursive", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessExtendMap.java#L147-L182
train
i-net-software/jlessc
src/com/inet/lib/less/LessExtend.java
LessExtend.addLessExtendsTo
static String addLessExtendsTo( FormattableContainer container, LessObject obj, String extendSelector ) { String baseSelectors = null; do { int idx1 = extendSelector.indexOf( ":extend(" ); int idx2 = extendSelector.indexOf( ')', idx1 ); int idx3 = extendSelector.lastI...
java
static String addLessExtendsTo( FormattableContainer container, LessObject obj, String extendSelector ) { String baseSelectors = null; do { int idx1 = extendSelector.indexOf( ":extend(" ); int idx2 = extendSelector.indexOf( ')', idx1 ); int idx3 = extendSelector.lastI...
[ "static", "String", "addLessExtendsTo", "(", "FormattableContainer", "container", ",", "LessObject", "obj", ",", "String", "extendSelector", ")", "{", "String", "baseSelectors", "=", "null", ";", "do", "{", "int", "idx1", "=", "extendSelector", ".", "indexOf", "...
Parse the extendSelector,create the needed LessExtend objects and add it to the container. @param container the container that should add the created LessExtend @param obj another LessObject with parse position. @param extendSelector the completely selector like "foo:extends(bar all)" @return the base selector
[ "Parse", "the", "extendSelector", "create", "the", "needed", "LessExtend", "objects", "and", "add", "it", "to", "the", "container", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessExtend.java#L54-L98
train
i-net-software/jlessc
src/com/inet/lib/less/Expression.java
Expression.stringValue
String stringValue( CssFormatter formatter ) { String str; try { formatter.addOutput(); appendTo( formatter ); } catch( Exception ex ) { throw createException( ex ); } finally { str = formatter.releaseOutput(); } return str;...
java
String stringValue( CssFormatter formatter ) { String str; try { formatter.addOutput(); appendTo( formatter ); } catch( Exception ex ) { throw createException( ex ); } finally { str = formatter.releaseOutput(); } return str;...
[ "String", "stringValue", "(", "CssFormatter", "formatter", ")", "{", "String", "str", ";", "try", "{", "formatter", ".", "addOutput", "(", ")", ";", "appendTo", "(", "formatter", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "createE...
Get the string value @param formatter the CCS target @return the value
[ "Get", "the", "string", "value" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Expression.java#L171-L182
train
i-net-software/jlessc
src/com/inet/lib/less/Expression.java
Expression.listValue
public Operation listValue( CssFormatter formatter ) { Expression expr = unpack( formatter ); if( expr == this ) { throw createException( "Exprestion is not a list: " + this ); } return expr.listValue( formatter ); }
java
public Operation listValue( CssFormatter formatter ) { Expression expr = unpack( formatter ); if( expr == this ) { throw createException( "Exprestion is not a list: " + this ); } return expr.listValue( formatter ); }
[ "public", "Operation", "listValue", "(", "CssFormatter", "formatter", ")", "{", "Expression", "expr", "=", "unpack", "(", "formatter", ")", ";", "if", "(", "expr", "==", "this", ")", "{", "throw", "createException", "(", "\"Exprestion is not a list: \"", "+", ...
Get the value as a list @param formatter the CCS target @return the value
[ "Get", "the", "value", "as", "a", "list" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Expression.java#L206-L212
train
i-net-software/jlessc
src/com/inet/lib/less/Expression.java
Expression.unpack
Expression unpack( CssFormatter formatter ) { Expression unpack = this; do { // unpack packed expressions like parenthesis or variables if( unpack.getClass() == FunctionExpression.class && ((FunctionExpression)unpack).toString().isEmpty() ) { //Parenthesis unpack = ((Function...
java
Expression unpack( CssFormatter formatter ) { Expression unpack = this; do { // unpack packed expressions like parenthesis or variables if( unpack.getClass() == FunctionExpression.class && ((FunctionExpression)unpack).toString().isEmpty() ) { //Parenthesis unpack = ((Function...
[ "Expression", "unpack", "(", "CssFormatter", "formatter", ")", "{", "Expression", "unpack", "=", "this", ";", "do", "{", "// unpack packed expressions like parenthesis or variables", "if", "(", "unpack", ".", "getClass", "(", ")", "==", "FunctionExpression", ".", "c...
Unpack this expression to return the core expression @param formatter the CCS target @return the core expression
[ "Unpack", "this", "expression", "to", "return", "the", "core", "expression" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/Expression.java#L236-L250
train
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.getColor
static double getColor( Expression param, CssFormatter formatter ) throws LessException { switch( param.getDataType( formatter ) ) { case Expression.COLOR: case Expression.RGBA: return param.doubleValue( formatter ); } throw new LessException( "Not a color...
java
static double getColor( Expression param, CssFormatter formatter ) throws LessException { switch( param.getDataType( formatter ) ) { case Expression.COLOR: case Expression.RGBA: return param.doubleValue( formatter ); } throw new LessException( "Not a color...
[ "static", "double", "getColor", "(", "Expression", "param", ",", "CssFormatter", "formatter", ")", "throws", "LessException", "{", "switch", "(", "param", ".", "getDataType", "(", "formatter", ")", ")", "{", "case", "Expression", ".", "COLOR", ":", "case", "...
Get the color value of the expression or fire an exception if not a color. @param param the expression to evaluate @param formatter current formatter @return the color value of the expression @throws LessException if the expression is not a color value
[ "Get", "the", "color", "value", "of", "the", "expression", "or", "fire", "an", "exception", "if", "not", "a", "color", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L153-L160
train
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.dataUri
static void dataUri( CssFormatter formatter, String relativeUrlStr, final String urlString, String type ) throws IOException { String urlStr = removeQuote( urlString ); InputStream input; try { input = formatter.getReaderFactory().openStream( formatter.getBaseURL(), urlStr, relativeU...
java
static void dataUri( CssFormatter formatter, String relativeUrlStr, final String urlString, String type ) throws IOException { String urlStr = removeQuote( urlString ); InputStream input; try { input = formatter.getReaderFactory().openStream( formatter.getBaseURL(), urlStr, relativeU...
[ "static", "void", "dataUri", "(", "CssFormatter", "formatter", ",", "String", "relativeUrlStr", ",", "final", "String", "urlString", ",", "String", "type", ")", "throws", "IOException", "{", "String", "urlStr", "=", "removeQuote", "(", "urlString", ")", ";", "...
Implementation of the function data-uri. @param formatter current formatter @param relativeUrlStr relative URL of the less script. Is used as base URL @param urlString the url parameter of the function @param type the mime type @throws IOException If any I/O errors occur on reading the content
[ "Implementation", "of", "the", "function", "data", "-", "uri", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L171-L207
train
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.dataUri
static void dataUri( CssFormatter formatter, byte[] bytes, String urlStr, String type ) { if( type == null ) { switch( urlStr.substring( urlStr.lastIndexOf( '.' ) + 1 ) ) { case "gif": type = "image/gif;base64"; break; case "pn...
java
static void dataUri( CssFormatter formatter, byte[] bytes, String urlStr, String type ) { if( type == null ) { switch( urlStr.substring( urlStr.lastIndexOf( '.' ) + 1 ) ) { case "gif": type = "image/gif;base64"; break; case "pn...
[ "static", "void", "dataUri", "(", "CssFormatter", "formatter", ",", "byte", "[", "]", "bytes", ",", "String", "urlStr", ",", "String", "type", ")", "{", "if", "(", "type", "==", "null", ")", "{", "switch", "(", "urlStr", ".", "substring", "(", "urlStr"...
Write the bytes as inline url. @param formatter current formatter @param bytes the bytes @param urlStr used if mime type is null to detect the mime type @param type the mime type
[ "Write", "the", "bytes", "as", "inline", "url", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L217-L246
train
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.appendEncode
private static void appendEncode( CssFormatter formatter, byte[] bytes ) { for( byte b : bytes ) { if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) { formatter.append( (char )b ); } else { switch( b ) { ...
java
private static void appendEncode( CssFormatter formatter, byte[] bytes ) { for( byte b : bytes ) { if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) { formatter.append( (char )b ); } else { switch( b ) { ...
[ "private", "static", "void", "appendEncode", "(", "CssFormatter", "formatter", ",", "byte", "[", "]", "bytes", ")", "{", "for", "(", "byte", "b", ":", "bytes", ")", "{", "if", "(", "(", "b", ">=", "'", "'", "&&", "b", "<=", "'", "'", ")", "||", ...
Append the bytes URL encoded. @param formatter current formatter @param bytes the bytes
[ "Append", "the", "bytes", "URL", "encoded", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L254-L273
train
i-net-software/jlessc
src/com/inet/lib/less/ReaderFactory.java
ReaderFactory.openStream
public InputStream openStream( URL baseURL, String urlStr, String relativeUrlStr ) throws IOException { URL url = new URL( baseURL, urlStr ); try { return openStream( url ); } catch( Exception e ) { // try rewrite location independent of option "rewrite-urls" for backward...
java
public InputStream openStream( URL baseURL, String urlStr, String relativeUrlStr ) throws IOException { URL url = new URL( baseURL, urlStr ); try { return openStream( url ); } catch( Exception e ) { // try rewrite location independent of option "rewrite-urls" for backward...
[ "public", "InputStream", "openStream", "(", "URL", "baseURL", ",", "String", "urlStr", ",", "String", "relativeUrlStr", ")", "throws", "IOException", "{", "URL", "url", "=", "new", "URL", "(", "baseURL", ",", "urlStr", ")", ";", "try", "{", "return", "open...
Open an InputStream for the given URL. This is used for inlining images via data-uri. @param baseURL the URL of the top less file @param urlStr the absolute or relative URL that should be open @param relativeUrlStr relative URL of the less script @return the stream, never null @throws IOException If any I/O error occu...
[ "Open", "an", "InputStream", "for", "the", "given", "URL", ".", "This", "is", "used", "for", "inlining", "images", "via", "data", "-", "uri", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ReaderFactory.java#L68-L77
train
i-net-software/jlessc
src/com/inet/lib/less/ReaderFactory.java
ReaderFactory.create
public Reader create( URL url ) throws IOException { return new InputStreamReader( openStream( url ), StandardCharsets.UTF_8 ); }
java
public Reader create( URL url ) throws IOException { return new InputStreamReader( openStream( url ), StandardCharsets.UTF_8 ); }
[ "public", "Reader", "create", "(", "URL", "url", ")", "throws", "IOException", "{", "return", "new", "InputStreamReader", "(", "openStream", "(", "url", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}" ]
Create a Reader for the given URL. @param url the url, not null @return the reader, never null @throws IOException If any I/O error occur on reading the URL.
[ "Create", "a", "Reader", "for", "the", "given", "URL", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/ReaderFactory.java#L88-L90
train
i-net-software/jlessc
src/com/inet/lib/less/JavaScriptExpression.java
JavaScriptExpression.eval
private void eval( CssFormatter formatter ) { if( type != UNKNOWN ) { return; } try { ScriptEngineManager factory = new ScriptEngineManager( getClass().getClassLoader() ); ScriptEngine engine = factory.getEngineByName( "JavaScript" ); engine.setCon...
java
private void eval( CssFormatter formatter ) { if( type != UNKNOWN ) { return; } try { ScriptEngineManager factory = new ScriptEngineManager( getClass().getClassLoader() ); ScriptEngine engine = factory.getEngineByName( "JavaScript" ); engine.setCon...
[ "private", "void", "eval", "(", "CssFormatter", "formatter", ")", "{", "if", "(", "type", "!=", "UNKNOWN", ")", "{", "return", ";", "}", "try", "{", "ScriptEngineManager", "factory", "=", "new", "ScriptEngineManager", "(", "getClass", "(", ")", ".", "getCl...
Execute the JavaScript @param formatter current formatter
[ "Execute", "the", "JavaScript" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/JavaScriptExpression.java#L123-L151
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.evalParam
private void evalParam( int idx, CssFormatter formatter ) { Expression expr = get( idx ); type = expr.getDataType( formatter ); switch( type ) { case BOOLEAN: booleanValue = expr.booleanValue( formatter ); break; case STRING: ...
java
private void evalParam( int idx, CssFormatter formatter ) { Expression expr = get( idx ); type = expr.getDataType( formatter ); switch( type ) { case BOOLEAN: booleanValue = expr.booleanValue( formatter ); break; case STRING: ...
[ "private", "void", "evalParam", "(", "int", "idx", ",", "CssFormatter", "formatter", ")", "{", "Expression", "expr", "=", "get", "(", "idx", ")", ";", "type", "=", "expr", ".", "getDataType", "(", "formatter", ")", ";", "switch", "(", "type", ")", "{",...
Evaluate a parameter as this function. @param idx the index of the parameter starting with 0 @param formatter the current formation context
[ "Evaluate", "a", "parameter", "as", "this", "function", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L748-L760
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.format
private void format( CssFormatter formatter ) { String fmt = get( 0 ).stringValue( formatter ); int idx = 1; for( int i = 0; i < fmt.length(); i++ ) { char ch = fmt.charAt( i ); if( ch == '%' ) { ch = fmt.charAt( ++i ); switch( ch ){ ...
java
private void format( CssFormatter formatter ) { String fmt = get( 0 ).stringValue( formatter ); int idx = 1; for( int i = 0; i < fmt.length(); i++ ) { char ch = fmt.charAt( i ); if( ch == '%' ) { ch = fmt.charAt( ++i ); switch( ch ){ ...
[ "private", "void", "format", "(", "CssFormatter", "formatter", ")", "{", "String", "fmt", "=", "get", "(", "0", ")", ".", "stringValue", "(", "formatter", ")", ";", "int", "idx", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fm...
Implements the format function "%" @param formatter the current formation context
[ "Implements", "the", "format", "function", "%" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L767-L815
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.get
Expression get( int idx ) { if( parameters.size() <= idx ) { throw new ParameterOutOfBoundsException(); } return parameters.get( idx ); }
java
Expression get( int idx ) { if( parameters.size() <= idx ) { throw new ParameterOutOfBoundsException(); } return parameters.get( idx ); }
[ "Expression", "get", "(", "int", "idx", ")", "{", "if", "(", "parameters", ".", "size", "(", ")", "<=", "idx", ")", "{", "throw", "new", "ParameterOutOfBoundsException", "(", ")", ";", "}", "return", "parameters", ".", "get", "(", "idx", ")", ";", "}...
Get the idx parameter from the parameter list. @param idx the index starting with 0 @return the expression @throws ParameterOutOfBoundsException if the parameter with the index does not exists
[ "Get", "the", "idx", "parameter", "from", "the", "parameter", "list", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L883-L888
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getColorDigit
private int getColorDigit( int idx, CssFormatter formatter ) { Expression expression = get( idx ); double d = expression.doubleValue( formatter ); if( expression.getDataType( formatter ) == PERCENT ) { d *= 2.55; } return colorDigit(d); }
java
private int getColorDigit( int idx, CssFormatter formatter ) { Expression expression = get( idx ); double d = expression.doubleValue( formatter ); if( expression.getDataType( formatter ) == PERCENT ) { d *= 2.55; } return colorDigit(d); }
[ "private", "int", "getColorDigit", "(", "int", "idx", ",", "CssFormatter", "formatter", ")", "{", "Expression", "expression", "=", "get", "(", "idx", ")", ";", "double", "d", "=", "expression", ".", "doubleValue", "(", "formatter", ")", ";", "if", "(", "...
Get the idx parameter from the parameter list as color digit. @param idx the index starting with 0 @param formatter current formatter @return the expression
[ "Get", "the", "idx", "parameter", "from", "the", "parameter", "list", "as", "color", "digit", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L899-L906
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getColor
private double getColor( Expression exp, CssFormatter formatter ) { type = exp.getDataType( formatter ); switch( type ) { case COLOR: case RGBA: return exp.doubleValue( formatter ); } throw new ParameterOutOfBoundsException(); }
java
private double getColor( Expression exp, CssFormatter formatter ) { type = exp.getDataType( formatter ); switch( type ) { case COLOR: case RGBA: return exp.doubleValue( formatter ); } throw new ParameterOutOfBoundsException(); }
[ "private", "double", "getColor", "(", "Expression", "exp", ",", "CssFormatter", "formatter", ")", "{", "type", "=", "exp", ".", "getDataType", "(", "formatter", ")", ";", "switch", "(", "type", ")", "{", "case", "COLOR", ":", "case", "RGBA", ":", "return...
Get a color value from the expression. And set the type variable. @param exp the expression @param formatter current formatter @return the the color value @throws ParameterOutOfBoundsException if the parameter with the index does not exists
[ "Get", "a", "color", "value", "from", "the", "expression", ".", "And", "set", "the", "type", "variable", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L993-L1001
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getRadians
double getRadians( CssFormatter formatter ) { final Expression exp = get( 0 ); String unit = exp.unit( formatter ); return exp.doubleValue( formatter ) * Operation.unitFactor( unit, "rad", false ); }
java
double getRadians( CssFormatter formatter ) { final Expression exp = get( 0 ); String unit = exp.unit( formatter ); return exp.doubleValue( formatter ) * Operation.unitFactor( unit, "rad", false ); }
[ "double", "getRadians", "(", "CssFormatter", "formatter", ")", "{", "final", "Expression", "exp", "=", "get", "(", "0", ")", ";", "String", "unit", "=", "exp", ".", "unit", "(", "formatter", ")", ";", "return", "exp", ".", "doubleValue", "(", "formatter"...
Get the value in radians. @param formatter the CSS formatter @return the radians
[ "Get", "the", "value", "in", "radians", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1008-L1012
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getDouble
private double getDouble( int idx, double defaultValue, CssFormatter formatter ) { if( parameters.size() <= idx ) { return defaultValue; } return parameters.get( idx ).doubleValue( formatter ); }
java
private double getDouble( int idx, double defaultValue, CssFormatter formatter ) { if( parameters.size() <= idx ) { return defaultValue; } return parameters.get( idx ).doubleValue( formatter ); }
[ "private", "double", "getDouble", "(", "int", "idx", ",", "double", "defaultValue", ",", "CssFormatter", "formatter", ")", "{", "if", "(", "parameters", ".", "size", "(", ")", "<=", "idx", ")", "{", "return", "defaultValue", ";", "}", "return", "parameters...
Get the idx parameter from the parameter list as double. @param idx the index starting with 0 @param defaultValue the result if such a parameter idx does not exists. @param formatter current formatter @return the expression
[ "Get", "the", "idx", "parameter", "from", "the", "parameter", "list", "as", "double", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1038-L1043
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.getParamList
private List<Expression> getParamList( CssFormatter formatter ) { Expression ex0 = get( 0 ).unpack( formatter ); if( ex0.getDataType( formatter ) == LIST ) { Operation op = ex0.listValue( formatter ); List<Expression> operants = op.getOperands(); if( operants.size() =...
java
private List<Expression> getParamList( CssFormatter formatter ) { Expression ex0 = get( 0 ).unpack( formatter ); if( ex0.getDataType( formatter ) == LIST ) { Operation op = ex0.listValue( formatter ); List<Expression> operants = op.getOperands(); if( operants.size() =...
[ "private", "List", "<", "Expression", ">", "getParamList", "(", "CssFormatter", "formatter", ")", "{", "Expression", "ex0", "=", "get", "(", "0", ")", ".", "unpack", "(", "formatter", ")", ";", "if", "(", "ex0", ".", "getDataType", "(", "formatter", ")",...
Get for extract and length the first parameter as parameter list. @param formatter current formatter @return the list
[ "Get", "for", "extract", "and", "length", "the", "first", "parameter", "as", "parameter", "list", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1066-L1082
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.extract
private Expression extract( CssFormatter formatter ) { List<Expression> exList = getParamList( formatter ); int idx = getInt( 1, formatter ); if( idx <= 0 || exList.size() < idx ) { type = STRING; return null; } Expression ex = exList.get( idx - 1 ); ...
java
private Expression extract( CssFormatter formatter ) { List<Expression> exList = getParamList( formatter ); int idx = getInt( 1, formatter ); if( idx <= 0 || exList.size() < idx ) { type = STRING; return null; } Expression ex = exList.get( idx - 1 ); ...
[ "private", "Expression", "extract", "(", "CssFormatter", "formatter", ")", "{", "List", "<", "Expression", ">", "exList", "=", "getParamList", "(", "formatter", ")", ";", "int", "idx", "=", "getInt", "(", "1", ",", "formatter", ")", ";", "if", "(", "idx"...
Function extract. Change the type and doubleValue @param formatter current CSS output @return the extracted expression if it is a string
[ "Function", "extract", ".", "Change", "the", "type", "and", "doubleValue" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1089-L1107
train
i-net-software/jlessc
src/com/inet/lib/less/FunctionExpression.java
FunctionExpression.range
private Operation range( CssFormatter formatter ) { type = LIST; double start = get( 0 ).doubleValue( formatter ); double end; if( parameters.size() >= 2 ) { end = get( 1 ).doubleValue( formatter ); } else { end = start; start = 1; } ...
java
private Operation range( CssFormatter formatter ) { type = LIST; double start = get( 0 ).doubleValue( formatter ); double end; if( parameters.size() >= 2 ) { end = get( 1 ).doubleValue( formatter ); } else { end = start; start = 1; } ...
[ "private", "Operation", "range", "(", "CssFormatter", "formatter", ")", "{", "type", "=", "LIST", ";", "double", "start", "=", "get", "(", "0", ")", ".", "doubleValue", "(", "formatter", ")", ";", "double", "end", ";", "if", "(", "parameters", ".", "si...
Function range. Generate a list spanning a range of values @param formatter current CSS output @return The operation representing a list of values
[ "Function", "range", ".", "Generate", "a", "list", "spanning", "a", "range", "of", "values" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/FunctionExpression.java#L1116-L1139
train
i-net-software/jlessc
src/com/inet/lib/less/CssMediaOutput.java
CssMediaOutput.startBlock
void startBlock( String[] selectors , StringBuilder output ) { this.results.add( new CssRuleOutput( selectors, output, isReference ) ); }
java
void startBlock( String[] selectors , StringBuilder output ) { this.results.add( new CssRuleOutput( selectors, output, isReference ) ); }
[ "void", "startBlock", "(", "String", "[", "]", "selectors", ",", "StringBuilder", "output", ")", "{", "this", ".", "results", ".", "add", "(", "new", "CssRuleOutput", "(", "selectors", ",", "output", ",", "isReference", ")", ")", ";", "}" ]
Start a block inside the media @param selectors the selectors @param output a buffer for the content of the rule.
[ "Start", "a", "block", "inside", "the", "media" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssMediaOutput.java#L107-L109
train
i-net-software/jlessc
src/com/inet/lib/less/SelectorUtils.java
SelectorUtils.fastReplace
static String fastReplace( String str, String target, String replacement ) { int targetLength = target.length(); if( targetLength == 0 ) { return str; } int idx2 = str.indexOf( target ); if( idx2 < 0 ) { return str; } StringBuilder buffer =...
java
static String fastReplace( String str, String target, String replacement ) { int targetLength = target.length(); if( targetLength == 0 ) { return str; } int idx2 = str.indexOf( target ); if( idx2 < 0 ) { return str; } StringBuilder buffer =...
[ "static", "String", "fastReplace", "(", "String", "str", ",", "String", "target", ",", "String", "replacement", ")", "{", "int", "targetLength", "=", "target", ".", "length", "(", ")", ";", "if", "(", "targetLength", "==", "0", ")", "{", "return", "str",...
Fast string replace which work without regular expressions @param str original string @param target the string which should be replaced @param replacement the new part @return the original or a replaced string
[ "Fast", "string", "replace", "which", "work", "without", "regular", "expressions" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/SelectorUtils.java#L94-L113
train
i-net-software/jlessc
src/com/inet/lib/less/SelectorUtils.java
SelectorUtils.replacePlaceHolder
static String replacePlaceHolder( CssFormatter formatter, String str, LessObject caller ) { int pos = str.startsWith( "@{" ) ? 0 : str.indexOf( "@", 1 ); if( pos >= 0 ) { formatter.addOutput(); SelectorUtils.appendToWithPlaceHolder( formatter, str, pos, false, caller ); ...
java
static String replacePlaceHolder( CssFormatter formatter, String str, LessObject caller ) { int pos = str.startsWith( "@{" ) ? 0 : str.indexOf( "@", 1 ); if( pos >= 0 ) { formatter.addOutput(); SelectorUtils.appendToWithPlaceHolder( formatter, str, pos, false, caller ); ...
[ "static", "String", "replacePlaceHolder", "(", "CssFormatter", "formatter", ",", "String", "str", ",", "LessObject", "caller", ")", "{", "int", "pos", "=", "str", ".", "startsWith", "(", "\"@{\"", ")", "?", "0", ":", "str", ".", "indexOf", "(", "\"@\"", ...
Replace the possible variable place holder. @param formatter current formatter @param str the string @param caller for exception handling @return the result
[ "Replace", "the", "possible", "variable", "place", "holder", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/SelectorUtils.java#L213-L221
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parse
void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException { this.baseURL = baseURL; this.readerFactory = readerFactory; this.relativeURL = new URL( "file", null, "" ); this.reader = new LessLookAheadReader( input, null, false, false...
java
void parse( URL baseURL, Reader input, ReaderFactory readerFactory ) throws MalformedURLException, LessException { this.baseURL = baseURL; this.readerFactory = readerFactory; this.relativeURL = new URL( "file", null, "" ); this.reader = new LessLookAheadReader( input, null, false, false...
[ "void", "parse", "(", "URL", "baseURL", ",", "Reader", "input", ",", "ReaderFactory", "readerFactory", ")", "throws", "MalformedURLException", ",", "LessException", "{", "this", ".", "baseURL", "=", "baseURL", ";", "this", ".", "readerFactory", "=", "readerFacto...
Main method for parsing of main less file. @param baseURL the baseURL for import of external less data. @param input the less input data @param readerFactory A factory for the readers for imports. @throws MalformedURLException Should never occur @throws LessException if any parsing error occurred
[ "Main", "method", "for", "parsing", "of", "main", "less", "file", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L117-L123
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parseLazy
void parseLazy( CssFormatter formatter ) { if( lazyImports != null ) { HashMap<String, Expression> vars = variables; formatter.addVariables( vars ); for( int i = 0; i < lazyImports.size(); i++ ) { LazyImport lazyImport = lazyImports.get( i ); S...
java
void parseLazy( CssFormatter formatter ) { if( lazyImports != null ) { HashMap<String, Expression> vars = variables; formatter.addVariables( vars ); for( int i = 0; i < lazyImports.size(); i++ ) { LazyImport lazyImport = lazyImports.get( i ); S...
[ "void", "parseLazy", "(", "CssFormatter", "formatter", ")", "{", "if", "(", "lazyImports", "!=", "null", ")", "{", "HashMap", "<", "String", ",", "Expression", ">", "vars", "=", "variables", ";", "formatter", ".", "addVariables", "(", "vars", ")", ";", "...
If there are some imports with variables then this will parse after a formatter if available. @param formatter the formatter to evaluate variables
[ "If", "there", "are", "some", "imports", "with", "variables", "then", "this", "will", "parse", "after", "a", "formatter", "if", "available", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L129-L144
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parse
private void parse( FormattableContainer currentRule ) { try { for( ;; ) { int ch = reader.nextBlockMarker(); switch( ch ) { case -1: return; // end of input reached case ';': pars...
java
private void parse( FormattableContainer currentRule ) { try { for( ;; ) { int ch = reader.nextBlockMarker(); switch( ch ) { case -1: return; // end of input reached case ';': pars...
[ "private", "void", "parse", "(", "FormattableContainer", "currentRule", ")", "{", "try", "{", "for", "(", ";", ";", ")", "{", "int", "ch", "=", "reader", ".", "nextBlockMarker", "(", ")", ";", "switch", "(", "ch", ")", "{", "case", "-", "1", ":", "...
Parse main and import less files. @param currentRule the current container. This can be the root or a rule.
[ "Parse", "main", "and", "import", "less", "files", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L150-L175
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parseSemicolon
private void parseSemicolon( FormattableContainer currentRule ) { String selector = null; Operation params = null; StringBuilder builder = cachesBuilder; LOOP: for( ;; ) { char ch; try { ch = read(); } catch( Exception e ) { ...
java
private void parseSemicolon( FormattableContainer currentRule ) { String selector = null; Operation params = null; StringBuilder builder = cachesBuilder; LOOP: for( ;; ) { char ch; try { ch = read(); } catch( Exception e ) { ...
[ "private", "void", "parseSemicolon", "(", "FormattableContainer", "currentRule", ")", "{", "String", "selector", "=", "null", ";", "Operation", "params", "=", "null", ";", "StringBuilder", "builder", "=", "cachesBuilder", ";", "LOOP", ":", "for", "(", ";", ";"...
Parse an expression which ends with a semicolon. This can be a property assignment, variable assignment, a directive or other. @param currentRule the current container. This can be the root or a rule.
[ "Parse", "an", "expression", "which", "ends", "with", "a", "semicolon", ".", "This", "can", "be", "a", "property", "assignment", "variable", "assignment", "a", "directive", "or", "other", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L181-L266
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.rule
@Nonnull private Rule rule( FormattableContainer parent, String selector, Operation params, Expression guard ) { Rule rule = new Rule( reader, parent, selector, params, guard ); parseRule( rule ); return rule; }
java
@Nonnull private Rule rule( FormattableContainer parent, String selector, Operation params, Expression guard ) { Rule rule = new Rule( reader, parent, selector, params, guard ); parseRule( rule ); return rule; }
[ "@", "Nonnull", "private", "Rule", "rule", "(", "FormattableContainer", "parent", ",", "String", "selector", ",", "Operation", "params", ",", "Expression", "guard", ")", "{", "Rule", "rule", "=", "new", "Rule", "(", "reader", ",", "parent", ",", "selector", ...
Create a rule and parse the content of an block. @param selector the selectors @param parent the parent in the hierarchy @param params the parameters if it is a mixin. @param guard an optional guard expression @return the rule
[ "Create", "a", "rule", "and", "parse", "the", "content", "of", "an", "block", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L623-L628
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parseRule
private void parseRule( Rule rule ) { ruleStack.add( rule ); for( ;; ) { int ch = reader.nextBlockMarker(); switch( ch ) { case -1: throw createException( "Unexpected end of Less data" ); case ';': parseSemic...
java
private void parseRule( Rule rule ) { ruleStack.add( rule ); for( ;; ) { int ch = reader.nextBlockMarker(); switch( ch ) { case -1: throw createException( "Unexpected end of Less data" ); case ';': parseSemic...
[ "private", "void", "parseRule", "(", "Rule", "rule", ")", "{", "ruleStack", ".", "add", "(", "rule", ")", ";", "for", "(", ";", ";", ")", "{", "int", "ch", "=", "reader", ".", "nextBlockMarker", "(", ")", ";", "switch", "(", "ch", ")", "{", "case...
Parse the content of an block. @param rule the container for the content
[ "Parse", "the", "content", "of", "an", "block", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L635-L657
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.readQuote
private String readQuote( char quote ) { StringBuilder builder = cachesBuilder; builder.setLength( 0 ); readQuote( quote, builder ); String str = builder.toString(); builder.setLength( 0 ); return str; }
java
private String readQuote( char quote ) { StringBuilder builder = cachesBuilder; builder.setLength( 0 ); readQuote( quote, builder ); String str = builder.toString(); builder.setLength( 0 ); return str; }
[ "private", "String", "readQuote", "(", "char", "quote", ")", "{", "StringBuilder", "builder", "=", "cachesBuilder", ";", "builder", ".", "setLength", "(", "0", ")", ";", "readQuote", "(", "quote", ",", "builder", ")", ";", "String", "str", "=", "builder", ...
Read a quoted string. @param quote the quote character. @return the string with quotes
[ "Read", "a", "quoted", "string", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1047-L1054
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.readQuote
private void readQuote( char quote, StringBuilder builder ) { builder.append( quote ); boolean isBackslash = false; for( ;; ) { char ch = read(); builder.append( ch ); if( ch == quote && !isBackslash ) { return; } isBack...
java
private void readQuote( char quote, StringBuilder builder ) { builder.append( quote ); boolean isBackslash = false; for( ;; ) { char ch = read(); builder.append( ch ); if( ch == quote && !isBackslash ) { return; } isBack...
[ "private", "void", "readQuote", "(", "char", "quote", ",", "StringBuilder", "builder", ")", "{", "builder", ".", "append", "(", "quote", ")", ";", "boolean", "isBackslash", "=", "false", ";", "for", "(", ";", ";", ")", "{", "char", "ch", "=", "read", ...
Read a quoted string and append it to the builder. @param quote the quote character. @param builder the target
[ "Read", "a", "quoted", "string", "and", "append", "it", "to", "the", "builder", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1062-L1073
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.parseUrlParam
private Operation parseUrlParam() { StringBuilder builder = cachesBuilder; builder.setLength( 0 ); Operation op = new Operation( reader, new ValueExpression( reader, relativeURL.getPath() ), ';' ); for( ;; ) { char ch = read(); switch( ch ) { case ...
java
private Operation parseUrlParam() { StringBuilder builder = cachesBuilder; builder.setLength( 0 ); Operation op = new Operation( reader, new ValueExpression( reader, relativeURL.getPath() ), ';' ); for( ;; ) { char ch = read(); switch( ch ) { case ...
[ "private", "Operation", "parseUrlParam", "(", ")", "{", "StringBuilder", "builder", "=", "cachesBuilder", ";", "builder", ".", "setLength", "(", "0", ")", ";", "Operation", "op", "=", "new", "Operation", "(", "reader", ",", "new", "ValueExpression", "(", "re...
Parse the parameter of an "url" function which has some curious fallbacks. @return the parameter of the function
[ "Parse", "the", "parameter", "of", "an", "url", "function", "which", "has", "some", "curious", "fallbacks", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1080-L1115
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.concat
private Expression concat( Expression left, char operator, Expression right ) { if( left == null ) { return right; } Operation op; if( left.getClass() == Operation.class && ((Operation)left).getOperator() == operator ) { op = (Operation)left; } else if( ri...
java
private Expression concat( Expression left, char operator, Expression right ) { if( left == null ) { return right; } Operation op; if( left.getClass() == Operation.class && ((Operation)left).getOperator() == operator ) { op = (Operation)left; } else if( ri...
[ "private", "Expression", "concat", "(", "Expression", "left", ",", "char", "operator", ",", "Expression", "right", ")", "{", "if", "(", "left", "==", "null", ")", "{", "return", "right", ";", "}", "Operation", "op", ";", "if", "(", "left", ".", "getCla...
Concatenate 2 expressions to one expression. @param left the left, can be null @param operator the expression operation @param right the right, can not be null @return the resulting expression
[ "Concatenate", "2", "expressions", "to", "one", "expression", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1128-L1146
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.buildExpression
@Nonnull private Expression buildExpression( String str ) { switch( str.charAt( 0 ) ) { case '@': return new VariableExpression( reader, str ); case '-': if( str.startsWith( "-@" ) ) { return new FunctionExpression( reader, "-", new...
java
@Nonnull private Expression buildExpression( String str ) { switch( str.charAt( 0 ) ) { case '@': return new VariableExpression( reader, str ); case '-': if( str.startsWith( "-@" ) ) { return new FunctionExpression( reader, "-", new...
[ "@", "Nonnull", "private", "Expression", "buildExpression", "(", "String", "str", ")", "{", "switch", "(", "str", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ":", "return", "new", "VariableExpression", "(", "reader", ",", "str", ")", ";",...
Create an expression from the given atomic string. @param str the expression like a number, color, variable, string, etc @return the expression
[ "Create", "an", "expression", "from", "the", "given", "atomic", "string", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1154-L1167
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.trim
private static String trim( StringBuilder builder ) { String str = builder.toString().trim(); builder.setLength( 0 ); return str; }
java
private static String trim( StringBuilder builder ) { String str = builder.toString().trim(); builder.setLength( 0 ); return str; }
[ "private", "static", "String", "trim", "(", "StringBuilder", "builder", ")", "{", "String", "str", "=", "builder", ".", "toString", "(", ")", ".", "trim", "(", ")", ";", "builder", ".", "setLength", "(", "0", ")", ";", "return", "str", ";", "}" ]
Get a trim string from the builder and clear the builder. @param builder the builder. @return a trim string
[ "Get", "a", "trim", "string", "from", "the", "builder", "and", "clear", "the", "builder", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1237-L1241
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.isWhitespace
private static boolean isWhitespace( StringBuilder builder ) { for( int i = 0; i < builder.length(); i++ ) { if( !Character.isWhitespace( builder.charAt( i ) ) ) { return false; } } return true; }
java
private static boolean isWhitespace( StringBuilder builder ) { for( int i = 0; i < builder.length(); i++ ) { if( !Character.isWhitespace( builder.charAt( i ) ) ) { return false; } } return true; }
[ "private", "static", "boolean", "isWhitespace", "(", "StringBuilder", "builder", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "builder", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isWhitespace"...
If the builder is empty or contains only whitespaces @param builder the builder. @return true if there is no content
[ "If", "the", "builder", "is", "empty", "or", "contains", "only", "whitespaces" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1250-L1257
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.isSelector
private static boolean isSelector( StringBuilder builder ) { int length = builder.length(); if( length == 0 ) { return false; } switch( builder.charAt( 0 ) ) { case '.': // Mixin case '#': // Mixin break; default: ...
java
private static boolean isSelector( StringBuilder builder ) { int length = builder.length(); if( length == 0 ) { return false; } switch( builder.charAt( 0 ) ) { case '.': // Mixin case '#': // Mixin break; default: ...
[ "private", "static", "boolean", "isSelector", "(", "StringBuilder", "builder", ")", "{", "int", "length", "=", "builder", ".", "length", "(", ")", ";", "if", "(", "length", "==", "0", ")", "{", "return", "false", ";", "}", "switch", "(", "builder", "."...
If the builder contains a selector and not a mixin. @param builder the builder @return true, if it 100% a selector and not a mixin with parameters
[ "If", "the", "builder", "contains", "a", "selector", "and", "not", "a", "mixin", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1281-L1302
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.isVariableName
private static boolean isVariableName( StringBuilder builder ) { for( int i = 1; i < builder.length(); ) { char ch = builder.charAt( i++ ); switch( ch ) { case '(': case '\"': return false; } } return true; ...
java
private static boolean isVariableName( StringBuilder builder ) { for( int i = 1; i < builder.length(); ) { char ch = builder.charAt( i++ ); switch( ch ) { case '(': case '\"': return false; } } return true; ...
[ "private", "static", "boolean", "isVariableName", "(", "StringBuilder", "builder", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "builder", ".", "length", "(", ")", ";", ")", "{", "char", "ch", "=", "builder", ".", "charAt", "(", "i", ...
If the builder contains a valid variable name @param builder the builder @return true, if a variable; false, if it is an at-rule.
[ "If", "the", "builder", "contains", "a", "valid", "variable", "name" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1357-L1367
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.firstNonWhitespace
private static char firstNonWhitespace( StringBuilder builder ) { for( int i = 0; i < builder.length(); i++ ) { if( !Character.isWhitespace( builder.charAt( i ) ) ) { return builder.charAt( i ); } } return ' '; }
java
private static char firstNonWhitespace( StringBuilder builder ) { for( int i = 0; i < builder.length(); i++ ) { if( !Character.isWhitespace( builder.charAt( i ) ) ) { return builder.charAt( i ); } } return ' '; }
[ "private", "static", "char", "firstNonWhitespace", "(", "StringBuilder", "builder", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "builder", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isWhitespa...
The first character in the builder that is not a whitespace. Else there are only whitespaces @param builder the builder. @return the first non whitespace
[ "The", "first", "character", "in", "the", "builder", "that", "is", "not", "a", "whitespace", ".", "Else", "there", "are", "only", "whitespaces" ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1376-L1383
train
i-net-software/jlessc
src/com/inet/lib/less/LessParser.java
LessParser.throwUnrecognizedInputIfAny
private void throwUnrecognizedInputIfAny( StringBuilder builder, int ch ) { if( !isWhitespace( builder ) ) { throw createException( "Unrecognized input: '" + trim( builder ) + (char)ch + "'" ); } builder.setLength( 0 ); }
java
private void throwUnrecognizedInputIfAny( StringBuilder builder, int ch ) { if( !isWhitespace( builder ) ) { throw createException( "Unrecognized input: '" + trim( builder ) + (char)ch + "'" ); } builder.setLength( 0 ); }
[ "private", "void", "throwUnrecognizedInputIfAny", "(", "StringBuilder", "builder", ",", "int", "ch", ")", "{", "if", "(", "!", "isWhitespace", "(", "builder", ")", ")", "{", "throw", "createException", "(", "\"Unrecognized input: '\"", "+", "trim", "(", "builder...
Throw an unrecognized input exception if there content in the StringBuilder. @param builder the StringBuilder @param ch the last character
[ "Throw", "an", "unrecognized", "input", "exception", "if", "there", "content", "in", "the", "StringBuilder", "." ]
15b13e1637f6cc2e4d72df021e23ee0ca8d5e629
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessParser.java#L1391-L1396
train
yannrichet/rsession
src/main/java/org/math/R/StartRserve.java
StartRserve.isRserveInstalled
public static boolean isRserveInstalled(String Rcmd) { Process p = doInR("is.element(set=installed.packages(lib.loc='" + RserveDaemon.app_dir() + "'),el='Rserve')", Rcmd, "--vanilla --silent", false); if (p == null) { Log.Err.println("Failed to ask if Rserve is installed"); retur...
java
public static boolean isRserveInstalled(String Rcmd) { Process p = doInR("is.element(set=installed.packages(lib.loc='" + RserveDaemon.app_dir() + "'),el='Rserve')", Rcmd, "--vanilla --silent", false); if (p == null) { Log.Err.println("Failed to ask if Rserve is installed"); retur...
[ "public", "static", "boolean", "isRserveInstalled", "(", "String", "Rcmd", ")", "{", "Process", "p", "=", "doInR", "(", "\"is.element(set=installed.packages(lib.loc='\"", "+", "RserveDaemon", ".", "app_dir", "(", ")", "+", "\"'),el='Rserve')\"", ",", "Rcmd", ",", ...
R batch to check Rserve is installed @param Rcmd command necessary to start R @return Rserve is already installed
[ "R", "batch", "to", "check", "Rserve", "is", "installed" ]
acaa47f4da1644e0d067634130c0e88e38cb9035
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/StartRserve.java#L142-L178
train
yannrichet/rsession
src/main/java/org/math/R/StartRserve.java
StartRserve.main
public static void main(String[] args) { File dir = null; System.out.println("checkLocalRserve: " + checkLocalRserve()); try { RConnection c = new RConnection(); //c.eval("cat('123')"); dir = new File(c.eval("getwd()").asString()); System.err.prin...
java
public static void main(String[] args) { File dir = null; System.out.println("checkLocalRserve: " + checkLocalRserve()); try { RConnection c = new RConnection(); //c.eval("cat('123')"); dir = new File(c.eval("getwd()").asString()); System.err.prin...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "File", "dir", "=", "null", ";", "System", ".", "out", ".", "println", "(", "\"checkLocalRserve: \"", "+", "checkLocalRserve", "(", ")", ")", ";", "try", "{", "RConnection", ...
just a demo main method which starts Rserve and shuts it down again @param args ...
[ "just", "a", "demo", "main", "method", "which", "starts", "Rserve", "and", "shuts", "it", "down", "again" ]
acaa47f4da1644e0d067634130c0e88e38cb9035
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/StartRserve.java#L530-L556
train
yannrichet/rsession
src/main/java/org/math/R/RserverConf.java
RserverConf.isPortAvailable
public static boolean isPortAvailable(int p) { try { ServerSocket test = new ServerSocket(p); test.close(); } catch (BindException e) { return false; } catch (IOException e) { return false; } return true; }
java
public static boolean isPortAvailable(int p) { try { ServerSocket test = new ServerSocket(p); test.close(); } catch (BindException e) { return false; } catch (IOException e) { return false; } return true; }
[ "public", "static", "boolean", "isPortAvailable", "(", "int", "p", ")", "{", "try", "{", "ServerSocket", "test", "=", "new", "ServerSocket", "(", "p", ")", ";", "test", ".", "close", "(", ")", ";", "}", "catch", "(", "BindException", "e", ")", "{", "...
used for windows multi-session emulation. Incremented at each new Rscript instance.
[ "used", "for", "windows", "multi", "-", "session", "emulation", ".", "Incremented", "at", "each", "new", "Rscript", "instance", "." ]
acaa47f4da1644e0d067634130c0e88e38cb9035
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/RserverConf.java#L202-L212
train
yannrichet/rsession
src/main/java/org/math/R/RserverConf.java
RserverConf.newLocalInstance
public static RserverConf newLocalInstance(Properties p) { RserverConf server = null; if (RserveDaemon.isWindows() || !UNIX_OPTIMIZE) { while (!isPortAvailable(RserverPort)) { RserverPort++; } server = new RserverConf(null, RserverPort, null, null, p);...
java
public static RserverConf newLocalInstance(Properties p) { RserverConf server = null; if (RserveDaemon.isWindows() || !UNIX_OPTIMIZE) { while (!isPortAvailable(RserverPort)) { RserverPort++; } server = new RserverConf(null, RserverPort, null, null, p);...
[ "public", "static", "RserverConf", "newLocalInstance", "(", "Properties", "p", ")", "{", "RserverConf", "server", "=", "null", ";", "if", "(", "RserveDaemon", ".", "isWindows", "(", ")", "||", "!", "UNIX_OPTIMIZE", ")", "{", "while", "(", "!", "isPortAvailab...
if we want to re-use older sessions. May wrongly fil if older session is already stucked...
[ "if", "we", "want", "to", "re", "-", "use", "older", "sessions", ".", "May", "wrongly", "fil", "if", "older", "session", "is", "already", "stucked", "..." ]
acaa47f4da1644e0d067634130c0e88e38cb9035
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/RserverConf.java#L216-L227
train
yannrichet/rsession
src/main/java/org/math/R/R2jsUtils.java
R2jsUtils.parse
public static List<String> parse(String expr) { List<String> expressions = new ArrayList<>(); int parenthesis = 0; // '(' and ')' int brackets = 0; // '{' and '}' int brackets2 = 0; // '[' and ']' String[] lines = expr.split("\n"); StringBuilder sb = ne...
java
public static List<String> parse(String expr) { List<String> expressions = new ArrayList<>(); int parenthesis = 0; // '(' and ')' int brackets = 0; // '{' and '}' int brackets2 = 0; // '[' and ']' String[] lines = expr.split("\n"); StringBuilder sb = ne...
[ "public", "static", "List", "<", "String", ">", "parse", "(", "String", "expr", ")", "{", "List", "<", "String", ">", "expressions", "=", "new", "ArrayList", "<>", "(", ")", ";", "int", "parenthesis", "=", "0", ";", "// '(' and ')'", "int", "brackets", ...
Parse an expression containing multiple lines, functions or sub-expressions in a list of inline sub-expressions. This function also cleanup comments. @param expr expression to parse @return a list of inline sub-expressions
[ "Parse", "an", "expression", "containing", "multiple", "lines", "functions", "or", "sub", "-", "expressions", "in", "a", "list", "of", "inline", "sub", "-", "expressions", ".", "This", "function", "also", "cleanup", "comments", "." ]
acaa47f4da1644e0d067634130c0e88e38cb9035
https://github.com/yannrichet/rsession/blob/acaa47f4da1644e0d067634130c0e88e38cb9035/src/main/java/org/math/R/R2jsUtils.java#L24-L84
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.bindExternalFunction
public void bindExternalFunction(String funcName, ExternalFunction func) throws Exception { ifAsyncWeCant("bind an external function"); Assert(!externals.containsKey(funcName), "Function '" + funcName + "' has already been bound."); externals.put(funcName, func); }
java
public void bindExternalFunction(String funcName, ExternalFunction func) throws Exception { ifAsyncWeCant("bind an external function"); Assert(!externals.containsKey(funcName), "Function '" + funcName + "' has already been bound."); externals.put(funcName, func); }
[ "public", "void", "bindExternalFunction", "(", "String", "funcName", ",", "ExternalFunction", "func", ")", "throws", "Exception", "{", "ifAsyncWeCant", "(", "\"bind an external function\"", ")", ";", "Assert", "(", "!", "externals", ".", "containsKey", "(", "funcNam...
Most general form of function binding that returns an Object and takes an array of Object parameters. The only way to bind a function with more than 3 arguments. @param funcName EXTERNAL ink function name to bind to. @param func The Java function to bind.
[ "Most", "general", "form", "of", "function", "binding", "that", "returns", "an", "Object", "and", "takes", "an", "array", "of", "Object", "parameters", ".", "The", "only", "way", "to", "bind", "a", "function", "with", "more", "than", "3", "arguments", "." ...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L222-L226
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.chooseChoiceIndex
public void chooseChoiceIndex(int choiceIdx) throws Exception { List<Choice> choices = getCurrentChoices(); Assert(choiceIdx >= 0 && choiceIdx < choices.size(), "choice out of range"); // Replace callstack with the one from the thread at the choosing point, // so that we can jump into the right place in the fl...
java
public void chooseChoiceIndex(int choiceIdx) throws Exception { List<Choice> choices = getCurrentChoices(); Assert(choiceIdx >= 0 && choiceIdx < choices.size(), "choice out of range"); // Replace callstack with the one from the thread at the choosing point, // so that we can jump into the right place in the fl...
[ "public", "void", "chooseChoiceIndex", "(", "int", "choiceIdx", ")", "throws", "Exception", "{", "List", "<", "Choice", ">", "choices", "=", "getCurrentChoices", "(", ")", ";", "Assert", "(", "choiceIdx", ">=", "0", "&&", "choiceIdx", "<", "choices", ".", ...
Chooses the Choice from the currentChoices list with the given index. Internally, this sets the current content path to that pointed to by the Choice, ready to continue story evaluation.
[ "Chooses", "the", "Choice", "from", "the", "currentChoices", "list", "with", "the", "given", "index", ".", "Internally", "this", "sets", "the", "current", "content", "path", "to", "that", "pointed", "to", "by", "the", "Choice", "ready", "to", "continue", "st...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L406-L419
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.error
void error(String message, boolean useEndLineNumber) throws Exception { StoryException e = new StoryException(message); e.useEndLineNumber = useEndLineNumber; throw e; }
java
void error(String message, boolean useEndLineNumber) throws Exception { StoryException e = new StoryException(message); e.useEndLineNumber = useEndLineNumber; throw e; }
[ "void", "error", "(", "String", "message", ",", "boolean", "useEndLineNumber", ")", "throws", "Exception", "{", "StoryException", "e", "=", "new", "StoryException", "(", "message", ")", ";", "e", ".", "useEndLineNumber", "=", "useEndLineNumber", ";", "throw", ...
then exits the flow.
[ "then", "exits", "the", "flow", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L819-L823
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.observeVariable
public void observeVariable(String variableName, VariableObserver observer) throws StoryException, Exception { ifAsyncWeCant("observe a new variable"); if (variableObservers == null) variableObservers = new HashMap<String, List<VariableObserver>>(); if (!state.getVariablesState().globalVariableExistsWithName...
java
public void observeVariable(String variableName, VariableObserver observer) throws StoryException, Exception { ifAsyncWeCant("observe a new variable"); if (variableObservers == null) variableObservers = new HashMap<String, List<VariableObserver>>(); if (!state.getVariablesState().globalVariableExistsWithName...
[ "public", "void", "observeVariable", "(", "String", "variableName", ",", "VariableObserver", "observer", ")", "throws", "StoryException", ",", "Exception", "{", "ifAsyncWeCant", "(", "\"observe a new variable\"", ")", ";", "if", "(", "variableObservers", "==", "null",...
When the named global variable changes it's value, the observer will be called to notify it of the change. Note that if the value changes multiple times within the ink, the observer will only be called once, at the end of the ink's evaluation. If, during the evaluation, it changes and then changes back again to its ori...
[ "When", "the", "named", "global", "variable", "changes", "it", "s", "value", "the", "observer", "will", "be", "called", "to", "notify", "it", "of", "the", "change", ".", "Note", "that", "if", "the", "value", "changes", "multiple", "times", "within", "the",...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L1039-L1056
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.observeVariables
public void observeVariables(List<String> variableNames, VariableObserver observer) throws StoryException, Exception { for (String varName : variableNames) { observeVariable(varName, observer); } }
java
public void observeVariables(List<String> variableNames, VariableObserver observer) throws StoryException, Exception { for (String varName : variableNames) { observeVariable(varName, observer); } }
[ "public", "void", "observeVariables", "(", "List", "<", "String", ">", "variableNames", ",", "VariableObserver", "observer", ")", "throws", "StoryException", ",", "Exception", "{", "for", "(", "String", "varName", ":", "variableNames", ")", "{", "observeVariable",...
Convenience function to allow multiple variables to be observed with the same observer delegate function. See the singular ObserveVariable for details. The observer will get one call for every variable that has changed. @param variableNames The set of variables to observe. @param observer The delegate function to call...
[ "Convenience", "function", "to", "allow", "multiple", "variables", "to", "be", "observed", "with", "the", "same", "observer", "delegate", "function", ".", "See", "the", "singular", "ObserveVariable", "for", "details", ".", "The", "observer", "will", "get", "one"...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L1071-L1076
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.toJsonString
public String toJsonString() throws Exception { List<?> rootContainerJsonList = (List<?>) Json.runtimeObjectToJToken(mainContentContainer); HashMap<String, Object> rootObject = new HashMap<String, Object>(); rootObject.put("inkVersion", inkVersionCurrent); rootObject.put("root", rootContainerJsonList); retu...
java
public String toJsonString() throws Exception { List<?> rootContainerJsonList = (List<?>) Json.runtimeObjectToJToken(mainContentContainer); HashMap<String, Object> rootObject = new HashMap<String, Object>(); rootObject.put("inkVersion", inkVersionCurrent); rootObject.put("root", rootContainerJsonList); retu...
[ "public", "String", "toJsonString", "(", ")", "throws", "Exception", "{", "List", "<", "?", ">", "rootContainerJsonList", "=", "(", "List", "<", "?", ">", ")", "Json", ".", "runtimeObjectToJToken", "(", "mainContentContainer", ")", ";", "HashMap", "<", "Stri...
The Story itself in JSON representation.
[ "The", "Story", "itself", "in", "JSON", "representation", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2139-L2147
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.unbindExternalFunction
public void unbindExternalFunction(String funcName) throws Exception { ifAsyncWeCant("unbind an external a function"); Assert(externals.containsKey(funcName), "Function '" + funcName + "' has not been bound."); externals.remove(funcName); }
java
public void unbindExternalFunction(String funcName) throws Exception { ifAsyncWeCant("unbind an external a function"); Assert(externals.containsKey(funcName), "Function '" + funcName + "' has not been bound."); externals.remove(funcName); }
[ "public", "void", "unbindExternalFunction", "(", "String", "funcName", ")", "throws", "Exception", "{", "ifAsyncWeCant", "(", "\"unbind an external a function\"", ")", ";", "Assert", "(", "externals", ".", "containsKey", "(", "funcName", ")", ",", "\"Function '\"", ...
Remove a binding for a named EXTERNAL ink function.
[ "Remove", "a", "binding", "for", "a", "named", "EXTERNAL", "ink", "function", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2190-L2194
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.visitContainer
void visitContainer(Container container, boolean atStart) { if (!container.getCountingAtStartOnly() || atStart) { if (container.getVisitsShouldBeCounted()) incrementVisitCountForContainer(container); if (container.getTurnIndexShouldBeCounted()) recordTurnIndexVisitToContainer(container); } }
java
void visitContainer(Container container, boolean atStart) { if (!container.getCountingAtStartOnly() || atStart) { if (container.getVisitsShouldBeCounted()) incrementVisitCountForContainer(container); if (container.getTurnIndexShouldBeCounted()) recordTurnIndexVisitToContainer(container); } }
[ "void", "visitContainer", "(", "Container", "container", ",", "boolean", "atStart", ")", "{", "if", "(", "!", "container", ".", "getCountingAtStartOnly", "(", ")", "||", "atStart", ")", "{", "if", "(", "container", ".", "getVisitsShouldBeCounted", "(", ")", ...
Mark a container as having been visited
[ "Mark", "a", "container", "as", "having", "been", "visited" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2335-L2343
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.evaluateFunction
public Object evaluateFunction(String functionName, Object[] arguments) throws Exception { return evaluateFunction(functionName, null, arguments); }
java
public Object evaluateFunction(String functionName, Object[] arguments) throws Exception { return evaluateFunction(functionName, null, arguments); }
[ "public", "Object", "evaluateFunction", "(", "String", "functionName", ",", "Object", "[", "]", "arguments", ")", "throws", "Exception", "{", "return", "evaluateFunction", "(", "functionName", ",", "null", ",", "arguments", ")", ";", "}" ]
Evaluates a function defined in ink. @param functionName The name of the function as declared in ink. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @return The return value as returne...
[ "Evaluates", "a", "function", "defined", "in", "ink", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2378-L2380
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Story.java
Story.evaluateFunction
public Object evaluateFunction(String functionName, StringBuilder textOutput, Object[] arguments) throws Exception { ifAsyncWeCant("evaluate a function"); if (functionName == null) { throw new Exception("Function is null"); } else if (functionName.trim().isEmpty()) { throw new Exception("Function is empty ...
java
public Object evaluateFunction(String functionName, StringBuilder textOutput, Object[] arguments) throws Exception { ifAsyncWeCant("evaluate a function"); if (functionName == null) { throw new Exception("Function is null"); } else if (functionName.trim().isEmpty()) { throw new Exception("Function is empty ...
[ "public", "Object", "evaluateFunction", "(", "String", "functionName", ",", "StringBuilder", "textOutput", ",", "Object", "[", "]", "arguments", ")", "throws", "Exception", "{", "ifAsyncWeCant", "(", "\"evaluate a function\"", ")", ";", "if", "(", "functionName", ...
Evaluates a function defined in ink, and gathers the possibly multi-line text as generated by the function. @param arguments The arguments that the ink function takes, if any. Note that we don't (can't) do any validation on the number of arguments right now, so make sure you get it right! @param functionName The name ...
[ "Evaluates", "a", "function", "defined", "in", "ink", "and", "gathers", "the", "possibly", "multi", "-", "line", "text", "as", "generated", "by", "the", "function", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Story.java#L2419-L2455
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Stopwatch.java
Stopwatch.getElapsedTicks
public long getElapsedTicks() { long elapsed; if (running) { elapsed = (System.nanoTime() - startTime); } else { elapsed = (stopTime - startTime); } return elapsed / nsPerTick; }
java
public long getElapsedTicks() { long elapsed; if (running) { elapsed = (System.nanoTime() - startTime); } else { elapsed = (stopTime - startTime); } return elapsed / nsPerTick; }
[ "public", "long", "getElapsedTicks", "(", ")", "{", "long", "elapsed", ";", "if", "(", "running", ")", "{", "elapsed", "=", "(", "System", ".", "nanoTime", "(", ")", "-", "startTime", ")", ";", "}", "else", "{", "elapsed", "=", "(", "stopTime", "-", ...
Gets the total elapsed time measured by the current instance, in nanoseconds. 1 Tick = 100 nanoseconds
[ "Gets", "the", "total", "elapsed", "time", "measured", "by", "the", "current", "instance", "in", "nanoseconds", ".", "1", "Tick", "=", "100", "nanoseconds" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Stopwatch.java#L47-L55
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/CallStack.java
CallStack.getJsonToken
public HashMap<String, Object> getJsonToken() throws Exception { HashMap<String, Object> jRTObject = new HashMap<String, Object>(); ArrayList<Object> jThreads = new ArrayList<Object>(); for (CallStack.Thread thread : threads) { jThreads.add(thread.jsonToken()); } jRTObject.put("threads", jThreads); jR...
java
public HashMap<String, Object> getJsonToken() throws Exception { HashMap<String, Object> jRTObject = new HashMap<String, Object>(); ArrayList<Object> jThreads = new ArrayList<Object>(); for (CallStack.Thread thread : threads) { jThreads.add(thread.jsonToken()); } jRTObject.put("threads", jThreads); jR...
[ "public", "HashMap", "<", "String", ",", "Object", ">", "getJsonToken", "(", ")", "throws", "Exception", "{", "HashMap", "<", "String", ",", "Object", ">", "jRTObject", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "ArrayList",...
See above for why we can't implement jsonToken
[ "See", "above", "for", "why", "we", "can", "t", "implement", "jsonToken" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/CallStack.java#L229-L242
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/CallStack.java
CallStack.getTemporaryVariableWithName
public RTObject getTemporaryVariableWithName(String name, int contextIndex) { if (contextIndex == -1) contextIndex = getCurrentElementIndex() + 1; Element contextElement = getCallStack().get(contextIndex - 1); RTObject varValue = contextElement.temporaryVariables.get(name); return varValue; }
java
public RTObject getTemporaryVariableWithName(String name, int contextIndex) { if (contextIndex == -1) contextIndex = getCurrentElementIndex() + 1; Element contextElement = getCallStack().get(contextIndex - 1); RTObject varValue = contextElement.temporaryVariables.get(name); return varValue; }
[ "public", "RTObject", "getTemporaryVariableWithName", "(", "String", "name", ",", "int", "contextIndex", ")", "{", "if", "(", "contextIndex", "==", "-", "1", ")", "contextIndex", "=", "getCurrentElementIndex", "(", ")", "+", "1", ";", "Element", "contextElement"...
Get variable value, dereferencing a variable pointer if necessary
[ "Get", "variable", "value", "dereferencing", "a", "variable", "pointer", "if", "necessary" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/CallStack.java#L249-L257
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/CallStack.java
CallStack.setJsonToken
@SuppressWarnings("unchecked") public void setJsonToken(HashMap<String, Object> jRTObject, Story storyContext) throws Exception { threads.clear(); List<Object> jThreads = (List<Object>) jRTObject.get("threads"); for (Object jThreadTok : jThreads) { HashMap<String, Object> jThreadObj = (HashMap<String, Objec...
java
@SuppressWarnings("unchecked") public void setJsonToken(HashMap<String, Object> jRTObject, Story storyContext) throws Exception { threads.clear(); List<Object> jThreads = (List<Object>) jRTObject.get("threads"); for (Object jThreadTok : jThreads) { HashMap<String, Object> jThreadObj = (HashMap<String, Objec...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "setJsonToken", "(", "HashMap", "<", "String", ",", "Object", ">", "jRTObject", ",", "Story", "storyContext", ")", "throws", "Exception", "{", "threads", ".", "clear", "(", ")", ";", "List...
look up RTObjects from paths for currentContainer within elements.
[ "look", "up", "RTObjects", "from", "paths", "for", "currentContainer", "within", "elements", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/CallStack.java#L317-L330
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/ProfileNode.java
ProfileNode.getDescendingOrderedNodes
public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() { if( nodes == null ) return null; List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet()); Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() { ...
java
public Iterable<Entry<String, ProfileNode>> getDescendingOrderedNodes() { if( nodes == null ) return null; List<Entry<String, ProfileNode>> averageStepTimes = new LinkedList<Entry<String, ProfileNode>>(nodes.entrySet()); Collections.sort(averageStepTimes, new Comparator<Entry<String, ProfileNode>>() { ...
[ "public", "Iterable", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", "getDescendingOrderedNodes", "(", ")", "{", "if", "(", "nodes", "==", "null", ")", "return", "null", ";", "List", "<", "Entry", "<", "String", ",", "ProfileNode", ">", ">", ...
Returns a sorted enumerable of the nodes in descending order of how long they took to run.
[ "Returns", "a", "sorted", "enumerable", "of", "the", "nodes", "in", "descending", "order", "of", "how", "long", "they", "took", "to", "run", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/ProfileNode.java#L98-L111
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/VariablesState.java
VariablesState.resolveVariablePointer
VariablePointerValue resolveVariablePointer(VariablePointerValue varPointer) throws Exception { int contextIndex = varPointer.getContextIndex(); if (contextIndex == -1) contextIndex = getContextIndexOfVariableNamed(varPointer.getVariableName()); RTObject valueOfVariablePointedTo = getRawVariableWithName(...
java
VariablePointerValue resolveVariablePointer(VariablePointerValue varPointer) throws Exception { int contextIndex = varPointer.getContextIndex(); if (contextIndex == -1) contextIndex = getContextIndexOfVariableNamed(varPointer.getVariableName()); RTObject valueOfVariablePointedTo = getRawVariableWithName(...
[ "VariablePointerValue", "resolveVariablePointer", "(", "VariablePointerValue", "varPointer", ")", "throws", "Exception", "{", "int", "contextIndex", "=", "varPointer", ".", "getContextIndex", "(", ")", ";", "if", "(", "contextIndex", "==", "-", "1", ")", "contextInd...
or the exact position of a temporary on the callstack.
[ "or", "the", "exact", "position", "of", "a", "temporary", "on", "the", "callstack", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/VariablesState.java#L210-L229
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.copy
StoryState copy() { StoryState copy = new StoryState(story); copy.getOutputStream().addAll(outputStream); outputStreamDirty(); copy.currentChoices.addAll(currentChoices); if (hasError()) { copy.currentErrors = new ArrayList<String>(); copy.currentErrors.addAll(currentErrors); } if (hasWarning()) ...
java
StoryState copy() { StoryState copy = new StoryState(story); copy.getOutputStream().addAll(outputStream); outputStreamDirty(); copy.currentChoices.addAll(currentChoices); if (hasError()) { copy.currentErrors = new ArrayList<String>(); copy.currentErrors.addAll(currentErrors); } if (hasWarning()) ...
[ "StoryState", "copy", "(", ")", "{", "StoryState", "copy", "=", "new", "StoryState", "(", "story", ")", ";", "copy", ".", "getOutputStream", "(", ")", ".", "addAll", "(", "outputStream", ")", ";", "outputStreamDirty", "(", ")", ";", "copy", ".", "current...
I wonder if there's a sensible way to enforce that..??
[ "I", "wonder", "if", "there", "s", "a", "sensible", "way", "to", "enforce", "that", "..", "??" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L98-L136
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.trimWhitespaceFromFunctionEnd
void trimWhitespaceFromFunctionEnd() { assert (callStack.getCurrentElement().type == PushPopType.Function); int functionStartPoint = callStack.getCurrentElement().functionStartInOuputStream; // If the start point has become -1, it means that some non-whitespace // text has been pushed, so it's safe to go as f...
java
void trimWhitespaceFromFunctionEnd() { assert (callStack.getCurrentElement().type == PushPopType.Function); int functionStartPoint = callStack.getCurrentElement().functionStartInOuputStream; // If the start point has become -1, it means that some non-whitespace // text has been pushed, so it's safe to go as f...
[ "void", "trimWhitespaceFromFunctionEnd", "(", ")", "{", "assert", "(", "callStack", ".", "getCurrentElement", "(", ")", ".", "type", "==", "PushPopType", ".", "Function", ")", ";", "int", "functionStartPoint", "=", "callStack", ".", "getCurrentElement", "(", ")"...
whitespace is trimmed in one go here when we pop the function.
[ "whitespace", "is", "trimmed", "in", "one", "go", "here", "when", "we", "pop", "the", "function", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L229-L258
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.getJsonToken
public HashMap<String, Object> getJsonToken() throws Exception { HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> choiceThreads = null; for (Choice c : currentChoices) { c.originalThreadIndex = c.getThreadAtGeneration().threadIndex; if (callStack.getThreadWithIndex(c.o...
java
public HashMap<String, Object> getJsonToken() throws Exception { HashMap<String, Object> obj = new HashMap<String, Object>(); HashMap<String, Object> choiceThreads = null; for (Choice c : currentChoices) { c.originalThreadIndex = c.getThreadAtGeneration().threadIndex; if (callStack.getThreadWithIndex(c.o...
[ "public", "HashMap", "<", "String", ",", "Object", ">", "getJsonToken", "(", ")", "throws", "Exception", "{", "HashMap", "<", "String", ",", "Object", ">", "obj", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "HashMap", "<", ...
Object representation of full JSON state. Usually you should use LoadJson and ToJson since they serialise directly to String for you. But it may be useful to get the object representation so that you can integrate it into your own serialisation system.
[ "Object", "representation", "of", "full", "JSON", "state", ".", "Usually", "you", "should", "use", "LoadJson", "and", "ToJson", "since", "they", "serialise", "directly", "to", "String", "for", "you", ".", "But", "it", "may", "be", "useful", "to", "get", "t...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L305-L347
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.pushToOutputStream
void pushToOutputStream(RTObject obj) { StringValue text = obj instanceof StringValue ? (StringValue) obj : null; if (text != null) { List<StringValue> listText = trySplittingHeadTailWhitespace(text); if (listText != null) { for (StringValue textObj : listText) { pushToOutputStreamIndividual(textObj...
java
void pushToOutputStream(RTObject obj) { StringValue text = obj instanceof StringValue ? (StringValue) obj : null; if (text != null) { List<StringValue> listText = trySplittingHeadTailWhitespace(text); if (listText != null) { for (StringValue textObj : listText) { pushToOutputStreamIndividual(textObj...
[ "void", "pushToOutputStream", "(", "RTObject", "obj", ")", "{", "StringValue", "text", "=", "obj", "instanceof", "StringValue", "?", "(", "StringValue", ")", "obj", ":", "null", ";", "if", "(", "text", "!=", "null", ")", "{", "List", "<", "StringValue", ...
in dealing with them later.
[ "in", "dealing", "with", "them", "later", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L542-L557
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.removeExistingGlue
void removeExistingGlue() { for (int i = outputStream.size() - 1; i >= 0; i--) { RTObject c = outputStream.get(i); if (c instanceof Glue) { outputStream.remove(i); } else if (c instanceof ControlCommand) { // e.g. // BeginString break; } } outputStreamDirty(); }
java
void removeExistingGlue() { for (int i = outputStream.size() - 1; i >= 0; i--) { RTObject c = outputStream.get(i); if (c instanceof Glue) { outputStream.remove(i); } else if (c instanceof ControlCommand) { // e.g. // BeginString break; } } outputStreamDirty(); }
[ "void", "removeExistingGlue", "(", ")", "{", "for", "(", "int", "i", "=", "outputStream", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "RTObject", "c", "=", "outputStream", ".", "get", "(", "i", ")", ";", "if"...
Only called when non-whitespace is appended
[ "Only", "called", "when", "non", "-", "whitespace", "is", "appended" ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L665-L677
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/StoryState.java
StoryState.trySplittingHeadTailWhitespace
List<StringValue> trySplittingHeadTailWhitespace(StringValue single) { String str = single.value; int headFirstNewlineIdx = -1; int headLastNewlineIdx = -1; for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); if (c == '\n') { if (headFirstNewlineIdx == -1) headFirstNewlineIdx = i; ...
java
List<StringValue> trySplittingHeadTailWhitespace(StringValue single) { String str = single.value; int headFirstNewlineIdx = -1; int headLastNewlineIdx = -1; for (int i = 0; i < str.length(); ++i) { char c = str.charAt(i); if (c == '\n') { if (headFirstNewlineIdx == -1) headFirstNewlineIdx = i; ...
[ "List", "<", "StringValue", ">", "trySplittingHeadTailWhitespace", "(", "StringValue", "single", ")", "{", "String", "str", "=", "single", ".", "value", ";", "int", "headFirstNewlineIdx", "=", "-", "1", ";", "int", "headLastNewlineIdx", "=", "-", "1", ";", "...
- A newline on its own is returned in an list for consistency.
[ "-", "A", "newline", "on", "its", "own", "is", "returned", "in", "an", "list", "for", "consistency", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/StoryState.java#L922-L990
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Profiler.java
Profiler.report
public String report() { StringBuilder sb = new StringBuilder(); sb.append(String.format("%d CONTINUES / LINES:\n", numContinues)); sb.append(String.format("TOTAL TIME: %s\n", formatMillisecs(continueTotal))); sb.append(String.format("SNAPSHOTTING: %s\n", formatMillisecs(snapTotal))); sb.append(String.format...
java
public String report() { StringBuilder sb = new StringBuilder(); sb.append(String.format("%d CONTINUES / LINES:\n", numContinues)); sb.append(String.format("TOTAL TIME: %s\n", formatMillisecs(continueTotal))); sb.append(String.format("SNAPSHOTTING: %s\n", formatMillisecs(snapTotal))); sb.append(String.format...
[ "public", "String", "report", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "String", ".", "format", "(", "\"%d CONTINUES / LINES:\\n\"", ",", "numContinues", ")", ")", ";", "sb", ".", "append",...
Generate a printable report based on the data recording during profiling.
[ "Generate", "a", "printable", "report", "based", "on", "the", "data", "recording", "during", "profiling", "." ]
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Profiler.java#L68-L78
train
bladecoder/blade-ink
src/main/java/com/bladecoder/ink/runtime/Profiler.java
Profiler.megalog
public String megalog() { StringBuilder sb = new StringBuilder(); sb.append("Step type\tDescription\tPath\tTime\n"); for (StepDetails step : stepDetails) { sb.append(step.type); sb.append("\t"); sb.append(step.obj.toString()); sb.append("\t"); sb.append(step.obj.getPath()); sb.append("\t"); ...
java
public String megalog() { StringBuilder sb = new StringBuilder(); sb.append("Step type\tDescription\tPath\tTime\n"); for (StepDetails step : stepDetails) { sb.append(step.type); sb.append("\t"); sb.append(step.obj.toString()); sb.append("\t"); sb.append(step.obj.getPath()); sb.append("\t"); ...
[ "public", "String", "megalog", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"Step type\\tDescription\\tPath\\tTime\\n\"", ")", ";", "for", "(", "StepDetails", "step", ":", "stepDetails", ")", "{"...
Create a large log of all the internal instructions that were evaluated while profiling was active. Log is in a tab-separated format, for easy loading into a spreadsheet application.
[ "Create", "a", "large", "log", "of", "all", "the", "internal", "instructions", "that", "were", "evaluated", "while", "profiling", "was", "active", ".", "Log", "is", "in", "a", "tab", "-", "separated", "format", "for", "easy", "loading", "into", "a", "sprea...
930922099f7073f50f956479adaa3cbd47c70225
https://github.com/bladecoder/blade-ink/blob/930922099f7073f50f956479adaa3cbd47c70225/src/main/java/com/bladecoder/ink/runtime/Profiler.java#L253-L270
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/AbstractCondition.java
AbstractCondition.awaitNanos
@Override public void awaitNanos(final long timeout) throws InterruptedException { long remaining = timeout; queueLock.lock(); try { while(test() && remaining > 0) { remaining = condition.awaitNanos(remaining); } } finally { ...
java
@Override public void awaitNanos(final long timeout) throws InterruptedException { long remaining = timeout; queueLock.lock(); try { while(test() && remaining > 0) { remaining = condition.awaitNanos(remaining); } } finally { ...
[ "@", "Override", "public", "void", "awaitNanos", "(", "final", "long", "timeout", ")", "throws", "InterruptedException", "{", "long", "remaining", "=", "timeout", ";", "queueLock", ".", "lock", "(", ")", ";", "try", "{", "while", "(", "test", "(", ")", "...
wake me when the condition is satisfied, or timeout
[ "wake", "me", "when", "the", "condition", "is", "satisfied", "or", "timeout" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/AbstractCondition.java#L37-L49
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/AbstractCondition.java
AbstractCondition.await
@Override public void await() throws InterruptedException { queueLock.lock(); try { while(test()) { condition.await(); } } finally { queueLock.unlock(); } }
java
@Override public void await() throws InterruptedException { queueLock.lock(); try { while(test()) { condition.await(); } } finally { queueLock.unlock(); } }
[ "@", "Override", "public", "void", "await", "(", ")", "throws", "InterruptedException", "{", "queueLock", ".", "lock", "(", ")", ";", "try", "{", "while", "(", "test", "(", ")", ")", "{", "condition", ".", "await", "(", ")", ";", "}", "}", "finally",...
wake if signal is called, or wait indefinitely
[ "wake", "if", "signal", "is", "called", "or", "wait", "indefinitely" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/AbstractCondition.java#L52-L63
train
conversant/disruptor
src/main/java/com/conversantmedia/util/collection/FixedStack.java
FixedStack.push
@Override public boolean push(final N n) { if(stackTop < size) { stack[(stackTop++) & mask] = n; return true; } return false; }
java
@Override public boolean push(final N n) { if(stackTop < size) { stack[(stackTop++) & mask] = n; return true; } return false; }
[ "@", "Override", "public", "boolean", "push", "(", "final", "N", "n", ")", "{", "if", "(", "stackTop", "<", "size", ")", "{", "stack", "[", "(", "stackTop", "++", ")", "&", "mask", "]", "=", "n", ";", "return", "true", ";", "}", "return", "false"...
add an element to the stack @param n - the element to add @return boolean - true if the operation succeeded
[ "add", "an", "element", "to", "the", "stack" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/collection/FixedStack.java#L67-L75
train
conversant/disruptor
src/main/java/com/conversantmedia/util/estimation/Percentile.java
Percentile.clear
public void clear() { for(int i=1; i<=2*m+3; i++) { n[i] = i+1; } f[1] = 0F; f[2*m+3] = 1F; for(int i=1; i<=m; i++) { f[2*i+1] = quantiles[i-1]; } for(int i=1; i<=m+1; i++) { f[2*i] = (f[2*i-1] + f[2*i+1])/2F; } ...
java
public void clear() { for(int i=1; i<=2*m+3; i++) { n[i] = i+1; } f[1] = 0F; f[2*m+3] = 1F; for(int i=1; i<=m; i++) { f[2*i+1] = quantiles[i-1]; } for(int i=1; i<=m+1; i++) { f[2*i] = (f[2*i-1] + f[2*i+1])/2F; } ...
[ "public", "void", "clear", "(", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "2", "*", "m", "+", "3", ";", "i", "++", ")", "{", "n", "[", "i", "]", "=", "i", "+", "1", ";", "}", "f", "[", "1", "]", "=", "0F", ";", "f"...
clear existing samples
[ "clear", "existing", "samples" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/estimation/Percentile.java#L76-L99
train
conversant/disruptor
src/main/java/com/conversantmedia/util/estimation/Percentile.java
Percentile.add
public void add(final float x) { if(isInitializing) { q[ni++] = x; if(ni == 2*m+3+1) { Arrays.sort(q); isInitializing=false; } } else { addMeasurement(x); } }
java
public void add(final float x) { if(isInitializing) { q[ni++] = x; if(ni == 2*m+3+1) { Arrays.sort(q); isInitializing=false; } } else { addMeasurement(x); } }
[ "public", "void", "add", "(", "final", "float", "x", ")", "{", "if", "(", "isInitializing", ")", "{", "q", "[", "ni", "++", "]", "=", "x", ";", "if", "(", "ni", "==", "2", "*", "m", "+", "3", "+", "1", ")", "{", "Arrays", ".", "sort", "(", ...
Add a measurement to estimate @param x - the value of the measurement
[ "Add", "a", "measurement", "to", "estimate" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/estimation/Percentile.java#L106-L117
train
conversant/disruptor
src/main/java/com/conversantmedia/util/estimation/Percentile.java
Percentile.getEstimates
public float[] getEstimates() throws InsufficientSamplesException { if(!isInitializing) { for (int i = 1; i <= m; i++) { e[i-1] = q[2*i+1]; } return e; } else { throw new InsufficientSamplesException(); } }
java
public float[] getEstimates() throws InsufficientSamplesException { if(!isInitializing) { for (int i = 1; i <= m; i++) { e[i-1] = q[2*i+1]; } return e; } else { throw new InsufficientSamplesException(); } }
[ "public", "float", "[", "]", "getEstimates", "(", ")", "throws", "InsufficientSamplesException", "{", "if", "(", "!", "isInitializing", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "m", ";", "i", "++", ")", "{", "e", "[", "i", "-", ...
get the estimates based on the last sample @return float[] @throws InsufficientSamplesException - if no estimate is currently available due to insufficient data
[ "get", "the", "estimates", "based", "on", "the", "last", "sample" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/estimation/Percentile.java#L151-L160
train
conversant/disruptor
src/main/java/com/conversantmedia/util/estimation/Percentile.java
Percentile.print
public static void print(final PrintStream out, final String name, final Percentile p) { if(p.isReady()) { try { final StringBuilder sb = new StringBuilder(512); final float[] q = p.getQuantiles(); final float[] e = p.getEstimates(); fi...
java
public static void print(final PrintStream out, final String name, final Percentile p) { if(p.isReady()) { try { final StringBuilder sb = new StringBuilder(512); final float[] q = p.getQuantiles(); final float[] e = p.getEstimates(); fi...
[ "public", "static", "void", "print", "(", "final", "PrintStream", "out", ",", "final", "String", "name", ",", "final", "Percentile", "p", ")", "{", "if", "(", "p", ".", "isReady", "(", ")", ")", "{", "try", "{", "final", "StringBuilder", "sb", "=", "...
print a nice histogram of percentiles @param out - output stream @param name - data set name @param p - percentile
[ "print", "a", "nice", "histogram", "of", "percentiles" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/estimation/Percentile.java#L241-L274
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java
ConcurrentStack.push
@Override public final boolean push(final N n) { int spin = 0; for(;;) { final long writeLock = seqLock.tryWriteLock(); if(writeLock>0L) { try { final int stackTop = this.stackTop.get(); if(size>stackTop) { ...
java
@Override public final boolean push(final N n) { int spin = 0; for(;;) { final long writeLock = seqLock.tryWriteLock(); if(writeLock>0L) { try { final int stackTop = this.stackTop.get(); if(size>stackTop) { ...
[ "@", "Override", "public", "final", "boolean", "push", "(", "final", "N", "n", ")", "{", "int", "spin", "=", "0", ";", "for", "(", ";", ";", ")", "{", "final", "long", "writeLock", "=", "seqLock", ".", "tryWriteLock", "(", ")", ";", "if", "(", "w...
add an element to the stack, failing if the stack is unable to grow @param n - the element to push @return boolean - false if stack overflow, true otherwise
[ "add", "an", "element", "to", "the", "stack", "failing", "if", "the", "stack", "is", "unable", "to", "grow" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java#L121-L148
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java
ConcurrentStack.peek
@Override public final N peek() { // read the current cursor int spin = 0; for(;;) { final long readLock = seqLock.readLock(); final int stackTop = this.stackTop.get(); if(stackTop > 0) { final N n = stack.get(stackTop-1); ...
java
@Override public final N peek() { // read the current cursor int spin = 0; for(;;) { final long readLock = seqLock.readLock(); final int stackTop = this.stackTop.get(); if(stackTop > 0) { final N n = stack.get(stackTop-1); ...
[ "@", "Override", "public", "final", "N", "peek", "(", ")", "{", "// read the current cursor", "int", "spin", "=", "0", ";", "for", "(", ";", ";", ")", "{", "final", "long", "readLock", "=", "seqLock", ".", "readLock", "(", ")", ";", "final", "int", "...
peek at the top of the stack @return N - the object at the top of the stack
[ "peek", "at", "the", "top", "of", "the", "stack" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java#L155-L173
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java
ConcurrentStack.clear
@Override public final void clear() { int spin = 0; for(;;) { final long writeLock = seqLock.tryWriteLock(); if(writeLock > 0L) { final int stackTop = this.stackTop.get(); if(stackTop>0) { try { for(i...
java
@Override public final void clear() { int spin = 0; for(;;) { final long writeLock = seqLock.tryWriteLock(); if(writeLock > 0L) { final int stackTop = this.stackTop.get(); if(stackTop>0) { try { for(i...
[ "@", "Override", "public", "final", "void", "clear", "(", ")", "{", "int", "spin", "=", "0", ";", "for", "(", ";", ";", ")", "{", "final", "long", "writeLock", "=", "seqLock", ".", "tryWriteLock", "(", ")", ";", "if", "(", "writeLock", ">", "0L", ...
clear the stack - does not null old references
[ "clear", "the", "stack", "-", "does", "not", "null", "old", "references" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/ConcurrentStack.java#L274-L298
train
conversant/disruptor
src/main/java/com/conversantmedia/util/concurrent/Capacity.java
Capacity.getCapacity
public static int getCapacity(int capacity) { int c = 1; if(capacity >= MAX_POWER2) { c = MAX_POWER2; } else { while(c < capacity) c <<= 1; } if(isPowerOf2(c)) { return c; } else { throw new RuntimeException("Capacity is no...
java
public static int getCapacity(int capacity) { int c = 1; if(capacity >= MAX_POWER2) { c = MAX_POWER2; } else { while(c < capacity) c <<= 1; } if(isPowerOf2(c)) { return c; } else { throw new RuntimeException("Capacity is no...
[ "public", "static", "int", "getCapacity", "(", "int", "capacity", ")", "{", "int", "c", "=", "1", ";", "if", "(", "capacity", ">=", "MAX_POWER2", ")", "{", "c", "=", "MAX_POWER2", ";", "}", "else", "{", "while", "(", "c", "<", "capacity", ")", "c",...
return the next power of two after @param capacity or capacity if it is already
[ "return", "the", "next", "power", "of", "two", "after" ]
3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25
https://github.com/conversant/disruptor/blob/3bd90c09dfff9ae5592fbefd6e5d675ed5ac8b25/src/main/java/com/conversantmedia/util/concurrent/Capacity.java#L35-L48
train
drtrang/Copiers
src/main/java/com/github/trang/copiers/util/ClassUtil.java
ClassUtil.getPrimitiveType
public static Class<?> getPrimitiveType(Class<?> wrapperType) { if (Boolean.class.equals(wrapperType)) { return Boolean.TYPE; } else if (Byte.class.equals(wrapperType)) { return Byte.TYPE; } else if (Character.class.equals(wrapperType)) { return Character.TYPE...
java
public static Class<?> getPrimitiveType(Class<?> wrapperType) { if (Boolean.class.equals(wrapperType)) { return Boolean.TYPE; } else if (Byte.class.equals(wrapperType)) { return Byte.TYPE; } else if (Character.class.equals(wrapperType)) { return Character.TYPE...
[ "public", "static", "Class", "<", "?", ">", "getPrimitiveType", "(", "Class", "<", "?", ">", "wrapperType", ")", "{", "if", "(", "Boolean", ".", "class", ".", "equals", "(", "wrapperType", ")", ")", "{", "return", "Boolean", ".", "TYPE", ";", "}", "e...
Returns the corresponding primitive type for the given primitive wrapper, or null if the type is not a primitive wrapper. @param wrapperType wrapperType @return the corresponding primitive type
[ "Returns", "the", "corresponding", "primitive", "type", "for", "the", "given", "primitive", "wrapper", "or", "null", "if", "the", "type", "is", "not", "a", "primitive", "wrapper", "." ]
775b2bc702d2df74c4ef3d3c9d7563aedc8e660b
https://github.com/drtrang/Copiers/blob/775b2bc702d2df74c4ef3d3c9d7563aedc8e660b/src/main/java/com/github/trang/copiers/util/ClassUtil.java#L71-L91
train
calimero-project/calimero-core
src/tuwien/auto/calimero/xml/XmlResolver.java
XmlResolver.getEncodingName
private static String getEncodingName(final InputStream is, final byte[] start, final int count) { // '<' = 0x3c, '?' = 0x3f final int b0 = start[0] & 0xFF; final int b1 = start[1] & 0xFF; final int b2 = start[2] & 0xFF; // check BOM if (count > 1) { // UTF-16, big-endian if (b0 == 0xFE && b1 == 0xFF...
java
private static String getEncodingName(final InputStream is, final byte[] start, final int count) { // '<' = 0x3c, '?' = 0x3f final int b0 = start[0] & 0xFF; final int b1 = start[1] & 0xFF; final int b2 = start[2] & 0xFF; // check BOM if (count > 1) { // UTF-16, big-endian if (b0 == 0xFE && b1 == 0xFF...
[ "private", "static", "String", "getEncodingName", "(", "final", "InputStream", "is", ",", "final", "byte", "[", "]", "start", ",", "final", "int", "count", ")", "{", "// '<' = 0x3c, '?' = 0x3f", "final", "int", "b0", "=", "start", "[", "0", "]", "&", "0xFF...
the detection is done equally to the one in xerces parser
[ "the", "detection", "is", "done", "equally", "to", "the", "one", "in", "xerces", "parser" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/xml/XmlResolver.java#L157-L201
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java
ManagementClientImpl.restart
private int restart(final boolean basic, final Destination dst, final int eraseCode, final int channel) throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException, KNXDisconnectException, InterruptedException { int time = 0; if (basic) { send(dst, priority, DataUnitBuilder.createLengthOptimizedA...
java
private int restart(final boolean basic, final Destination dst, final int eraseCode, final int channel) throws KNXTimeoutException, KNXRemoteException, KNXLinkClosedException, KNXDisconnectException, InterruptedException { int time = 0; if (basic) { send(dst, priority, DataUnitBuilder.createLengthOptimizedA...
[ "private", "int", "restart", "(", "final", "boolean", "basic", ",", "final", "Destination", "dst", ",", "final", "int", "eraseCode", ",", "final", "int", "channel", ")", "throws", "KNXTimeoutException", ",", "KNXRemoteException", ",", "KNXLinkClosedException", ","...
for erase codes 1,3,4 the channel should be 0
[ "for", "erase", "codes", "1", "3", "4", "the", "channel", "should", "be", "0" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L557-L610
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java
ManagementClientImpl.readProperty2
List<byte[]> readProperty2(final Destination dst, final int objIndex, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException, InterruptedException { return readProperty(dst, objIndex, propertyId, start, elements, f...
java
List<byte[]> readProperty2(final Destination dst, final int objIndex, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXDisconnectException, KNXLinkClosedException, InterruptedException { return readProperty(dst, objIndex, propertyId, start, elements, f...
[ "List", "<", "byte", "[", "]", ">", "readProperty2", "(", "final", "Destination", "dst", ",", "final", "int", "objIndex", ",", "final", "int", "propertyId", ",", "final", "int", "start", ",", "final", "int", "elements", ")", "throws", "KNXTimeoutException", ...
as readProperty, but collects all responses until response timeout is reached
[ "as", "readProperty", "but", "collects", "all", "responses", "until", "response", "timeout", "is", "reached" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L624-L629
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java
ManagementClientImpl.send
private void send(final Destination d, final Priority p, final byte[] apdu, final int response) throws KNXTimeoutException, KNXDisconnectException, KNXLinkClosedException { svcResponse = response; if (d.isConnectionOriented()) { tl.connect(d); tl.sendData(d, p, apdu); } else tl.sendData(d.getAddress...
java
private void send(final Destination d, final Priority p, final byte[] apdu, final int response) throws KNXTimeoutException, KNXDisconnectException, KNXLinkClosedException { svcResponse = response; if (d.isConnectionOriented()) { tl.connect(d); tl.sendData(d, p, apdu); } else tl.sendData(d.getAddress...
[ "private", "void", "send", "(", "final", "Destination", "d", ",", "final", "Priority", "p", ",", "final", "byte", "[", "]", "apdu", ",", "final", "int", "response", ")", "throws", "KNXTimeoutException", ",", "KNXDisconnectException", ",", "KNXLinkClosedException...
helper which sets the expected svc response, and sends in CO or CL mode
[ "helper", "which", "sets", "the", "expected", "svc", "response", "and", "sends", "in", "CO", "or", "CL", "mode" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L933-L943
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java
ManagementClientImpl.extractPropertyElements
private static byte[] extractPropertyElements(final byte[] apdu, final int objIndex, final int propertyId, final int elements) throws KNXRemoteException { final int oi = apdu[2] & 0xff; final int pid = apdu[3] & 0xff; if (oi != objIndex || pid != propertyId) throw new KNXInvalidResponseException( Strin...
java
private static byte[] extractPropertyElements(final byte[] apdu, final int objIndex, final int propertyId, final int elements) throws KNXRemoteException { final int oi = apdu[2] & 0xff; final int pid = apdu[3] & 0xff; if (oi != objIndex || pid != propertyId) throw new KNXInvalidResponseException( Strin...
[ "private", "static", "byte", "[", "]", "extractPropertyElements", "(", "final", "byte", "[", "]", "apdu", ",", "final", "int", "objIndex", ",", "final", "int", "propertyId", ",", "final", "int", "elements", ")", "throws", "KNXRemoteException", "{", "final", ...
returns property read.res element values
[ "returns", "property", "read", ".", "res", "element", "values" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementClientImpl.java#L1137-L1157
train
calimero-project/calimero-core
src/tuwien/auto/calimero/link/KNXNetworkLinkTpuart.java
KNXNetworkLinkTpuart.ensureDeviceAck
private static Collection<? extends KNXAddress> ensureDeviceAck(final KNXMediumSettings settings, final Collection<? extends KNXAddress> acknowledge) { if (settings.getMedium() != KNXMediumSettings.MEDIUM_TP1) throw new KNXIllegalArgumentException("TP-UART link supports only TP1 medium"); // see if we have a ...
java
private static Collection<? extends KNXAddress> ensureDeviceAck(final KNXMediumSettings settings, final Collection<? extends KNXAddress> acknowledge) { if (settings.getMedium() != KNXMediumSettings.MEDIUM_TP1) throw new KNXIllegalArgumentException("TP-UART link supports only TP1 medium"); // see if we have a ...
[ "private", "static", "Collection", "<", "?", "extends", "KNXAddress", ">", "ensureDeviceAck", "(", "final", "KNXMediumSettings", "settings", ",", "final", "Collection", "<", "?", "extends", "KNXAddress", ">", "acknowledge", ")", "{", "if", "(", "settings", ".", ...
if possible, add this link to the list of addresses to acknowledge
[ "if", "possible", "add", "this", "link", "to", "the", "list", "of", "addresses", "to", "acknowledge" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkTpuart.java#L144-L157
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/LocalDeviceManagementUsb.java
LocalDeviceManagementUsb.setProperty
public void setProperty(final int objectType, final int objectInstance, final int propertyId, final int start, final int elements, final byte... data) throws KNXTimeoutException, KNXRemoteException, KNXPortClosedException, InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt(CEMIDevMgmt.MC_PROPWRITE_RE...
java
public void setProperty(final int objectType, final int objectInstance, final int propertyId, final int start, final int elements, final byte... data) throws KNXTimeoutException, KNXRemoteException, KNXPortClosedException, InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt(CEMIDevMgmt.MC_PROPWRITE_RE...
[ "public", "void", "setProperty", "(", "final", "int", "objectType", ",", "final", "int", "objectInstance", ",", "final", "int", "propertyId", ",", "final", "int", "start", ",", "final", "int", "elements", ",", "final", "byte", "...", "data", ")", "throws", ...
Sets property value elements of an interface object property. @param objectType the interface object type @param objectInstance the interface object instance (usually 1) @param propertyId the property identifier (PID) @param start start index in the property value to start writing to @param elements number of elements...
[ "Sets", "property", "value", "elements", "of", "an", "interface", "object", "property", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/LocalDeviceManagementUsb.java#L122-L130
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/LocalDeviceManagementUsb.java
LocalDeviceManagementUsb.getProperty
public byte[] getProperty(final int objectType, final int objectInstance, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXPortClosedException, InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt(CEMIDevMgmt.MC_PROPREAD_REQ, objectType, obje...
java
public byte[] getProperty(final int objectType, final int objectInstance, final int propertyId, final int start, final int elements) throws KNXTimeoutException, KNXRemoteException, KNXPortClosedException, InterruptedException { final CEMIDevMgmt req = new CEMIDevMgmt(CEMIDevMgmt.MC_PROPREAD_REQ, objectType, obje...
[ "public", "byte", "[", "]", "getProperty", "(", "final", "int", "objectType", ",", "final", "int", "objectInstance", ",", "final", "int", "propertyId", ",", "final", "int", "start", ",", "final", "int", "elements", ")", "throws", "KNXTimeoutException", ",", ...
Gets property value elements of an interface object property. @param objectType the interface object type @param objectInstance the interface object instance (usually 1) @param propertyId the property identifier (PID) @param start start index in the property value to start writing to @param elements number of elements...
[ "Gets", "property", "value", "elements", "of", "an", "interface", "object", "property", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/LocalDeviceManagementUsb.java#L146-L154
train
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/ClientConnection.java
ClientConnection.onSameSubnet
private Optional<InetAddress> onSameSubnet(final InetAddress remote) { try { return Collections.list(NetworkInterface.getNetworkInterfaces()).stream() .flatMap(ni -> ni.getInterfaceAddresses().stream()) .filter(ia -> ia.getAddress() instanceof Inet4Address) .peek(ia -> logger.trace("match local add...
java
private Optional<InetAddress> onSameSubnet(final InetAddress remote) { try { return Collections.list(NetworkInterface.getNetworkInterfaces()).stream() .flatMap(ni -> ni.getInterfaceAddresses().stream()) .filter(ia -> ia.getAddress() instanceof Inet4Address) .peek(ia -> logger.trace("match local add...
[ "private", "Optional", "<", "InetAddress", ">", "onSameSubnet", "(", "final", "InetAddress", "remote", ")", "{", "try", "{", "return", "Collections", ".", "list", "(", "NetworkInterface", ".", "getNetworkInterfaces", "(", ")", ")", ".", "stream", "(", ")", "...
finds a local IPv4 address with its network prefix "matching" the remote address
[ "finds", "a", "local", "IPv4", "address", "with", "its", "network", "prefix", "matching", "the", "remote", "address" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/ClientConnection.java#L402-L415
train
calimero-project/calimero-core
src/tuwien/auto/calimero/mgmt/ManagementProceduresImpl.java
ManagementProceduresImpl.getOrCreateDestination
private Destination getOrCreateDestination(final IndividualAddress device, final boolean keepAlive, final boolean verifyByServer) { final Destination d = ((TransportLayerImpl) tl).getDestination(device); return d != null ? d : tl.createDestination(device, true, keepAlive, verifyByServer); }
java
private Destination getOrCreateDestination(final IndividualAddress device, final boolean keepAlive, final boolean verifyByServer) { final Destination d = ((TransportLayerImpl) tl).getDestination(device); return d != null ? d : tl.createDestination(device, true, keepAlive, verifyByServer); }
[ "private", "Destination", "getOrCreateDestination", "(", "final", "IndividualAddress", "device", ",", "final", "boolean", "keepAlive", ",", "final", "boolean", "verifyByServer", ")", "{", "final", "Destination", "d", "=", "(", "(", "TransportLayerImpl", ")", "tl", ...
work around for implementation in TL, which unconditionally throws if dst exists
[ "work", "around", "for", "implementation", "in", "TL", "which", "unconditionally", "throws", "if", "dst", "exists" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/ManagementProceduresImpl.java#L546-L551
train
calimero-project/calimero-core
src/tuwien/auto/calimero/serial/TpuartConnection.java
TpuartConnection.activateBusmonitor
public void activateBusmonitor() throws IOException { logger.debug("activate TP-UART busmonitor"); os.write(ActivateBusmon); busmonSequence = 0; busmon = true; }
java
public void activateBusmonitor() throws IOException { logger.debug("activate TP-UART busmonitor"); os.write(ActivateBusmon); busmonSequence = 0; busmon = true; }
[ "public", "void", "activateBusmonitor", "(", ")", "throws", "IOException", "{", "logger", ".", "debug", "(", "\"activate TP-UART busmonitor\"", ")", ";", "os", ".", "write", "(", "ActivateBusmon", ")", ";", "busmonSequence", "=", "0", ";", "busmon", "=", "true...
Activate busmonitor mode, the TP-UART controller is set completely passive. @throws IOException on I/O error
[ "Activate", "busmonitor", "mode", "the", "TP", "-", "UART", "controller", "is", "set", "completely", "passive", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/TpuartConnection.java#L217-L223
train
calimero-project/calimero-core
src/tuwien/auto/calimero/serial/TpuartConnection.java
TpuartConnection.cEmiToTP1
private static byte[] cEmiToTP1(final byte[] frame) { // set frame type to std/ext final int stdMaxApdu = 15; final int cEmiPrefix = 10; final boolean std = frame.length <= cEmiPrefix + stdMaxApdu; final byte[] tp1; if (std) { tp1 = new byte[frame.length - 2]; int i = 0; // set upper 6 bits of ct...
java
private static byte[] cEmiToTP1(final byte[] frame) { // set frame type to std/ext final int stdMaxApdu = 15; final int cEmiPrefix = 10; final boolean std = frame.length <= cEmiPrefix + stdMaxApdu; final byte[] tp1; if (std) { tp1 = new byte[frame.length - 2]; int i = 0; // set upper 6 bits of ct...
[ "private", "static", "byte", "[", "]", "cEmiToTP1", "(", "final", "byte", "[", "]", "frame", ")", "{", "// set frame type to std/ext", "final", "int", "stdMaxApdu", "=", "15", ";", "final", "int", "cEmiPrefix", "=", "10", ";", "final", "boolean", "std", "=...
returns a TP1 std or ext frame
[ "returns", "a", "TP1", "std", "or", "ext", "frame" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/TpuartConnection.java#L338-L378
train
calimero-project/calimero-core
src/tuwien/auto/calimero/serial/usb/HidReport.java
HidReport.createFeatureService
public static HidReport createFeatureService(final BusAccessServerService service, final BusAccessServerFeature feature, final byte[] frame) { return new HidReport(service, feature, frame); }
java
public static HidReport createFeatureService(final BusAccessServerService service, final BusAccessServerFeature feature, final byte[] frame) { return new HidReport(service, feature, frame); }
[ "public", "static", "HidReport", "createFeatureService", "(", "final", "BusAccessServerService", "service", ",", "final", "BusAccessServerFeature", "feature", ",", "final", "byte", "[", "]", "frame", ")", "{", "return", "new", "HidReport", "(", "service", ",", "fe...
Creates a new report for use with the Bus Access Server feature service. @param service Bus Access Server service @param feature feature ID @param frame feature protocol data @return the created HID report
[ "Creates", "a", "new", "report", "for", "use", "with", "the", "Bus", "Access", "Server", "feature", "service", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/usb/HidReport.java#L126-L130
train
calimero-project/calimero-core
src/tuwien/auto/calimero/serial/usb/HidReport.java
HidReport.create
public static List<HidReport> create(final KnxTunnelEmi emi, final byte[] frame) { final List<HidReport> l = new ArrayList<>(); final EnumSet<PacketType> packetType = EnumSet.of(PacketType.Start); int maxData = maxDataStartPacket; if (frame.length > maxData) packetType.add(PacketType.Partial); int offset ...
java
public static List<HidReport> create(final KnxTunnelEmi emi, final byte[] frame) { final List<HidReport> l = new ArrayList<>(); final EnumSet<PacketType> packetType = EnumSet.of(PacketType.Start); int maxData = maxDataStartPacket; if (frame.length > maxData) packetType.add(PacketType.Partial); int offset ...
[ "public", "static", "List", "<", "HidReport", ">", "create", "(", "final", "KnxTunnelEmi", "emi", ",", "final", "byte", "[", "]", "frame", ")", "{", "final", "List", "<", "HidReport", ">", "l", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "...
Creates a new report containing an EMI frame. @param emi EMI type @param frame the EMI message as byte array @return the created HID report
[ "Creates", "a", "new", "report", "containing", "an", "EMI", "frame", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/usb/HidReport.java#L139-L160
train
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java
KNXnetIPTunnel.unifyLData
private byte[] unifyLData(final CEMI ldata, final boolean emptySrc, final List<Integer> types) { final byte[] data; if (ldata instanceof CEMILDataEx) { final CEMILDataEx ext = ((CEMILDataEx) ldata); final List<AddInfo> additionalInfo = ext.additionalInfo(); synchronized (additionalInfo) { for (final I...
java
private byte[] unifyLData(final CEMI ldata, final boolean emptySrc, final List<Integer> types) { final byte[] data; if (ldata instanceof CEMILDataEx) { final CEMILDataEx ext = ((CEMILDataEx) ldata); final List<AddInfo> additionalInfo = ext.additionalInfo(); synchronized (additionalInfo) { for (final I...
[ "private", "byte", "[", "]", "unifyLData", "(", "final", "CEMI", "ldata", ",", "final", "boolean", "emptySrc", ",", "final", "List", "<", "Integer", ">", "types", ")", "{", "final", "byte", "[", "]", "data", ";", "if", "(", "ldata", "instanceof", "CEMI...
additional info. types provides the list of add.info types we want to keep, everything else is removed
[ "additional", "info", ".", "types", "provides", "the", "list", "of", "add", ".", "info", "types", "we", "want", "to", "keep", "everything", "else", "is", "removed" ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/KNXnetIPTunnel.java#L410-L437
train
calimero-project/calimero-core
src/tuwien/auto/calimero/serial/LibraryAdapter.java
LibraryAdapter.open
public static LibraryAdapter open(final Logger logger, final String portId, final int baudrate, final int idleTimeout) throws KNXException { Throwable t = null; // check for Java ME Embedded platform and available serial communication port, // protocol support for communication ports is optional if (CommConn...
java
public static LibraryAdapter open(final Logger logger, final String portId, final int baudrate, final int idleTimeout) throws KNXException { Throwable t = null; // check for Java ME Embedded platform and available serial communication port, // protocol support for communication ports is optional if (CommConn...
[ "public", "static", "LibraryAdapter", "open", "(", "final", "Logger", "logger", ",", "final", "String", "portId", ",", "final", "int", "baudrate", ",", "final", "int", "idleTimeout", ")", "throws", "KNXException", "{", "Throwable", "t", "=", "null", ";", "//...
Factory method to open a serial connection using one of the available library adapters. @param logger logger @param portId serial port identifier @param baudrate baudrate @param idleTimeout idle timeout in milliseconds @return adapter to access serial communication port, port resource is in open state @throws KNXExcep...
[ "Factory", "method", "to", "open", "a", "serial", "connection", "using", "one", "of", "the", "available", "library", "adapters", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/serial/LibraryAdapter.java#L119-L180
train
calimero-project/calimero-core
src/tuwien/auto/calimero/cemi/CEMILData.java
CEMILData.setRepeat
private void setRepeat(final boolean repeat) { final boolean flag = mc == MC_LDATA_IND ? !repeat : repeat; if (flag) ctrl1 |= 0x20; else ctrl1 &= 0xDF; }
java
private void setRepeat(final boolean repeat) { final boolean flag = mc == MC_LDATA_IND ? !repeat : repeat; if (flag) ctrl1 |= 0x20; else ctrl1 &= 0xDF; }
[ "private", "void", "setRepeat", "(", "final", "boolean", "repeat", ")", "{", "final", "boolean", "flag", "=", "mc", "==", "MC_LDATA_IND", "?", "!", "repeat", ":", "repeat", ";", "if", "(", "flag", ")", "ctrl1", "|=", "0x20", ";", "else", "ctrl1", "&=",...
Sets the repeat flag in control field, using the message code type for decision. @param repeat <code>true</code> for a repeat request or repeated frame, <code>false</code> otherwise
[ "Sets", "the", "repeat", "flag", "in", "control", "field", "using", "the", "message", "code", "type", "for", "decision", "." ]
7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/cemi/CEMILData.java#L596-L603
train