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
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/AbstractStoreResource.java
AbstractStoreResource.getGeneralID
private void getGeneralID(final String _complStmt) throws EFapsException { ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); while (rs.next()) { this.generalID = rs.getLong(1); this.fileName = rs.getString(2); if (this.fileName != null && !this.fileName.isEmpty()) { this.fileName = this.fileName.trim(); } this.fileLength = rs.getLong(3); for (int i = 0; i < this.exist.length; i++) { this.exist[i] = rs.getLong(4 + i) > 0; } getAdditionalInfo(rs); } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e); } }
java
private void getGeneralID(final String _complStmt) throws EFapsException { ConnectionResource con = null; try { con = Context.getThreadContext().getConnectionResource(); final Statement stmt = con.createStatement(); final ResultSet rs = stmt.executeQuery(_complStmt.toString()); while (rs.next()) { this.generalID = rs.getLong(1); this.fileName = rs.getString(2); if (this.fileName != null && !this.fileName.isEmpty()) { this.fileName = this.fileName.trim(); } this.fileLength = rs.getLong(3); for (int i = 0; i < this.exist.length; i++) { this.exist[i] = rs.getLong(4 + i) > 0; } getAdditionalInfo(rs); } rs.close(); stmt.close(); } catch (final SQLException e) { throw new EFapsException(InstanceQuery.class, "executeOneCompleteStmt", e); } }
[ "private", "void", "getGeneralID", "(", "final", "String", "_complStmt", ")", "throws", "EFapsException", "{", "ConnectionResource", "con", "=", "null", ";", "try", "{", "con", "=", "Context", ".", "getThreadContext", "(", ")", ".", "getConnectionResource", "(",...
Get the generalID etc. from the eFasp DataBase. @param _complStmt Statement to be executed @throws EFapsException on error
[ "Get", "the", "generalID", "etc", ".", "from", "the", "eFasp", "DataBase", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L305-L333
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/AbstractStoreResource.java
AbstractStoreResource.getCompress
protected Compress getCompress() { final Compress compress; if (this.store.getResourceProperties().containsKey(Store.PROPERTY_COMPRESS)) { compress = Compress.valueOf(this.store.getResourceProperties().get(Store.PROPERTY_COMPRESS).toUpperCase()); } else { compress = Compress.NONE; } return compress; }
java
protected Compress getCompress() { final Compress compress; if (this.store.getResourceProperties().containsKey(Store.PROPERTY_COMPRESS)) { compress = Compress.valueOf(this.store.getResourceProperties().get(Store.PROPERTY_COMPRESS).toUpperCase()); } else { compress = Compress.NONE; } return compress; }
[ "protected", "Compress", "getCompress", "(", ")", "{", "final", "Compress", "compress", ";", "if", "(", "this", ".", "store", ".", "getResourceProperties", "(", ")", ".", "containsKey", "(", "Store", ".", "PROPERTY_COMPRESS", ")", ")", "{", "compress", "=", ...
Is this Store resource compressed. @return Is this Store resource compressed
[ "Is", "this", "Store", "resource", "compressed", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L378-L387
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/index/Queue.java
Queue.registerUpdate
public static void registerUpdate(final Instance _instance) throws EFapsException { // check if SystemConfiguration exists, necessary during install if (EFapsSystemConfiguration.get() != null && EFapsSystemConfiguration.get().getAttributeValueAsBoolean(KernelSettings.INDEXACTIVATE)) { if (_instance != null && _instance.getType() != null && IndexDefinition.get(_instance.getType().getUUID()) != null) { final AdvancedCache<String, String> cache = InfinispanCache.get() .<String, String>getIgnReCache(CACHENAME); cache.put(RandomUtil.random(12), _instance.getOid()); } } }
java
public static void registerUpdate(final Instance _instance) throws EFapsException { // check if SystemConfiguration exists, necessary during install if (EFapsSystemConfiguration.get() != null && EFapsSystemConfiguration.get().getAttributeValueAsBoolean(KernelSettings.INDEXACTIVATE)) { if (_instance != null && _instance.getType() != null && IndexDefinition.get(_instance.getType().getUUID()) != null) { final AdvancedCache<String, String> cache = InfinispanCache.get() .<String, String>getIgnReCache(CACHENAME); cache.put(RandomUtil.random(12), _instance.getOid()); } } }
[ "public", "static", "void", "registerUpdate", "(", "final", "Instance", "_instance", ")", "throws", "EFapsException", "{", "// check if SystemConfiguration exists, necessary during install", "if", "(", "EFapsSystemConfiguration", ".", "get", "(", ")", "!=", "null", "&&", ...
Register update. @param _instance the _instance @throws EFapsException the e faps exception
[ "Register", "update", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/index/Queue.java#L54-L67
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/AbstractDataModelObject.java
AbstractDataModelObject.initialize
public static void initialize() throws CacheReloadException { Context.getDbType().initialize(AbstractDataModelObject.class); AttributeType.initialize(AbstractDataModelObject.class); SQLTable.initialize(AbstractDataModelObject.class); Type.initialize(AbstractDataModelObject.class); Dimension.initialize(AbstractDataModelObject.class); Attribute.initialize(AbstractDataModelObject.class); Status.initialize(AbstractDataModelObject.class); }
java
public static void initialize() throws CacheReloadException { Context.getDbType().initialize(AbstractDataModelObject.class); AttributeType.initialize(AbstractDataModelObject.class); SQLTable.initialize(AbstractDataModelObject.class); Type.initialize(AbstractDataModelObject.class); Dimension.initialize(AbstractDataModelObject.class); Attribute.initialize(AbstractDataModelObject.class); Status.initialize(AbstractDataModelObject.class); }
[ "public", "static", "void", "initialize", "(", ")", "throws", "CacheReloadException", "{", "Context", ".", "getDbType", "(", ")", ".", "initialize", "(", "AbstractDataModelObject", ".", "class", ")", ";", "AttributeType", ".", "initialize", "(", "AbstractDataModel...
Initialize the cache of all data model objects. @throws CacheReloadException if cache could not be initialized
[ "Initialize", "the", "cache", "of", "all", "data", "model", "objects", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/AbstractDataModelObject.java#L55-L65
train
navnorth/LRJavaLib
src/com/navnorth/learningregistry/util/StringUtil.java
StringUtil.nullifyBadInput
public static String nullifyBadInput(String input) { if (input != null) { if (input.matches(emptyRegex)) { return null; } return input.trim(); } return null; }
java
public static String nullifyBadInput(String input) { if (input != null) { if (input.matches(emptyRegex)) { return null; } return input.trim(); } return null; }
[ "public", "static", "String", "nullifyBadInput", "(", "String", "input", ")", "{", "if", "(", "input", "!=", "null", ")", "{", "if", "(", "input", ".", "matches", "(", "emptyRegex", ")", ")", "{", "return", "null", ";", "}", "return", "input", ".", "...
Returns a valid string or null, if empty @param input original string @return resultant string
[ "Returns", "a", "valid", "string", "or", "null", "if", "empty" ]
27af28b9f80d772273592414e7d0dccffaac09e1
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/util/StringUtil.java#L56-L67
train
navnorth/LRJavaLib
src/com/navnorth/learningregistry/util/StringUtil.java
StringUtil.nullifyBadInput
public static String[] nullifyBadInput(String[] input) { if (input != null) { if (input.length > 0) { return input; } } return null; }
java
public static String[] nullifyBadInput(String[] input) { if (input != null) { if (input.length > 0) { return input; } } return null; }
[ "public", "static", "String", "[", "]", "nullifyBadInput", "(", "String", "[", "]", "input", ")", "{", "if", "(", "input", "!=", "null", ")", "{", "if", "(", "input", ".", "length", ">", "0", ")", "{", "return", "input", ";", "}", "}", "return", ...
Returns a valid string array or null, if empty @param input original string array @return resultant string array
[ "Returns", "a", "valid", "string", "array", "or", "null", "if", "empty" ]
27af28b9f80d772273592414e7d0dccffaac09e1
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/util/StringUtil.java#L75-L85
train
navnorth/LRJavaLib
src/com/navnorth/learningregistry/util/StringUtil.java
StringUtil.removeDuplicates
public static String[] removeDuplicates(String[] input) { if (input != null) { if (input.length > 0) { Set<String> inputSet = new HashSet<String>(Arrays.asList(input)); if (inputSet.size() > 0) { return inputSet.toArray(new String[inputSet.size()]); } } } return null; }
java
public static String[] removeDuplicates(String[] input) { if (input != null) { if (input.length > 0) { Set<String> inputSet = new HashSet<String>(Arrays.asList(input)); if (inputSet.size() > 0) { return inputSet.toArray(new String[inputSet.size()]); } } } return null; }
[ "public", "static", "String", "[", "]", "removeDuplicates", "(", "String", "[", "]", "input", ")", "{", "if", "(", "input", "!=", "null", ")", "{", "if", "(", "input", ".", "length", ">", "0", ")", "{", "Set", "<", "String", ">", "inputSet", "=", ...
Returns a valid string array without dulicates or null, if empty @param input original string array @return resultant string array
[ "Returns", "a", "valid", "string", "array", "without", "dulicates", "or", "null", "if", "empty" ]
27af28b9f80d772273592414e7d0dccffaac09e1
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/util/StringUtil.java#L93-L107
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/UserAttributesSet.java
UserAttributesSet.getString
public String getString(final String _key) { String ret = null; if (this.attributes.containsKey(_key)) { ret = this.attributes.get(_key).getValue(); } return ret; }
java
public String getString(final String _key) { String ret = null; if (this.attributes.containsKey(_key)) { ret = this.attributes.get(_key).getValue(); } return ret; }
[ "public", "String", "getString", "(", "final", "String", "_key", ")", "{", "String", "ret", "=", "null", ";", "if", "(", "this", ".", "attributes", ".", "containsKey", "(", "_key", ")", ")", "{", "ret", "=", "this", ".", "attributes", ".", "get", "("...
Returns the value for a key as a String. @param _key key for the searched value @return string of the value if exist; otherwise <code>null</code>
[ "Returns", "the", "value", "for", "a", "key", "as", "a", "String", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/UserAttributesSet.java#L188-L195
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/UserAttributesSet.java
UserAttributesSet.set
public void set(final String _key, final String _value, final UserAttributesDefinition _definition) throws EFapsException { if (_key == null || _value == null) { throw new EFapsException(this.getClass(), "set", _key, _value, _definition); } else { final UserAttribute userattribute = this.attributes.get(_key); if (userattribute == null) { this.attributes.put(_key, new UserAttribute(_definition.name, _value.trim(), true)); } else if (!userattribute.getValue().equals(_value.trim())) { userattribute.setUpdate(true); userattribute.setValue(_value.trim()); } } }
java
public void set(final String _key, final String _value, final UserAttributesDefinition _definition) throws EFapsException { if (_key == null || _value == null) { throw new EFapsException(this.getClass(), "set", _key, _value, _definition); } else { final UserAttribute userattribute = this.attributes.get(_key); if (userattribute == null) { this.attributes.put(_key, new UserAttribute(_definition.name, _value.trim(), true)); } else if (!userattribute.getValue().equals(_value.trim())) { userattribute.setUpdate(true); userattribute.setValue(_value.trim()); } } }
[ "public", "void", "set", "(", "final", "String", "_key", ",", "final", "String", "_value", ",", "final", "UserAttributesDefinition", "_definition", ")", "throws", "EFapsException", "{", "if", "(", "_key", "==", "null", "||", "_value", "==", "null", ")", "{",...
Sets a key-value pair into the attribute set of an user. The method will search for the key and if the key already exists it will update the user attribute in this set. If the key does not exist a new user attribute will be added to this set. @param _key key to be set @param _value value to be set @param _definition type of the key-value pair @throws EFapsException if <code>_key</code> or <code>_value</code> is <code>null</code>
[ "Sets", "a", "key", "-", "value", "pair", "into", "the", "attribute", "set", "of", "an", "user", ".", "The", "method", "will", "search", "for", "the", "key", "and", "if", "the", "key", "already", "exists", "it", "will", "update", "the", "user", "attrib...
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/UserAttributesSet.java#L233-L249
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/print/value/FormatValueSelect.java
FormatValueSelect.get
@Override public Object get(final Attribute _attribute, final Object _object) throws EFapsException { Object ret = null; if (_object != null && _attribute.getAttributeType().getDbAttrType() instanceof IFormattableType) { final IFormattableType attrType = (IFormattableType) _attribute.getAttributeType().getDbAttrType(); if (_object instanceof List<?>) { final List<?> objectList = (List<?>) _object; final List<Object> temp = new ArrayList<>(); for (final Object object : objectList) { temp.add(attrType.format(object, this.pattern)); } ret = temp; } else { ret = attrType.format(_object, this.pattern); } } return ret; }
java
@Override public Object get(final Attribute _attribute, final Object _object) throws EFapsException { Object ret = null; if (_object != null && _attribute.getAttributeType().getDbAttrType() instanceof IFormattableType) { final IFormattableType attrType = (IFormattableType) _attribute.getAttributeType().getDbAttrType(); if (_object instanceof List<?>) { final List<?> objectList = (List<?>) _object; final List<Object> temp = new ArrayList<>(); for (final Object object : objectList) { temp.add(attrType.format(object, this.pattern)); } ret = temp; } else { ret = attrType.format(_object, this.pattern); } } return ret; }
[ "@", "Override", "public", "Object", "get", "(", "final", "Attribute", "_attribute", ",", "final", "Object", "_object", ")", "throws", "EFapsException", "{", "Object", "ret", "=", "null", ";", "if", "(", "_object", "!=", "null", "&&", "_attribute", ".", "g...
Method to format a given object. @param _attribute Attribute the object belongs to @param _object Object to be formated @return formated object @throws EFapsException on error
[ "Method", "to", "format", "a", "given", "object", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/print/value/FormatValueSelect.java#L72-L92
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/CachedMultiPrintQuery.java
CachedMultiPrintQuery.get4Request
public static CachedMultiPrintQuery get4Request(final List<Instance> _instances) throws EFapsException { return new CachedMultiPrintQuery(_instances, Context.getThreadContext().getRequestId()).setLifespan(5) .setLifespanUnit(TimeUnit.MINUTES); }
java
public static CachedMultiPrintQuery get4Request(final List<Instance> _instances) throws EFapsException { return new CachedMultiPrintQuery(_instances, Context.getThreadContext().getRequestId()).setLifespan(5) .setLifespanUnit(TimeUnit.MINUTES); }
[ "public", "static", "CachedMultiPrintQuery", "get4Request", "(", "final", "List", "<", "Instance", ">", "_instances", ")", "throws", "EFapsException", "{", "return", "new", "CachedMultiPrintQuery", "(", "_instances", ",", "Context", ".", "getThreadContext", "(", ")"...
Get a CachedMultiPrintQuery that will only cache during a request. @param _instances instance to be updated. @return the 4 request @throws EFapsException on error
[ "Get", "a", "CachedMultiPrintQuery", "that", "will", "only", "cache", "during", "a", "request", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/CachedMultiPrintQuery.java#L182-L187
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/eql/builder/Insert.java
Insert.set
public Insert set(final CIAttribute _attr, final Object _value) throws EFapsException { return super.set(_attr.name, Converter.convert(_value)); }
java
public Insert set(final CIAttribute _attr, final Object _value) throws EFapsException { return super.set(_attr.name, Converter.convert(_value)); }
[ "public", "Insert", "set", "(", "final", "CIAttribute", "_attr", ",", "final", "Object", "_value", ")", "throws", "EFapsException", "{", "return", "super", ".", "set", "(", "_attr", ".", "name", ",", "Converter", ".", "convert", "(", "_value", ")", ")", ...
Sets a value for an CIAttribute. @param _attr the attr @param _value the value @return the insert @throws EFapsException if parsing went wrong
[ "Sets", "a", "value", "for", "an", "CIAttribute", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/eql/builder/Insert.java#L40-L44
train
casmi/casmi
src/main/java/casmi/graphics/element/Point.java
Point.set
public void set(double x, double y, double z) { this.MODE = POINTS_3D; this.x = x; this.y = y; this.z = z; }
java
public void set(double x, double y, double z) { this.MODE = POINTS_3D; this.x = x; this.y = y; this.z = z; }
[ "public", "void", "set", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "this", ".", "MODE", "=", "POINTS_3D", ";", "this", ".", "x", "=", "x", ";", "this", ".", "y", "=", "y", ";", "this", ".", "z", "=", "z", ";", "}...
Sets x,y,z-coordinate. @param x The x-coordinate of the Point. @param y The y-coordinate of the Point. @param z The z-coordinate of the Point.
[ "Sets", "x", "y", "z", "-", "coordinate", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Point.java#L87-L92
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/SQLTable.java
SQLTable.addType
protected void addType(final Long _typeId) { if (!this.types.contains(_typeId)) { this.types.add(_typeId); setDirty(); } }
java
protected void addType(final Long _typeId) { if (!this.types.contains(_typeId)) { this.types.add(_typeId); setDirty(); } }
[ "protected", "void", "addType", "(", "final", "Long", "_typeId", ")", "{", "if", "(", "!", "this", ".", "types", ".", "contains", "(", "_typeId", ")", ")", "{", "this", ".", "types", ".", "add", "(", "_typeId", ")", ";", "setDirty", "(", ")", ";", ...
The instance method adds a new type to the type list. @param _typeId id of the Type to add @see #types
[ "The", "instance", "method", "adds", "a", "new", "type", "to", "the", "type", "list", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/SQLTable.java#L217-L223
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/Store.java
Store.loadResourceProperties
private void loadResourceProperties(final long _id) throws EFapsException { this.resourceProperties.clear(); final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.Property); queryBldr.addWhereAttrEqValue(CIAdminCommon.Property.Abstract, _id); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute(CIAdminCommon.Property.Name, CIAdminCommon.Property.Value); multi.executeWithoutAccessCheck(); while (multi.next()) { this.resourceProperties.put(multi.<String>getAttribute(CIAdminCommon.Property.Name), multi.<String>getAttribute(CIAdminCommon.Property.Value)); } }
java
private void loadResourceProperties(final long _id) throws EFapsException { this.resourceProperties.clear(); final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.Property); queryBldr.addWhereAttrEqValue(CIAdminCommon.Property.Abstract, _id); final MultiPrintQuery multi = queryBldr.getPrint(); multi.addAttribute(CIAdminCommon.Property.Name, CIAdminCommon.Property.Value); multi.executeWithoutAccessCheck(); while (multi.next()) { this.resourceProperties.put(multi.<String>getAttribute(CIAdminCommon.Property.Name), multi.<String>getAttribute(CIAdminCommon.Property.Value)); } }
[ "private", "void", "loadResourceProperties", "(", "final", "long", "_id", ")", "throws", "EFapsException", "{", "this", ".", "resourceProperties", ".", "clear", "(", ")", ";", "final", "QueryBuilder", "queryBldr", "=", "new", "QueryBuilder", "(", "CIAdminCommon", ...
Method to get the properties for the resource. @param _id id of the resource @throws EFapsException on error
[ "Method", "to", "get", "the", "properties", "for", "the", "resource", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/Store.java#L130-L143
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/Store.java
Store.getResource
public Resource getResource(final Instance _instance) throws EFapsException { Resource ret = null; try { Store.LOG.debug("Getting resource for: {} with properties: {}", this.resource, this.resourceProperties); ret = (Resource) Class.forName(this.resource).newInstance(); ret.initialize(_instance, this); } catch (final InstantiationException e) { throw new EFapsException(Store.class, "getResource.InstantiationException", e, this.resource); } catch (final IllegalAccessException e) { throw new EFapsException(Store.class, "getResource.IllegalAccessException", e, this.resource); } catch (final ClassNotFoundException e) { throw new EFapsException(Store.class, "getResource.ClassNotFoundException", e, this.resource); } return ret; }
java
public Resource getResource(final Instance _instance) throws EFapsException { Resource ret = null; try { Store.LOG.debug("Getting resource for: {} with properties: {}", this.resource, this.resourceProperties); ret = (Resource) Class.forName(this.resource).newInstance(); ret.initialize(_instance, this); } catch (final InstantiationException e) { throw new EFapsException(Store.class, "getResource.InstantiationException", e, this.resource); } catch (final IllegalAccessException e) { throw new EFapsException(Store.class, "getResource.IllegalAccessException", e, this.resource); } catch (final ClassNotFoundException e) { throw new EFapsException(Store.class, "getResource.ClassNotFoundException", e, this.resource); } return ret; }
[ "public", "Resource", "getResource", "(", "final", "Instance", "_instance", ")", "throws", "EFapsException", "{", "Resource", "ret", "=", "null", ";", "try", "{", "Store", ".", "LOG", ".", "debug", "(", "\"Getting resource for: {} with properties: {}\"", ",", "thi...
Method to get a instance of the resource. @param _instance instance the resource is wanted for @return Resource @throws EFapsException on error
[ "Method", "to", "get", "a", "instance", "of", "the", "resource", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/Store.java#L160-L176
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.copyImage
public BufferedImage copyImage(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); Graphics2D g2d = newImage.createGraphics(); g2d.drawImage(image, 0, 0, null); g2d.dispose(); return newImage; }
java
public BufferedImage copyImage(BufferedImage image) { BufferedImage newImage = new BufferedImage(image.getWidth(), image.getHeight(), image.getType()); Graphics2D g2d = newImage.createGraphics(); g2d.drawImage(image, 0, 0, null); g2d.dispose(); return newImage; }
[ "public", "BufferedImage", "copyImage", "(", "BufferedImage", "image", ")", "{", "BufferedImage", "newImage", "=", "new", "BufferedImage", "(", "image", ".", "getWidth", "(", ")", ",", "image", ".", "getHeight", "(", ")", ",", "image", ".", "getType", "(", ...
Copies a Image object using BuffedImage. @param image <<<<<<< HEAD The BufferedImage of this Image. ======= The BufferedImage of this Image. >>>>>>> 16121fd9fe4eeaef3cb56619769a3119a9e6531a @return The copy of this Image.
[ "Copies", "a", "Image", "object", "using", "BuffedImage", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L142-L148
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.loadTexture
public final void loadTexture() { texture = null; texture = AWTTextureIO.newTexture(GLProfile.get(GLProfile.GL2), img, true); if (texture == null) { throw new CasmiRuntimeException("Cannot load texture"); } }
java
public final void loadTexture() { texture = null; texture = AWTTextureIO.newTexture(GLProfile.get(GLProfile.GL2), img, true); if (texture == null) { throw new CasmiRuntimeException("Cannot load texture"); } }
[ "public", "final", "void", "loadTexture", "(", ")", "{", "texture", "=", "null", ";", "texture", "=", "AWTTextureIO", ".", "newTexture", "(", "GLProfile", ".", "get", "(", "GLProfile", ".", "GL2", ")", ",", "img", ",", "true", ")", ";", "if", "(", "t...
Loads a texture using image data.
[ "Loads", "a", "texture", "using", "image", "data", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L190-L196
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.getColor
public final Color getColor(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0, (pixels[idx] >> 8 & 0x000000ff) / 255.0, (pixels[idx] & 0x000000ff) / 255.0, (pixels[idx] >> 24) / 255.0); }
java
public final Color getColor(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0, (pixels[idx] >> 8 & 0x000000ff) / 255.0, (pixels[idx] & 0x000000ff) / 255.0, (pixels[idx] >> 24) / 255.0); }
[ "public", "final", "Color", "getColor", "(", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "getData", "(", ")", ...
Returns the pixel color of this Image. @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel. @return The color of the pixel.
[ "Returns", "the", "pixel", "color", "of", "this", "Image", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L251-L259
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.getRed
public final double getRed(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return (pixels[idx] >> 16 & 0x000000ff); }
java
public final double getRed(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return (pixels[idx] >> 16 & 0x000000ff); }
[ "public", "final", "double", "getRed", "(", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "getData", "(", ")", "...
Returns the red color value of the pixel data in this Image. @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel. @return The red color value of the pixel.
[ "Returns", "the", "red", "color", "value", "of", "the", "pixel", "data", "in", "this", "Image", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L271-L276
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.setColor
public final void setColor(Color color, int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int red = (int)(color.getRed() * 255.0); int green = (int)(color.getGreen() * 255.0); int blue = (int)(color.getBlue() * 255.0); int alpha = (int)(color.getAlpha() * 255.0); pixels[x + y * width] = alpha << 24 | red << 16 | green << 8 | blue; }
java
public final void setColor(Color color, int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int red = (int)(color.getRed() * 255.0); int green = (int)(color.getGreen() * 255.0); int blue = (int)(color.getBlue() * 255.0); int alpha = (int)(color.getAlpha() * 255.0); pixels[x + y * width] = alpha << 24 | red << 16 | green << 8 | blue; }
[ "public", "final", "void", "setColor", "(", "Color", "color", ",", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", ...
Sets the color value of the pixel data in this Image. @param color <<<<<<< HEAD The color value of the pixel. ======= The color value of the pixel. >>>>>>> 16121fd9fe4eeaef3cb56619769a3119a9e6531a @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel.
[ "Sets", "the", "color", "value", "of", "the", "pixel", "data", "in", "this", "Image", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L360-L370
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.setA
public final void setA(double alpha, int x, int y){ int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; int tmpR = pixels[idx] >> 16 & 0x000000ff; int tmpG = pixels[idx] >> 8 & 0x000000ff; int tmpB = pixels[idx] & 0x000000ff; pixels[idx] = (int)alpha << 24 | tmpR << 16 | tmpG << 8 | tmpB; }
java
public final void setA(double alpha, int x, int y){ int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; int tmpR = pixels[idx] >> 16 & 0x000000ff; int tmpG = pixels[idx] >> 8 & 0x000000ff; int tmpB = pixels[idx] & 0x000000ff; pixels[idx] = (int)alpha << 24 | tmpR << 16 | tmpG << 8 | tmpB; }
[ "public", "final", "void", "setA", "(", "double", "alpha", ",", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "g...
Sets the alpha value of the pixel data in this Image. @param alpha The alpha value of the pixel. @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel.
[ "Sets", "the", "alpha", "value", "of", "the", "pixel", "data", "in", "this", "Image", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L382-L392
train
casmi/casmi
src/main/java/casmi/image/Image.java
Image.setColors
public final void setColors(Color[] colors) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { int idx = x + y * width; if (colors.length <= idx) break; int red = (int)(colors[idx].getRed() * 255.0); int green = (int)(colors[idx].getGreen() * 255.0); int blue = (int)(colors[idx].getBlue() * 255.0); int alpha = (int)(colors[idx].getAlpha() * 255.0); pixels[idx] = alpha << 24 | red << 16 | green << 8 | blue; } } }
java
public final void setColors(Color[] colors) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); for (int y = 0; y < height; ++y) { for (int x = 0; x < width; ++x) { int idx = x + y * width; if (colors.length <= idx) break; int red = (int)(colors[idx].getRed() * 255.0); int green = (int)(colors[idx].getGreen() * 255.0); int blue = (int)(colors[idx].getBlue() * 255.0); int alpha = (int)(colors[idx].getAlpha() * 255.0); pixels[idx] = alpha << 24 | red << 16 | green << 8 | blue; } } }
[ "public", "final", "void", "setColors", "(", "Color", "[", "]", "colors", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "getData", "(", ")", ";...
Sets the color values to this Image. @param colors <<<<<<< HEAD The array of Color which size is width * height of this Image. ======= The array of Color which size is width * height of this Image. >>>>>>> 16121fd9fe4eeaef3cb56619769a3119a9e6531a
[ "Sets", "the", "color", "values", "to", "this", "Image", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L404-L420
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/eql/JSONCI.java
JSONCI.getCI
public static AbstractCI<?> getCI(final ICIPrintStmt _stmt) throws CacheReloadException { AbstractCI<?> ret = null; switch (_stmt.getCINature()) { case TYPE: final Type type; if (UUIDUtil.isUUID(_stmt.getCI())) { type = Type.get(UUID.fromString(_stmt.getCI())); } else { type = Type.get(_stmt.getCI()); } if (type != null) { final org.efaps.json.ci.Type jsonType = new org.efaps.json.ci.Type() .setName(type.getName()) .setUUID(type.getUUID()) .setId(type.getId()); for (final Attribute attr : type.getAttributes().values()) { final AttributeType attrType = new AttributeType() .setName(attr.getAttributeType().getName()); switch (DMAttributeType.fromValue(attr.getAttributeType().getName())) { case LINK: case LINK_WITH_RANGES: case STATUS: if (attr.hasLink()) { attrType.setInfo(attr.getLink().getName() + ", " + attr.getLink().getUUID()); } break; default: break; } jsonType.addAttribute(new org.efaps.json.ci.Attribute() .setName(attr.getName()) .setType(attrType)); } ret = jsonType; } break; default: break; } return ret; }
java
public static AbstractCI<?> getCI(final ICIPrintStmt _stmt) throws CacheReloadException { AbstractCI<?> ret = null; switch (_stmt.getCINature()) { case TYPE: final Type type; if (UUIDUtil.isUUID(_stmt.getCI())) { type = Type.get(UUID.fromString(_stmt.getCI())); } else { type = Type.get(_stmt.getCI()); } if (type != null) { final org.efaps.json.ci.Type jsonType = new org.efaps.json.ci.Type() .setName(type.getName()) .setUUID(type.getUUID()) .setId(type.getId()); for (final Attribute attr : type.getAttributes().values()) { final AttributeType attrType = new AttributeType() .setName(attr.getAttributeType().getName()); switch (DMAttributeType.fromValue(attr.getAttributeType().getName())) { case LINK: case LINK_WITH_RANGES: case STATUS: if (attr.hasLink()) { attrType.setInfo(attr.getLink().getName() + ", " + attr.getLink().getUUID()); } break; default: break; } jsonType.addAttribute(new org.efaps.json.ci.Attribute() .setName(attr.getName()) .setType(attrType)); } ret = jsonType; } break; default: break; } return ret; }
[ "public", "static", "AbstractCI", "<", "?", ">", "getCI", "(", "final", "ICIPrintStmt", "_stmt", ")", "throws", "CacheReloadException", "{", "AbstractCI", "<", "?", ">", "ret", "=", "null", ";", "switch", "(", "_stmt", ".", "getCINature", "(", ")", ")", ...
Gets the ci. @param _stmt the stmt @return the ci @throws CacheReloadException the cache reload exception
[ "Gets", "the", "ci", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/eql/JSONCI.java#L51-L93
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/databases/information/TableInformation.java
TableInformation.addUniqueKeyColumn
public void addUniqueKeyColumn(final String _ukName, final int _colIndex, final String _colName) { final String ukName = _ukName.toUpperCase(); final UniqueKeyInformation uki; if (!this.ukMap.containsKey(ukName)) { uki = new UniqueKeyInformation(_ukName); this.ukMap.put(ukName, uki); } else { uki = this.ukMap.get(ukName); } uki.appendColumnName(_colIndex, _colName); // this.ukColMap.put(uki.getColumnNames(), uki); }
java
public void addUniqueKeyColumn(final String _ukName, final int _colIndex, final String _colName) { final String ukName = _ukName.toUpperCase(); final UniqueKeyInformation uki; if (!this.ukMap.containsKey(ukName)) { uki = new UniqueKeyInformation(_ukName); this.ukMap.put(ukName, uki); } else { uki = this.ukMap.get(ukName); } uki.appendColumnName(_colIndex, _colName); // this.ukColMap.put(uki.getColumnNames(), uki); }
[ "public", "void", "addUniqueKeyColumn", "(", "final", "String", "_ukName", ",", "final", "int", "_colIndex", ",", "final", "String", "_colName", ")", "{", "final", "String", "ukName", "=", "_ukName", ".", "toUpperCase", "(", ")", ";", "final", "UniqueKeyInform...
Adds an unique key information to this table information. @param _ukName name of unique key @param _colIndex index of the column for given unique key @param _colName name of the column for given unique key @see #ukMap @see #ukColMap
[ "Adds", "an", "unique", "key", "information", "to", "this", "table", "information", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/databases/information/TableInformation.java#L129-L144
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/databases/information/TableInformation.java
TableInformation.addForeignKey
public void addForeignKey(final String _fkName, final String _colName, final String _refTableName, final String _refColName, final boolean _cascade) { this.fkMap.put(_fkName.toUpperCase(), new ForeignKeyInformation(_fkName, _colName, _refTableName, _refColName, _cascade)); }
java
public void addForeignKey(final String _fkName, final String _colName, final String _refTableName, final String _refColName, final boolean _cascade) { this.fkMap.put(_fkName.toUpperCase(), new ForeignKeyInformation(_fkName, _colName, _refTableName, _refColName, _cascade)); }
[ "public", "void", "addForeignKey", "(", "final", "String", "_fkName", ",", "final", "String", "_colName", ",", "final", "String", "_refTableName", ",", "final", "String", "_refColName", ",", "final", "boolean", "_cascade", ")", "{", "this", ".", "fkMap", ".", ...
Fetches all foreign keys for this table. @param _fkName name of foreign key @param _colName name of column name @param _refTableName name of referenced SQL table @param _refColName name of column within referenced SQL table @param _cascade delete cascade activated @see #fkMap
[ "Fetches", "all", "foreign", "keys", "for", "this", "table", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/databases/information/TableInformation.java#L156-L164
train
javabits/yar
yar-guice/src/main/java/org/javabits/yar/guice/RegistryListenerBindingHandler.java
RegistryListenerBindingHandler.addListenerToRegistry
@SuppressWarnings("unchecked") private List<ListenerRegistration> addListenerToRegistry() { List<ListenerRegistration> registrationsBuilder = newArrayList(); for (Pair<IdMatcher, Watcher> guiceWatcherRegistration : getRegisteredWatchers()) { Watcher watcher = guiceWatcherRegistration.right(); IdMatcher idMatcher = guiceWatcherRegistration.left(); Registration registration = registry.addWatcher(idMatcher, watcher); ListenerRegistration listenerRegistration = new ListenerRegistration(registration, idMatcher, watcher); registrationsBuilder.add(listenerRegistration); } return registrationsBuilder; }
java
@SuppressWarnings("unchecked") private List<ListenerRegistration> addListenerToRegistry() { List<ListenerRegistration> registrationsBuilder = newArrayList(); for (Pair<IdMatcher, Watcher> guiceWatcherRegistration : getRegisteredWatchers()) { Watcher watcher = guiceWatcherRegistration.right(); IdMatcher idMatcher = guiceWatcherRegistration.left(); Registration registration = registry.addWatcher(idMatcher, watcher); ListenerRegistration listenerRegistration = new ListenerRegistration(registration, idMatcher, watcher); registrationsBuilder.add(listenerRegistration); } return registrationsBuilder; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "List", "<", "ListenerRegistration", ">", "addListenerToRegistry", "(", ")", "{", "List", "<", "ListenerRegistration", ">", "registrationsBuilder", "=", "newArrayList", "(", ")", ";", "for", "(", "Pair...
enforce creation of all watcher before register it
[ "enforce", "creation", "of", "all", "watcher", "before", "register", "it" ]
e146a86611ca4831e8334c9a98fd7086cee9c03e
https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-guice/src/main/java/org/javabits/yar/guice/RegistryListenerBindingHandler.java#L67-L78
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.initConfig
private void initConfig() { SystemConfiguration config = null; try { config = EFapsSystemConfiguration.get(); if (config != null) { final Properties confProps = config.getAttributeValueAsProperties(KernelSettings.PWDSTORE); this.digesterConfig.setAlgorithm(confProps.getProperty(PasswordStore.ALGORITHM, this.digesterConfig.getAlgorithm())); this.digesterConfig.setIterations(confProps.getProperty(PasswordStore.ITERATIONS, this.digesterConfig.getIterations().toString())); this.digesterConfig.setSaltSizeBytes(confProps.getProperty(PasswordStore.SALTSIZE, this.digesterConfig.getSaltSizeBytes().toString())); this.threshold = config.getAttributeValueAsInteger(KernelSettings.PWDTH); } } catch (final EFapsException e) { PasswordStore.LOG.error("Error on reading SystemConfiguration for PasswordStore", e); } }
java
private void initConfig() { SystemConfiguration config = null; try { config = EFapsSystemConfiguration.get(); if (config != null) { final Properties confProps = config.getAttributeValueAsProperties(KernelSettings.PWDSTORE); this.digesterConfig.setAlgorithm(confProps.getProperty(PasswordStore.ALGORITHM, this.digesterConfig.getAlgorithm())); this.digesterConfig.setIterations(confProps.getProperty(PasswordStore.ITERATIONS, this.digesterConfig.getIterations().toString())); this.digesterConfig.setSaltSizeBytes(confProps.getProperty(PasswordStore.SALTSIZE, this.digesterConfig.getSaltSizeBytes().toString())); this.threshold = config.getAttributeValueAsInteger(KernelSettings.PWDTH); } } catch (final EFapsException e) { PasswordStore.LOG.error("Error on reading SystemConfiguration for PasswordStore", e); } }
[ "private", "void", "initConfig", "(", ")", "{", "SystemConfiguration", "config", "=", "null", ";", "try", "{", "config", "=", "EFapsSystemConfiguration", ".", "get", "(", ")", ";", "if", "(", "config", "!=", "null", ")", "{", "final", "Properties", "confPr...
Initialize the digester configuration by reading values from the kernel SystemConfiguration.
[ "Initialize", "the", "digester", "configuration", "by", "reading", "values", "from", "the", "kernel", "SystemConfiguration", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L99-L118
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.read
public void read(final String _readValue) throws EFapsException { if (_readValue != null) { try { this.props.load(new StringReader(_readValue)); } catch (final IOException e) { throw new EFapsException(PasswordStore.class.getName(), e); } } }
java
public void read(final String _readValue) throws EFapsException { if (_readValue != null) { try { this.props.load(new StringReader(_readValue)); } catch (final IOException e) { throw new EFapsException(PasswordStore.class.getName(), e); } } }
[ "public", "void", "read", "(", "final", "String", "_readValue", ")", "throws", "EFapsException", "{", "if", "(", "_readValue", "!=", "null", ")", "{", "try", "{", "this", ".", "props", ".", "load", "(", "new", "StringReader", "(", "_readValue", ")", ")",...
Read a PasswordStore from a String. @param _readValue String to be read @throws EFapsException on error
[ "Read", "a", "PasswordStore", "from", "a", "String", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L126-L136
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.check
private boolean check(final String _plainPassword, final int _pos) { boolean ret = false; if (this.props.containsKey(PasswordStore.DIGEST + _pos)) { final ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor(); this.digesterConfig.setAlgorithm(this.props.getProperty(PasswordStore.ALGORITHM + _pos)); this.digesterConfig.setIterations(this.props.getProperty(PasswordStore.ITERATIONS + _pos)); this.digesterConfig.setSaltSizeBytes(this.props.getProperty(PasswordStore.SALTSIZE + _pos)); passwordEncryptor.setConfig(this.digesterConfig); ret = passwordEncryptor.checkPassword(_plainPassword, this.props.getProperty(PasswordStore.DIGEST + _pos)); } return ret; }
java
private boolean check(final String _plainPassword, final int _pos) { boolean ret = false; if (this.props.containsKey(PasswordStore.DIGEST + _pos)) { final ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor(); this.digesterConfig.setAlgorithm(this.props.getProperty(PasswordStore.ALGORITHM + _pos)); this.digesterConfig.setIterations(this.props.getProperty(PasswordStore.ITERATIONS + _pos)); this.digesterConfig.setSaltSizeBytes(this.props.getProperty(PasswordStore.SALTSIZE + _pos)); passwordEncryptor.setConfig(this.digesterConfig); ret = passwordEncryptor.checkPassword(_plainPassword, this.props.getProperty(PasswordStore.DIGEST + _pos)); } return ret; }
[ "private", "boolean", "check", "(", "final", "String", "_plainPassword", ",", "final", "int", "_pos", ")", "{", "boolean", "ret", "=", "false", ";", "if", "(", "this", ".", "props", ".", "containsKey", "(", "PasswordStore", ".", "DIGEST", "+", "_pos", ")...
Check the given Plain Text Password for equal on the Hash by applying the algorithm salt etc. @param _plainPassword plain text password @param _pos position of the password to be checked @return true if equal, else false
[ "Check", "the", "given", "Plain", "Text", "Password", "for", "equal", "on", "the", "Hash", "by", "applying", "the", "algorithm", "salt", "etc", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L158-L171
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.isRepeated
public boolean isRepeated(final String _plainPassword) { boolean ret = false; for (int i = 1; i < this.threshold + 1; i++) { ret = check(_plainPassword, i); if (ret) { break; } } return ret; }
java
public boolean isRepeated(final String _plainPassword) { boolean ret = false; for (int i = 1; i < this.threshold + 1; i++) { ret = check(_plainPassword, i); if (ret) { break; } } return ret; }
[ "public", "boolean", "isRepeated", "(", "final", "String", "_plainPassword", ")", "{", "boolean", "ret", "=", "false", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "this", ".", "threshold", "+", "1", ";", "i", "++", ")", "{", "ret", "=", ...
Is the given plain password repeated. It is checked against the existing previous passwords. @param _plainPassword plain text password @return true if repeated, else false
[ "Is", "the", "given", "plain", "password", "repeated", ".", "It", "is", "checked", "against", "the", "existing", "previous", "passwords", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L180-L190
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.setNew
public void setNew(final String _plainPassword, final String _currentValue) throws EFapsException { initConfig(); read(_currentValue); final ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor(); passwordEncryptor.setConfig(this.digesterConfig); final String encrypted = passwordEncryptor.encryptPassword(_plainPassword); shiftAll(); this.props.setProperty(PasswordStore.DIGEST + 0, encrypted); this.props.setProperty(PasswordStore.ALGORITHM + 0, this.digesterConfig.getAlgorithm()); this.props.setProperty(PasswordStore.ITERATIONS + 0, this.digesterConfig.getIterations().toString()); this.props.setProperty(PasswordStore.SALTSIZE + 0, this.digesterConfig.getSaltSizeBytes().toString()); }
java
public void setNew(final String _plainPassword, final String _currentValue) throws EFapsException { initConfig(); read(_currentValue); final ConfigurablePasswordEncryptor passwordEncryptor = new ConfigurablePasswordEncryptor(); passwordEncryptor.setConfig(this.digesterConfig); final String encrypted = passwordEncryptor.encryptPassword(_plainPassword); shiftAll(); this.props.setProperty(PasswordStore.DIGEST + 0, encrypted); this.props.setProperty(PasswordStore.ALGORITHM + 0, this.digesterConfig.getAlgorithm()); this.props.setProperty(PasswordStore.ITERATIONS + 0, this.digesterConfig.getIterations().toString()); this.props.setProperty(PasswordStore.SALTSIZE + 0, this.digesterConfig.getSaltSizeBytes().toString()); }
[ "public", "void", "setNew", "(", "final", "String", "_plainPassword", ",", "final", "String", "_currentValue", ")", "throws", "EFapsException", "{", "initConfig", "(", ")", ";", "read", "(", "_currentValue", ")", ";", "final", "ConfigurablePasswordEncryptor", "pas...
Set the given given Plain Password as the new current Password by encrypting it. @param _plainPassword plain password to be used @param _currentValue current value of the Store @param _currentValue @throws EFapsException on error
[ "Set", "the", "given", "given", "Plain", "Password", "as", "the", "new", "current", "Password", "by", "encrypting", "it", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L201-L215
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.shiftAll
private void shiftAll() { shift(PasswordStore.DIGEST); shift(PasswordStore.ALGORITHM); shift(PasswordStore.ITERATIONS); shift(PasswordStore.SALTSIZE); }
java
private void shiftAll() { shift(PasswordStore.DIGEST); shift(PasswordStore.ALGORITHM); shift(PasswordStore.ITERATIONS); shift(PasswordStore.SALTSIZE); }
[ "private", "void", "shiftAll", "(", ")", "{", "shift", "(", "PasswordStore", ".", "DIGEST", ")", ";", "shift", "(", "PasswordStore", ".", "ALGORITHM", ")", ";", "shift", "(", "PasswordStore", ".", "ITERATIONS", ")", ";", "shift", "(", "PasswordStore", ".",...
Shift all Properties.
[ "Shift", "all", "Properties", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L220-L226
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java
PasswordStore.shift
private void shift(final String _key) { for (int i = this.threshold; i > 0; i--) { this.props.setProperty(_key + i, this.props.getProperty(_key + (i - 1), "").trim()); } int i = this.threshold + 1; while (this.props.contains(_key + i)) { this.props.remove(_key + i); i++; } }
java
private void shift(final String _key) { for (int i = this.threshold; i > 0; i--) { this.props.setProperty(_key + i, this.props.getProperty(_key + (i - 1), "").trim()); } int i = this.threshold + 1; while (this.props.contains(_key + i)) { this.props.remove(_key + i); i++; } }
[ "private", "void", "shift", "(", "final", "String", "_key", ")", "{", "for", "(", "int", "i", "=", "this", ".", "threshold", ";", "i", ">", "0", ";", "i", "--", ")", "{", "this", ".", "props", ".", "setProperty", "(", "_key", "+", "i", ",", "th...
Shift a property. @param _key key the property must be shifted for
[ "Shift", "a", "property", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/attributevalue/PasswordStore.java#L233-L243
train
labai/ted
ted-driver/src/main/java/ted/driver/sys/TedDriverImpl.java
TedDriverImpl.createBatch
public Long createBatch(String batchTaskName, String data, String key1, String key2, List<TedTask> tedTasks) { if (tedTasks == null || tedTasks.isEmpty()) return null; if (batchTaskName == null) { throw new IllegalStateException("batchTaskName is required!"); } TaskConfig batchTC = context.registry.getTaskConfig(batchTaskName); if (batchTC == null) throw new IllegalArgumentException("Batch task '" + batchTaskName + "' is not known for TED"); Long batchId = context.tedDao.createTaskPostponed(batchTC.taskName, Model.CHANNEL_BATCH, data, key1, key2, 30 * 60); createTasksBulk(tedTasks, batchId); context.tedDao.setStatusPostponed(batchId, TedStatus.NEW, Model.BATCH_MSG, new Date()); return batchId; }
java
public Long createBatch(String batchTaskName, String data, String key1, String key2, List<TedTask> tedTasks) { if (tedTasks == null || tedTasks.isEmpty()) return null; if (batchTaskName == null) { throw new IllegalStateException("batchTaskName is required!"); } TaskConfig batchTC = context.registry.getTaskConfig(batchTaskName); if (batchTC == null) throw new IllegalArgumentException("Batch task '" + batchTaskName + "' is not known for TED"); Long batchId = context.tedDao.createTaskPostponed(batchTC.taskName, Model.CHANNEL_BATCH, data, key1, key2, 30 * 60); createTasksBulk(tedTasks, batchId); context.tedDao.setStatusPostponed(batchId, TedStatus.NEW, Model.BATCH_MSG, new Date()); return batchId; }
[ "public", "Long", "createBatch", "(", "String", "batchTaskName", ",", "String", "data", ",", "String", "key1", ",", "String", "key2", ",", "List", "<", "TedTask", ">", "tedTasks", ")", "{", "if", "(", "tedTasks", "==", "null", "||", "tedTasks", ".", "isE...
if batchTaskName is null - will take from taskConfiguration
[ "if", "batchTaskName", "is", "null", "-", "will", "take", "from", "taskConfiguration" ]
2ee197246a78d842c18d6780c48fd903b00608a6
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/TedDriverImpl.java#L337-L352
train
tvesalainen/lpg
src/main/java/org/vesalainen/grammar/state/DFA.java
DFA.maxDepth
public int maxDepth() { Map<DFAState<T>,Integer> indexOf = new NumMap<>(); Map<DFAState<T>,Long> depth = new NumMap<>(); Deque<DFAState<T>> stack = new ArrayDeque<>(); maxDepth(root, indexOf, stack, depth); long d = depth.get(root); assert d >= 0; if (d >= Integer.MAX_VALUE) { return Integer.MAX_VALUE; } else { return (int) d; } }
java
public int maxDepth() { Map<DFAState<T>,Integer> indexOf = new NumMap<>(); Map<DFAState<T>,Long> depth = new NumMap<>(); Deque<DFAState<T>> stack = new ArrayDeque<>(); maxDepth(root, indexOf, stack, depth); long d = depth.get(root); assert d >= 0; if (d >= Integer.MAX_VALUE) { return Integer.MAX_VALUE; } else { return (int) d; } }
[ "public", "int", "maxDepth", "(", ")", "{", "Map", "<", "DFAState", "<", "T", ">", ",", "Integer", ">", "indexOf", "=", "new", "NumMap", "<>", "(", ")", ";", "Map", "<", "DFAState", "<", "T", ">", ",", "Long", ">", "depth", "=", "new", "NumMap", ...
Calculates the maximum length of accepted string. Returns Integer.MAX_VALUE if length is infinite. For "if|while" returns 5. For "a+" returns Integer.MAX_VALUE. @return
[ "Calculates", "the", "maximum", "length", "of", "accepted", "string", ".", "Returns", "Integer", ".", "MAX_VALUE", "if", "length", "is", "infinite", ".", "For", "if|while", "returns", "5", ".", "For", "a", "+", "returns", "Integer", ".", "MAX_VALUE", "." ]
0917b8d295e9772b9f8a0affc258a08530cd567a
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFA.java#L182-L198
train
tvesalainen/lpg
src/main/java/org/vesalainen/grammar/state/DFA.java
DFA.calculateMaxFindSkip
public void calculateMaxFindSkip() { Map<DFAState<T>,Integer> indexOf = new NumMap<>(); Map<DFAState<T>,Integer> skip = new NumMap<>(); Deque<DFAState<T>> stack = new ArrayDeque<>(); findSkip(root, indexOf, stack, new LinkedList()); root.setAcceptStartLength(1); }
java
public void calculateMaxFindSkip() { Map<DFAState<T>,Integer> indexOf = new NumMap<>(); Map<DFAState<T>,Integer> skip = new NumMap<>(); Deque<DFAState<T>> stack = new ArrayDeque<>(); findSkip(root, indexOf, stack, new LinkedList()); root.setAcceptStartLength(1); }
[ "public", "void", "calculateMaxFindSkip", "(", ")", "{", "Map", "<", "DFAState", "<", "T", ">", ",", "Integer", ">", "indexOf", "=", "new", "NumMap", "<>", "(", ")", ";", "Map", "<", "DFAState", "<", "T", ">", ",", "Integer", ">", "skip", "=", "new...
Calculates how many characters we can skip after failed find operation @return
[ "Calculates", "how", "many", "characters", "we", "can", "skip", "after", "failed", "find", "operation" ]
0917b8d295e9772b9f8a0affc258a08530cd567a
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFA.java#L314-L321
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java
Server.register
public void register() { logger.debug("[register] uri = {}", getManagementUri()); JsonNode jsonNode; ObjectMapper objectMapper = jsonObjectMapper.getObjectMapperBinary(); ObjectNode objectNode = objectMapper.createObjectNode(); objectNode.put(CommandParameters.METHOD, "register"); try { jsonNode = objectMapper.readTree(managementConnection.sendWithResult(objectMapper.writeValueAsBytes(objectNode))); } catch (Exception e) { logger.error("[register] could not register at server"); return; } id = jsonNode.get("id").asText(); setMaster(jsonNode.get("isMaster").asBoolean()); managementConnection.setServerId(id); logger.debug("[register] id = {}, isMaster = {}, uri = {}", getId(), isMaster(), getManagementUri()); }
java
public void register() { logger.debug("[register] uri = {}", getManagementUri()); JsonNode jsonNode; ObjectMapper objectMapper = jsonObjectMapper.getObjectMapperBinary(); ObjectNode objectNode = objectMapper.createObjectNode(); objectNode.put(CommandParameters.METHOD, "register"); try { jsonNode = objectMapper.readTree(managementConnection.sendWithResult(objectMapper.writeValueAsBytes(objectNode))); } catch (Exception e) { logger.error("[register] could not register at server"); return; } id = jsonNode.get("id").asText(); setMaster(jsonNode.get("isMaster").asBoolean()); managementConnection.setServerId(id); logger.debug("[register] id = {}, isMaster = {}, uri = {}", getId(), isMaster(), getManagementUri()); }
[ "public", "void", "register", "(", ")", "{", "logger", ".", "debug", "(", "\"[register] uri = {}\"", ",", "getManagementUri", "(", ")", ")", ";", "JsonNode", "jsonNode", ";", "ObjectMapper", "objectMapper", "=", "jsonObjectMapper", ".", "getObjectMapperBinary", "(...
Registers with the Neo4j server and saves some Neo4j server information with this object.
[ "Registers", "with", "the", "Neo4j", "server", "and", "saves", "some", "Neo4j", "server", "information", "with", "this", "object", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java#L115-L137
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java
Server.getConnection
public DataConnection getConnection() { DataConnection connection; for (connection = availableConnections.poll(); connection != null && !connection.isUsable(); connection = availableConnections.poll()) { if (!connection.isUsable()) { connection.close(); } } if (connection == null) { connection = new DataConnection(getDataUri()); try { connection.connect(); } catch (Exception e) { logger.error("[getConnection] could not connect to database", e); return null; } } connection.setLocale(threadLocale.getLocale()); return connection; }
java
public DataConnection getConnection() { DataConnection connection; for (connection = availableConnections.poll(); connection != null && !connection.isUsable(); connection = availableConnections.poll()) { if (!connection.isUsable()) { connection.close(); } } if (connection == null) { connection = new DataConnection(getDataUri()); try { connection.connect(); } catch (Exception e) { logger.error("[getConnection] could not connect to database", e); return null; } } connection.setLocale(threadLocale.getLocale()); return connection; }
[ "public", "DataConnection", "getConnection", "(", ")", "{", "DataConnection", "connection", ";", "for", "(", "connection", "=", "availableConnections", ".", "poll", "(", ")", ";", "connection", "!=", "null", "&&", "!", "connection", ".", "isUsable", "(", ")", ...
Gets a connection from the pool of available and free data connections to this server. @return data connection to this server
[ "Gets", "a", "connection", "from", "the", "pool", "of", "available", "and", "free", "data", "connections", "to", "this", "server", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java#L175-L202
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java
Server.returnConnection
public void returnConnection(DataConnection connection) { if (connection.isUsable()) { connection.setLastUsage(new Date()); availableConnections.add(connection); } else { connection.close(); } usedConnections.remove(connection); }
java
public void returnConnection(DataConnection connection) { if (connection.isUsable()) { connection.setLastUsage(new Date()); availableConnections.add(connection); } else { connection.close(); } usedConnections.remove(connection); }
[ "public", "void", "returnConnection", "(", "DataConnection", "connection", ")", "{", "if", "(", "connection", ".", "isUsable", "(", ")", ")", "{", "connection", ".", "setLastUsage", "(", "new", "Date", "(", ")", ")", ";", "availableConnections", ".", "add", ...
Returns a connection to the pool of available and free data connections to this server. @param connection data connection to this server
[ "Returns", "a", "connection", "to", "the", "pool", "of", "available", "and", "free", "data", "connections", "to", "this", "server", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/server/Server.java#L208-L218
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java
ManagementConnection.connect
public void connect() throws Exception { logger.debug("[connect] initializing new connection"); if (timer != null) { timer.cancel(); } if (isConnected()) { return; } synchronized (webSocketHandler.getNotifyConnectionObject()) { webSocketConnectionManager.start(); try { webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT)); } catch (InterruptedException e) { onConnectionClosed(); logger.debug("[connect] not open"); throw new Exception("websocket connection not open"); } if (!isConnected()) { onConnectionClosed(); logger.debug("[connect] timeout"); throw new Exception("websocket connection timeout"); } } }
java
public void connect() throws Exception { logger.debug("[connect] initializing new connection"); if (timer != null) { timer.cancel(); } if (isConnected()) { return; } synchronized (webSocketHandler.getNotifyConnectionObject()) { webSocketConnectionManager.start(); try { webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT)); } catch (InterruptedException e) { onConnectionClosed(); logger.debug("[connect] not open"); throw new Exception("websocket connection not open"); } if (!isConnected()) { onConnectionClosed(); logger.debug("[connect] timeout"); throw new Exception("websocket connection timeout"); } } }
[ "public", "void", "connect", "(", ")", "throws", "Exception", "{", "logger", ".", "debug", "(", "\"[connect] initializing new connection\"", ")", ";", "if", "(", "timer", "!=", "null", ")", "{", "timer", ".", "cancel", "(", ")", ";", "}", "if", "(", "isC...
Connects to the Neo4j server identified by URI and ID of this connection. @throws Exception websocket timeout exception
[ "Connects", "to", "the", "Neo4j", "server", "identified", "by", "URI", "and", "ID", "of", "this", "connection", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java#L92-L121
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java
ManagementConnection.onConnectionClosed
public void onConnectionClosed() { logger.debug("[onConnectionClosed] '{}', isConnected = {}", uri, isConnected()); webSocketConnectionManager.stop(); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { logger.debug("[onConnectionClosed:run]"); synchronized (webSocketHandler.getNotifyConnectionObject()) { webSocketConnectionManager.start(); try { webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT)); } catch (InterruptedException e) { logger.debug("[onConnectionClose]", e); } if (isConnected()) { logger.debug("[onConnectionClosed:run] connected"); clusterListener.onServerReconnected(getServerId(), uri); this.cancel(); } else { logger.debug("[onConnectionClosed:run] NOT connected"); webSocketConnectionManager.stop(); } } } }, TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT), TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT)); }
java
public void onConnectionClosed() { logger.debug("[onConnectionClosed] '{}', isConnected = {}", uri, isConnected()); webSocketConnectionManager.stop(); timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { logger.debug("[onConnectionClosed:run]"); synchronized (webSocketHandler.getNotifyConnectionObject()) { webSocketConnectionManager.start(); try { webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT)); } catch (InterruptedException e) { logger.debug("[onConnectionClose]", e); } if (isConnected()) { logger.debug("[onConnectionClosed:run] connected"); clusterListener.onServerReconnected(getServerId(), uri); this.cancel(); } else { logger.debug("[onConnectionClosed:run] NOT connected"); webSocketConnectionManager.stop(); } } } }, TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT), TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT)); }
[ "public", "void", "onConnectionClosed", "(", ")", "{", "logger", ".", "debug", "(", "\"[onConnectionClosed] '{}', isConnected = {}\"", ",", "uri", ",", "isConnected", "(", ")", ")", ";", "webSocketConnectionManager", ".", "stop", "(", ")", ";", "timer", "=", "ne...
Is being called when the websocket connection was closed and tries to reconnect.
[ "Is", "being", "called", "when", "the", "websocket", "connection", "was", "closed", "and", "tries", "to", "reconnect", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java#L126-L160
train
owetterau/neo4j-websockets
client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java
ManagementConnection.sendWithResult
public byte[] sendWithResult(final byte[] message) { synchronized (webSocketHandler.getNotifyResultObject()) { webSocketHandler.sendMessage(message); try { webSocketHandler.getNotifyResultObject().wait(TimeUnit.SECONDS.toMillis(ANSWER_TIMEOUT)); } catch (InterruptedException e) { return null; } return webSocketHandler.getResultBytes(); } }
java
public byte[] sendWithResult(final byte[] message) { synchronized (webSocketHandler.getNotifyResultObject()) { webSocketHandler.sendMessage(message); try { webSocketHandler.getNotifyResultObject().wait(TimeUnit.SECONDS.toMillis(ANSWER_TIMEOUT)); } catch (InterruptedException e) { return null; } return webSocketHandler.getResultBytes(); } }
[ "public", "byte", "[", "]", "sendWithResult", "(", "final", "byte", "[", "]", "message", ")", "{", "synchronized", "(", "webSocketHandler", ".", "getNotifyResultObject", "(", ")", ")", "{", "webSocketHandler", ".", "sendMessage", "(", "message", ")", ";", "t...
Sends a message through it's websocket connection to the server and waits for the reply. @param message json message in binary format @return answer from the server in json binary format
[ "Sends", "a", "message", "through", "it", "s", "websocket", "connection", "to", "the", "server", "and", "waits", "for", "the", "reply", "." ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/client/src/main/java/de/oliverwetterau/neo4j/websockets/client/web/ManagementConnection.java#L184-L197
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/stmt/selection/ProxiedObject.java
ProxiedObject.getObject
public Object getObject() { Object ret = null; try { ret = this.proxy.getValue(this.object); } catch (final EFapsException e) { LOG.error("Catched", e); } return ret; }
java
public Object getObject() { Object ret = null; try { ret = this.proxy.getValue(this.object); } catch (final EFapsException e) { LOG.error("Catched", e); } return ret; }
[ "public", "Object", "getObject", "(", ")", "{", "Object", "ret", "=", "null", ";", "try", "{", "ret", "=", "this", ".", "proxy", ".", "getValue", "(", "this", ".", "object", ")", ";", "}", "catch", "(", "final", "EFapsException", "e", ")", "{", "LO...
Gets the object. @return the object
[ "Gets", "the", "object", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/selection/ProxiedObject.java#L70-L79
train
casmi/casmi
src/main/java/casmi/graphics/element/Ellipse.java
Ellipse.setCenterColor
public void setCenterColor(Color color) { if (centerColor == null) { centerColor = new RGBColor(0.0, 0.0, 0.0); } setGradation(true); this.centerColor = color; }
java
public void setCenterColor(Color color) { if (centerColor == null) { centerColor = new RGBColor(0.0, 0.0, 0.0); } setGradation(true); this.centerColor = color; }
[ "public", "void", "setCenterColor", "(", "Color", "color", ")", "{", "if", "(", "centerColor", "==", "null", ")", "{", "centerColor", "=", "new", "RGBColor", "(", "0.0", ",", "0.0", ",", "0.0", ")", ";", "}", "setGradation", "(", "true", ")", ";", "t...
Sets the color of this Ellipse's center. @param color The color of the Ellipse's center.
[ "Sets", "the", "color", "of", "this", "Ellipse", "s", "center", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Ellipse.java#L313-L319
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Attribute.java
Attribute.copy
protected Attribute copy(final long _parentId) { final Attribute ret = new Attribute(getId(), _parentId, getName(), this.sqlTable, this.attributeType, this.defaultValue, this.dimensionUUID, this.required, this.size, this.scale); ret.getSqlColNames().addAll(getSqlColNames()); ret.setLink(this.link); ret.setClassName(getClassName()); ret.getProperties().putAll(getProperties()); return ret; }
java
protected Attribute copy(final long _parentId) { final Attribute ret = new Attribute(getId(), _parentId, getName(), this.sqlTable, this.attributeType, this.defaultValue, this.dimensionUUID, this.required, this.size, this.scale); ret.getSqlColNames().addAll(getSqlColNames()); ret.setLink(this.link); ret.setClassName(getClassName()); ret.getProperties().putAll(getProperties()); return ret; }
[ "protected", "Attribute", "copy", "(", "final", "long", "_parentId", ")", "{", "final", "Attribute", "ret", "=", "new", "Attribute", "(", "getId", "(", ")", ",", "_parentId", ",", "getName", "(", ")", ",", "this", ".", "sqlTable", ",", "this", ".", "at...
The method makes a clone of the current attribute instance. @param _parentId if of the parent type @return clone of current attribute instance
[ "The", "method", "makes", "a", "clone", "of", "the", "current", "attribute", "instance", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Attribute.java#L373-L382
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Attribute.java
Attribute.getDimension
public Dimension getDimension() { Dimension ret = null; try { ret = Dimension.get(UUID.fromString(this.dimensionUUID)); } catch (final CacheReloadException e) { Attribute.LOG.error("Catched CacheReloadException", e); } return ret; }
java
public Dimension getDimension() { Dimension ret = null; try { ret = Dimension.get(UUID.fromString(this.dimensionUUID)); } catch (final CacheReloadException e) { Attribute.LOG.error("Catched CacheReloadException", e); } return ret; }
[ "public", "Dimension", "getDimension", "(", ")", "{", "Dimension", "ret", "=", "null", ";", "try", "{", "ret", "=", "Dimension", ".", "get", "(", "UUID", ".", "fromString", "(", "this", ".", "dimensionUUID", ")", ")", ";", "}", "catch", "(", "final", ...
Method to get the dimension related to this attribute. @return Dimension
[ "Method", "to", "get", "the", "dimension", "related", "to", "this", "attribute", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Attribute.java#L572-L581
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Attribute.java
Attribute.initialize
public static void initialize(final Class<?> _class) throws CacheReloadException { if (InfinispanCache.get().exists(Attribute.NAMECACHE)) { InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE).clear(); } else { InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE) .addListener(new CacheLogListener(Attribute.LOG)); } if (InfinispanCache.get().exists(Attribute.IDCACHE)) { InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE).clear(); } else { InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE) .addListener(new CacheLogListener(Attribute.LOG)); } }
java
public static void initialize(final Class<?> _class) throws CacheReloadException { if (InfinispanCache.get().exists(Attribute.NAMECACHE)) { InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE).clear(); } else { InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE) .addListener(new CacheLogListener(Attribute.LOG)); } if (InfinispanCache.get().exists(Attribute.IDCACHE)) { InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE).clear(); } else { InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE) .addListener(new CacheLogListener(Attribute.LOG)); } }
[ "public", "static", "void", "initialize", "(", "final", "Class", "<", "?", ">", "_class", ")", "throws", "CacheReloadException", "{", "if", "(", "InfinispanCache", ".", "get", "(", ")", ".", "exists", "(", "Attribute", ".", "NAMECACHE", ")", ")", "{", "I...
Method to initialize this Cache. @param _class clas that called this method @throws CacheReloadException on error
[ "Method", "to", "initialize", "this", "Cache", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Attribute.java#L717-L733
train
owetterau/neo4j-websockets
core/src/main/java/de/oliverwetterau/neo4j/websockets/core/data/Error.java
Error.toHtml
public String toHtml() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append("<p>") .append(objectNode.get(TYPE).asText()).append(": ") .append(objectNode.get(MESSAGE).asText()).append(" -> ") .append(objectNode.get(DETAILS).toString()) .append("</p>"); return stringBuilder.toString(); }
java
public String toHtml() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder .append("<p>") .append(objectNode.get(TYPE).asText()).append(": ") .append(objectNode.get(MESSAGE).asText()).append(" -> ") .append(objectNode.get(DETAILS).toString()) .append("</p>"); return stringBuilder.toString(); }
[ "public", "String", "toHtml", "(", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "stringBuilder", ".", "append", "(", "\"<p>\"", ")", ".", "append", "(", "objectNode", ".", "get", "(", "TYPE", ")", ".", "asText", ...
Get the error as a string in html format @return error in html format
[ "Get", "the", "error", "as", "a", "string", "in", "html", "format" ]
ca3481066819d01169873aeb145ab3bf5c736afe
https://github.com/owetterau/neo4j-websockets/blob/ca3481066819d01169873aeb145ab3bf5c736afe/core/src/main/java/de/oliverwetterau/neo4j/websockets/core/data/Error.java#L110-L121
train
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.createLifecycleListener
LifecycleListener createLifecycleListener(final WeakReference<ComapiChatClient> ref) { return new LifecycleListener() { /** * App foregrounded. * * @param context Application context */ public void onForegrounded(Context context) { ComapiChatClient client = ref.get(); if (client != null) { client.service().messaging().synchroniseStore(null); } } /** * App backgrounded. * * @param context Application context */ public void onBackgrounded(Context context) { } }; }
java
LifecycleListener createLifecycleListener(final WeakReference<ComapiChatClient> ref) { return new LifecycleListener() { /** * App foregrounded. * * @param context Application context */ public void onForegrounded(Context context) { ComapiChatClient client = ref.get(); if (client != null) { client.service().messaging().synchroniseStore(null); } } /** * App backgrounded. * * @param context Application context */ public void onBackgrounded(Context context) { } }; }
[ "LifecycleListener", "createLifecycleListener", "(", "final", "WeakReference", "<", "ComapiChatClient", ">", "ref", ")", "{", "return", "new", "LifecycleListener", "(", ")", "{", "/**\n * App foregrounded.\n *\n * @param context Application conte...
Creates listener for Application visibility. @param ref Weak reference to comapi client used to trigger synchronisation in response to app being foregrounded. @return Listener to app lifecycle changes.
[ "Creates", "listener", "for", "Application", "visibility", "." ]
388f37bfacb7793ce30c92ab70e5f32848bbe460
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L156-L181
train
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.addListener
public void addListener(final ParticipantsListener participantsListener) { if (participantsListener != null) { MessagingListener messagingListener = new MessagingListener() { @Override public void onParticipantAdded(ParticipantAddedEvent event) { participantsListener.onParticipantAdded(event); } @Override public void onParticipantUpdated(ParticipantUpdatedEvent event) { participantsListener.onParticipantUpdated(event); } @Override public void onParticipantRemoved(ParticipantRemovedEvent event) { participantsListener.onParticipantRemoved(event); } }; participantsListeners.put(participantsListener, messagingListener); client.addListener(messagingListener); } }
java
public void addListener(final ParticipantsListener participantsListener) { if (participantsListener != null) { MessagingListener messagingListener = new MessagingListener() { @Override public void onParticipantAdded(ParticipantAddedEvent event) { participantsListener.onParticipantAdded(event); } @Override public void onParticipantUpdated(ParticipantUpdatedEvent event) { participantsListener.onParticipantUpdated(event); } @Override public void onParticipantRemoved(ParticipantRemovedEvent event) { participantsListener.onParticipantRemoved(event); } }; participantsListeners.put(participantsListener, messagingListener); client.addListener(messagingListener); } }
[ "public", "void", "addListener", "(", "final", "ParticipantsListener", "participantsListener", ")", "{", "if", "(", "participantsListener", "!=", "null", ")", "{", "MessagingListener", "messagingListener", "=", "new", "MessagingListener", "(", ")", "{", "@", "Overri...
Registers listener for changes in participant list in conversations. Delivers participant added, updated and removed events. @param participantsListener Listener for changes in participant list in conversations.
[ "Registers", "listener", "for", "changes", "in", "participant", "list", "in", "conversations", ".", "Delivers", "participant", "added", "updated", "and", "removed", "events", "." ]
388f37bfacb7793ce30c92ab70e5f32848bbe460
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L230-L252
train
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.removeListener
public void removeListener(final ParticipantsListener participantsListener) { MessagingListener messagingListener = participantsListeners.get(participantsListener); if (messagingListener != null) { client.removeListener(messagingListener); participantsListeners.remove(participantsListener); } }
java
public void removeListener(final ParticipantsListener participantsListener) { MessagingListener messagingListener = participantsListeners.get(participantsListener); if (messagingListener != null) { client.removeListener(messagingListener); participantsListeners.remove(participantsListener); } }
[ "public", "void", "removeListener", "(", "final", "ParticipantsListener", "participantsListener", ")", "{", "MessagingListener", "messagingListener", "=", "participantsListeners", ".", "get", "(", "participantsListener", ")", ";", "if", "(", "messagingListener", "!=", "...
Removes listener for changes in participant list in conversations. @param participantsListener Listener for changes in participant list in conversations.
[ "Removes", "listener", "for", "changes", "in", "participant", "list", "in", "conversations", "." ]
388f37bfacb7793ce30c92ab70e5f32848bbe460
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L259-L265
train
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.addListener
public void addListener(final ProfileListener profileListener) { if (profileListener != null) { com.comapi.ProfileListener foundationListener = new com.comapi.ProfileListener() { @Override public void onProfileUpdate(ProfileUpdateEvent event) { profileListener.onProfileUpdate(event); } }; profileListeners.put(profileListener, foundationListener); client.addListener(foundationListener); } }
java
public void addListener(final ProfileListener profileListener) { if (profileListener != null) { com.comapi.ProfileListener foundationListener = new com.comapi.ProfileListener() { @Override public void onProfileUpdate(ProfileUpdateEvent event) { profileListener.onProfileUpdate(event); } }; profileListeners.put(profileListener, foundationListener); client.addListener(foundationListener); } }
[ "public", "void", "addListener", "(", "final", "ProfileListener", "profileListener", ")", "{", "if", "(", "profileListener", "!=", "null", ")", "{", "com", ".", "comapi", ".", "ProfileListener", "foundationListener", "=", "new", "com", ".", "comapi", ".", "Pro...
Registers listener for changes in profile details. @param profileListener Listener for changes in in profile details.
[ "Registers", "listener", "for", "changes", "in", "profile", "details", "." ]
388f37bfacb7793ce30c92ab70e5f32848bbe460
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L272-L283
train
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.removeListener
public void removeListener(final ProfileListener profileListener) { com.comapi.ProfileListener foundationListener = profileListeners.get(profileListener); if (foundationListener != null) { client.removeListener(foundationListener); profileListeners.remove(profileListener); } }
java
public void removeListener(final ProfileListener profileListener) { com.comapi.ProfileListener foundationListener = profileListeners.get(profileListener); if (foundationListener != null) { client.removeListener(foundationListener); profileListeners.remove(profileListener); } }
[ "public", "void", "removeListener", "(", "final", "ProfileListener", "profileListener", ")", "{", "com", ".", "comapi", ".", "ProfileListener", "foundationListener", "=", "profileListeners", ".", "get", "(", "profileListener", ")", ";", "if", "(", "foundationListene...
Removes listener for changes in profile details. @param profileListener Listener for changes in in profile details.
[ "Removes", "listener", "for", "changes", "in", "profile", "details", "." ]
388f37bfacb7793ce30c92ab70e5f32848bbe460
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L290-L296
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/JAASSystem.java
JAASSystem.initialize
public static void initialize() throws CacheReloadException { if (InfinispanCache.get().exists(JAASSystem.IDCACHE)) { InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE).clear(); } else { InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE) .addListener(new CacheLogListener(JAASSystem.LOG)); } if (InfinispanCache.get().exists(JAASSystem.NAMECACHE)) { InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE).clear(); } else { InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE) .addListener(new CacheLogListener(JAASSystem.LOG)); } JAASSystem.getJAASSystemFromDB(JAASSystem.SQL_SELECT, null); }
java
public static void initialize() throws CacheReloadException { if (InfinispanCache.get().exists(JAASSystem.IDCACHE)) { InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE).clear(); } else { InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE) .addListener(new CacheLogListener(JAASSystem.LOG)); } if (InfinispanCache.get().exists(JAASSystem.NAMECACHE)) { InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE).clear(); } else { InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE) .addListener(new CacheLogListener(JAASSystem.LOG)); } JAASSystem.getJAASSystemFromDB(JAASSystem.SQL_SELECT, null); }
[ "public", "static", "void", "initialize", "(", ")", "throws", "CacheReloadException", "{", "if", "(", "InfinispanCache", ".", "get", "(", ")", ".", "exists", "(", "JAASSystem", ".", "IDCACHE", ")", ")", "{", "InfinispanCache", ".", "get", "(", ")", ".", ...
Method to initialize the cache of JAAS systems. @throws CacheReloadException on error
[ "Method", "to", "initialize", "the", "cache", "of", "JAAS", "systems", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/JAASSystem.java#L296-L312
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/JAASSystem.java
JAASSystem.getAllJAASSystems
public static Set<JAASSystem> getAllJAASSystems() { final Set<JAASSystem> ret = new HashSet<>(); final Cache<Long, JAASSystem> cache = InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE); for (final Map.Entry<Long, JAASSystem> entry : cache.entrySet()) { ret.add(entry.getValue()); } return ret; }
java
public static Set<JAASSystem> getAllJAASSystems() { final Set<JAASSystem> ret = new HashSet<>(); final Cache<Long, JAASSystem> cache = InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE); for (final Map.Entry<Long, JAASSystem> entry : cache.entrySet()) { ret.add(entry.getValue()); } return ret; }
[ "public", "static", "Set", "<", "JAASSystem", ">", "getAllJAASSystems", "(", ")", "{", "final", "Set", "<", "JAASSystem", ">", "ret", "=", "new", "HashSet", "<>", "(", ")", ";", "final", "Cache", "<", "Long", ",", "JAASSystem", ">", "cache", "=", "Infi...
Returns all cached JAAS system in a set. @return set of all loaded and cached JAAS systems
[ "Returns", "all", "cached", "JAAS", "system", "in", "a", "set", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/JAASSystem.java#L356-L364
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.reset
void reset(boolean deleteFile) { String path = this.path; this.path = null; this.projectId = -1; this.projectToken = null; this.deviceId = null; this.client = null; synchronized (dataStoreLock) { dataStore = null; dataBatches.clear(); } if (deleteFile) { File f = new File(path, DEVICE_FILENAME); if (f.exists()) { f.delete(); } } }
java
void reset(boolean deleteFile) { String path = this.path; this.path = null; this.projectId = -1; this.projectToken = null; this.deviceId = null; this.client = null; synchronized (dataStoreLock) { dataStore = null; dataBatches.clear(); } if (deleteFile) { File f = new File(path, DEVICE_FILENAME); if (f.exists()) { f.delete(); } } }
[ "void", "reset", "(", "boolean", "deleteFile", ")", "{", "String", "path", "=", "this", ".", "path", ";", "this", ".", "path", "=", "null", ";", "this", ".", "projectId", "=", "-", "1", ";", "this", ".", "projectToken", "=", "null", ";", "this", "....
Resets the iobeam client to uninitialized state, including removing any added data. @param deleteFile Whether or not to delete the on-disk device ID. Tests use false sometimes.
[ "Resets", "the", "iobeam", "client", "to", "uninitialized", "state", "including", "removing", "any", "added", "data", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L253-L273
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.registerDeviceAsync
public void registerDeviceAsync(String deviceId, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).build(); registerDeviceAsync(d, callback); }
java
public void registerDeviceAsync(String deviceId, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).build(); registerDeviceAsync(d, callback); }
[ "public", "void", "registerDeviceAsync", "(", "String", "deviceId", ",", "RegisterCallback", "callback", ")", "{", "final", "Device", "d", "=", "new", "Device", ".", "Builder", "(", "projectId", ")", ".", "id", "(", "deviceId", ")", ".", "build", "(", ")",...
Registers a device asynchronously with the provided device ID. See {@link #registerDeviceAsync(Device, RegisterCallback)} for more details. @param deviceId Desired device ID. @param callback Callback for result of the registration. @throws ApiException Thrown if the iobeam client is not initialized.
[ "Registers", "a", "device", "asynchronously", "with", "the", "provided", "device", "ID", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L572-L575
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.registerDeviceWithIdAsync
@Deprecated public void registerDeviceWithIdAsync(String deviceId, String deviceName, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).name(deviceName).build(); registerDeviceAsync(d, callback); }
java
@Deprecated public void registerDeviceWithIdAsync(String deviceId, String deviceName, RegisterCallback callback) { final Device d = new Device.Builder(projectId).id(deviceId).name(deviceName).build(); registerDeviceAsync(d, callback); }
[ "@", "Deprecated", "public", "void", "registerDeviceWithIdAsync", "(", "String", "deviceId", ",", "String", "deviceName", ",", "RegisterCallback", "callback", ")", "{", "final", "Device", "d", "=", "new", "Device", ".", "Builder", "(", "projectId", ")", ".", "...
Registers a device asynchronously with the provided device ID and name. See {@link #registerDeviceAsync(Device, RegisterCallback)} for more details. @param deviceId Desired device ID. @param callback Callback for result of the registration. @param deviceName Desired device name. @throws ApiException Thrown if the iobeam client is not initialized. @deprecated Use {@link #registerDeviceAsync(Device, RegisterCallback)} instead. Will be removed after 0.6.x
[ "Registers", "a", "device", "asynchronously", "with", "the", "provided", "device", "ID", "and", "name", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L589-L594
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.setDeviceId
public void setDeviceId(String deviceId) throws CouldNotPersistException { this.deviceId = deviceId; if (deviceId != null && path != null) { persistDeviceId(); } }
java
public void setDeviceId(String deviceId) throws CouldNotPersistException { this.deviceId = deviceId; if (deviceId != null && path != null) { persistDeviceId(); } }
[ "public", "void", "setDeviceId", "(", "String", "deviceId", ")", "throws", "CouldNotPersistException", "{", "this", ".", "deviceId", "=", "deviceId", ";", "if", "(", "deviceId", "!=", "null", "&&", "path", "!=", "null", ")", "{", "persistDeviceId", "(", ")",...
Sets the current device id that the iobeam client is associated with. @param deviceId Device id to be associated with the iobeam client. @throws CouldNotPersistException Thrown if there are problems saving the device id to disk.
[ "Sets", "the", "current", "device", "id", "that", "the", "iobeam", "client", "is", "associated", "with", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L684-L689
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.getDataStore
public DataStore getDataStore(final Collection<String> columns) { for (DataStore ds : dataBatches) { if (ds.hasColumns(columns)) { return ds; } } return null; }
java
public DataStore getDataStore(final Collection<String> columns) { for (DataStore ds : dataBatches) { if (ds.hasColumns(columns)) { return ds; } } return null; }
[ "public", "DataStore", "getDataStore", "(", "final", "Collection", "<", "String", ">", "columns", ")", "{", "for", "(", "DataStore", "ds", ":", "dataBatches", ")", "{", "if", "(", "ds", ".", "hasColumns", "(", "columns", ")", ")", "{", "return", "ds", ...
Get the DataStore associated with a collection of column names. @param columns Collection of columns to find a corresponding DataStore for. @return DataStore corresponding to the columns, or null if not found.
[ "Get", "the", "DataStore", "associated", "with", "a", "collection", "of", "column", "names", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L706-L713
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.getOrAddDataStore
public DataStore getOrAddDataStore(final Collection<String> columns) { DataStore ret = getDataStore(columns); if (ret == null) { ret = this.createDataStore(columns); } return ret; }
java
public DataStore getOrAddDataStore(final Collection<String> columns) { DataStore ret = getDataStore(columns); if (ret == null) { ret = this.createDataStore(columns); } return ret; }
[ "public", "DataStore", "getOrAddDataStore", "(", "final", "Collection", "<", "String", ">", "columns", ")", "{", "DataStore", "ret", "=", "getDataStore", "(", "columns", ")", ";", "if", "(", "ret", "==", "null", ")", "{", "ret", "=", "this", ".", "create...
Get the DataStore associated with a collection of column names, adding a new one if necessary. @param columns Collection of columns to find a corresponding DataStore for. @return DataStore corresponding to the columns.
[ "Get", "the", "DataStore", "associated", "with", "a", "collection", "of", "column", "names", "adding", "a", "new", "one", "if", "necessary", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L722-L728
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.addData
@Deprecated public void addData(String seriesName, DataPoint dataPoint) { synchronized (dataStoreLock) { _addDataWithoutLock(seriesName, dataPoint); } }
java
@Deprecated public void addData(String seriesName, DataPoint dataPoint) { synchronized (dataStoreLock) { _addDataWithoutLock(seriesName, dataPoint); } }
[ "@", "Deprecated", "public", "void", "addData", "(", "String", "seriesName", ",", "DataPoint", "dataPoint", ")", "{", "synchronized", "(", "dataStoreLock", ")", "{", "_addDataWithoutLock", "(", "seriesName", ",", "dataPoint", ")", ";", "}", "}" ]
Adds a data value to a particular series in the data store. @param seriesName The name of the series that the data belongs to. @param dataPoint The DataPoint representing a data value at a particular time. @deprecated Use DataStore and `trackDataStore()` instead.
[ "Adds", "a", "data", "value", "to", "a", "particular", "series", "in", "the", "data", "store", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L753-L758
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.addDataMapToSeries
@Deprecated public boolean addDataMapToSeries(String[] seriesNames, DataPoint[] points) { if (seriesNames == null || points == null || points.length != seriesNames.length) { return false; } synchronized (dataStoreLock) { for (int i = 0; i < seriesNames.length; i++) { _addDataWithoutLock(seriesNames[i], points[i]); } } return true; }
java
@Deprecated public boolean addDataMapToSeries(String[] seriesNames, DataPoint[] points) { if (seriesNames == null || points == null || points.length != seriesNames.length) { return false; } synchronized (dataStoreLock) { for (int i = 0; i < seriesNames.length; i++) { _addDataWithoutLock(seriesNames[i], points[i]); } } return true; }
[ "@", "Deprecated", "public", "boolean", "addDataMapToSeries", "(", "String", "[", "]", "seriesNames", ",", "DataPoint", "[", "]", "points", ")", "{", "if", "(", "seriesNames", "==", "null", "||", "points", "==", "null", "||", "points", ".", "length", "!=",...
Adds a list of data points to a list of series in the data store. This is essentially a 'zip' operation on the points and series names, where the first point is put in the first series, the second point in the second series, etc. Both lists MUST be the same size. @param points List of DataPoints to be added @param seriesNames List of corresponding series for the datapoints. @return True if the points are added; false if the lists are not the same size, or adding fails. @deprecated Use {@link DataStore} and {@link #createDataStore(Collection)} instead.
[ "Adds", "a", "list", "of", "data", "points", "to", "a", "list", "of", "series", "in", "the", "data", "store", ".", "This", "is", "essentially", "a", "zip", "operation", "on", "the", "points", "and", "series", "names", "where", "the", "first", "point", ...
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L771-L783
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.createDataStore
public DataStore createDataStore(Collection<String> columns) { DataStore b = new DataStore(columns); trackDataStore(b); return b; }
java
public DataStore createDataStore(Collection<String> columns) { DataStore b = new DataStore(columns); trackDataStore(b); return b; }
[ "public", "DataStore", "createDataStore", "(", "Collection", "<", "String", ">", "columns", ")", "{", "DataStore", "b", "=", "new", "DataStore", "(", "columns", ")", ";", "trackDataStore", "(", "b", ")", ";", "return", "b", ";", "}" ]
Creates a DataStore with a given set of columns, and tracks it so that any data added will be sent on a subsequent send calls. @param columns Columns in the DataStore @return DataStore for storing data for a given set of columns.
[ "Creates", "a", "DataStore", "with", "a", "given", "set", "of", "columns", "and", "tracks", "it", "so", "that", "any", "data", "added", "will", "be", "sent", "on", "a", "subsequent", "send", "calls", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L813-L818
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.getDataSize
public long getDataSize() { long size = 0; synchronized (dataStoreLock) { for (DataStore b : dataBatches) { size += b.getDataSize(); } } return size; }
java
public long getDataSize() { long size = 0; synchronized (dataStoreLock) { for (DataStore b : dataBatches) { size += b.getDataSize(); } } return size; }
[ "public", "long", "getDataSize", "(", ")", "{", "long", "size", "=", "0", ";", "synchronized", "(", "dataStoreLock", ")", "{", "for", "(", "DataStore", "b", ":", "dataBatches", ")", "{", "size", "+=", "b", ".", "getDataSize", "(", ")", ";", "}", "}",...
Returns the size of all of the data in all the series. @return Size of the data store, or 0 if it has not been made yet.
[ "Returns", "the", "size", "of", "all", "of", "the", "data", "in", "all", "the", "series", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L858-L866
train
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.getSeriesSize
private int getSeriesSize(String series) { synchronized (dataStoreLock) { if (dataStore == null) { return 0; } if (seriesToBatch.containsKey(series)) { return (int) seriesToBatch.get(series).getDataSize(); } else { return 0; } } }
java
private int getSeriesSize(String series) { synchronized (dataStoreLock) { if (dataStore == null) { return 0; } if (seriesToBatch.containsKey(series)) { return (int) seriesToBatch.get(series).getDataSize(); } else { return 0; } } }
[ "private", "int", "getSeriesSize", "(", "String", "series", ")", "{", "synchronized", "(", "dataStoreLock", ")", "{", "if", "(", "dataStore", "==", "null", ")", "{", "return", "0", ";", "}", "if", "(", "seriesToBatch", ".", "containsKey", "(", "series", ...
Returns the size of the data set in a particular series. @param series The series to query @return Size of the data set, or 0 if series does not exist.
[ "Returns", "the", "size", "of", "the", "data", "set", "in", "a", "particular", "series", "." ]
06e7aeb2a313503392358a3671de7d28628d0e33
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L886-L897
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/common/SystemConfiguration.java
SystemConfiguration.reload
public void reload() { InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE).remove(uuid); InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE).remove(id); InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE).remove(name); }
java
public void reload() { InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE).remove(uuid); InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE).remove(id); InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE).remove(name); }
[ "public", "void", "reload", "(", ")", "{", "InfinispanCache", ".", "get", "(", ")", ".", "<", "UUID", ",", "SystemConfiguration", ">", "getCache", "(", "SystemConfiguration", ".", "UUIDCACHE", ")", ".", "remove", "(", "uuid", ")", ";", "InfinispanCache", "...
Reload the current SystemConfiguration by removing it from the Cache.
[ "Reload", "the", "current", "SystemConfiguration", "by", "removing", "it", "from", "the", "Cache", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/SystemConfiguration.java#L593-L598
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/common/SystemConfiguration.java
SystemConfiguration.readConfig
private void readConfig() throws CacheReloadException { Connection con = null; try { boolean closeContext = false; if (!Context.isThreadActive()) { Context.begin(); closeContext = true; } final List<Object[]> dbValues = new ArrayList<>(); con = Context.getConnection(); PreparedStatement stmt = null; try { stmt = con.prepareStatement(SystemConfiguration.SQL_CONFIG); stmt.setObject(1, getId()); final ResultSet rs = stmt.executeQuery(); while (rs.next()) { dbValues.add(new Object[] { rs.getLong(1), rs.getString(2), rs.getString(3), rs.getLong(4), rs.getString(5) }); } rs.close(); } finally { if (stmt != null) { stmt.close(); } } con.commit(); if (closeContext) { Context.rollback(); } for (final Object[] row : dbValues) { final Long typeId = (Long) row[0]; final String key = (String) row[1]; final String value = (String) row[2]; final Long companyId = (Long) row[3]; final String appkey = (String) row[4]; final Type type = Type.get(typeId); final ConfType confType; if (type.equals(CIAdminCommon.SystemConfigurationLink.getType())) { confType = ConfType.LINK; } else if (type.equals(CIAdminCommon.SystemConfigurationObjectAttribute.getType())) { confType = ConfType.OBJATTR; } else { confType = ConfType.ATTRIBUTE; } values.add(new Value(confType, key, value, companyId, appkey)); } } catch (final SQLException e) { throw new CacheReloadException("could not read SystemConfiguration attributes", e); } catch (final EFapsException e) { throw new CacheReloadException("could not read SystemConfiguration attributes", e); } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new CacheReloadException("Cannot read a type for an attribute.", e); } } }
java
private void readConfig() throws CacheReloadException { Connection con = null; try { boolean closeContext = false; if (!Context.isThreadActive()) { Context.begin(); closeContext = true; } final List<Object[]> dbValues = new ArrayList<>(); con = Context.getConnection(); PreparedStatement stmt = null; try { stmt = con.prepareStatement(SystemConfiguration.SQL_CONFIG); stmt.setObject(1, getId()); final ResultSet rs = stmt.executeQuery(); while (rs.next()) { dbValues.add(new Object[] { rs.getLong(1), rs.getString(2), rs.getString(3), rs.getLong(4), rs.getString(5) }); } rs.close(); } finally { if (stmt != null) { stmt.close(); } } con.commit(); if (closeContext) { Context.rollback(); } for (final Object[] row : dbValues) { final Long typeId = (Long) row[0]; final String key = (String) row[1]; final String value = (String) row[2]; final Long companyId = (Long) row[3]; final String appkey = (String) row[4]; final Type type = Type.get(typeId); final ConfType confType; if (type.equals(CIAdminCommon.SystemConfigurationLink.getType())) { confType = ConfType.LINK; } else if (type.equals(CIAdminCommon.SystemConfigurationObjectAttribute.getType())) { confType = ConfType.OBJATTR; } else { confType = ConfType.ATTRIBUTE; } values.add(new Value(confType, key, value, companyId, appkey)); } } catch (final SQLException e) { throw new CacheReloadException("could not read SystemConfiguration attributes", e); } catch (final EFapsException e) { throw new CacheReloadException("could not read SystemConfiguration attributes", e); } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new CacheReloadException("Cannot read a type for an attribute.", e); } } }
[ "private", "void", "readConfig", "(", ")", "throws", "CacheReloadException", "{", "Connection", "con", "=", "null", ";", "try", "{", "boolean", "closeContext", "=", "false", ";", "if", "(", "!", "Context", ".", "isThreadActive", "(", ")", ")", "{", "Contex...
Read the config. @throws CacheReloadException on error
[ "Read", "the", "config", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/SystemConfiguration.java#L604-L671
train
gpein/jcache-jee7
src/main/java/io/github/gpein/jcache/interfaces/rest/CacheResource.java
CacheResource.put
@PUT @Consumes(MediaType.APPLICATION_JSON) public Response put(@PathParam("cacheName") String cacheName, Cache cache) { if (!cacheService.isPresent(cacheName)) { return Response.status(Response.Status.NOT_FOUND).build(); } cacheService.update(cacheName, cache); return Response.ok().build(); }
java
@PUT @Consumes(MediaType.APPLICATION_JSON) public Response put(@PathParam("cacheName") String cacheName, Cache cache) { if (!cacheService.isPresent(cacheName)) { return Response.status(Response.Status.NOT_FOUND).build(); } cacheService.update(cacheName, cache); return Response.ok().build(); }
[ "@", "PUT", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "Response", "put", "(", "@", "PathParam", "(", "\"cacheName\"", ")", "String", "cacheName", ",", "Cache", "cache", ")", "{", "if", "(", "!", "cacheService", ".", "isPres...
Modify state of a single cache @param cacheName name of cache to modify @param cache data to modify @return response with status code 200
[ "Modify", "state", "of", "a", "single", "cache" ]
492dd3bb6423cdfb064e7005952a7b79fe4cd7aa
https://github.com/gpein/jcache-jee7/blob/492dd3bb6423cdfb064e7005952a7b79fe4cd7aa/src/main/java/io/github/gpein/jcache/interfaces/rest/CacheResource.java#L45-L56
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.addAttributes
protected void addAttributes(final boolean _inherited, final Attribute... _attributes) throws CacheReloadException { for (final Attribute attribute : _attributes) { if (!this.attributes.containsKey(attribute.getName())) { Type.LOG.trace("adding Attribute:'{}' to type: '{}'", attribute.getName(), getName()); // evaluate for type attribute if (attribute.getAttributeType().getClassRepr().equals(TypeType.class)) { this.typeAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(StatusType.class) && !_inherited) { // evaluate for status, an inherited attribute will not // overwrite the original attribute this.statusAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(CompanyLinkType.class) || attribute.getAttributeType().getClassRepr().equals(ConsortiumLinkType.class)) { // evaluate for company this.companyAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(GroupLinkType.class)) { // evaluate for group this.groupAttributeName = attribute.getName(); } this.attributes.put(attribute.getName(), attribute); if (attribute.getTable() != null) { this.tables.add(attribute.getTable()); attribute.getTable().addType(getId()); if (getMainTable() == null) { setMainTable(attribute.getTable()); } } setDirty(); } } }
java
protected void addAttributes(final boolean _inherited, final Attribute... _attributes) throws CacheReloadException { for (final Attribute attribute : _attributes) { if (!this.attributes.containsKey(attribute.getName())) { Type.LOG.trace("adding Attribute:'{}' to type: '{}'", attribute.getName(), getName()); // evaluate for type attribute if (attribute.getAttributeType().getClassRepr().equals(TypeType.class)) { this.typeAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(StatusType.class) && !_inherited) { // evaluate for status, an inherited attribute will not // overwrite the original attribute this.statusAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(CompanyLinkType.class) || attribute.getAttributeType().getClassRepr().equals(ConsortiumLinkType.class)) { // evaluate for company this.companyAttributeName = attribute.getName(); } else if (attribute.getAttributeType().getClassRepr().equals(GroupLinkType.class)) { // evaluate for group this.groupAttributeName = attribute.getName(); } this.attributes.put(attribute.getName(), attribute); if (attribute.getTable() != null) { this.tables.add(attribute.getTable()); attribute.getTable().addType(getId()); if (getMainTable() == null) { setMainTable(attribute.getTable()); } } setDirty(); } } }
[ "protected", "void", "addAttributes", "(", "final", "boolean", "_inherited", ",", "final", "Attribute", "...", "_attributes", ")", "throws", "CacheReloadException", "{", "for", "(", "final", "Attribute", "attribute", ":", "_attributes", ")", "{", "if", "(", "!",...
Add attributes to this type and all child types of this type. Recursive method. @param _inherited is the attribute inherited or form this type @param _attributes attributes to add @throws CacheReloadException on error
[ "Add", "attributes", "to", "this", "type", "and", "all", "child", "types", "of", "this", "type", ".", "Recursive", "method", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L467-L500
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.inheritAttributes
protected void inheritAttributes() throws CacheReloadException { Type parent = getParentType(); final List<Attribute> attributesTmp = new ArrayList<>(); while (parent != null) { for (final Attribute attribute : getParentType().getAttributes().values()) { attributesTmp.add(attribute.copy(getId())); } parent = parent.getParentType(); } addAttributes(true, attributesTmp.toArray(new Attribute[attributesTmp.size()])); }
java
protected void inheritAttributes() throws CacheReloadException { Type parent = getParentType(); final List<Attribute> attributesTmp = new ArrayList<>(); while (parent != null) { for (final Attribute attribute : getParentType().getAttributes().values()) { attributesTmp.add(attribute.copy(getId())); } parent = parent.getParentType(); } addAttributes(true, attributesTmp.toArray(new Attribute[attributesTmp.size()])); }
[ "protected", "void", "inheritAttributes", "(", ")", "throws", "CacheReloadException", "{", "Type", "parent", "=", "getParentType", "(", ")", ";", "final", "List", "<", "Attribute", ">", "attributesTmp", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", ...
Inherit Attributes are child types. @throws CacheReloadException on error
[ "Inherit", "Attributes", "are", "child", "types", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L506-L518
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.getTypeAttribute
public Attribute getTypeAttribute() { final Attribute ret; if (this.typeAttributeName == null && getParentType() != null) { ret = getParentType().getTypeAttribute(); } else { ret = this.attributes.get(this.typeAttributeName); } return ret; }
java
public Attribute getTypeAttribute() { final Attribute ret; if (this.typeAttributeName == null && getParentType() != null) { ret = getParentType().getTypeAttribute(); } else { ret = this.attributes.get(this.typeAttributeName); } return ret; }
[ "public", "Attribute", "getTypeAttribute", "(", ")", "{", "final", "Attribute", "ret", ";", "if", "(", "this", ".", "typeAttributeName", "==", "null", "&&", "getParentType", "(", ")", "!=", "null", ")", "{", "ret", "=", "getParentType", "(", ")", ".", "g...
Get the attribute containing the type information. @return attribute containing the type information
[ "Get", "the", "attribute", "containing", "the", "type", "information", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L585-L594
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.checkAccess
@SuppressWarnings("unchecked") public Map<Instance, Boolean> checkAccess(final Collection<Instance> _instances, final AccessType _accessType) throws EFapsException { Map<Instance, Boolean> ret = new HashMap<>(); if (_instances != null && !_instances.isEmpty() && _instances.size() == 1) { final Instance instance = _instances.iterator().next(); ret.put(instance, hasAccess(instance, _accessType)); } else { final List<EventDefinition> events = super.getEvents(EventType.ACCESSCHECK); if (events != null) { final Parameter parameter = new Parameter(); parameter.put(ParameterValues.OTHERS, _instances); parameter.put(ParameterValues.ACCESSTYPE, _accessType); parameter.put(ParameterValues.CLASS, this); for (final EventDefinition event : events) { final Return retrn = event.execute(parameter); ret = (Map<Instance, Boolean>) retrn.get(ReturnValues.VALUES); } } else { for (final Instance instance : _instances) { ret.put(instance, true); } } } return ret; }
java
@SuppressWarnings("unchecked") public Map<Instance, Boolean> checkAccess(final Collection<Instance> _instances, final AccessType _accessType) throws EFapsException { Map<Instance, Boolean> ret = new HashMap<>(); if (_instances != null && !_instances.isEmpty() && _instances.size() == 1) { final Instance instance = _instances.iterator().next(); ret.put(instance, hasAccess(instance, _accessType)); } else { final List<EventDefinition> events = super.getEvents(EventType.ACCESSCHECK); if (events != null) { final Parameter parameter = new Parameter(); parameter.put(ParameterValues.OTHERS, _instances); parameter.put(ParameterValues.ACCESSTYPE, _accessType); parameter.put(ParameterValues.CLASS, this); for (final EventDefinition event : events) { final Return retrn = event.execute(parameter); ret = (Map<Instance, Boolean>) retrn.get(ReturnValues.VALUES); } } else { for (final Instance instance : _instances) { ret.put(instance, true); } } } return ret; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Map", "<", "Instance", ",", "Boolean", ">", "checkAccess", "(", "final", "Collection", "<", "Instance", ">", "_instances", ",", "final", "AccessType", "_accessType", ")", "throws", "EFapsException", ...
Method to check the access right for a list of instances. @param _instances list of instances @param _accessType access type @throws EFapsException on error @return Map of instances to boolean
[ "Method", "to", "check", "the", "access", "right", "for", "a", "list", "of", "instances", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L744-L771
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.addClassifiedByType
protected void addClassifiedByType(final Classification _classification) { this.checked4classifiedBy = true; this.classifiedByTypes.add(_classification.getId()); setDirty(); }
java
protected void addClassifiedByType(final Classification _classification) { this.checked4classifiedBy = true; this.classifiedByTypes.add(_classification.getId()); setDirty(); }
[ "protected", "void", "addClassifiedByType", "(", "final", "Classification", "_classification", ")", "{", "this", ".", "checked4classifiedBy", "=", "true", ";", "this", ".", "classifiedByTypes", ".", "add", "(", "_classification", ".", "getId", "(", ")", ")", ";"...
Add a root Classification to this type. @param _classification classifixation that classifies this type
[ "Add", "a", "root", "Classification", "to", "this", "type", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L887-L892
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.cacheTypesByHierachy
protected static void cacheTypesByHierachy(final Type _type) throws CacheReloadException { final Cache<UUID, Type> cache4UUID = InfinispanCache.get().<UUID, Type>getIgnReCache(Type.UUIDCACHE); if (cache4UUID.getCacheConfiguration().clustering() != null && !cache4UUID.getCacheConfiguration().clustering().cacheMode().equals(CacheMode.LOCAL)) { Type type = _type; while (type.getParentTypeId() != null) { final Cache<Long, Type> cache = InfinispanCache.get().<Long, Type>getIgnReCache(Type.IDCACHE); if (cache.containsKey(type.getParentTypeId())) { type = cache.get(type.getParentTypeId()); } else { type = type.getParentType(); } } type.recacheChildren(); } }
java
protected static void cacheTypesByHierachy(final Type _type) throws CacheReloadException { final Cache<UUID, Type> cache4UUID = InfinispanCache.get().<UUID, Type>getIgnReCache(Type.UUIDCACHE); if (cache4UUID.getCacheConfiguration().clustering() != null && !cache4UUID.getCacheConfiguration().clustering().cacheMode().equals(CacheMode.LOCAL)) { Type type = _type; while (type.getParentTypeId() != null) { final Cache<Long, Type> cache = InfinispanCache.get().<Long, Type>getIgnReCache(Type.IDCACHE); if (cache.containsKey(type.getParentTypeId())) { type = cache.get(type.getParentTypeId()); } else { type = type.getParentType(); } } type.recacheChildren(); } }
[ "protected", "static", "void", "cacheTypesByHierachy", "(", "final", "Type", "_type", ")", "throws", "CacheReloadException", "{", "final", "Cache", "<", "UUID", ",", "Type", ">", "cache4UUID", "=", "InfinispanCache", ".", "get", "(", ")", ".", "<", "UUID", "...
In case of a cluster the types must be cached after the final loading again to be sure that the last instance including all the changes like attribute links etc are up to date. @param _type Type the Hierachy must be cached @throws CacheReloadException on error
[ "In", "case", "of", "a", "cluster", "the", "types", "must", "be", "cached", "after", "the", "final", "loading", "again", "to", "be", "sure", "that", "the", "last", "instance", "including", "all", "the", "changes", "like", "attribute", "links", "etc", "are"...
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L1342-L1359
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/datamodel/Type.java
Type.recacheChildren
private void recacheChildren() throws CacheReloadException { if (isDirty()) { Type.cacheType(this); } for (final Type child : getChildTypes()) { child.recacheChildren(); } }
java
private void recacheChildren() throws CacheReloadException { if (isDirty()) { Type.cacheType(this); } for (final Type child : getChildTypes()) { child.recacheChildren(); } }
[ "private", "void", "recacheChildren", "(", ")", "throws", "CacheReloadException", "{", "if", "(", "isDirty", "(", ")", ")", "{", "Type", ".", "cacheType", "(", "this", ")", ";", "}", "for", "(", "final", "Type", "child", ":", "getChildTypes", "(", ")", ...
Recache the children in dropdown. Used for Caching in cluster. @throws CacheReloadException on error
[ "Recache", "the", "children", "in", "dropdown", ".", "Used", "for", "Caching", "in", "cluster", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/datamodel/Type.java#L1365-L1374
train
casmi/casmi
src/main/java/casmi/matrix/Matrix3D.java
Matrix3D.transpose
@Override public void transpose() { double temp; temp = m01; m01 = m10; m10 = temp; temp = m02; m02 = m20; m20 = temp; temp = m03; m03 = m30; m30 = temp; temp = m12; m12 = m21; m21 = temp; temp = m13; m13 = m31; m31 = temp; temp = m23; m23 = m32; m32 = temp; }
java
@Override public void transpose() { double temp; temp = m01; m01 = m10; m10 = temp; temp = m02; m02 = m20; m20 = temp; temp = m03; m03 = m30; m30 = temp; temp = m12; m12 = m21; m21 = temp; temp = m13; m13 = m31; m31 = temp; temp = m23; m23 = m32; m32 = temp; }
[ "@", "Override", "public", "void", "transpose", "(", ")", "{", "double", "temp", ";", "temp", "=", "m01", ";", "m01", "=", "m10", ";", "m10", "=", "temp", ";", "temp", "=", "m02", ";", "m02", "=", "m20", ";", "m20", "=", "temp", ";", "temp", "=...
Transpose this matrix.
[ "Transpose", "this", "matrix", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/matrix/Matrix3D.java#L528-L537
train
casmi/casmi
src/main/java/casmi/matrix/Matrix3D.java
Matrix3D.determinant3x3
private double determinant3x3(double t00, double t01, double t02, double t10, double t11, double t12, double t20, double t21, double t22) { return (t00 * (t11 * t22 - t12 * t21) + t01 * (t12 * t20 - t10 * t22) + t02 * (t10 * t21 - t11 * t20)); }
java
private double determinant3x3(double t00, double t01, double t02, double t10, double t11, double t12, double t20, double t21, double t22) { return (t00 * (t11 * t22 - t12 * t21) + t01 * (t12 * t20 - t10 * t22) + t02 * (t10 * t21 - t11 * t20)); }
[ "private", "double", "determinant3x3", "(", "double", "t00", ",", "double", "t01", ",", "double", "t02", ",", "double", "t10", ",", "double", "t11", ",", "double", "t12", ",", "double", "t20", ",", "double", "t21", ",", "double", "t22", ")", "{", "retu...
Calculate the determinant of a 3x3 matrix. @return result
[ "Calculate", "the", "determinant", "of", "a", "3x3", "matrix", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/matrix/Matrix3D.java#L602-L608
train
labai/ted
ted-driver/src/main/java/ted/driver/sys/Executors.java
Executors.createChannelExecutor
ThreadPoolExecutor createChannelExecutor(String channel, final String threadPrefix, final int workerCount, int queueSize) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, threadPrefix + "-" + ++counter); } }; ThreadPoolExecutor executor = new ChannelThreadPoolExecutor(channel, workerCount, new LinkedBlockingQueue<Runnable>(queueSize), threadFactory); return executor; }
java
ThreadPoolExecutor createChannelExecutor(String channel, final String threadPrefix, final int workerCount, int queueSize) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, threadPrefix + "-" + ++counter); } }; ThreadPoolExecutor executor = new ChannelThreadPoolExecutor(channel, workerCount, new LinkedBlockingQueue<Runnable>(queueSize), threadFactory); return executor; }
[ "ThreadPoolExecutor", "createChannelExecutor", "(", "String", "channel", ",", "final", "String", "threadPrefix", ",", "final", "int", "workerCount", ",", "int", "queueSize", ")", "{", "ThreadFactory", "threadFactory", "=", "new", "ThreadFactory", "(", ")", "{", "p...
create ThreadPoolExecutor for channel
[ "create", "ThreadPoolExecutor", "for", "channel" ]
2ee197246a78d842c18d6780c48fd903b00608a6
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/Executors.java#L147-L158
train
labai/ted
ted-driver/src/main/java/ted/driver/sys/Executors.java
Executors.createExecutor
ThreadPoolExecutor createExecutor(final String threadPrefix, final int workerCount, int queueSize) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, threadPrefix + "-" + ++counter); } }; ThreadPoolExecutor executor = new ThreadPoolExecutor(workerCount, workerCount, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueSize), threadFactory); return executor; }
java
ThreadPoolExecutor createExecutor(final String threadPrefix, final int workerCount, int queueSize) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, threadPrefix + "-" + ++counter); } }; ThreadPoolExecutor executor = new ThreadPoolExecutor(workerCount, workerCount, 0, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(queueSize), threadFactory); return executor; }
[ "ThreadPoolExecutor", "createExecutor", "(", "final", "String", "threadPrefix", ",", "final", "int", "workerCount", ",", "int", "queueSize", ")", "{", "ThreadFactory", "threadFactory", "=", "new", "ThreadFactory", "(", ")", "{", "private", "int", "counter", "=", ...
create general purpose ThreadPoolExecutor
[ "create", "general", "purpose", "ThreadPoolExecutor" ]
2ee197246a78d842c18d6780c48fd903b00608a6
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/Executors.java#L163-L175
train
labai/ted
ted-driver/src/main/java/ted/driver/sys/Executors.java
Executors.createSchedulerExecutor
ScheduledExecutorService createSchedulerExecutor(final String prefix) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, prefix + ++counter); } }; ScheduledExecutorService executor = java.util.concurrent.Executors.newSingleThreadScheduledExecutor(threadFactory); return executor; }
java
ScheduledExecutorService createSchedulerExecutor(final String prefix) { ThreadFactory threadFactory = new ThreadFactory() { private int counter = 0; @Override public Thread newThread(Runnable runnable) { return new Thread(runnable, prefix + ++counter); } }; ScheduledExecutorService executor = java.util.concurrent.Executors.newSingleThreadScheduledExecutor(threadFactory); return executor; }
[ "ScheduledExecutorService", "createSchedulerExecutor", "(", "final", "String", "prefix", ")", "{", "ThreadFactory", "threadFactory", "=", "new", "ThreadFactory", "(", ")", "{", "private", "int", "counter", "=", "0", ";", "@", "Override", "public", "Thread", "newTh...
create scheduler ThreadPoolExecutor
[ "create", "scheduler", "ThreadPoolExecutor" ]
2ee197246a78d842c18d6780c48fd903b00608a6
https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/Executors.java#L180-L190
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/transaction/AbstractResource.java
AbstractResource.open
protected void open() throws EFapsException { AbstractResource.LOG.debug("open resource:{}", this); if (this.opened) { AbstractResource.LOG.error("resource already opened"); throw new EFapsException(AbstractResource.class, "open.AlreadyOpened"); } try { final Context context = Context.getThreadContext(); context.getTransaction().enlistResource(this); } catch (final RollbackException e) { AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e); throw new EFapsException(AbstractResource.class, "open.RollbackException", e); } catch (final SystemException e) { AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e); throw new EFapsException(AbstractResource.class, "open.SystemException", e); } this.opened = true; }
java
protected void open() throws EFapsException { AbstractResource.LOG.debug("open resource:{}", this); if (this.opened) { AbstractResource.LOG.error("resource already opened"); throw new EFapsException(AbstractResource.class, "open.AlreadyOpened"); } try { final Context context = Context.getThreadContext(); context.getTransaction().enlistResource(this); } catch (final RollbackException e) { AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e); throw new EFapsException(AbstractResource.class, "open.RollbackException", e); } catch (final SystemException e) { AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e); throw new EFapsException(AbstractResource.class, "open.SystemException", e); } this.opened = true; }
[ "protected", "void", "open", "(", ")", "throws", "EFapsException", "{", "AbstractResource", ".", "LOG", ".", "debug", "(", "\"open resource:{}\"", ",", "this", ")", ";", "if", "(", "this", ".", "opened", ")", "{", "AbstractResource", ".", "LOG", ".", "erro...
Opens this connection resource and enlisted this resource in the transaction. @throws EFapsException if the resource is already opened or this resource could not be enlisted
[ "Opens", "this", "connection", "resource", "and", "enlisted", "this", "resource", "in", "the", "transaction", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/transaction/AbstractResource.java#L62-L81
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/transaction/AbstractResource.java
AbstractResource.end
@Override public void end(final Xid _xid, final int _flags) { AbstractResource.LOG.trace("end resource {}, flags {}" + _flags, _xid, _flags); }
java
@Override public void end(final Xid _xid, final int _flags) { AbstractResource.LOG.trace("end resource {}, flags {}" + _flags, _xid, _flags); }
[ "@", "Override", "public", "void", "end", "(", "final", "Xid", "_xid", ",", "final", "int", "_flags", ")", "{", "AbstractResource", ".", "LOG", ".", "trace", "(", "\"end resource {}, flags {}\"", "+", "_flags", ",", "_xid", ",", "_flags", ")", ";", "}" ]
The method ends the work performed on behalf of a transaction branch. Normally nothing must be done, because an instance of a resource is only defined for one transaction. @param _xid global transaction identifier @param _flags flags
[ "The", "method", "ends", "the", "work", "performed", "on", "behalf", "of", "a", "transaction", "branch", ".", "Normally", "nothing", "must", "be", "done", "because", "an", "instance", "of", "a", "resource", "is", "only", "defined", "for", "one", "transaction...
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/transaction/AbstractResource.java#L138-L143
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/Install.java
Install.getUpdateLifecycles
private List<UpdateLifecycle> getUpdateLifecycles() { final List<UpdateLifecycle> ret = new ArrayList<>(); for (final UpdateLifecycle cycle : UpdateLifecycle.values()) { ret.add(cycle); } Collections.sort(ret, (_cycle1, _cycle2) -> _cycle1.getOrder().compareTo(_cycle2.getOrder())); return ret; }
java
private List<UpdateLifecycle> getUpdateLifecycles() { final List<UpdateLifecycle> ret = new ArrayList<>(); for (final UpdateLifecycle cycle : UpdateLifecycle.values()) { ret.add(cycle); } Collections.sort(ret, (_cycle1, _cycle2) -> _cycle1.getOrder().compareTo(_cycle2.getOrder())); return ret; }
[ "private", "List", "<", "UpdateLifecycle", ">", "getUpdateLifecycles", "(", ")", "{", "final", "List", "<", "UpdateLifecycle", ">", "ret", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "UpdateLifecycle", "cycle", ":", "UpdateLifecycle", ...
Method to get all UpdateLifecycle in an ordered List. @return ordered List of all UpdateLifecycle
[ "Method", "to", "get", "all", "UpdateLifecycle", "in", "an", "ordered", "List", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/Install.java#L197-L205
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/update/Install.java
Install.initialise
protected void initialise() throws InstallationException { if (!this.initialised) { this.initialised = true; this.cache.clear(); AppDependency.initialise(); for (final FileType fileType : FileType.values()) { if (fileType == FileType.XML) { for (final InstallFile file : this.files) { if (file.getType() == fileType) { final SaxHandler handler = new SaxHandler(); try { final IUpdate elem = handler.parse(file); final List<IUpdate> list; if (this.cache.containsKey(elem.getIdentifier())) { list = this.cache.get(elem.getIdentifier()); } else { list = new ArrayList<>(); this.cache.put(elem.getIdentifier(), list); } list.add(handler.getUpdate()); } catch (final SAXException e) { throw new InstallationException("initialise()", e); } catch (final IOException e) { throw new InstallationException("initialise()", e); } } } } else { for (final Class<? extends IUpdate> updateClass : fileType.getClazzes()) { Method method = null; try { method = updateClass.getMethod("readFile", InstallFile.class); } catch (final SecurityException e) { throw new InstallationException("initialise()", e); } catch (final NoSuchMethodException e) { throw new InstallationException("initialise()", e); } for (final InstallFile file : this.files) { if (file.getType() == fileType) { Object obj = null; try { obj = method.invoke(null, file); } catch (final IllegalArgumentException e) { throw new InstallationException("initialise()", e); } catch (final IllegalAccessException e) { throw new InstallationException("initialise()", e); } catch (final InvocationTargetException e) { throw new InstallationException("initialise()", e); } if (obj != null && obj instanceof IUpdate) { final IUpdate iUpdate = (IUpdate) obj; final List<IUpdate> list; if (this.cache.containsKey(iUpdate.getIdentifier())) { list = this.cache.get(iUpdate.getIdentifier()); } else { list = new ArrayList<>(); this.cache.put(iUpdate.getIdentifier(), list); } list.add(iUpdate); } } } } } } } }
java
protected void initialise() throws InstallationException { if (!this.initialised) { this.initialised = true; this.cache.clear(); AppDependency.initialise(); for (final FileType fileType : FileType.values()) { if (fileType == FileType.XML) { for (final InstallFile file : this.files) { if (file.getType() == fileType) { final SaxHandler handler = new SaxHandler(); try { final IUpdate elem = handler.parse(file); final List<IUpdate> list; if (this.cache.containsKey(elem.getIdentifier())) { list = this.cache.get(elem.getIdentifier()); } else { list = new ArrayList<>(); this.cache.put(elem.getIdentifier(), list); } list.add(handler.getUpdate()); } catch (final SAXException e) { throw new InstallationException("initialise()", e); } catch (final IOException e) { throw new InstallationException("initialise()", e); } } } } else { for (final Class<? extends IUpdate> updateClass : fileType.getClazzes()) { Method method = null; try { method = updateClass.getMethod("readFile", InstallFile.class); } catch (final SecurityException e) { throw new InstallationException("initialise()", e); } catch (final NoSuchMethodException e) { throw new InstallationException("initialise()", e); } for (final InstallFile file : this.files) { if (file.getType() == fileType) { Object obj = null; try { obj = method.invoke(null, file); } catch (final IllegalArgumentException e) { throw new InstallationException("initialise()", e); } catch (final IllegalAccessException e) { throw new InstallationException("initialise()", e); } catch (final InvocationTargetException e) { throw new InstallationException("initialise()", e); } if (obj != null && obj instanceof IUpdate) { final IUpdate iUpdate = (IUpdate) obj; final List<IUpdate> list; if (this.cache.containsKey(iUpdate.getIdentifier())) { list = this.cache.get(iUpdate.getIdentifier()); } else { list = new ArrayList<>(); this.cache.put(iUpdate.getIdentifier(), list); } list.add(iUpdate); } } } } } } } }
[ "protected", "void", "initialise", "(", ")", "throws", "InstallationException", "{", "if", "(", "!", "this", ".", "initialised", ")", "{", "this", ".", "initialised", "=", "true", ";", "this", ".", "cache", ".", "clear", "(", ")", ";", "AppDependency", "...
Reads all XML update files and parses them. @see #initialised @throws InstallationException on error
[ "Reads", "all", "XML", "update", "files", "and", "parses", "them", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/Install.java#L326-L396
train
casmi/casmi
src/main/java/casmi/graphics/element/Line.java
Line.set
public void set(boolean index, double x, double y) { this.MODE = LINES; if (index == true) { this.x1 = x; this.y1 = y; } else { this.x2 = x; this.y2 = y; } calcG(); dx[0] = x1 - this.x; dx[1] = x2 - this.x; dy[0] = y1 - this.y; dy[1] = y2 - this.y; dz[0] = z1 - 0; dz[1] = z2 - 0; if (dashed) calcDashedLine(); }
java
public void set(boolean index, double x, double y) { this.MODE = LINES; if (index == true) { this.x1 = x; this.y1 = y; } else { this.x2 = x; this.y2 = y; } calcG(); dx[0] = x1 - this.x; dx[1] = x2 - this.x; dy[0] = y1 - this.y; dy[1] = y2 - this.y; dz[0] = z1 - 0; dz[1] = z2 - 0; if (dashed) calcDashedLine(); }
[ "public", "void", "set", "(", "boolean", "index", ",", "double", "x", ",", "double", "y", ")", "{", "this", ".", "MODE", "=", "LINES", ";", "if", "(", "index", "==", "true", ")", "{", "this", ".", "x1", "=", "x", ";", "this", ".", "y1", "=", ...
Sets the coordinates for the first or second point. @param index choose the point; if index is true, the point is first. @param x The x-coordinate of the first or second control point. @param y The y-coordinate of the first or second control point.
[ "Sets", "the", "coordinates", "for", "the", "first", "or", "second", "point", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Line.java#L204-L222
train
casmi/casmi
src/main/java/casmi/graphics/element/Line.java
Line.setDashedLinePram
public void setDashedLinePram(double length, double interval) { this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
java
public void setDashedLinePram(double length, double interval) { this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
[ "public", "void", "setDashedLinePram", "(", "double", "length", ",", "double", "interval", ")", "{", "this", ".", "dashedLineLength", "=", "length", ";", "this", ".", "dashedLineInterval", "=", "interval", ";", "this", ".", "dashed", "=", "true", ";", "calcD...
Sets the parameter for the dashed line. @param length The length of the dashed lines. @param interval The interval of the dashed lines.
[ "Sets", "the", "parameter", "for", "the", "dashed", "line", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Line.java#L288-L293
train
casmi/casmi
src/main/java/casmi/graphics/element/Line.java
Line.getCorner
public Vector3D getCorner(int index) { Vector3D v = new Vector3D(); if (index <= 0) v.set(x1, y1, z1); else v.set(x2, y2, z2); return v; }
java
public Vector3D getCorner(int index) { Vector3D v = new Vector3D(); if (index <= 0) v.set(x1, y1, z1); else v.set(x2, y2, z2); return v; }
[ "public", "Vector3D", "getCorner", "(", "int", "index", ")", "{", "Vector3D", "v", "=", "new", "Vector3D", "(", ")", ";", "if", "(", "index", "<=", "0", ")", "v", ".", "set", "(", "x1", ",", "y1", ",", "z1", ")", ";", "else", "v", ".", "set", ...
Gets coordinates of the point. @param index The index of the point; if the index is 0, the point is first. @return The coordinates of the point.
[ "Gets", "coordinates", "of", "the", "point", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Line.java#L526-L533
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/beans/ValueList.java
ValueList.getValueList
public String getValueList() { final StringBuffer buf = new StringBuffer(); for (final Token token : this.tokens) { switch (token.type) { case EXPRESSION: buf.append("$<").append(token.value).append(">"); break; case TEXT: buf.append(token.value); break; default: break; } } return buf.toString(); }
java
public String getValueList() { final StringBuffer buf = new StringBuffer(); for (final Token token : this.tokens) { switch (token.type) { case EXPRESSION: buf.append("$<").append(token.value).append(">"); break; case TEXT: buf.append(token.value); break; default: break; } } return buf.toString(); }
[ "public", "String", "getValueList", "(", ")", "{", "final", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "final", "Token", "token", ":", "this", ".", "tokens", ")", "{", "switch", "(", "token", ".", "type", ")", "{", ...
Get the ValueList. @return String with the Values, which looks like the original
[ "Get", "the", "ValueList", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L86-L103
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/beans/ValueList.java
ValueList.addExpression
public void addExpression(final String _expression) { this.tokens.add(new Token(ValueList.TokenType.EXPRESSION, _expression)); getExpressions().add(_expression); }
java
public void addExpression(final String _expression) { this.tokens.add(new Token(ValueList.TokenType.EXPRESSION, _expression)); getExpressions().add(_expression); }
[ "public", "void", "addExpression", "(", "final", "String", "_expression", ")", "{", "this", ".", "tokens", ".", "add", "(", "new", "Token", "(", "ValueList", ".", "TokenType", ".", "EXPRESSION", ",", "_expression", ")", ")", ";", "getExpressions", "(", ")"...
Add an Expression to this ValueList. @param _expression String with the expression
[ "Add", "an", "Expression", "to", "this", "ValueList", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L110-L114
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/beans/ValueList.java
ValueList.addText
public void addText(final String _text) { this.tokens.add(new Token(ValueList.TokenType.TEXT, _text)); }
java
public void addText(final String _text) { this.tokens.add(new Token(ValueList.TokenType.TEXT, _text)); }
[ "public", "void", "addText", "(", "final", "String", "_text", ")", "{", "this", ".", "tokens", ".", "add", "(", "new", "Token", "(", "ValueList", ".", "TokenType", ".", "TEXT", ",", "_text", ")", ")", ";", "}" ]
Add Text to the Tokens. @param _text Text to be added
[ "Add", "Text", "to", "the", "Tokens", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L121-L124
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/beans/ValueList.java
ValueList.makeSelect
public void makeSelect(final AbstractPrintQuery _print) throws EFapsException { for (final String expression : getExpressions()) { // TODO remove, only selects allowed if (_print.getMainType().getAttributes().containsKey(expression)) { _print.addAttribute(expression); ValueList.LOG.warn( "The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}", expression, getValueList()); } else if (expression.contains("[") || expression.equals(expression.toLowerCase())) { _print.addSelect(expression); } else { ValueList.LOG.warn( "The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}", expression, getValueList()); } } }
java
public void makeSelect(final AbstractPrintQuery _print) throws EFapsException { for (final String expression : getExpressions()) { // TODO remove, only selects allowed if (_print.getMainType().getAttributes().containsKey(expression)) { _print.addAttribute(expression); ValueList.LOG.warn( "The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}", expression, getValueList()); } else if (expression.contains("[") || expression.equals(expression.toLowerCase())) { _print.addSelect(expression); } else { ValueList.LOG.warn( "The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}", expression, getValueList()); } } }
[ "public", "void", "makeSelect", "(", "final", "AbstractPrintQuery", "_print", ")", "throws", "EFapsException", "{", "for", "(", "final", "String", "expression", ":", "getExpressions", "(", ")", ")", "{", "// TODO remove, only selects allowed", "if", "(", "_print", ...
This method adds the expressions of this ValueList to the given query. @param _print PrintQuery the expressions should be added @throws EFapsException on error @see {@link #makeString(AbstractQuery)}
[ "This", "method", "adds", "the", "expressions", "of", "this", "ValueList", "to", "the", "given", "query", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L133-L151
train
eFaps/eFaps-Kernel
src/main/java/org/efaps/beans/ValueList.java
ValueList.makeString
public String makeString(final Instance _callInstance, final AbstractPrintQuery _print, final TargetMode _mode) throws EFapsException { final StringBuilder buf = new StringBuilder(); for (final Token token : this.tokens) { switch (token.type) { case EXPRESSION: Attribute attr = null; Object value = null; if (_print.getMainType().getAttributes().containsKey(token.value)) { attr = _print.getAttribute4Attribute(token.value); value = _print.getAttribute(token.value); } else { attr = _print.getAttribute4Select(token.value); value = _print.getSelect(token.value); } if (attr != null) { buf.append(attr.getAttributeType().getUIProvider().getStringValue( UIValue.get(null, attr, value))); } else if (value != null) { buf.append(value); } break; case TEXT: buf.append(token.value); break; default: break; } } return buf.toString(); }
java
public String makeString(final Instance _callInstance, final AbstractPrintQuery _print, final TargetMode _mode) throws EFapsException { final StringBuilder buf = new StringBuilder(); for (final Token token : this.tokens) { switch (token.type) { case EXPRESSION: Attribute attr = null; Object value = null; if (_print.getMainType().getAttributes().containsKey(token.value)) { attr = _print.getAttribute4Attribute(token.value); value = _print.getAttribute(token.value); } else { attr = _print.getAttribute4Select(token.value); value = _print.getSelect(token.value); } if (attr != null) { buf.append(attr.getAttributeType().getUIProvider().getStringValue( UIValue.get(null, attr, value))); } else if (value != null) { buf.append(value); } break; case TEXT: buf.append(token.value); break; default: break; } } return buf.toString(); }
[ "public", "String", "makeString", "(", "final", "Instance", "_callInstance", ",", "final", "AbstractPrintQuery", "_print", ",", "final", "TargetMode", "_mode", ")", "throws", "EFapsException", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ...
This method retrieves the Values from the given PrintQuery and combines them with the Text partes. @param _callInstance instance on which the query was called @param _print AbstractPrintQuery the ValueString should be retrieved @param _mode target mode @return String with the actuall Value of this ValueList @throws EFapsException on error @see {@link #makeSelect(AbstractQuery)}
[ "This", "method", "retrieves", "the", "Values", "from", "the", "given", "PrintQuery", "and", "combines", "them", "with", "the", "Text", "partes", "." ]
04b96548f518c2386a93f5ec2b9349f9b9063859
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L165-L199
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.moveFile
public static void moveFile(File src, File dest) throws IOException { copyFile(src, dest); if (!delete(src)) { throw new IOException("Failed to delete the src file '" + src + "' after copying."); } }
java
public static void moveFile(File src, File dest) throws IOException { copyFile(src, dest); if (!delete(src)) { throw new IOException("Failed to delete the src file '" + src + "' after copying."); } }
[ "public", "static", "void", "moveFile", "(", "File", "src", ",", "File", "dest", ")", "throws", "IOException", "{", "copyFile", "(", "src", ",", "dest", ")", ";", "if", "(", "!", "delete", "(", "src", ")", ")", "{", "throw", "new", "IOException", "("...
Moves a file from src to dest. This method is equals to "copy -> delete." @param src An existing file to move, must not be <code>null</code>. @param dest The destination file, must not be <code>null</code> and exist. @throws IOException If moving is failed.
[ "Moves", "a", "file", "from", "src", "to", "dest", ".", "This", "method", "is", "equals", "to", "copy", "-", ">", "delete", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L72-L78
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.copyFile
public static void copyFile(File src, File dest) throws IOException { if (src == null) throw new NullPointerException("Source must not be null"); if (dest == null) throw new NullPointerException("Destination must not be null"); if (!src.exists()) throw new FileNotFoundException("Source '" + src + "' does not exist"); if (!src.isFile()) throw new IOException("Source '" + src + "' is not a file"); if (dest.exists()) throw new IOException("Destination '" + dest + "' is already exists"); FileChannel in = null, out = null; try { in = new FileInputStream(src).getChannel(); out = new FileOutputStream(dest).getChannel(); in.transferTo(0, in.size(), out); } finally { try { in.close(); out.close(); } catch (IOException e) { // Ignore. } } if (src.length() != dest.length()) { throw new IOException("Failed to copy full contents from '" + src + "' to '" + dest + "'"); } dest.setLastModified(src.lastModified()); }
java
public static void copyFile(File src, File dest) throws IOException { if (src == null) throw new NullPointerException("Source must not be null"); if (dest == null) throw new NullPointerException("Destination must not be null"); if (!src.exists()) throw new FileNotFoundException("Source '" + src + "' does not exist"); if (!src.isFile()) throw new IOException("Source '" + src + "' is not a file"); if (dest.exists()) throw new IOException("Destination '" + dest + "' is already exists"); FileChannel in = null, out = null; try { in = new FileInputStream(src).getChannel(); out = new FileOutputStream(dest).getChannel(); in.transferTo(0, in.size(), out); } finally { try { in.close(); out.close(); } catch (IOException e) { // Ignore. } } if (src.length() != dest.length()) { throw new IOException("Failed to copy full contents from '" + src + "' to '" + dest + "'"); } dest.setLastModified(src.lastModified()); }
[ "public", "static", "void", "copyFile", "(", "File", "src", ",", "File", "dest", ")", "throws", "IOException", "{", "if", "(", "src", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Source must not be null\"", ")", ";", "if", "(", "dest", ...
Copies a file to a new location preserving the file date. @param src An existing file to copy, must not be <code>null</code>. @param dest The new file, must not be <code>null</code> and exist. @throws IOException If copying is failed.
[ "Copies", "a", "file", "to", "a", "new", "location", "preserving", "the", "file", "date", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L91-L125
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.delete
public static boolean delete(File file) { if (file == null) { return false; } else if (!file.isFile()) { return false; } return file.delete(); }
java
public static boolean delete(File file) { if (file == null) { return false; } else if (!file.isFile()) { return false; } return file.delete(); }
[ "public", "static", "boolean", "delete", "(", "File", "file", ")", "{", "if", "(", "file", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "!", "file", ".", "isFile", "(", ")", ")", "{", "return", "false", ";", "}", "retur...
Deletes a file. @param file A file to delete. @return <code>true</code> if the file was deleted, otherwise <code>false</code>.
[ "Deletes", "a", "file", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L135-L144
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.exist
public static boolean exist(String filePath) { File f = new File(filePath); if( !f.isFile() ) { return false; } return true; }
java
public static boolean exist(String filePath) { File f = new File(filePath); if( !f.isFile() ) { return false; } return true; }
[ "public", "static", "boolean", "exist", "(", "String", "filePath", ")", "{", "File", "f", "=", "new", "File", "(", "filePath", ")", ";", "if", "(", "!", "f", ".", "isFile", "(", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "...
Check file existence @param filePath @return Return <code>true</code> if the file is exist, otherwise return <code>false</code>
[ "Check", "file", "existence" ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L154-L163
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.getSuffix
public static String getSuffix(File file) { String filename = file.getName(); int index = filename.lastIndexOf("."); if (index != -1) { return filename.substring(index + 1); } return filename; }
java
public static String getSuffix(File file) { String filename = file.getName(); int index = filename.lastIndexOf("."); if (index != -1) { return filename.substring(index + 1); } return filename; }
[ "public", "static", "String", "getSuffix", "(", "File", "file", ")", "{", "String", "filename", "=", "file", ".", "getName", "(", ")", ";", "int", "index", "=", "filename", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "index", "!=", "-", "1...
Returns a suffix string from a File. @param file The file to know the suffix. @return A suffix string
[ "Returns", "a", "suffix", "string", "from", "a", "File", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L172-L181
train
casmi/casmi
src/main/java/casmi/util/FileUtil.java
FileUtil.searchFilePath
public static String searchFilePath(String fileName) { java.io.File dir = new java.io.File(System.getProperty("user.dir")); return recursiveSearch(dir, fileName); }
java
public static String searchFilePath(String fileName) { java.io.File dir = new java.io.File(System.getProperty("user.dir")); return recursiveSearch(dir, fileName); }
[ "public", "static", "String", "searchFilePath", "(", "String", "fileName", ")", "{", "java", ".", "io", ".", "File", "dir", "=", "new", "java", ".", "io", ".", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ";", "return", "re...
Search an absolute file path from current working directory recursively. @param fileName file name to search. @return an absolute file path.
[ "Search", "an", "absolute", "file", "path", "from", "current", "working", "directory", "recursively", "." ]
90f6514a9cbce0685186e7a92beb69e22a3b11c4
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/util/FileUtil.java#L189-L192
train