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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java | Histogram.setStrategy | public void setStrategy( T minimum,
T maximum ) {
this.bucketingStrategy = new ExplicitBucketingStrategy(minimum, maximum);
this.bucketWidth = null;
} | java | public void setStrategy( T minimum,
T maximum ) {
this.bucketingStrategy = new ExplicitBucketingStrategy(minimum, maximum);
this.bucketWidth = null;
} | [
"public",
"void",
"setStrategy",
"(",
"T",
"minimum",
",",
"T",
"maximum",
")",
"{",
"this",
".",
"bucketingStrategy",
"=",
"new",
"ExplicitBucketingStrategy",
"(",
"minimum",
",",
"maximum",
")",
";",
"this",
".",
"bucketWidth",
"=",
"null",
";",
"}"
] | Set the histogram to use the supplied minimum and maximum values to determine the bucket size.
@param minimum
@param maximum | [
"Set",
"the",
"histogram",
"to",
"use",
"the",
"supplied",
"minimum",
"and",
"maximum",
"values",
"to",
"determine",
"the",
"bucket",
"size",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java#L94-L98 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java | Histogram.setSignificantFigures | public Histogram<T> setSignificantFigures( int significantFigures ) {
if (significantFigures != this.significantFigures) {
this.significantFigures = significantFigures;
this.bucketWidth = null;
this.buckets.clear();
}
return this;
} | java | public Histogram<T> setSignificantFigures( int significantFigures ) {
if (significantFigures != this.significantFigures) {
this.significantFigures = significantFigures;
this.bucketWidth = null;
this.buckets.clear();
}
return this;
} | [
"public",
"Histogram",
"<",
"T",
">",
"setSignificantFigures",
"(",
"int",
"significantFigures",
")",
"{",
"if",
"(",
"significantFigures",
"!=",
"this",
".",
"significantFigures",
")",
"{",
"this",
".",
"significantFigures",
"=",
"significantFigures",
";",
"this"... | Set the number of significant figures used in the calculation of the bucket widths.
@param significantFigures the number of significant figures for the bucket widths
@return this histogram, useful for method-chaining
@see #DEFAULT_SIGNIFICANT_FIGURES | [
"Set",
"the",
"number",
"of",
"significant",
"figures",
"used",
"in",
"the",
"calculation",
"of",
"the",
"bucket",
"widths",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java#L119-L126 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java | Histogram.setBucketCount | public Histogram<T> setBucketCount( int count ) {
if (count != this.bucketCount) {
this.bucketCount = count;
this.bucketWidth = null;
this.buckets.clear();
}
return this;
} | java | public Histogram<T> setBucketCount( int count ) {
if (count != this.bucketCount) {
this.bucketCount = count;
this.bucketWidth = null;
this.buckets.clear();
}
return this;
} | [
"public",
"Histogram",
"<",
"T",
">",
"setBucketCount",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"count",
"!=",
"this",
".",
"bucketCount",
")",
"{",
"this",
".",
"bucketCount",
"=",
"count",
";",
"this",
".",
"bucketWidth",
"=",
"null",
";",
"this",
... | Set the number of buckets that this histogram will use.
@param count the number of buckets
@return this histogram, useful for method-chaining
@see #DEFAULT_BUCKET_COUNT | [
"Set",
"the",
"number",
"of",
"buckets",
"that",
"this",
"histogram",
"will",
"use",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/statistic/Histogram.java#L144-L151 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrResourceAdapter.java | JcrResourceAdapter.start | @Override
public synchronized void start( BootstrapContext ctx ) throws ResourceAdapterInternalException {
if (engine == null) {
engine = new ModeShapeEngine();
engine.start();
}
} | java | @Override
public synchronized void start( BootstrapContext ctx ) throws ResourceAdapterInternalException {
if (engine == null) {
engine = new ModeShapeEngine();
engine.start();
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"start",
"(",
"BootstrapContext",
"ctx",
")",
"throws",
"ResourceAdapterInternalException",
"{",
"if",
"(",
"engine",
"==",
"null",
")",
"{",
"engine",
"=",
"new",
"ModeShapeEngine",
"(",
")",
";",
"engine",
"... | This is called when a resource adapter instance is bootstrapped.
@param ctx A bootstrap context containing references
@throws ResourceAdapterInternalException indicates bootstrap failure. | [
"This",
"is",
"called",
"when",
"a",
"resource",
"adapter",
"instance",
"is",
"bootstrapped",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrResourceAdapter.java#L91-L97 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrResourceAdapter.java | JcrResourceAdapter.stop | @Override
public synchronized void stop() {
if (engine != null) {
Future<Boolean> shutdown = engine.shutdown();
final int SHUTDOWN_TIMEOUT = 30;
try {
LOGGER.debug("Shutting down engine to stop resource adapter");
if ( ! shutdown.get(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
// ModeShapeEngine somehow remained running, nothing to be done about it.
LOGGER.error(JcaI18n.unableToStopEngine);
}
} catch (TimeoutException e) {
// Exception can be expected, but stack trace is logged to find where limit was defined
LOGGER.error(e, JcaI18n.unableToStopEngineWithinTimeLimit, SHUTDOWN_TIMEOUT);
} catch (InterruptedException e) {
LOGGER.error(e, JcaI18n.interruptedWhileStoppingJcaAdapter,e.getMessage());
} catch (ExecutionException e) {
LOGGER.error(e, JcaI18n.errorWhileStoppingJcaAdapter,e.getMessage());
}
engine = null;
}
} | java | @Override
public synchronized void stop() {
if (engine != null) {
Future<Boolean> shutdown = engine.shutdown();
final int SHUTDOWN_TIMEOUT = 30;
try {
LOGGER.debug("Shutting down engine to stop resource adapter");
if ( ! shutdown.get(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
// ModeShapeEngine somehow remained running, nothing to be done about it.
LOGGER.error(JcaI18n.unableToStopEngine);
}
} catch (TimeoutException e) {
// Exception can be expected, but stack trace is logged to find where limit was defined
LOGGER.error(e, JcaI18n.unableToStopEngineWithinTimeLimit, SHUTDOWN_TIMEOUT);
} catch (InterruptedException e) {
LOGGER.error(e, JcaI18n.interruptedWhileStoppingJcaAdapter,e.getMessage());
} catch (ExecutionException e) {
LOGGER.error(e, JcaI18n.errorWhileStoppingJcaAdapter,e.getMessage());
}
engine = null;
}
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"if",
"(",
"engine",
"!=",
"null",
")",
"{",
"Future",
"<",
"Boolean",
">",
"shutdown",
"=",
"engine",
".",
"shutdown",
"(",
")",
";",
"final",
"int",
"SHUTDOWN_TIMEOUT",
"=",
"3... | This is called when a resource adapter instance is undeployed or during application server shutdown. | [
"This",
"is",
"called",
"when",
"a",
"resource",
"adapter",
"instance",
"is",
"undeployed",
"or",
"during",
"application",
"server",
"shutdown",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrResourceAdapter.java#L102-L123 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/BufferManager.java | BufferManager.serializerFor | public Serializer<?> serializerFor( TypeFactory<?> type ) {
if (type instanceof TupleFactory) {
return ((TupleFactory<?>)type).getSerializer(this);
}
return serializers.serializerFor(type.getType());
} | java | public Serializer<?> serializerFor( TypeFactory<?> type ) {
if (type instanceof TupleFactory) {
return ((TupleFactory<?>)type).getSerializer(this);
}
return serializers.serializerFor(type.getType());
} | [
"public",
"Serializer",
"<",
"?",
">",
"serializerFor",
"(",
"TypeFactory",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"TupleFactory",
")",
"{",
"return",
"(",
"(",
"TupleFactory",
"<",
"?",
">",
")",
"type",
")",
".",
"getSerial... | Obtain a serializer for the given value type.
@param type the type; may not be null
@return the serializer | [
"Obtain",
"a",
"serializer",
"for",
"the",
"given",
"value",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/BufferManager.java#L442-L447 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/BufferManager.java | BufferManager.bTreeKeySerializerFor | public BTreeKeySerializer<?> bTreeKeySerializerFor( TypeFactory<?> type,
boolean pack ) {
return serializers.bTreeKeySerializerFor(type.getType(), type.getComparator(), pack);
} | java | public BTreeKeySerializer<?> bTreeKeySerializerFor( TypeFactory<?> type,
boolean pack ) {
return serializers.bTreeKeySerializerFor(type.getType(), type.getComparator(), pack);
} | [
"public",
"BTreeKeySerializer",
"<",
"?",
">",
"bTreeKeySerializerFor",
"(",
"TypeFactory",
"<",
"?",
">",
"type",
",",
"boolean",
"pack",
")",
"{",
"return",
"serializers",
".",
"bTreeKeySerializerFor",
"(",
"type",
".",
"getType",
"(",
")",
",",
"type",
".... | Obtain a serializer for the given key type.
@param type the type; may not be null
@param pack true if the serializer can/should pack keys together when possible, or false otherwise
@return the serializer | [
"Obtain",
"a",
"serializer",
"for",
"the",
"given",
"key",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/BufferManager.java#L471-L474 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java | JcrNodeTypeManager.getNodeDefinition | JcrNodeDefinition getNodeDefinition( NodeDefinitionId definitionId ) {
if (definitionId == null) return null;
return nodeTypes().getChildNodeDefinition(definitionId);
} | java | JcrNodeDefinition getNodeDefinition( NodeDefinitionId definitionId ) {
if (definitionId == null) return null;
return nodeTypes().getChildNodeDefinition(definitionId);
} | [
"JcrNodeDefinition",
"getNodeDefinition",
"(",
"NodeDefinitionId",
"definitionId",
")",
"{",
"if",
"(",
"definitionId",
"==",
"null",
")",
"return",
"null",
";",
"return",
"nodeTypes",
"(",
")",
".",
"getChildNodeDefinition",
"(",
"definitionId",
")",
";",
"}"
] | Get the node definition given the supplied identifier.
@param definitionId the identifier of the node definition
@return the node definition, or null if there is no such definition (or if the ID was null) | [
"Get",
"the",
"node",
"definition",
"given",
"the",
"supplied",
"identifier",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java#L218-L221 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java | JcrNodeTypeManager.getPropertyDefinition | JcrPropertyDefinition getPropertyDefinition( PropertyDefinitionId definitionId ) {
if (definitionId == null) return null;
return nodeTypes().getPropertyDefinition(definitionId);
} | java | JcrPropertyDefinition getPropertyDefinition( PropertyDefinitionId definitionId ) {
if (definitionId == null) return null;
return nodeTypes().getPropertyDefinition(definitionId);
} | [
"JcrPropertyDefinition",
"getPropertyDefinition",
"(",
"PropertyDefinitionId",
"definitionId",
")",
"{",
"if",
"(",
"definitionId",
"==",
"null",
")",
"return",
"null",
";",
"return",
"nodeTypes",
"(",
")",
".",
"getPropertyDefinition",
"(",
"definitionId",
")",
";"... | Get the property definition given the supplied identifier.
@param definitionId the identifier of the node definition
@return the property definition, or null if there is no such definition (or if the ID was null) | [
"Get",
"the",
"property",
"definition",
"given",
"the",
"supplied",
"identifier",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java#L229-L232 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java | JcrNodeTypeManager.isDerivedFrom | public boolean isDerivedFrom( String[] testTypeNames,
String primaryTypeName,
String[] mixinNames ) throws RepositoryException {
CheckArg.isNotEmpty(testTypeNames, "testTypeNames");
CheckArg.isNotEmpty(primaryTypeName, "primaryTypeName");
NameFactory nameFactory = context().getValueFactories().getNameFactory();
Name[] typeNames = nameFactory.create(testTypeNames);
// first check primary type
for (Name typeName : typeNames) {
JcrNodeType nodeType = getNodeType(typeName);
if ((nodeType != null) && nodeType.isNodeType(primaryTypeName)) {
return true;
}
}
// now check mixins
if (mixinNames != null) {
for (String mixin : mixinNames) {
for (Name typeName : typeNames) {
JcrNodeType nodeType = getNodeType(typeName);
if ((nodeType != null) && nodeType.isNodeType(mixin)) {
return true;
}
}
}
}
return false;
} | java | public boolean isDerivedFrom( String[] testTypeNames,
String primaryTypeName,
String[] mixinNames ) throws RepositoryException {
CheckArg.isNotEmpty(testTypeNames, "testTypeNames");
CheckArg.isNotEmpty(primaryTypeName, "primaryTypeName");
NameFactory nameFactory = context().getValueFactories().getNameFactory();
Name[] typeNames = nameFactory.create(testTypeNames);
// first check primary type
for (Name typeName : typeNames) {
JcrNodeType nodeType = getNodeType(typeName);
if ((nodeType != null) && nodeType.isNodeType(primaryTypeName)) {
return true;
}
}
// now check mixins
if (mixinNames != null) {
for (String mixin : mixinNames) {
for (Name typeName : typeNames) {
JcrNodeType nodeType = getNodeType(typeName);
if ((nodeType != null) && nodeType.isNodeType(mixin)) {
return true;
}
}
}
}
return false;
} | [
"public",
"boolean",
"isDerivedFrom",
"(",
"String",
"[",
"]",
"testTypeNames",
",",
"String",
"primaryTypeName",
",",
"String",
"[",
"]",
"mixinNames",
")",
"throws",
"RepositoryException",
"{",
"CheckArg",
".",
"isNotEmpty",
"(",
"testTypeNames",
",",
"\"testTyp... | Determine if any of the test type names are equal to or have been derived from the primary type or any of the mixins.
@param testTypeNames the names of the types or mixins being tested against (never <code>null</code>)
@param primaryTypeName the primary type name (never <code>null</code>)
@param mixinNames the mixin names (may be <code>null</code>)
@return <code>true</code> if at least one test type name is equal to or derived from the primary type or one of the mixins
@throws RepositoryException if there is an exception obtaining node types
@throws IllegalArgumentException if <code>testTypeNames</code> is <code>null</code> or empty or if
<code>primaryTypeName</code> is <code>null</code> or zero length | [
"Determine",
"if",
"any",
"of",
"the",
"test",
"type",
"names",
"are",
"equal",
"to",
"or",
"have",
"been",
"derived",
"from",
"the",
"primary",
"type",
"or",
"any",
"of",
"the",
"mixins",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrNodeTypeManager.java#L719-L751 | train |
ModeShape/modeshape | modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/PropertyType.java | PropertyType.valueFromName | public static int valueFromName(String name) {
if (name.equals(TYPENAME_SIMPLE_REFERENCE)) {
return SIMPLE_REFERENCE;
}
return javax.jcr.PropertyType.valueFromName(name);
} | java | public static int valueFromName(String name) {
if (name.equals(TYPENAME_SIMPLE_REFERENCE)) {
return SIMPLE_REFERENCE;
}
return javax.jcr.PropertyType.valueFromName(name);
} | [
"public",
"static",
"int",
"valueFromName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"TYPENAME_SIMPLE_REFERENCE",
")",
")",
"{",
"return",
"SIMPLE_REFERENCE",
";",
"}",
"return",
"javax",
".",
"jcr",
".",
"PropertyType",
".",
... | Returns the numeric constant value of the type with the specified name.
@param name the name of the property type.
@return the numeric constant value.
@throws IllegalArgumentException if <code>name</code> is not a valid
property type name. | [
"Returns",
"the",
"numeric",
"constant",
"value",
"of",
"the",
"type",
"with",
"the",
"specified",
"name",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/PropertyType.java#L61-L66 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java | SessionNode.nodeInWorkspace | protected CachedNode nodeInWorkspace( AbstractSessionCache session ) {
return isNew() ? null : session.getWorkspace().getNode(key);
} | java | protected CachedNode nodeInWorkspace( AbstractSessionCache session ) {
return isNew() ? null : session.getWorkspace().getNode(key);
} | [
"protected",
"CachedNode",
"nodeInWorkspace",
"(",
"AbstractSessionCache",
"session",
")",
"{",
"return",
"isNew",
"(",
")",
"?",
"null",
":",
"session",
".",
"getWorkspace",
"(",
")",
".",
"getNode",
"(",
"key",
")",
";",
"}"
] | Get the CachedNode within the workspace cache.
@param session the session; may not be null
@return the workspace cache's node, or null if this node is new | [
"Get",
"the",
"CachedNode",
"within",
"the",
"workspace",
"cache",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java#L311-L313 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java | SessionNode.getSegment | protected final Segment getSegment( NodeCache cache,
CachedNode parent ) {
if (parent != null) {
ChildReference ref = parent.getChildReferences(cache).getChild(key);
if (ref == null) {
// This node doesn't exist in the parent
throw new NodeNotFoundInParentException(key, parent.getKey());
}
return ref.getSegment();
}
// This is the root node ...
return workspace(cache).childReferenceForRoot().getSegment();
} | java | protected final Segment getSegment( NodeCache cache,
CachedNode parent ) {
if (parent != null) {
ChildReference ref = parent.getChildReferences(cache).getChild(key);
if (ref == null) {
// This node doesn't exist in the parent
throw new NodeNotFoundInParentException(key, parent.getKey());
}
return ref.getSegment();
}
// This is the root node ...
return workspace(cache).childReferenceForRoot().getSegment();
} | [
"protected",
"final",
"Segment",
"getSegment",
"(",
"NodeCache",
"cache",
",",
"CachedNode",
"parent",
")",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"ChildReference",
"ref",
"=",
"parent",
".",
"getChildReferences",
"(",
"cache",
")",
".",
"getChild... | Get the segment for this node.
@param cache the cache
@param parent the parent node
@return the segment
@throws NodeNotFoundInParentException if the node doesn't exist in the referenced parent | [
"Get",
"the",
"segment",
"for",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/SessionNode.java#L429-L441 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java | JcrSystemViewExporter.emitValue | private void emitValue( Value value,
ContentHandler contentHandler,
int propertyType,
boolean skipBinary ) throws RepositoryException, SAXException {
if (PropertyType.BINARY == propertyType) {
startElement(contentHandler, JcrSvLexicon.VALUE, null);
// Per section 6.5 of the 1.0.1 spec, we need to emit one empty-value tag for each value if the property is
// multi-valued and skipBinary is true
if (!skipBinary) {
byte[] bytes = new byte[BASE_64_BUFFER_SIZE];
int len;
Binary binary = value.getBinary();
try {
InputStream stream = new Base64.InputStream(binary.getStream(), Base64.ENCODE);
try {
while (-1 != (len = stream.read(bytes))) {
contentHandler.characters(new String(bytes, 0, len).toCharArray(), 0, len);
}
} finally {
stream.close();
}
} catch (IOException ioe) {
throw new RepositoryException(ioe);
} finally {
binary.dispose();
}
}
endElement(contentHandler, JcrSvLexicon.VALUE);
} else {
emitValue(value.getString(), contentHandler);
}
} | java | private void emitValue( Value value,
ContentHandler contentHandler,
int propertyType,
boolean skipBinary ) throws RepositoryException, SAXException {
if (PropertyType.BINARY == propertyType) {
startElement(contentHandler, JcrSvLexicon.VALUE, null);
// Per section 6.5 of the 1.0.1 spec, we need to emit one empty-value tag for each value if the property is
// multi-valued and skipBinary is true
if (!skipBinary) {
byte[] bytes = new byte[BASE_64_BUFFER_SIZE];
int len;
Binary binary = value.getBinary();
try {
InputStream stream = new Base64.InputStream(binary.getStream(), Base64.ENCODE);
try {
while (-1 != (len = stream.read(bytes))) {
contentHandler.characters(new String(bytes, 0, len).toCharArray(), 0, len);
}
} finally {
stream.close();
}
} catch (IOException ioe) {
throw new RepositoryException(ioe);
} finally {
binary.dispose();
}
}
endElement(contentHandler, JcrSvLexicon.VALUE);
} else {
emitValue(value.getString(), contentHandler);
}
} | [
"private",
"void",
"emitValue",
"(",
"Value",
"value",
",",
"ContentHandler",
"contentHandler",
",",
"int",
"propertyType",
",",
"boolean",
"skipBinary",
")",
"throws",
"RepositoryException",
",",
"SAXException",
"{",
"if",
"(",
"PropertyType",
".",
"BINARY",
"=="... | Fires the appropriate SAX events on the content handler to build the XML elements for the value.
@param value the value to be exported
@param contentHandler the SAX content handler for which SAX events will be invoked as the XML document is created.
@param propertyType the {@link PropertyType} for the given value
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@throws SAXException if an exception occurs during generation of the XML document
@throws RepositoryException if an exception occurs accessing the content repository | [
"Fires",
"the",
"appropriate",
"SAX",
"events",
"on",
"the",
"content",
"handler",
"to",
"build",
"the",
"XML",
"elements",
"for",
"the",
"value",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java#L256-L290 | train |
ModeShape/modeshape | web/modeshape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/ModeShapeWebdavStore.java | ModeShapeWebdavStore.nodeFor | private Node nodeFor( ITransaction transaction,
ResolvedRequest request ) throws RepositoryException {
return ((JcrSessionTransaction)transaction).nodeFor(request);
} | java | private Node nodeFor( ITransaction transaction,
ResolvedRequest request ) throws RepositoryException {
return ((JcrSessionTransaction)transaction).nodeFor(request);
} | [
"private",
"Node",
"nodeFor",
"(",
"ITransaction",
"transaction",
",",
"ResolvedRequest",
"request",
")",
"throws",
"RepositoryException",
"{",
"return",
"(",
"(",
"JcrSessionTransaction",
")",
"transaction",
")",
".",
"nodeFor",
"(",
"request",
")",
";",
"}"
] | Get the node that corresponds to the resolved request, using the supplied active transaction.
@param transaction the active transaction; may not be null
@param request the resolved request; may not be null and must contain a repository name and workspace name
@return the node; never null
@throws RepositoryException if the node does not exist, or if there is another problem obtaining the node | [
"Get",
"the",
"node",
"that",
"corresponds",
"to",
"the",
"resolved",
"request",
"using",
"the",
"supplied",
"active",
"transaction",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/ModeShapeWebdavStore.java#L639-L642 | train |
ModeShape/modeshape | web/modeshape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/ModeShapeWebdavStore.java | ModeShapeWebdavStore.childrenFor | private String[] childrenFor( ITransaction transaction,
ResolvedRequest request ) throws RepositoryException {
return ((JcrSessionTransaction)transaction).childrenFor(request);
} | java | private String[] childrenFor( ITransaction transaction,
ResolvedRequest request ) throws RepositoryException {
return ((JcrSessionTransaction)transaction).childrenFor(request);
} | [
"private",
"String",
"[",
"]",
"childrenFor",
"(",
"ITransaction",
"transaction",
",",
"ResolvedRequest",
"request",
")",
"throws",
"RepositoryException",
"{",
"return",
"(",
"(",
"JcrSessionTransaction",
")",
"transaction",
")",
".",
"childrenFor",
"(",
"request",
... | Determine the names of the children given the supplied request
@param transaction the active transaction; may not be null
@param request the resolved request; may not be null and must contain a repository name and workspace name
@return the children names, or null if there are no children
@throws RepositoryException if is a problem accessing the repository | [
"Determine",
"the",
"names",
"of",
"the",
"children",
"given",
"the",
"supplied",
"request"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-jcr-webdav/src/main/java/org/modeshape/web/jcr/webdav/ModeShapeWebdavStore.java#L665-L668 | train |
ModeShape/modeshape | web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestQueryResult.java | RestQueryResult.addColumn | public RestQueryResult addColumn( String name,
String type ) {
if (!StringUtil.isBlank(name)) {
columns.put(name, type);
}
return this;
} | java | public RestQueryResult addColumn( String name,
String type ) {
if (!StringUtil.isBlank(name)) {
columns.put(name, type);
}
return this;
} | [
"public",
"RestQueryResult",
"addColumn",
"(",
"String",
"name",
",",
"String",
"type",
")",
"{",
"if",
"(",
"!",
"StringUtil",
".",
"isBlank",
"(",
"name",
")",
")",
"{",
"columns",
".",
"put",
"(",
"name",
",",
"type",
")",
";",
"}",
"return",
"thi... | Adds a new column to this result.
@param name a {@code non-null} string, the name of the column
@param type a {@code non-null} string, the type of the column
@return this instance | [
"Adds",
"a",
"new",
"column",
"to",
"this",
"result",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestQueryResult.java#L53-L59 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalDuplicateIndex.java | LocalDuplicateIndex.create | static <T> LocalDuplicateIndex<T> create( String name,
String workspaceName,
DB db,
Converter<T> converter,
Serializer<T> valueSerializer,
Comparator<T> comparator ) {
return new LocalDuplicateIndex<>(name, workspaceName, db, converter, valueSerializer, comparator);
} | java | static <T> LocalDuplicateIndex<T> create( String name,
String workspaceName,
DB db,
Converter<T> converter,
Serializer<T> valueSerializer,
Comparator<T> comparator ) {
return new LocalDuplicateIndex<>(name, workspaceName, db, converter, valueSerializer, comparator);
} | [
"static",
"<",
"T",
">",
"LocalDuplicateIndex",
"<",
"T",
">",
"create",
"(",
"String",
"name",
",",
"String",
"workspaceName",
",",
"DB",
"db",
",",
"Converter",
"<",
"T",
">",
"converter",
",",
"Serializer",
"<",
"T",
">",
"valueSerializer",
",",
"Comp... | Create a new index that allows duplicate values across all keys.
@param name the name of the index; may not be null or empty
@param workspaceName the name of the workspace; may not be null
@param db the database in which the index information is to be stored; may not be null
@param converter the converter from {@link StaticOperand} to values being indexed; may not be null
@param valueSerializer the serializer for the type of value being indexed
@param comparator the comparator for the values; may not be null
@return the new index; never null | [
"Create",
"a",
"new",
"index",
"that",
"allows",
"duplicate",
"values",
"across",
"all",
"keys",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/index/local/LocalDuplicateIndex.java#L51-L58 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java | Transactions.currentTransactionId | public String currentTransactionId() {
try {
javax.transaction.Transaction txn = txnMgr.getTransaction();
return txn != null ? txn.toString() : null;
} catch (SystemException e) {
return null;
}
} | java | public String currentTransactionId() {
try {
javax.transaction.Transaction txn = txnMgr.getTransaction();
return txn != null ? txn.toString() : null;
} catch (SystemException e) {
return null;
}
} | [
"public",
"String",
"currentTransactionId",
"(",
")",
"{",
"try",
"{",
"javax",
".",
"transaction",
".",
"Transaction",
"txn",
"=",
"txnMgr",
".",
"getTransaction",
"(",
")",
";",
"return",
"txn",
"!=",
"null",
"?",
"txn",
".",
"toString",
"(",
")",
":",... | Get a string representation of the current transaction if there already is an existing transaction.
@return a string representation of the transaction if there is an existing transaction, or null if there is none | [
"Get",
"a",
"string",
"representation",
"of",
"the",
"current",
"transaction",
"if",
"there",
"already",
"is",
"an",
"existing",
"transaction",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java#L115-L122 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java | Transactions.begin | public Transaction begin() throws NotSupportedException, SystemException, RollbackException {
// check if there isn't an active transaction already
NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION.get();
if (localTx != null) {
// we have an existing local transaction so we need to be aware of nesting by calling 'begin'
if (logger.isTraceEnabled()) {
logger.trace("Found active ModeShape transaction '{0}' ", localTx);
}
return localTx.begin();
}
// Get the transaction currently associated with this thread (if there is one) ...
javax.transaction.Transaction txn = txnMgr.getTransaction();
if (txn != null && Status.STATUS_ACTIVE != txn.getStatus()) {
// there is a user transaction which is not valid, so abort everything
throw new IllegalStateException(JcrI18n.errorInvalidUserTransaction.text(txn));
}
if (txn == null) {
// There is no transaction or a leftover one which isn't active, so start a local one ...
txnMgr.begin();
// create our wrapper ...
localTx = new NestableThreadLocalTransaction(txnMgr);
localTx.begin();
// notify the listener
localTx.started();
return logTransactionInformation(localTx);
}
// There's an existing tx, meaning user transactions are being used
SynchronizedTransaction synchronizedTransaction = transactionTable.get(txn);
if (synchronizedTransaction != null) {
// notify the listener
synchronizedTransaction.started();
// we've already started our own transaction so just return it as is
return logTransactionInformation(synchronizedTransaction);
} else {
synchronizedTransaction = new SynchronizedTransaction(txnMgr, txn);
transactionTable.put(txn, synchronizedTransaction);
// and register a synchronization
txn.registerSynchronization(synchronizedTransaction);
// and notify the listener
synchronizedTransaction.started();
return logTransactionInformation(synchronizedTransaction);
}
} | java | public Transaction begin() throws NotSupportedException, SystemException, RollbackException {
// check if there isn't an active transaction already
NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION.get();
if (localTx != null) {
// we have an existing local transaction so we need to be aware of nesting by calling 'begin'
if (logger.isTraceEnabled()) {
logger.trace("Found active ModeShape transaction '{0}' ", localTx);
}
return localTx.begin();
}
// Get the transaction currently associated with this thread (if there is one) ...
javax.transaction.Transaction txn = txnMgr.getTransaction();
if (txn != null && Status.STATUS_ACTIVE != txn.getStatus()) {
// there is a user transaction which is not valid, so abort everything
throw new IllegalStateException(JcrI18n.errorInvalidUserTransaction.text(txn));
}
if (txn == null) {
// There is no transaction or a leftover one which isn't active, so start a local one ...
txnMgr.begin();
// create our wrapper ...
localTx = new NestableThreadLocalTransaction(txnMgr);
localTx.begin();
// notify the listener
localTx.started();
return logTransactionInformation(localTx);
}
// There's an existing tx, meaning user transactions are being used
SynchronizedTransaction synchronizedTransaction = transactionTable.get(txn);
if (synchronizedTransaction != null) {
// notify the listener
synchronizedTransaction.started();
// we've already started our own transaction so just return it as is
return logTransactionInformation(synchronizedTransaction);
} else {
synchronizedTransaction = new SynchronizedTransaction(txnMgr, txn);
transactionTable.put(txn, synchronizedTransaction);
// and register a synchronization
txn.registerSynchronization(synchronizedTransaction);
// and notify the listener
synchronizedTransaction.started();
return logTransactionInformation(synchronizedTransaction);
}
} | [
"public",
"Transaction",
"begin",
"(",
")",
"throws",
"NotSupportedException",
",",
"SystemException",
",",
"RollbackException",
"{",
"// check if there isn't an active transaction already",
"NestableThreadLocalTransaction",
"localTx",
"=",
"LOCAL_TRANSACTION",
".",
"get",
"(",... | Starts a new transaction if one does not already exist, and associate it with the calling thread.
@return the ModeShape transaction
@throws NotSupportedException If the calling thread is already associated with a transaction, and nested transactions are
not supported.
@throws SystemException If the transaction service fails in an unexpected way. | [
"Starts",
"a",
"new",
"transaction",
"if",
"one",
"does",
"not",
"already",
"exist",
"and",
"associate",
"it",
"with",
"the",
"calling",
"thread",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java#L141-L186 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java | Transactions.commit | public void commit() throws HeuristicRollbackException, RollbackException, HeuristicMixedException, SystemException {
Transaction transaction = currentTransaction();
if (transaction == null) {
throw new IllegalStateException("No active transaction");
}
transaction.commit();
} | java | public void commit() throws HeuristicRollbackException, RollbackException, HeuristicMixedException, SystemException {
Transaction transaction = currentTransaction();
if (transaction == null) {
throw new IllegalStateException("No active transaction");
}
transaction.commit();
} | [
"public",
"void",
"commit",
"(",
")",
"throws",
"HeuristicRollbackException",
",",
"RollbackException",
",",
"HeuristicMixedException",
",",
"SystemException",
"{",
"Transaction",
"transaction",
"=",
"currentTransaction",
"(",
")",
";",
"if",
"(",
"transaction",
"==",... | Commits the current transaction, if one exists.
@throws IllegalStateException If the calling thread is not associated with a transaction.
@throws SystemException If the transaction service fails in an unexpected way.
@throws HeuristicMixedException If a heuristic decision was made and some some parts of the transaction have been
committed while other parts have been rolled back.
@throws HeuristicRollbackException If a heuristic decision to roll back the transaction was made. | [
"Commits",
"the",
"current",
"transaction",
"if",
"one",
"exists",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java#L259-L265 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java | Transactions.rollback | public void rollback() throws SystemException {
Transaction transaction = currentTransaction();
if (transaction == null) {
throw new IllegalStateException("No active transaction");
}
transaction.rollback();
} | java | public void rollback() throws SystemException {
Transaction transaction = currentTransaction();
if (transaction == null) {
throw new IllegalStateException("No active transaction");
}
transaction.rollback();
} | [
"public",
"void",
"rollback",
"(",
")",
"throws",
"SystemException",
"{",
"Transaction",
"transaction",
"=",
"currentTransaction",
"(",
")",
";",
"if",
"(",
"transaction",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No active transacti... | Rolls back the current transaction, if one exists.
@throws IllegalStateException If the calling thread is not associated with a transaction.
@throws SystemException If the transaction service fails in an unexpected way. | [
"Rolls",
"back",
"the",
"current",
"transaction",
"if",
"one",
"exists",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java#L273-L279 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.without | protected NodeTypes without( Collection<JcrNodeType> removedNodeTypes ) {
if (removedNodeTypes.isEmpty()) return this;
Collection<JcrNodeType> nodeTypes = new HashSet<JcrNodeType>(this.nodeTypes.values());
nodeTypes.removeAll(removedNodeTypes);
return new NodeTypes(this.context, nodeTypes, getVersion() + 1);
} | java | protected NodeTypes without( Collection<JcrNodeType> removedNodeTypes ) {
if (removedNodeTypes.isEmpty()) return this;
Collection<JcrNodeType> nodeTypes = new HashSet<JcrNodeType>(this.nodeTypes.values());
nodeTypes.removeAll(removedNodeTypes);
return new NodeTypes(this.context, nodeTypes, getVersion() + 1);
} | [
"protected",
"NodeTypes",
"without",
"(",
"Collection",
"<",
"JcrNodeType",
">",
"removedNodeTypes",
")",
"{",
"if",
"(",
"removedNodeTypes",
".",
"isEmpty",
"(",
")",
")",
"return",
"this",
";",
"Collection",
"<",
"JcrNodeType",
">",
"nodeTypes",
"=",
"new",
... | Obtain a new version of this cache with the specified node types removed from the new cache.
@param removedNodeTypes the node types that are to be removed from the resulting cache; may not be null but may be empty
@return the resulting cache that contains all of the node types within this cache but without the supplied node types;
never null | [
"Obtain",
"a",
"new",
"version",
"of",
"this",
"cache",
"with",
"the",
"specified",
"node",
"types",
"removed",
"from",
"the",
"new",
"cache",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L359-L364 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.with | protected NodeTypes with( Collection<JcrNodeType> addedNodeTypes ) {
if (addedNodeTypes.isEmpty()) return this;
Collection<JcrNodeType> nodeTypes = new HashSet<JcrNodeType>(this.nodeTypes.values());
// if there are updated node types, remove them first (hashcode is based on name alone),
// else addAll() will ignore the changes.
nodeTypes.removeAll(addedNodeTypes);
nodeTypes.addAll(addedNodeTypes);
return new NodeTypes(this.context, nodeTypes, getVersion() + 1);
} | java | protected NodeTypes with( Collection<JcrNodeType> addedNodeTypes ) {
if (addedNodeTypes.isEmpty()) return this;
Collection<JcrNodeType> nodeTypes = new HashSet<JcrNodeType>(this.nodeTypes.values());
// if there are updated node types, remove them first (hashcode is based on name alone),
// else addAll() will ignore the changes.
nodeTypes.removeAll(addedNodeTypes);
nodeTypes.addAll(addedNodeTypes);
return new NodeTypes(this.context, nodeTypes, getVersion() + 1);
} | [
"protected",
"NodeTypes",
"with",
"(",
"Collection",
"<",
"JcrNodeType",
">",
"addedNodeTypes",
")",
"{",
"if",
"(",
"addedNodeTypes",
".",
"isEmpty",
"(",
")",
")",
"return",
"this",
";",
"Collection",
"<",
"JcrNodeType",
">",
"nodeTypes",
"=",
"new",
"Hash... | Obtain a new version of this cache with the specified node types added to the new cache.
@param addedNodeTypes the node types that are to be added to the resulting cache; may not be null but may be empty
@return the resulting cache that contains all of the node types within this cache and the supplied node types; never null | [
"Obtain",
"a",
"new",
"version",
"of",
"this",
"cache",
"with",
"the",
"specified",
"node",
"types",
"added",
"to",
"the",
"new",
"cache",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L372-L380 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.isTypeOrSubtype | public boolean isTypeOrSubtype( Name nodeTypeName,
Name candidateSupertypeName ) {
if (JcrNtLexicon.BASE.equals(candidateSupertypeName)) {
// If the candidate is 'nt:base', then every node type is a subtype ...
return true;
}
if (nodeTypeName.equals(candidateSupertypeName)) return true;
JcrNodeType nodeType = getNodeType(nodeTypeName);
return nodeType != null && nodeType.isNodeType(candidateSupertypeName);
} | java | public boolean isTypeOrSubtype( Name nodeTypeName,
Name candidateSupertypeName ) {
if (JcrNtLexicon.BASE.equals(candidateSupertypeName)) {
// If the candidate is 'nt:base', then every node type is a subtype ...
return true;
}
if (nodeTypeName.equals(candidateSupertypeName)) return true;
JcrNodeType nodeType = getNodeType(nodeTypeName);
return nodeType != null && nodeType.isNodeType(candidateSupertypeName);
} | [
"public",
"boolean",
"isTypeOrSubtype",
"(",
"Name",
"nodeTypeName",
",",
"Name",
"candidateSupertypeName",
")",
"{",
"if",
"(",
"JcrNtLexicon",
".",
"BASE",
".",
"equals",
"(",
"candidateSupertypeName",
")",
")",
"{",
"// If the candidate is 'nt:base', then every node ... | Determine whether the node's given node type matches or extends the node type with the supplied name.
@param nodeTypeName the name of the node type of a node; may not be null
@param candidateSupertypeName the name of the potential supertype node type; may not be null
@return true if the node type does extend or match the node type given by the supplied name, or false otherwise | [
"Determine",
"whether",
"the",
"node",
"s",
"given",
"node",
"type",
"matches",
"or",
"extends",
"the",
"node",
"type",
"with",
"the",
"supplied",
"name",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L441-L450 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.isTypeOrSubtype | public boolean isTypeOrSubtype( Set<Name> nodeTypeNames,
Name candidateSupertypeName ) {
for (Name nodeTypeName : nodeTypeNames) {
if (isTypeOrSubtype(nodeTypeName, candidateSupertypeName)) return true;
}
return false;
} | java | public boolean isTypeOrSubtype( Set<Name> nodeTypeNames,
Name candidateSupertypeName ) {
for (Name nodeTypeName : nodeTypeNames) {
if (isTypeOrSubtype(nodeTypeName, candidateSupertypeName)) return true;
}
return false;
} | [
"public",
"boolean",
"isTypeOrSubtype",
"(",
"Set",
"<",
"Name",
">",
"nodeTypeNames",
",",
"Name",
"candidateSupertypeName",
")",
"{",
"for",
"(",
"Name",
"nodeTypeName",
":",
"nodeTypeNames",
")",
"{",
"if",
"(",
"isTypeOrSubtype",
"(",
"nodeTypeName",
",",
... | Determine whether at least one of the node's given node types matches or extends the node type with the supplied name.
@param nodeTypeNames the names of the node types of a node; may not be null
@param candidateSupertypeName the name of the potential supertype node type; may not be null
@return true if the node type does extend or match the node type given by at least one of the supplied names, or false
otherwise | [
"Determine",
"whether",
"at",
"least",
"one",
"of",
"the",
"node",
"s",
"given",
"node",
"types",
"matches",
"or",
"extends",
"the",
"node",
"type",
"with",
"the",
"supplied",
"name",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L460-L466 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.allowsNameSiblings | public boolean allowsNameSiblings( Name primaryType,
Set<Name> mixinTypes ) {
if (isUnorderedCollection(primaryType, mixinTypes)) {
// regardless of the actual types, if at least one of them is an unordered collection, SNS are not allowed
return false;
}
if (nodeTypeNamesThatAllowSameNameSiblings.contains(primaryType)) return true;
if (mixinTypes != null && !mixinTypes.isEmpty()) {
for (Name mixinType : mixinTypes) {
if (nodeTypeNamesThatAllowSameNameSiblings.contains(mixinType))
return true;
}
}
return false;
} | java | public boolean allowsNameSiblings( Name primaryType,
Set<Name> mixinTypes ) {
if (isUnorderedCollection(primaryType, mixinTypes)) {
// regardless of the actual types, if at least one of them is an unordered collection, SNS are not allowed
return false;
}
if (nodeTypeNamesThatAllowSameNameSiblings.contains(primaryType)) return true;
if (mixinTypes != null && !mixinTypes.isEmpty()) {
for (Name mixinType : mixinTypes) {
if (nodeTypeNamesThatAllowSameNameSiblings.contains(mixinType))
return true;
}
}
return false;
} | [
"public",
"boolean",
"allowsNameSiblings",
"(",
"Name",
"primaryType",
",",
"Set",
"<",
"Name",
">",
"mixinTypes",
")",
"{",
"if",
"(",
"isUnorderedCollection",
"(",
"primaryType",
",",
"mixinTypes",
")",
")",
"{",
"// regardless of the actual types, if at least one o... | Determine if either the primary type or any of the mixin types allows SNS.
@param primaryType the primary type name; may not be null
@param mixinTypes the mixin type names; may be null or empty
@return {@code true} if either the primary type or any of the mixin types allows SNS. If neither allow SNS,
this will return {@code false} | [
"Determine",
"if",
"either",
"the",
"primary",
"type",
"or",
"any",
"of",
"the",
"mixin",
"types",
"allows",
"SNS",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L593-L607 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.getBucketIdLengthForUnorderedCollection | public int getBucketIdLengthForUnorderedCollection( Name nodeTypeName, Set<Name> mixinTypes ) {
Set<Name> allTypes = new LinkedHashSet<>();
allTypes.add(nodeTypeName);
if (mixinTypes != null && !mixinTypes.isEmpty()) {
allTypes.addAll(mixinTypes);
}
for (Name typeName : allTypes) {
if (isTypeOrSubtype(typeName, ModeShapeLexicon.TINY_UNORDERED_COLLECTION)) {
return 1;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.SMALL_UNORDERED_COLLECTION)) {
return 2;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.LARGE_UNORDERED_COLLECTION)) {
return 3;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.HUGE_UNORDERED_COLLECTION)) {
return 4;
}
}
throw new IllegalArgumentException("None of the node types are known unordered collection types: " + allTypes);
} | java | public int getBucketIdLengthForUnorderedCollection( Name nodeTypeName, Set<Name> mixinTypes ) {
Set<Name> allTypes = new LinkedHashSet<>();
allTypes.add(nodeTypeName);
if (mixinTypes != null && !mixinTypes.isEmpty()) {
allTypes.addAll(mixinTypes);
}
for (Name typeName : allTypes) {
if (isTypeOrSubtype(typeName, ModeShapeLexicon.TINY_UNORDERED_COLLECTION)) {
return 1;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.SMALL_UNORDERED_COLLECTION)) {
return 2;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.LARGE_UNORDERED_COLLECTION)) {
return 3;
} else if (isTypeOrSubtype(typeName, ModeShapeLexicon.HUGE_UNORDERED_COLLECTION)) {
return 4;
}
}
throw new IllegalArgumentException("None of the node types are known unordered collection types: " + allTypes);
} | [
"public",
"int",
"getBucketIdLengthForUnorderedCollection",
"(",
"Name",
"nodeTypeName",
",",
"Set",
"<",
"Name",
">",
"mixinTypes",
")",
"{",
"Set",
"<",
"Name",
">",
"allTypes",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"allTypes",
".",
"add",
"(",... | Determine the length of a bucket ID for an unordered collection, based on its type and possible mixins.
@param nodeTypeName the primary type of the collection; may not be null.
@param mixinTypes the mixin type names; may be null or empty
@return the order of magnitude, as a power of 16 | [
"Determine",
"the",
"length",
"of",
"a",
"bucket",
"ID",
"for",
"an",
"unordered",
"collection",
"based",
"on",
"its",
"type",
"and",
"possible",
"mixins",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L647-L665 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.isReferenceProperty | public boolean isReferenceProperty( Name nodeTypeName,
Name propertyName ) {
JcrNodeType type = getNodeType(nodeTypeName);
if (type != null) {
for (JcrPropertyDefinition propDefn : type.allPropertyDefinitions(propertyName)) {
int requiredType = propDefn.getRequiredType();
if (requiredType == PropertyType.REFERENCE || requiredType == PropertyType.WEAKREFERENCE
|| requiredType == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE) {
return true;
}
}
}
return false;
} | java | public boolean isReferenceProperty( Name nodeTypeName,
Name propertyName ) {
JcrNodeType type = getNodeType(nodeTypeName);
if (type != null) {
for (JcrPropertyDefinition propDefn : type.allPropertyDefinitions(propertyName)) {
int requiredType = propDefn.getRequiredType();
if (requiredType == PropertyType.REFERENCE || requiredType == PropertyType.WEAKREFERENCE
|| requiredType == org.modeshape.jcr.api.PropertyType.SIMPLE_REFERENCE) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"isReferenceProperty",
"(",
"Name",
"nodeTypeName",
",",
"Name",
"propertyName",
")",
"{",
"JcrNodeType",
"type",
"=",
"getNodeType",
"(",
"nodeTypeName",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"{",
"for",
"(",
"JcrPropertyDefinit... | Determine if the named property on the node type is a reference property.
@param nodeTypeName the name of the node type; may not be null
@param propertyName the name of the property definition; may not be null
@return true if the property is a {@link PropertyType#REFERENCE}, {@link PropertyType#WEAKREFERENCE}, or
{@link org.modeshape.jcr.api.PropertyType#SIMPLE_REFERENCE}, or false otherwise | [
"Determine",
"if",
"the",
"named",
"property",
"on",
"the",
"node",
"type",
"is",
"a",
"reference",
"property",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L691-L704 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.hasMandatoryPropertyDefinitions | public boolean hasMandatoryPropertyDefinitions( Name primaryType,
Set<Name> mixinTypes ) {
if (mandatoryPropertiesNodeTypes.containsKey(primaryType)) return true;
for (Name mixinType : mixinTypes) {
if (mandatoryPropertiesNodeTypes.containsKey(mixinType)) return true;
}
return false;
} | java | public boolean hasMandatoryPropertyDefinitions( Name primaryType,
Set<Name> mixinTypes ) {
if (mandatoryPropertiesNodeTypes.containsKey(primaryType)) return true;
for (Name mixinType : mixinTypes) {
if (mandatoryPropertiesNodeTypes.containsKey(mixinType)) return true;
}
return false;
} | [
"public",
"boolean",
"hasMandatoryPropertyDefinitions",
"(",
"Name",
"primaryType",
",",
"Set",
"<",
"Name",
">",
"mixinTypes",
")",
"{",
"if",
"(",
"mandatoryPropertiesNodeTypes",
".",
"containsKey",
"(",
"primaryType",
")",
")",
"return",
"true",
";",
"for",
"... | Determine if the named primary node type or mixin types has at least one mandatory property definitions declared on it or
any of its supertypes.
@param primaryType the primary type name; may not be null
@param mixinTypes the mixin type names; may not be null but may be empty
@return true if any of the named node types has one or more mandatory property definitions, or false if there are none | [
"Determine",
"if",
"the",
"named",
"primary",
"node",
"type",
"or",
"mixin",
"types",
"has",
"at",
"least",
"one",
"mandatory",
"property",
"definitions",
"declared",
"on",
"it",
"or",
"any",
"of",
"its",
"supertypes",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L714-L721 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.hasMandatoryChildNodeDefinitions | public boolean hasMandatoryChildNodeDefinitions( Name primaryType,
Set<Name> mixinTypes ) {
if (mandatoryChildrenNodeTypes.containsKey(primaryType)) return true;
for (Name mixinType : mixinTypes) {
if (mandatoryChildrenNodeTypes.containsKey(mixinType)) return true;
}
return false;
} | java | public boolean hasMandatoryChildNodeDefinitions( Name primaryType,
Set<Name> mixinTypes ) {
if (mandatoryChildrenNodeTypes.containsKey(primaryType)) return true;
for (Name mixinType : mixinTypes) {
if (mandatoryChildrenNodeTypes.containsKey(mixinType)) return true;
}
return false;
} | [
"public",
"boolean",
"hasMandatoryChildNodeDefinitions",
"(",
"Name",
"primaryType",
",",
"Set",
"<",
"Name",
">",
"mixinTypes",
")",
"{",
"if",
"(",
"mandatoryChildrenNodeTypes",
".",
"containsKey",
"(",
"primaryType",
")",
")",
"return",
"true",
";",
"for",
"(... | Determine if the named primary node type or mixin types has at least one mandatory child node definitions declared on it or
any of its supertypes.
@param primaryType the primary type name; may not be null
@param mixinTypes the mixin type names; may not be null but may be empty
@return true if any of the the named node types has one or more mandatory child node definitions, or false if there are
none | [
"Determine",
"if",
"the",
"named",
"primary",
"node",
"type",
"or",
"mixin",
"types",
"has",
"at",
"least",
"one",
"mandatory",
"child",
"node",
"definitions",
"declared",
"on",
"it",
"or",
"any",
"of",
"its",
"supertypes",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L732-L739 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.isQueryable | public boolean isQueryable(Name nodeTypeName, Set<Name> mixinTypes) {
if (nonQueryableNodeTypes.contains(nodeTypeName)) {
return false;
}
if (!mixinTypes.isEmpty()) {
for (Name mixinType : mixinTypes) {
if (nonQueryableNodeTypes.contains(mixinType)) {
return false;
}
}
}
return true;
} | java | public boolean isQueryable(Name nodeTypeName, Set<Name> mixinTypes) {
if (nonQueryableNodeTypes.contains(nodeTypeName)) {
return false;
}
if (!mixinTypes.isEmpty()) {
for (Name mixinType : mixinTypes) {
if (nonQueryableNodeTypes.contains(mixinType)) {
return false;
}
}
}
return true;
} | [
"public",
"boolean",
"isQueryable",
"(",
"Name",
"nodeTypeName",
",",
"Set",
"<",
"Name",
">",
"mixinTypes",
")",
"{",
"if",
"(",
"nonQueryableNodeTypes",
".",
"contains",
"(",
"nodeTypeName",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"... | Check if the node type and mixin types are queryable or not.
@param nodeTypeName a {@link Name}, never {@code null}
@param mixinTypes the mixin type names; may not be null but may be empty
@return {@code false} if at least one of the node types is not queryable, {@code true} otherwise | [
"Check",
"if",
"the",
"node",
"type",
"and",
"mixin",
"types",
"are",
"queryable",
"or",
"not",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L885-L897 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.canRemoveItem | boolean canRemoveItem( Name primaryTypeNameOfParent,
List<Name> mixinTypeNamesOfParent,
Name itemName,
boolean skipProtected ) {
// First look in the primary type for a matching property definition...
JcrNodeType primaryType = getNodeType(primaryTypeNameOfParent);
if (primaryType != null) {
for (JcrPropertyDefinition definition : primaryType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
// Then, look in the primary type for a matching child node definition...
if (primaryType != null) {
for (JcrNodeDefinition definition : primaryType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
// Then, look in the mixin types for a matching property definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrPropertyDefinition definition : mixinType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
}
// Then, look in the mixin types for a matching child node definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrNodeDefinition definition : mixinType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
}
// Nothing was found, so look for residual item definitions ...
if (!itemName.equals(JcrNodeType.RESIDUAL_NAME)) return canRemoveItem(primaryTypeNameOfParent, mixinTypeNamesOfParent,
JcrNodeType.RESIDUAL_NAME, skipProtected);
return false;
} | java | boolean canRemoveItem( Name primaryTypeNameOfParent,
List<Name> mixinTypeNamesOfParent,
Name itemName,
boolean skipProtected ) {
// First look in the primary type for a matching property definition...
JcrNodeType primaryType = getNodeType(primaryTypeNameOfParent);
if (primaryType != null) {
for (JcrPropertyDefinition definition : primaryType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
// Then, look in the primary type for a matching child node definition...
if (primaryType != null) {
for (JcrNodeDefinition definition : primaryType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
// Then, look in the mixin types for a matching property definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrPropertyDefinition definition : mixinType.allPropertyDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove the property ...
return !definition.isMandatory();
}
}
}
// Then, look in the mixin types for a matching child node definition...
if (mixinTypeNamesOfParent != null && !mixinTypeNamesOfParent.isEmpty()) {
for (Name mixinTypeName : mixinTypeNamesOfParent) {
JcrNodeType mixinType = getNodeType(mixinTypeName);
if (mixinType == null) continue;
for (JcrNodeDefinition definition : mixinType.allChildNodeDefinitions(itemName)) {
// Skip protected definitions ...
if (skipProtected && definition.isProtected()) continue;
// If this definition is not mandatory, then we have found that we CAN remove all children ...
return !definition.isMandatory();
}
}
}
// Nothing was found, so look for residual item definitions ...
if (!itemName.equals(JcrNodeType.RESIDUAL_NAME)) return canRemoveItem(primaryTypeNameOfParent, mixinTypeNamesOfParent,
JcrNodeType.RESIDUAL_NAME, skipProtected);
return false;
} | [
"boolean",
"canRemoveItem",
"(",
"Name",
"primaryTypeNameOfParent",
",",
"List",
"<",
"Name",
">",
"mixinTypeNamesOfParent",
",",
"Name",
"itemName",
",",
"boolean",
"skipProtected",
")",
"{",
"// First look in the primary type for a matching property definition...",
"JcrNode... | Determine if the node and property definitions of the supplied primary type and mixin types allow the item with the
supplied name to be removed.
@param primaryTypeNameOfParent the name of the primary type for the parent node; may not be null
@param mixinTypeNamesOfParent the names of the mixin types for the parent node; may be null or empty if there are no mixins
to include in the search
@param itemName the name of the item to be removed; may not be null
@param skipProtected true if this operation is being done from within the public JCR node and property API, or false if
this operation is being done from within internal implementations
@return true if at least one child node definition does not require children with the supplied name to exist, or false
otherwise | [
"Determine",
"if",
"the",
"node",
"and",
"property",
"definitions",
"of",
"the",
"supplied",
"primary",
"type",
"and",
"mixin",
"types",
"allow",
"the",
"item",
"with",
"the",
"supplied",
"name",
"to",
"be",
"removed",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1686-L1743 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.findTypeInMapOrList | protected JcrNodeType findTypeInMapOrList( Name typeName,
Collection<JcrNodeType> pendingList ) {
for (JcrNodeType pendingNodeType : pendingList) {
if (pendingNodeType.getInternalName().equals(typeName)) {
return pendingNodeType;
}
}
return nodeTypes.get(typeName);
} | java | protected JcrNodeType findTypeInMapOrList( Name typeName,
Collection<JcrNodeType> pendingList ) {
for (JcrNodeType pendingNodeType : pendingList) {
if (pendingNodeType.getInternalName().equals(typeName)) {
return pendingNodeType;
}
}
return nodeTypes.get(typeName);
} | [
"protected",
"JcrNodeType",
"findTypeInMapOrList",
"(",
"Name",
"typeName",
",",
"Collection",
"<",
"JcrNodeType",
">",
"pendingList",
")",
"{",
"for",
"(",
"JcrNodeType",
"pendingNodeType",
":",
"pendingList",
")",
"{",
"if",
"(",
"pendingNodeType",
".",
"getInte... | Finds the named type in the given collection of types pending registration if it exists, else returns the type definition
from the repository
@param typeName the name of the type to retrieve
@param pendingList a collection of types that have passed validation but have not yet been committed to the repository
@return the node type with the given name from {@code pendingList} if it exists in the collection or from the
{@link #nodeTypes registered types} if it exists there; may be null | [
"Finds",
"the",
"named",
"type",
"in",
"the",
"given",
"collection",
"of",
"types",
"pending",
"registration",
"if",
"it",
"exists",
"else",
"returns",
"the",
"type",
"definition",
"from",
"the",
"repository"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1877-L1886 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.supertypesFor | protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType,
Collection<JcrNodeType> pendingTypes ) throws RepositoryException {
assert nodeType != null;
List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>();
boolean isMixin = nodeType.isMixin();
boolean needsPrimaryAncestor = !isMixin;
String nodeTypeName = nodeType.getName();
for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) {
Name supertypeName = nameFactory.create(supertypeNameStr);
JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes);
if (supertype == null) {
throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName));
}
needsPrimaryAncestor &= supertype.isMixin();
supertypes.add(supertype);
}
// primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base
if (needsPrimaryAncestor) {
Name nodeName = nameFactory.create(nodeTypeName);
if (!JcrNtLexicon.BASE.equals(nodeName)) {
JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
assert ntBase != null;
supertypes.add(0, ntBase);
}
}
return supertypes;
} | java | protected List<JcrNodeType> supertypesFor( NodeTypeDefinition nodeType,
Collection<JcrNodeType> pendingTypes ) throws RepositoryException {
assert nodeType != null;
List<JcrNodeType> supertypes = new LinkedList<JcrNodeType>();
boolean isMixin = nodeType.isMixin();
boolean needsPrimaryAncestor = !isMixin;
String nodeTypeName = nodeType.getName();
for (String supertypeNameStr : nodeType.getDeclaredSupertypeNames()) {
Name supertypeName = nameFactory.create(supertypeNameStr);
JcrNodeType supertype = findTypeInMapOrList(supertypeName, pendingTypes);
if (supertype == null) {
throw new InvalidNodeTypeDefinitionException(JcrI18n.invalidSupertypeName.text(supertypeNameStr, nodeTypeName));
}
needsPrimaryAncestor &= supertype.isMixin();
supertypes.add(supertype);
}
// primary types (other than nt:base) always have at least one ancestor that's a primary type - nt:base
if (needsPrimaryAncestor) {
Name nodeName = nameFactory.create(nodeTypeName);
if (!JcrNtLexicon.BASE.equals(nodeName)) {
JcrNodeType ntBase = findTypeInMapOrList(JcrNtLexicon.BASE, pendingTypes);
assert ntBase != null;
supertypes.add(0, ntBase);
}
}
return supertypes;
} | [
"protected",
"List",
"<",
"JcrNodeType",
">",
"supertypesFor",
"(",
"NodeTypeDefinition",
"nodeType",
",",
"Collection",
"<",
"JcrNodeType",
">",
"pendingTypes",
")",
"throws",
"RepositoryException",
"{",
"assert",
"nodeType",
"!=",
"null",
";",
"List",
"<",
"JcrN... | Returns the list of node types for the supertypes defined in the given node type.
@param nodeType a node type with a non-null array of supertypes
@param pendingTypes the list of types that have been processed in this type batch but not yet committed to the repository's
set of types
@return a list of node types where each element is the node type for the corresponding element of the array of supertype
names
@throws RepositoryException if any of the names in the array of supertype names does not correspond to an
already-registered node type or a node type that is pending registration | [
"Returns",
"the",
"list",
"of",
"node",
"types",
"for",
"the",
"supertypes",
"defined",
"in",
"the",
"given",
"node",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1899-L1929 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.subtypesFor | final Collection<JcrNodeType> subtypesFor( JcrNodeType nodeType ) {
List<JcrNodeType> subtypes = new LinkedList<JcrNodeType>();
for (JcrNodeType type : this.nodeTypes.values()) {
if (type.supertypes().contains(nodeType)) {
subtypes.add(type);
}
}
return subtypes;
} | java | final Collection<JcrNodeType> subtypesFor( JcrNodeType nodeType ) {
List<JcrNodeType> subtypes = new LinkedList<JcrNodeType>();
for (JcrNodeType type : this.nodeTypes.values()) {
if (type.supertypes().contains(nodeType)) {
subtypes.add(type);
}
}
return subtypes;
} | [
"final",
"Collection",
"<",
"JcrNodeType",
">",
"subtypesFor",
"(",
"JcrNodeType",
"nodeType",
")",
"{",
"List",
"<",
"JcrNodeType",
">",
"subtypes",
"=",
"new",
"LinkedList",
"<",
"JcrNodeType",
">",
"(",
")",
";",
"for",
"(",
"JcrNodeType",
"type",
":",
... | Returns the list of subtypes for the given node.
@param nodeType the node type for which subtypes should be returned; may not be null
@return the subtypes for the node | [
"Returns",
"the",
"list",
"of",
"subtypes",
"for",
"the",
"given",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1937-L1945 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.declaredSubtypesFor | final Collection<JcrNodeType> declaredSubtypesFor( JcrNodeType nodeType ) {
CheckArg.isNotNull(nodeType, "nodeType");
String nodeTypeName = nodeType.getName();
List<JcrNodeType> subtypes = new LinkedList<JcrNodeType>();
for (JcrNodeType type : this.nodeTypes.values()) {
if (Arrays.asList(type.getDeclaredSupertypeNames()).contains(nodeTypeName)) {
subtypes.add(type);
}
}
return subtypes;
} | java | final Collection<JcrNodeType> declaredSubtypesFor( JcrNodeType nodeType ) {
CheckArg.isNotNull(nodeType, "nodeType");
String nodeTypeName = nodeType.getName();
List<JcrNodeType> subtypes = new LinkedList<JcrNodeType>();
for (JcrNodeType type : this.nodeTypes.values()) {
if (Arrays.asList(type.getDeclaredSupertypeNames()).contains(nodeTypeName)) {
subtypes.add(type);
}
}
return subtypes;
} | [
"final",
"Collection",
"<",
"JcrNodeType",
">",
"declaredSubtypesFor",
"(",
"JcrNodeType",
"nodeType",
")",
"{",
"CheckArg",
".",
"isNotNull",
"(",
"nodeType",
",",
"\"nodeType\"",
")",
";",
"String",
"nodeTypeName",
"=",
"nodeType",
".",
"getName",
"(",
")",
... | Returns the list of declared subtypes for the given node.
@param nodeType the node type for which declared subtypes should be returned; may not be null
@return the subtypes for the node | [
"Returns",
"the",
"list",
"of",
"declared",
"subtypes",
"for",
"the",
"given",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L1953-L1963 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java | NodeTypes.validate | protected void validate( JcrNodeType nodeType,
List<JcrNodeType> supertypes,
List<JcrNodeType> pendingTypes ) throws RepositoryException {
validateSupertypes(supertypes);
List<Name> supertypeNames = new ArrayList<Name>(supertypes.size());
for (JcrNodeType supertype : supertypes) {
supertypeNames.add(supertype.getInternalName());
}
boolean foundExact = false;
boolean foundResidual = false;
boolean foundSNS = false;
Name primaryItemName = nodeType.getInternalPrimaryItemName();
for (JcrNodeDefinition node : nodeType.getDeclaredChildNodeDefinitions()) {
validateChildNodeDefinition(node, supertypeNames, pendingTypes);
if (node.isResidual()) {
foundResidual = true;
}
if (primaryItemName != null && primaryItemName.equals(node.getInternalName())) {
foundExact = true;
}
if (node.allowsSameNameSiblings()) {
foundSNS = true;
}
}
for (JcrPropertyDefinition prop : nodeType.getDeclaredPropertyDefinitions()) {
validatePropertyDefinition(prop, supertypeNames, pendingTypes);
if (prop.isResidual()) {
foundResidual = true;
}
if (primaryItemName != null && primaryItemName.equals(prop.getInternalName())) {
if (foundExact) {
throw new RepositoryException(JcrI18n.ambiguousPrimaryItemName.text(primaryItemName));
}
foundExact = true;
}
}
if (primaryItemName != null && !foundExact && !foundResidual) {
throw new RepositoryException(JcrI18n.invalidPrimaryItemName.text(primaryItemName));
}
Name internalName = nodeType.getInternalName();
if (isUnorderedCollection(internalName, supertypeNames)) {
boolean isVersionable = isVersionable(internalName, supertypeNames);
if (isVersionable || foundSNS || nodeType.hasOrderableChildNodes()) {
throw new RepositoryException(JcrI18n.invalidUnorderedCollectionType.text(internalName.toString()));
}
}
} | java | protected void validate( JcrNodeType nodeType,
List<JcrNodeType> supertypes,
List<JcrNodeType> pendingTypes ) throws RepositoryException {
validateSupertypes(supertypes);
List<Name> supertypeNames = new ArrayList<Name>(supertypes.size());
for (JcrNodeType supertype : supertypes) {
supertypeNames.add(supertype.getInternalName());
}
boolean foundExact = false;
boolean foundResidual = false;
boolean foundSNS = false;
Name primaryItemName = nodeType.getInternalPrimaryItemName();
for (JcrNodeDefinition node : nodeType.getDeclaredChildNodeDefinitions()) {
validateChildNodeDefinition(node, supertypeNames, pendingTypes);
if (node.isResidual()) {
foundResidual = true;
}
if (primaryItemName != null && primaryItemName.equals(node.getInternalName())) {
foundExact = true;
}
if (node.allowsSameNameSiblings()) {
foundSNS = true;
}
}
for (JcrPropertyDefinition prop : nodeType.getDeclaredPropertyDefinitions()) {
validatePropertyDefinition(prop, supertypeNames, pendingTypes);
if (prop.isResidual()) {
foundResidual = true;
}
if (primaryItemName != null && primaryItemName.equals(prop.getInternalName())) {
if (foundExact) {
throw new RepositoryException(JcrI18n.ambiguousPrimaryItemName.text(primaryItemName));
}
foundExact = true;
}
}
if (primaryItemName != null && !foundExact && !foundResidual) {
throw new RepositoryException(JcrI18n.invalidPrimaryItemName.text(primaryItemName));
}
Name internalName = nodeType.getInternalName();
if (isUnorderedCollection(internalName, supertypeNames)) {
boolean isVersionable = isVersionable(internalName, supertypeNames);
if (isVersionable || foundSNS || nodeType.hasOrderableChildNodes()) {
throw new RepositoryException(JcrI18n.invalidUnorderedCollectionType.text(internalName.toString()));
}
}
} | [
"protected",
"void",
"validate",
"(",
"JcrNodeType",
"nodeType",
",",
"List",
"<",
"JcrNodeType",
">",
"supertypes",
",",
"List",
"<",
"JcrNodeType",
">",
"pendingTypes",
")",
"throws",
"RepositoryException",
"{",
"validateSupertypes",
"(",
"supertypes",
")",
";",... | Validates that the given node type definition is valid under the ModeShape and JCR type rules within the given context.
@param nodeType the node type to attempt to validate
@param supertypes the names of the supertypes of the node type
@param pendingTypes the list of types previously registered in this batch but not yet committed to the repository
@throws RepositoryException if the given node type template is not valid | [
"Validates",
"that",
"the",
"given",
"node",
"type",
"definition",
"is",
"valid",
"under",
"the",
"ModeShape",
"and",
"JCR",
"type",
"rules",
"within",
"the",
"given",
"context",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/NodeTypes.java#L2038-L2092 | train |
ModeShape/modeshape | modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrType.java | JcrType.isCaseSensitive | public boolean isCaseSensitive() {
switch (getJcrType()) {
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.DECIMAL:
case PropertyType.WEAKREFERENCE:
case PropertyType.REFERENCE: // conversion is case-insensitive
case PropertyType.BOOLEAN: // conversion is case-insensitive
return false;
}
return true;
} | java | public boolean isCaseSensitive() {
switch (getJcrType()) {
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.DECIMAL:
case PropertyType.WEAKREFERENCE:
case PropertyType.REFERENCE: // conversion is case-insensitive
case PropertyType.BOOLEAN: // conversion is case-insensitive
return false;
}
return true;
} | [
"public",
"boolean",
"isCaseSensitive",
"(",
")",
"{",
"switch",
"(",
"getJcrType",
"(",
")",
")",
"{",
"case",
"PropertyType",
".",
"DOUBLE",
":",
"case",
"PropertyType",
".",
"LONG",
":",
"case",
"PropertyType",
".",
"DECIMAL",
":",
"case",
"PropertyType",... | Get the indicator if the value is case sensitive
@return boolean indicating if the value is case sensitive | [
"Get",
"the",
"indicator",
"if",
"the",
"value",
"is",
"case",
"sensitive"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrType.java#L207-L218 | train |
ModeShape/modeshape | modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrType.java | JcrType.isSigned | public boolean isSigned() {
switch (getJcrType()) {
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.DECIMAL:
case PropertyType.DATE:
return true;
}
return false;
} | java | public boolean isSigned() {
switch (getJcrType()) {
case PropertyType.DOUBLE:
case PropertyType.LONG:
case PropertyType.DECIMAL:
case PropertyType.DATE:
return true;
}
return false;
} | [
"public",
"boolean",
"isSigned",
"(",
")",
"{",
"switch",
"(",
"getJcrType",
"(",
")",
")",
"{",
"case",
"PropertyType",
".",
"DOUBLE",
":",
"case",
"PropertyType",
".",
"LONG",
":",
"case",
"PropertyType",
".",
"DECIMAL",
":",
"case",
"PropertyType",
".",... | Get the indicator if the value is considered a signed value.
@return boolean indicating if value is signed. | [
"Get",
"the",
"indicator",
"if",
"the",
"value",
"is",
"considered",
"a",
"signed",
"value",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jdbc-local/src/main/java/org/modeshape/jdbc/JcrType.java#L225-L234 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/collection/Collections.java | Collections.concat | public static <T> Iterable<T> concat( final Iterable<T> a,
final Iterable<T> b ) {
assert (a != null);
assert (b != null);
return () -> Collections.concat(a.iterator(), b.iterator());
} | java | public static <T> Iterable<T> concat( final Iterable<T> a,
final Iterable<T> b ) {
assert (a != null);
assert (b != null);
return () -> Collections.concat(a.iterator(), b.iterator());
} | [
"public",
"static",
"<",
"T",
">",
"Iterable",
"<",
"T",
">",
"concat",
"(",
"final",
"Iterable",
"<",
"T",
">",
"a",
",",
"final",
"Iterable",
"<",
"T",
">",
"b",
")",
"{",
"assert",
"(",
"a",
"!=",
"null",
")",
";",
"assert",
"(",
"b",
"!=",
... | Concatenate two Iterable sources
@param a a non-null Iterable value
@param b a non-null Iterable value
@return an Iterable that will iterate through all the values from 'a' and then all the values from 'b'
@param <T> the value type | [
"Concatenate",
"two",
"Iterable",
"sources"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/collection/Collections.java#L53-L59 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/collection/Collections.java | Collections.concat | public static <T> Iterator<T> concat( final Iterator<T> a,
final Iterator<T> b ) {
assert (a != null);
assert (b != null);
return new Iterator<T>() {
@Override
public boolean hasNext() {
return a.hasNext() || b.hasNext();
}
@Override
public T next() {
if (a.hasNext()) {
return a.next();
}
return b.next();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} | java | public static <T> Iterator<T> concat( final Iterator<T> a,
final Iterator<T> b ) {
assert (a != null);
assert (b != null);
return new Iterator<T>() {
@Override
public boolean hasNext() {
return a.hasNext() || b.hasNext();
}
@Override
public T next() {
if (a.hasNext()) {
return a.next();
}
return b.next();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
} | [
"public",
"static",
"<",
"T",
">",
"Iterator",
"<",
"T",
">",
"concat",
"(",
"final",
"Iterator",
"<",
"T",
">",
"a",
",",
"final",
"Iterator",
"<",
"T",
">",
"b",
")",
"{",
"assert",
"(",
"a",
"!=",
"null",
")",
";",
"assert",
"(",
"b",
"!=",
... | Concatenate two Iterators
@param a a non-null Iterator
@param b a non-null Iterator
@return an Iterator that will iterate through all the values of 'a', and then all the values of 'b'
@param <T> the value type | [
"Concatenate",
"two",
"Iterators"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/collection/Collections.java#L69-L95 | train |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.column | public EsIndexColumn column(String name) {
return columns.get(noprefix(name,
EsIndexColumn.LENGTH_PREFIX,
EsIndexColumn.LOWERCASE_PREFIX,
EsIndexColumn.UPPERCASE_PREFIX));
} | java | public EsIndexColumn column(String name) {
return columns.get(noprefix(name,
EsIndexColumn.LENGTH_PREFIX,
EsIndexColumn.LOWERCASE_PREFIX,
EsIndexColumn.UPPERCASE_PREFIX));
} | [
"public",
"EsIndexColumn",
"column",
"(",
"String",
"name",
")",
"{",
"return",
"columns",
".",
"get",
"(",
"noprefix",
"(",
"name",
",",
"EsIndexColumn",
".",
"LENGTH_PREFIX",
",",
"EsIndexColumn",
".",
"LOWERCASE_PREFIX",
",",
"EsIndexColumn",
".",
"UPPERCASE_... | Gets column with given name.
@param name the name of column in index or name of pseudo column like
lower case, upper case or length.
@return real column definition related to the specified name | [
"Gets",
"column",
"with",
"given",
"name",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L78-L83 | train |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.noprefix | private String noprefix(String name, String... prefix) {
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | java | private String noprefix(String name, String... prefix) {
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | [
"private",
"String",
"noprefix",
"(",
"String",
"name",
",",
"String",
"...",
"prefix",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prefix",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"name",
".",
"startsWith",
"(",
"pref... | Cuts name prefix for the pseudo column case.
@param name the name of the column or pseudo column.
@param prefix the list of prefixes to cut.
@return the name without prefix. | [
"Cuts",
"name",
"prefix",
"for",
"the",
"pseudo",
"column",
"case",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L92-L99 | train |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.mappings | public EsRequest mappings( String type ) {
EsRequest mappings = new EsRequest();
EsRequest mappingsValue = new EsRequest();
EsRequest mtype = new EsRequest();
EsRequest properties = new EsRequest();
for (EsIndexColumn col : columns()) {
properties.put(col.getName(), fieldMapping(col.getType()));
properties.put(col.getLowerCaseFieldName(), fieldMapping(PropertyType.STRING));
properties.put(col.getUpperCaseFieldName(), fieldMapping(PropertyType.STRING));
properties.put(col.getLengthFieldName(), fieldMapping(PropertyType.LONG));
}
mtype.put("properties", properties);
mappingsValue.put(type, mtype);
mappings.put("mappings", mappingsValue);
return mappings;
} | java | public EsRequest mappings( String type ) {
EsRequest mappings = new EsRequest();
EsRequest mappingsValue = new EsRequest();
EsRequest mtype = new EsRequest();
EsRequest properties = new EsRequest();
for (EsIndexColumn col : columns()) {
properties.put(col.getName(), fieldMapping(col.getType()));
properties.put(col.getLowerCaseFieldName(), fieldMapping(PropertyType.STRING));
properties.put(col.getUpperCaseFieldName(), fieldMapping(PropertyType.STRING));
properties.put(col.getLengthFieldName(), fieldMapping(PropertyType.LONG));
}
mtype.put("properties", properties);
mappingsValue.put(type, mtype);
mappings.put("mappings", mappingsValue);
return mappings;
} | [
"public",
"EsRequest",
"mappings",
"(",
"String",
"type",
")",
"{",
"EsRequest",
"mappings",
"=",
"new",
"EsRequest",
"(",
")",
";",
"EsRequest",
"mappingsValue",
"=",
"new",
"EsRequest",
"(",
")",
";",
"EsRequest",
"mtype",
"=",
"new",
"EsRequest",
"(",
"... | Provides Elasticsearch mapping definition for the given type and
this columns.
@param type the type name for wich this mapping will be applied.
@return mappings definition in the JSON format. | [
"Provides",
"Elasticsearch",
"mapping",
"definition",
"for",
"the",
"given",
"type",
"and",
"this",
"columns",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L117-L133 | train |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.fieldMapping | private EsRequest fieldMapping( PropertyType type ) {
EsRequest mappings = new EsRequest();
switch (type) {
case BINARY:
mappings.put("type", "binary");
break;
case BOOLEAN:
mappings.put("type", "boolean");
break;
case DATE:
mappings.put("type", "long");
break;
case LONG:
case DECIMAL:
mappings.put("type", "long");
break;
case DOUBLE:
mappings.put("type", "double");
break;
default:
mappings.put("type", "string");
mappings.put("analyzer", "whitespace");
}
return mappings;
} | java | private EsRequest fieldMapping( PropertyType type ) {
EsRequest mappings = new EsRequest();
switch (type) {
case BINARY:
mappings.put("type", "binary");
break;
case BOOLEAN:
mappings.put("type", "boolean");
break;
case DATE:
mappings.put("type", "long");
break;
case LONG:
case DECIMAL:
mappings.put("type", "long");
break;
case DOUBLE:
mappings.put("type", "double");
break;
default:
mappings.put("type", "string");
mappings.put("analyzer", "whitespace");
}
return mappings;
} | [
"private",
"EsRequest",
"fieldMapping",
"(",
"PropertyType",
"type",
")",
"{",
"EsRequest",
"mappings",
"=",
"new",
"EsRequest",
"(",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"BINARY",
":",
"mappings",
".",
"put",
"(",
"\"type\"",
",",
"\"binary\... | Creates mapping definition for the specified column type.
@param type
@return | [
"Creates",
"mapping",
"definition",
"for",
"the",
"specified",
"column",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L141-L165 | train |
ModeShape/modeshape | web/modeshape-web-explorer/src/main/java/org/modeshape/web/shared/ModalDialog.java | ModalDialog.setControls | public void setControls(FormItem... items) {
FormItem[] controls = new FormItem[items.length + 3];
int i = 0;
for (FormItem item : items) {
controls[i++] = item;
}
controls[i++] = new SpacerItem();
controls[i++] = confirmButton;
controls[i++] = cancelButton;
form.setItems(controls);
} | java | public void setControls(FormItem... items) {
FormItem[] controls = new FormItem[items.length + 3];
int i = 0;
for (FormItem item : items) {
controls[i++] = item;
}
controls[i++] = new SpacerItem();
controls[i++] = confirmButton;
controls[i++] = cancelButton;
form.setItems(controls);
} | [
"public",
"void",
"setControls",
"(",
"FormItem",
"...",
"items",
")",
"{",
"FormItem",
"[",
"]",
"controls",
"=",
"new",
"FormItem",
"[",
"items",
".",
"length",
"+",
"3",
"]",
";",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"FormItem",
"item",
":",
"... | Adds controls to this dialog.
@param items controls | [
"Adds",
"controls",
"to",
"this",
"dialog",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/shared/ModalDialog.java#L110-L123 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java | FileUtil.unzip | public static void unzip(InputStream zipFile, String dest) throws IOException {
byte[] buffer = new byte[1024];
//create output directory is not exists
File folder = new File(dest);
if (folder.exists()) {
FileUtil.delete(folder);
}
folder.mkdir();
//get the zip file content
try (ZipInputStream zis = new ZipInputStream(zipFile)) {
//get the zipped file list entry
ZipEntry ze = zis.getNextEntry();
File parent = new File(dest);
while (ze != null) {
String fileName = ze.getName();
if (ze.isDirectory()) {
File newFolder = new File(parent, fileName);
newFolder.mkdir();
} else {
File newFile = new File(parent, fileName);
try (FileOutputStream fos = new FileOutputStream(newFile)) {
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
}
}
ze = zis.getNextEntry();
}
zis.closeEntry();
}
} | java | public static void unzip(InputStream zipFile, String dest) throws IOException {
byte[] buffer = new byte[1024];
//create output directory is not exists
File folder = new File(dest);
if (folder.exists()) {
FileUtil.delete(folder);
}
folder.mkdir();
//get the zip file content
try (ZipInputStream zis = new ZipInputStream(zipFile)) {
//get the zipped file list entry
ZipEntry ze = zis.getNextEntry();
File parent = new File(dest);
while (ze != null) {
String fileName = ze.getName();
if (ze.isDirectory()) {
File newFolder = new File(parent, fileName);
newFolder.mkdir();
} else {
File newFile = new File(parent, fileName);
try (FileOutputStream fos = new FileOutputStream(newFile)) {
int len;
while ((len = zis.read(buffer)) > 0) {
fos.write(buffer, 0, len);
}
}
}
ze = zis.getNextEntry();
}
zis.closeEntry();
}
} | [
"public",
"static",
"void",
"unzip",
"(",
"InputStream",
"zipFile",
",",
"String",
"dest",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"//create output directory is not exists",
"File",
"folder",
"=... | Unzip archive to the specified destination.
@param zipFile zip archive
@param dest directory where archive will be uncompressed
@throws IOException | [
"Unzip",
"archive",
"to",
"the",
"specified",
"destination",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L206-L242 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java | FileUtil.zipDir | public static void zipDir(String dirName, String nameZipFile) throws IOException {
try (FileOutputStream fW = new FileOutputStream(nameZipFile);
ZipOutputStream zip = new ZipOutputStream(fW)) {
addFolderToZip("", dirName, zip);
}
} | java | public static void zipDir(String dirName, String nameZipFile) throws IOException {
try (FileOutputStream fW = new FileOutputStream(nameZipFile);
ZipOutputStream zip = new ZipOutputStream(fW)) {
addFolderToZip("", dirName, zip);
}
} | [
"public",
"static",
"void",
"zipDir",
"(",
"String",
"dirName",
",",
"String",
"nameZipFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"fW",
"=",
"new",
"FileOutputStream",
"(",
"nameZipFile",
")",
";",
"ZipOutputStream",
"zip",
"=",
... | Compresses directory into zip archive.
@param dirName the path to the directory
@param nameZipFile archive name.
@throws IOException | [
"Compresses",
"directory",
"into",
"zip",
"archive",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L251-L256 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java | FileUtil.addFolderToZip | public static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException {
File folder = new File(srcFolder);
if (folder.list().length == 0) {
addFileToZip(path, srcFolder, zip, true);
} else {
for (String fileName : folder.list()) {
if (path.equals("")) {
addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip, false);
} else {
addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip, false);
}
}
}
} | java | public static void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) throws IOException {
File folder = new File(srcFolder);
if (folder.list().length == 0) {
addFileToZip(path, srcFolder, zip, true);
} else {
for (String fileName : folder.list()) {
if (path.equals("")) {
addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip, false);
} else {
addFileToZip(path + "/" + folder.getName(), srcFolder + "/" + fileName, zip, false);
}
}
}
} | [
"public",
"static",
"void",
"addFolderToZip",
"(",
"String",
"path",
",",
"String",
"srcFolder",
",",
"ZipOutputStream",
"zip",
")",
"throws",
"IOException",
"{",
"File",
"folder",
"=",
"new",
"File",
"(",
"srcFolder",
")",
";",
"if",
"(",
"folder",
".",
"... | Adds folder to the archive.
@param path path to the folder
@param srcFolder folder name
@param zip zip archive
@throws IOException | [
"Adds",
"folder",
"to",
"the",
"archive",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L266-L279 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java | FileUtil.addFileToZip | public static void addFileToZip(String path, String srcFile, ZipOutputStream zip, boolean flag) throws IOException {
File folder = new File(srcFile);
if (flag) {
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName() + "/"));
} else {
if (folder.isDirectory()) {
addFolderToZip(path, srcFile, zip);
} else {
byte[] buf = new byte[1024];
int len;
try (FileInputStream in = new FileInputStream(srcFile)) {
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
while ((len = in.read(buf)) > 0) {
zip.write(buf, 0, len);
}
}
}
}
} | java | public static void addFileToZip(String path, String srcFile, ZipOutputStream zip, boolean flag) throws IOException {
File folder = new File(srcFile);
if (flag) {
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName() + "/"));
} else {
if (folder.isDirectory()) {
addFolderToZip(path, srcFile, zip);
} else {
byte[] buf = new byte[1024];
int len;
try (FileInputStream in = new FileInputStream(srcFile)) {
zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
while ((len = in.read(buf)) > 0) {
zip.write(buf, 0, len);
}
}
}
}
} | [
"public",
"static",
"void",
"addFileToZip",
"(",
"String",
"path",
",",
"String",
"srcFile",
",",
"ZipOutputStream",
"zip",
",",
"boolean",
"flag",
")",
"throws",
"IOException",
"{",
"File",
"folder",
"=",
"new",
"File",
"(",
"srcFile",
")",
";",
"if",
"("... | Appends file to the archive.
@param path path to the file
@param srcFile file name
@param zip archive
@param flag
@throws IOException | [
"Appends",
"file",
"to",
"the",
"archive",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L290-L308 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java | FileUtil.getExtension | public static String getExtension(final String filename) {
Objects.requireNonNull(filename, "filename cannot be null");
int lastDotIdx = filename.lastIndexOf(".");
return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : "";
} | java | public static String getExtension(final String filename) {
Objects.requireNonNull(filename, "filename cannot be null");
int lastDotIdx = filename.lastIndexOf(".");
return lastDotIdx >= 0 ? filename.substring(lastDotIdx) : "";
} | [
"public",
"static",
"String",
"getExtension",
"(",
"final",
"String",
"filename",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"filename",
",",
"\"filename cannot be null\"",
")",
";",
"int",
"lastDotIdx",
"=",
"filename",
".",
"lastIndexOf",
"(",
"\".\"",
"... | Returns the extension of a file, including the dot.
@param filename the name of a file, may be not be null
@return the file extension or an empty string if the extension cannot be determined. | [
"Returns",
"the",
"extension",
"of",
"a",
"file",
"including",
"the",
"dot",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/FileUtil.java#L316-L320 | train |
ModeShape/modeshape | sequencers/modeshape-sequencer-sramp/src/main/java/org/modeshape/sequencer/sramp/AbstractResolvingReader.java | AbstractResolvingReader.read | public void read( InputStream stream,
Node outputNode ) throws Exception {
read(new InputSource(stream), outputNode);
} | java | public void read( InputStream stream,
Node outputNode ) throws Exception {
read(new InputSource(stream), outputNode);
} | [
"public",
"void",
"read",
"(",
"InputStream",
"stream",
",",
"Node",
"outputNode",
")",
"throws",
"Exception",
"{",
"read",
"(",
"new",
"InputSource",
"(",
"stream",
")",
",",
"outputNode",
")",
";",
"}"
] | Read the document from the supplied stream, and produce the derived content.
@param stream the stream; may not be null
@param outputNode the parent node at which the derived content should be written; may not be null
@throws Exception if there is a problem reading the XSD content | [
"Read",
"the",
"document",
"from",
"the",
"supplied",
"stream",
"and",
"produce",
"the",
"derived",
"content",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-sramp/src/main/java/org/modeshape/sequencer/sramp/AbstractResolvingReader.java#L75-L78 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java | JcrManagedConnection.openSession | private JcrSession openSession() throws ResourceException {
try {
Repository repo = mcf.getRepository();
Session s = repo.login(cri.getCredentials(), cri.getWorkspace());
return (JcrSession) s;
} catch (RepositoryException e) {
throw new ResourceException("Failed to create session: " + e.getMessage(), e);
}
} | java | private JcrSession openSession() throws ResourceException {
try {
Repository repo = mcf.getRepository();
Session s = repo.login(cri.getCredentials(), cri.getWorkspace());
return (JcrSession) s;
} catch (RepositoryException e) {
throw new ResourceException("Failed to create session: " + e.getMessage(), e);
}
} | [
"private",
"JcrSession",
"openSession",
"(",
")",
"throws",
"ResourceException",
"{",
"try",
"{",
"Repository",
"repo",
"=",
"mcf",
".",
"getRepository",
"(",
")",
";",
"Session",
"s",
"=",
"repo",
".",
"login",
"(",
"cri",
".",
"getCredentials",
"(",
")",... | Create a new session.
@return new JCR session handle object.
@throws ResourceException if there is an error opening the session | [
"Create",
"a",
"new",
"session",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java#L126-L134 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java | JcrManagedConnection.destroy | @Override
public void destroy() throws ResourceException {
LOGGER.debug("Shutting down connection to repo '{0}'", mcf.getRepositoryURL());
this.session.logout();
this.handles.clear();
} | java | @Override
public void destroy() throws ResourceException {
LOGGER.debug("Shutting down connection to repo '{0}'", mcf.getRepositoryURL());
this.session.logout();
this.handles.clear();
} | [
"@",
"Override",
"public",
"void",
"destroy",
"(",
")",
"throws",
"ResourceException",
"{",
"LOGGER",
".",
"debug",
"(",
"\"Shutting down connection to repo '{0}'\"",
",",
"mcf",
".",
"getRepositoryURL",
"(",
")",
")",
";",
"this",
".",
"session",
".",
"logout",... | Destroys the physical connection to the underlying resource manager.
@throws ResourceException generic exception if operation fails | [
"Destroys",
"the",
"physical",
"connection",
"to",
"the",
"underlying",
"resource",
"manager",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java#L187-L192 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java | JcrManagedConnection.getMetaData | @Override
public ManagedConnectionMetaData getMetaData() throws ResourceException {
try {
return new JcrManagedConnectionMetaData(mcf.getRepository(), session);
} catch (Exception e) {
throw new ResourceException(e);
}
} | java | @Override
public ManagedConnectionMetaData getMetaData() throws ResourceException {
try {
return new JcrManagedConnectionMetaData(mcf.getRepository(), session);
} catch (Exception e) {
throw new ResourceException(e);
}
} | [
"@",
"Override",
"public",
"ManagedConnectionMetaData",
"getMetaData",
"(",
")",
"throws",
"ResourceException",
"{",
"try",
"{",
"return",
"new",
"JcrManagedConnectionMetaData",
"(",
"mcf",
".",
"getRepository",
"(",
")",
",",
"session",
")",
";",
"}",
"catch",
... | Gets the metadata information for this connection's underlying EIS resource manager instance.
@return ManagedConnectionMetaData instance
@throws ResourceException generic exception if operation fails | [
"Gets",
"the",
"metadata",
"information",
"for",
"this",
"connection",
"s",
"underlying",
"EIS",
"resource",
"manager",
"instance",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java#L283-L290 | train |
ModeShape/modeshape | modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java | JcrManagedConnection.getSession | public Session getSession( JcrSessionHandle handle ) {
if ((handles.size() > 0) && (handles.get(0) == handle)) {
return session;
}
throw new java.lang.IllegalStateException("Inactive logical session handle called");
} | java | public Session getSession( JcrSessionHandle handle ) {
if ((handles.size() > 0) && (handles.get(0) == handle)) {
return session;
}
throw new java.lang.IllegalStateException("Inactive logical session handle called");
} | [
"public",
"Session",
"getSession",
"(",
"JcrSessionHandle",
"handle",
")",
"{",
"if",
"(",
"(",
"handles",
".",
"size",
"(",
")",
">",
"0",
")",
"&&",
"(",
"handles",
".",
"get",
"(",
"0",
")",
"==",
"handle",
")",
")",
"{",
"return",
"session",
";... | Searches session object using handle.
@param handle the session handle
@return session related to specified handle. | [
"Searches",
"session",
"object",
"using",
"handle",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jca/src/main/java/org/modeshape/jca/JcrManagedConnection.java#L298-L303 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.combineLines | public static String combineLines( String[] lines,
char separator ) {
if (lines == null || lines.length == 0) return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i != lines.length; ++i) {
String line = lines[i];
if (i != 0) sb.append(separator);
sb.append(line);
}
return sb.toString();
} | java | public static String combineLines( String[] lines,
char separator ) {
if (lines == null || lines.length == 0) return "";
StringBuilder sb = new StringBuilder();
for (int i = 0; i != lines.length; ++i) {
String line = lines[i];
if (i != 0) sb.append(separator);
sb.append(line);
}
return sb.toString();
} | [
"public",
"static",
"String",
"combineLines",
"(",
"String",
"[",
"]",
"lines",
",",
"char",
"separator",
")",
"{",
"if",
"(",
"lines",
"==",
"null",
"||",
"lines",
".",
"length",
"==",
"0",
")",
"return",
"\"\"",
";",
"StringBuilder",
"sb",
"=",
"new"... | Combine the lines into a single string, using the supplied separator as the delimiter.
@param lines the lines to be combined
@param separator the separator character
@return the combined lines, or an empty string if there are no lines | [
"Combine",
"the",
"lines",
"into",
"a",
"single",
"string",
"using",
"the",
"supplied",
"separator",
"as",
"the",
"delimiter",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L67-L77 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.splitLines | public static List<String> splitLines( final String content ) {
if (content == null || content.length() == 0) return Collections.emptyList();
String[] lines = content.split("[\\r]?\\n");
return Arrays.asList(lines);
} | java | public static List<String> splitLines( final String content ) {
if (content == null || content.length() == 0) return Collections.emptyList();
String[] lines = content.split("[\\r]?\\n");
return Arrays.asList(lines);
} | [
"public",
"static",
"List",
"<",
"String",
">",
"splitLines",
"(",
"final",
"String",
"content",
")",
"{",
"if",
"(",
"content",
"==",
"null",
"||",
"content",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"Collections",
".",
"emptyList",
"(",
")"... | Split the supplied content into lines, returning each line as an element in the returned list.
@param content the string content that is to be split
@return the list of lines; never null but may be an empty (unmodifiable) list if the supplied content is null or empty | [
"Split",
"the",
"supplied",
"content",
"into",
"lines",
"returning",
"each",
"line",
"as",
"an",
"element",
"in",
"the",
"returned",
"list",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L85-L89 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.createString | public static String createString( final char charToRepeat,
int numberOfRepeats ) {
assert numberOfRepeats >= 0;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < numberOfRepeats; ++i) {
sb.append(charToRepeat);
}
return sb.toString();
} | java | public static String createString( final char charToRepeat,
int numberOfRepeats ) {
assert numberOfRepeats >= 0;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < numberOfRepeats; ++i) {
sb.append(charToRepeat);
}
return sb.toString();
} | [
"public",
"static",
"String",
"createString",
"(",
"final",
"char",
"charToRepeat",
",",
"int",
"numberOfRepeats",
")",
"{",
"assert",
"numberOfRepeats",
">=",
"0",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i... | Create a new string containing the specified character repeated a specific number of times.
@param charToRepeat the character to repeat
@param numberOfRepeats the number of times the character is to repeat in the result; must be greater than 0
@return the resulting string | [
"Create",
"a",
"new",
"string",
"containing",
"the",
"specified",
"character",
"repeated",
"a",
"specific",
"number",
"of",
"times",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L206-L214 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.justify | public static String justify( Justify justify,
String str,
final int width,
char padWithChar ) {
switch (justify) {
case LEFT:
return justifyLeft(str, width, padWithChar);
case RIGHT:
return justifyRight(str, width, padWithChar);
case CENTER:
return justifyCenter(str, width, padWithChar);
}
assert false;
return null;
} | java | public static String justify( Justify justify,
String str,
final int width,
char padWithChar ) {
switch (justify) {
case LEFT:
return justifyLeft(str, width, padWithChar);
case RIGHT:
return justifyRight(str, width, padWithChar);
case CENTER:
return justifyCenter(str, width, padWithChar);
}
assert false;
return null;
} | [
"public",
"static",
"String",
"justify",
"(",
"Justify",
"justify",
",",
"String",
"str",
",",
"final",
"int",
"width",
",",
"char",
"padWithChar",
")",
"{",
"switch",
"(",
"justify",
")",
"{",
"case",
"LEFT",
":",
"return",
"justifyLeft",
"(",
"str",
",... | Justify the contents of the string.
@param justify the way in which the string is to be justified
@param str the string to be right justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the right justified string | [
"Justify",
"the",
"contents",
"of",
"the",
"string",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L248-L262 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.justifyRight | public static String justifyRight( String str,
final int width,
char padWithChar ) {
assert width > 0;
// Trim the leading and trailing whitespace ...
str = str != null ? str.trim() : "";
final int length = str.length();
int addChars = width - length;
if (addChars < 0) {
// truncate the first characters, keep the last
return str.subSequence(length - width, length).toString();
}
// Prepend the whitespace ...
final StringBuilder sb = new StringBuilder();
while (addChars > 0) {
sb.append(padWithChar);
--addChars;
}
// Write the content ...
sb.append(str);
return sb.toString();
} | java | public static String justifyRight( String str,
final int width,
char padWithChar ) {
assert width > 0;
// Trim the leading and trailing whitespace ...
str = str != null ? str.trim() : "";
final int length = str.length();
int addChars = width - length;
if (addChars < 0) {
// truncate the first characters, keep the last
return str.subSequence(length - width, length).toString();
}
// Prepend the whitespace ...
final StringBuilder sb = new StringBuilder();
while (addChars > 0) {
sb.append(padWithChar);
--addChars;
}
// Write the content ...
sb.append(str);
return sb.toString();
} | [
"public",
"static",
"String",
"justifyRight",
"(",
"String",
"str",
",",
"final",
"int",
"width",
",",
"char",
"padWithChar",
")",
"{",
"assert",
"width",
">",
"0",
";",
"// Trim the leading and trailing whitespace ...",
"str",
"=",
"str",
"!=",
"null",
"?",
"... | Right justify the contents of the string, ensuring that the string ends at the last character. If the supplied string is
longer than the desired width, the leading characters are removed so that the last character in the supplied string at the
last position. If the supplied string is shorter than the desired width, the padding character is inserted one or more
times such that the last character in the supplied string appears as the last character in the resulting string and that
the length matches that specified.
@param str the string to be right justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the right justified string | [
"Right",
"justify",
"the",
"contents",
"of",
"the",
"string",
"ensuring",
"that",
"the",
"string",
"ends",
"at",
"the",
"last",
"character",
".",
"If",
"the",
"supplied",
"string",
"is",
"longer",
"than",
"the",
"desired",
"width",
"the",
"leading",
"charact... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L276-L299 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.justifyLeft | public static String justifyLeft( String str,
final int width,
char padWithChar ) {
return justifyLeft(str, width, padWithChar, true);
} | java | public static String justifyLeft( String str,
final int width,
char padWithChar ) {
return justifyLeft(str, width, padWithChar, true);
} | [
"public",
"static",
"String",
"justifyLeft",
"(",
"String",
"str",
",",
"final",
"int",
"width",
",",
"char",
"padWithChar",
")",
"{",
"return",
"justifyLeft",
"(",
"str",
",",
"width",
",",
"padWithChar",
",",
"true",
")",
";",
"}"
] | Left justify the contents of the string, ensuring that the supplied string begins at the first character and that the
resulting string is of the desired length. If the supplied string is longer than the desired width, it is truncated to the
specified length. If the supplied string is shorter than the desired width, the padding character is added to the end of
the string one or more times such that the length is that specified. All leading and trailing whitespace is removed.
@param str the string to be left justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the left justified string
@see #setLength(String, int, char) | [
"Left",
"justify",
"the",
"contents",
"of",
"the",
"string",
"ensuring",
"that",
"the",
"supplied",
"string",
"begins",
"at",
"the",
"first",
"character",
"and",
"that",
"the",
"resulting",
"string",
"is",
"of",
"the",
"desired",
"length",
".",
"If",
"the",
... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L313-L317 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.justifyCenter | public static String justifyCenter( String str,
final int width,
char padWithChar ) {
// Trim the leading and trailing whitespace ...
str = str != null ? str.trim() : "";
int addChars = width - str.length();
if (addChars < 0) {
// truncate
return str.subSequence(0, width).toString();
}
// Write the content ...
int prependNumber = addChars / 2;
int appendNumber = prependNumber;
if ((prependNumber + appendNumber) != addChars) {
++prependNumber;
}
final StringBuilder sb = new StringBuilder();
// Prepend the pad character(s) ...
while (prependNumber > 0) {
sb.append(padWithChar);
--prependNumber;
}
// Add the actual content
sb.append(str);
// Append the pad character(s) ...
while (appendNumber > 0) {
sb.append(padWithChar);
--appendNumber;
}
return sb.toString();
} | java | public static String justifyCenter( String str,
final int width,
char padWithChar ) {
// Trim the leading and trailing whitespace ...
str = str != null ? str.trim() : "";
int addChars = width - str.length();
if (addChars < 0) {
// truncate
return str.subSequence(0, width).toString();
}
// Write the content ...
int prependNumber = addChars / 2;
int appendNumber = prependNumber;
if ((prependNumber + appendNumber) != addChars) {
++prependNumber;
}
final StringBuilder sb = new StringBuilder();
// Prepend the pad character(s) ...
while (prependNumber > 0) {
sb.append(padWithChar);
--prependNumber;
}
// Add the actual content
sb.append(str);
// Append the pad character(s) ...
while (appendNumber > 0) {
sb.append(padWithChar);
--appendNumber;
}
return sb.toString();
} | [
"public",
"static",
"String",
"justifyCenter",
"(",
"String",
"str",
",",
"final",
"int",
"width",
",",
"char",
"padWithChar",
")",
"{",
"// Trim the leading and trailing whitespace ...",
"str",
"=",
"str",
"!=",
"null",
"?",
"str",
".",
"trim",
"(",
")",
":",... | Center the contents of the string. If the supplied string is longer than the desired width, it is truncated to the
specified length. If the supplied string is shorter than the desired width, padding characters are added to the beginning
and end of the string such that the length is that specified; one additional padding character is prepended if required.
All leading and trailing whitespace is removed before centering.
@param str the string to be left justified; if null, an empty string is used
@param width the desired width of the string; must be positive
@param padWithChar the character to use for padding, if needed
@return the left justified string
@see #setLength(String, int, char) | [
"Center",
"the",
"contents",
"of",
"the",
"string",
".",
"If",
"the",
"supplied",
"string",
"is",
"longer",
"than",
"the",
"desired",
"width",
"it",
"is",
"truncated",
"to",
"the",
"specified",
"length",
".",
"If",
"the",
"supplied",
"string",
"is",
"short... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L356-L392 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.truncate | public static String truncate( Object obj,
int maxLength,
String suffix ) {
CheckArg.isNonNegative(maxLength, "maxLength");
if (obj == null || maxLength == 0) {
return "";
}
String str = obj.toString();
if (str.length() <= maxLength) return str;
if (suffix == null) suffix = "...";
int maxNumChars = maxLength - suffix.length();
if (maxNumChars < 0) {
// Then the max length is actually shorter than the suffix ...
str = suffix.substring(0, maxLength);
} else if (str.length() > maxNumChars) {
str = str.substring(0, maxNumChars) + suffix;
}
return str;
} | java | public static String truncate( Object obj,
int maxLength,
String suffix ) {
CheckArg.isNonNegative(maxLength, "maxLength");
if (obj == null || maxLength == 0) {
return "";
}
String str = obj.toString();
if (str.length() <= maxLength) return str;
if (suffix == null) suffix = "...";
int maxNumChars = maxLength - suffix.length();
if (maxNumChars < 0) {
// Then the max length is actually shorter than the suffix ...
str = suffix.substring(0, maxLength);
} else if (str.length() > maxNumChars) {
str = str.substring(0, maxNumChars) + suffix;
}
return str;
} | [
"public",
"static",
"String",
"truncate",
"(",
"Object",
"obj",
",",
"int",
"maxLength",
",",
"String",
"suffix",
")",
"{",
"CheckArg",
".",
"isNonNegative",
"(",
"maxLength",
",",
"\"maxLength\"",
")",
";",
"if",
"(",
"obj",
"==",
"null",
"||",
"maxLength... | Truncate the supplied string to be no more than the specified length. This method returns an empty string if the supplied
object is null.
@param obj the object from which the string is to be obtained using {@link Object#toString()}.
@param maxLength the maximum length of the string being returned
@param suffix the suffix that should be added to the content if the string must be truncated, or null if the default suffix
of "..." should be used
@return the supplied string if no longer than the maximum length, or the supplied string truncated to be no longer than the
maximum length (including the suffix)
@throws IllegalArgumentException if the maximum length is negative | [
"Truncate",
"the",
"supplied",
"string",
"to",
"be",
"no",
"more",
"than",
"the",
"specified",
"length",
".",
"This",
"method",
"returns",
"an",
"empty",
"string",
"if",
"the",
"supplied",
"object",
"is",
"null",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L421-L439 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.getStackTrace | public static String getStackTrace( Throwable throwable ) {
if (throwable == null) return null;
final ByteArrayOutputStream bas = new ByteArrayOutputStream();
final PrintWriter pw = new PrintWriter(bas);
throwable.printStackTrace(pw);
pw.close();
return bas.toString();
} | java | public static String getStackTrace( Throwable throwable ) {
if (throwable == null) return null;
final ByteArrayOutputStream bas = new ByteArrayOutputStream();
final PrintWriter pw = new PrintWriter(bas);
throwable.printStackTrace(pw);
pw.close();
return bas.toString();
} | [
"public",
"static",
"String",
"getStackTrace",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"throwable",
"==",
"null",
")",
"return",
"null",
";",
"final",
"ByteArrayOutputStream",
"bas",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"Pri... | Get the stack trace of the supplied exception.
@param throwable the exception for which the stack trace is to be returned
@return the stack trace, or null if the supplied exception is null | [
"Get",
"the",
"stack",
"trace",
"of",
"the",
"supplied",
"exception",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L499-L506 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.normalize | public static String normalize( String text ) {
CheckArg.isNotNull(text, "text");
// This could be much more efficient.
return NORMALIZE_PATTERN.matcher(text).replaceAll(" ").trim();
} | java | public static String normalize( String text ) {
CheckArg.isNotNull(text, "text");
// This could be much more efficient.
return NORMALIZE_PATTERN.matcher(text).replaceAll(" ").trim();
} | [
"public",
"static",
"String",
"normalize",
"(",
"String",
"text",
")",
"{",
"CheckArg",
".",
"isNotNull",
"(",
"text",
",",
"\"text\"",
")",
";",
"// This could be much more efficient.",
"return",
"NORMALIZE_PATTERN",
".",
"matcher",
"(",
"text",
")",
".",
"repl... | Removes leading and trailing whitespace from the supplied text, and reduces other consecutive whitespace characters to a
single space. Whitespace includes line-feeds.
@param text the text to be normalized
@return the normalized text | [
"Removes",
"leading",
"and",
"trailing",
"whitespace",
"from",
"the",
"supplied",
"text",
"and",
"reduces",
"other",
"consecutive",
"whitespace",
"characters",
"to",
"a",
"single",
"space",
".",
"Whitespace",
"includes",
"line",
"-",
"feeds",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L515-L519 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.getHexString | public static String getHexString( byte[] bytes ) {
try {
byte[] hex = new byte[2 * bytes.length];
int index = 0;
for (byte b : bytes) {
int v = b & 0xFF;
hex[index++] = HEX_CHAR_TABLE[v >>> 4];
hex[index++] = HEX_CHAR_TABLE[v & 0xF];
}
return new String(hex, "ASCII");
} catch (UnsupportedEncodingException e) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "x", bi);
}
} | java | public static String getHexString( byte[] bytes ) {
try {
byte[] hex = new byte[2 * bytes.length];
int index = 0;
for (byte b : bytes) {
int v = b & 0xFF;
hex[index++] = HEX_CHAR_TABLE[v >>> 4];
hex[index++] = HEX_CHAR_TABLE[v & 0xF];
}
return new String(hex, "ASCII");
} catch (UnsupportedEncodingException e) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "x", bi);
}
} | [
"public",
"static",
"String",
"getHexString",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"hex",
"=",
"new",
"byte",
"[",
"2",
"*",
"bytes",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"byte",
... | Get the hexadecimal string representation of the supplied byte array.
@param bytes the byte array
@return the hex string representation of the byte array; never null | [
"Get",
"the",
"hexadecimal",
"string",
"representation",
"of",
"the",
"supplied",
"byte",
"array",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L530-L545 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java | StringUtil.containsAnyOf | public static boolean containsAnyOf( String str,
char... chars ) {
CharacterIterator iter = new StringCharacterIterator(str);
for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
for (char match : chars) {
if (c == match) return true;
}
}
return false;
} | java | public static boolean containsAnyOf( String str,
char... chars ) {
CharacterIterator iter = new StringCharacterIterator(str);
for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
for (char match : chars) {
if (c == match) return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsAnyOf",
"(",
"String",
"str",
",",
"char",
"...",
"chars",
")",
"{",
"CharacterIterator",
"iter",
"=",
"new",
"StringCharacterIterator",
"(",
"str",
")",
";",
"for",
"(",
"char",
"c",
"=",
"iter",
".",
"first",
"(",
... | Return whether the supplied string contains any of the supplied characters.
@param str the string to be examined; may not be null
@param chars the characters to be found within the supplied string; may be zero-length
@return true if the supplied string contains at least one of the supplied characters, or false otherwise | [
"Return",
"whether",
"the",
"supplied",
"string",
"contains",
"any",
"of",
"the",
"supplied",
"characters",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/StringUtil.java#L599-L608 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryLockManager.java | RepositoryLockManager.refreshFromSystem | protected void refreshFromSystem() {
try {
// Re-read and re-register all of the namespaces ...
SessionCache systemCache = repository.createSystemSession(repository.context(), false);
SystemContent system = new SystemContent(systemCache);
CachedNode locks = system.locksNode();
MutableCachedNode mutableLocks = null;
Set<NodeKey> corruptedLocks = new HashSet<>();
for (ChildReference ref : locks.getChildReferences(systemCache)) {
CachedNode node = systemCache.getNode(ref);
if (node == null) {
if (mutableLocks == null) {
mutableLocks = system.mutableLocksNode();
}
NodeKey lockKey = ref.getKey();
logger.warn(JcrI18n.lockNotFound, lockKey);
mutableLocks.removeChild(systemCache, lockKey);
corruptedLocks.add(lockKey);
continue;
}
ModeShapeLock lock = new ModeShapeLock(node, systemCache);
locksByNodeKey.put(lock.getLockedNodeKey(), lock);
}
if (mutableLocks != null) {
system.save();
for (Iterator<Map.Entry<NodeKey, ModeShapeLock>> locksIterator = locksByNodeKey.entrySet().iterator();
locksIterator.hasNext();) {
NodeKey lockKey = locksIterator.next().getValue().getLockKey();
if (corruptedLocks.contains(lockKey)) {
locksIterator.remove();
}
}
}
} catch (Throwable e) {
logger.error(e, JcrI18n.errorRefreshingLocks, repository.name());
}
} | java | protected void refreshFromSystem() {
try {
// Re-read and re-register all of the namespaces ...
SessionCache systemCache = repository.createSystemSession(repository.context(), false);
SystemContent system = new SystemContent(systemCache);
CachedNode locks = system.locksNode();
MutableCachedNode mutableLocks = null;
Set<NodeKey> corruptedLocks = new HashSet<>();
for (ChildReference ref : locks.getChildReferences(systemCache)) {
CachedNode node = systemCache.getNode(ref);
if (node == null) {
if (mutableLocks == null) {
mutableLocks = system.mutableLocksNode();
}
NodeKey lockKey = ref.getKey();
logger.warn(JcrI18n.lockNotFound, lockKey);
mutableLocks.removeChild(systemCache, lockKey);
corruptedLocks.add(lockKey);
continue;
}
ModeShapeLock lock = new ModeShapeLock(node, systemCache);
locksByNodeKey.put(lock.getLockedNodeKey(), lock);
}
if (mutableLocks != null) {
system.save();
for (Iterator<Map.Entry<NodeKey, ModeShapeLock>> locksIterator = locksByNodeKey.entrySet().iterator();
locksIterator.hasNext();) {
NodeKey lockKey = locksIterator.next().getValue().getLockKey();
if (corruptedLocks.contains(lockKey)) {
locksIterator.remove();
}
}
}
} catch (Throwable e) {
logger.error(e, JcrI18n.errorRefreshingLocks, repository.name());
}
} | [
"protected",
"void",
"refreshFromSystem",
"(",
")",
"{",
"try",
"{",
"// Re-read and re-register all of the namespaces ...",
"SessionCache",
"systemCache",
"=",
"repository",
".",
"createSystemSession",
"(",
"repository",
".",
"context",
"(",
")",
",",
"false",
")",
"... | Refresh the locks from the stored representation. | [
"Refresh",
"the",
"locks",
"from",
"the",
"stored",
"representation",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/RepositoryLockManager.java#L120-L156 | train |
ModeShape/modeshape | sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/JdtRecorder.java | JdtRecorder.record | protected void record( final Sequencer.Context context,
final char[] sourceCode,
final Node outputNode ) throws Exception {
if ((sourceCode == null) || (sourceCode.length == 0)) {
LOGGER.debug("No source code was found for output node {0}", outputNode.getName());
return;
}
this.context = context;
this.sourceCode = new String(sourceCode);
this.compilationUnit = (CompilationUnit)CompilationUnitParser.runJLS3Conversion(sourceCode, true);
outputNode.addMixin(ClassFileSequencerLexicon.COMPILATION_UNIT);
record(this.compilationUnit, outputNode);
} | java | protected void record( final Sequencer.Context context,
final char[] sourceCode,
final Node outputNode ) throws Exception {
if ((sourceCode == null) || (sourceCode.length == 0)) {
LOGGER.debug("No source code was found for output node {0}", outputNode.getName());
return;
}
this.context = context;
this.sourceCode = new String(sourceCode);
this.compilationUnit = (CompilationUnit)CompilationUnitParser.runJLS3Conversion(sourceCode, true);
outputNode.addMixin(ClassFileSequencerLexicon.COMPILATION_UNIT);
record(this.compilationUnit, outputNode);
} | [
"protected",
"void",
"record",
"(",
"final",
"Sequencer",
".",
"Context",
"context",
",",
"final",
"char",
"[",
"]",
"sourceCode",
",",
"final",
"Node",
"outputNode",
")",
"throws",
"Exception",
"{",
"if",
"(",
"(",
"sourceCode",
"==",
"null",
")",
"||",
... | Convert the compilation unit into JCR nodes.
@param context the sequencer context
@param sourceCode the source code being recorded (can be <code>null</code> if there is no source code)
@param outputNode the {@link Node node} where the output will be saved (cannot be <code>null</code>)
@throws Exception if there is a problem | [
"Convert",
"the",
"compilation",
"unit",
"into",
"JCR",
"nodes",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/JdtRecorder.java#L922-L936 | train |
ModeShape/modeshape | sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java | AbstractJavaMetadata.getTypeName | private String getTypeName( Type type ) {
CheckArg.isNotNull(type, "type");
if (type.isPrimitiveType()) {
PrimitiveType primitiveType = (PrimitiveType)type;
return primitiveType.getPrimitiveTypeCode().toString();
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
return JavaMetadataUtil.getName(simpleType.getName());
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
return getTypeName(parameterizedType.getType());
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
// the element type is never an array type
Type elementType = arrayType.getElementType();
if (elementType.isPrimitiveType()) {
return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();
}
// can't be an array type
if (elementType.isSimpleType()) {
return JavaMetadataUtil.getName(((SimpleType)elementType).getName());
}
}
return null;
} | java | private String getTypeName( Type type ) {
CheckArg.isNotNull(type, "type");
if (type.isPrimitiveType()) {
PrimitiveType primitiveType = (PrimitiveType)type;
return primitiveType.getPrimitiveTypeCode().toString();
}
if (type.isSimpleType()) {
SimpleType simpleType = (SimpleType)type;
return JavaMetadataUtil.getName(simpleType.getName());
}
if (type.isParameterizedType()) {
ParameterizedType parameterizedType = (ParameterizedType)type;
return getTypeName(parameterizedType.getType());
}
if (type.isArrayType()) {
ArrayType arrayType = (ArrayType)type;
// the element type is never an array type
Type elementType = arrayType.getElementType();
if (elementType.isPrimitiveType()) {
return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();
}
// can't be an array type
if (elementType.isSimpleType()) {
return JavaMetadataUtil.getName(((SimpleType)elementType).getName());
}
}
return null;
} | [
"private",
"String",
"getTypeName",
"(",
"Type",
"type",
")",
"{",
"CheckArg",
".",
"isNotNull",
"(",
"type",
",",
"\"type\"",
")",
";",
"if",
"(",
"type",
".",
"isPrimitiveType",
"(",
")",
")",
"{",
"PrimitiveType",
"primitiveType",
"=",
"(",
"PrimitiveTy... | Extract the type name
@param type - the type to be processed. This can be primitive, simple, parameterized ...
@return the name of a type.
@throws IllegalArgumentException if type is null. | [
"Extract",
"the",
"type",
"name"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java#L455-L484 | train |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/database/DatabaseUtil.java | DatabaseUtil.determineType | public static DatabaseType determineType(DatabaseMetaData metaData) throws SQLException {
metaData = Objects.requireNonNull(metaData, "metaData cannot be null");
int majorVersion = metaData.getDatabaseMajorVersion();
int minorVersion = metaData.getDatabaseMinorVersion();
String name = metaData.getDatabaseProductName().toLowerCase();
if (name.contains("mysql")) {
return new DatabaseType(DatabaseType.Name.MYSQL, majorVersion, minorVersion);
} else if (name.contains("postgres")) {
return new DatabaseType(DatabaseType.Name.POSTGRES, majorVersion, minorVersion);
} else if (name.contains("derby")) {
return new DatabaseType(DatabaseType.Name.DERBY, majorVersion, minorVersion);
} else if (name.contains("hsql") || name.toLowerCase().contains("hypersonic")) {
return new DatabaseType(DatabaseType.Name.HSQL, majorVersion, minorVersion);
} else if (name.contains("h2")) {
return new DatabaseType(DatabaseType.Name.H2, majorVersion, minorVersion);
} else if (name.contains("sqlite")) {
return new DatabaseType(DatabaseType.Name.SQLITE, majorVersion, minorVersion);
} else if (name.contains("db2")) {
return new DatabaseType(DatabaseType.Name.DB2, majorVersion, minorVersion);
} else if (name.contains("informix")) {
return new DatabaseType(DatabaseType.Name.INFORMIX, majorVersion, minorVersion);
} else if (name.contains("interbase")) {
return new DatabaseType(DatabaseType.Name.INTERBASE, majorVersion, minorVersion);
} else if (name.contains("firebird")) {
return new DatabaseType(DatabaseType.Name.FIREBIRD, majorVersion, minorVersion);
} else if (name.contains("sqlserver") || name.toLowerCase().contains("microsoft")) {
return new DatabaseType(DatabaseType.Name.SQLSERVER, majorVersion, minorVersion);
} else if (name.contains("access")) {
return new DatabaseType(DatabaseType.Name.ACCESS, majorVersion, minorVersion);
} else if (name.contains("oracle")) {
return new DatabaseType(DatabaseType.Name.ORACLE, majorVersion, minorVersion);
} else if (name.contains("adaptive")) {
return new DatabaseType(DatabaseType.Name.SYBASE, majorVersion, minorVersion);
} else if (name.contains("cassandra")) {
return new DatabaseType(DatabaseType.Name.CASSANDRA, majorVersion, minorVersion);
}
return DatabaseType.UNKNOWN;
} | java | public static DatabaseType determineType(DatabaseMetaData metaData) throws SQLException {
metaData = Objects.requireNonNull(metaData, "metaData cannot be null");
int majorVersion = metaData.getDatabaseMajorVersion();
int minorVersion = metaData.getDatabaseMinorVersion();
String name = metaData.getDatabaseProductName().toLowerCase();
if (name.contains("mysql")) {
return new DatabaseType(DatabaseType.Name.MYSQL, majorVersion, minorVersion);
} else if (name.contains("postgres")) {
return new DatabaseType(DatabaseType.Name.POSTGRES, majorVersion, minorVersion);
} else if (name.contains("derby")) {
return new DatabaseType(DatabaseType.Name.DERBY, majorVersion, minorVersion);
} else if (name.contains("hsql") || name.toLowerCase().contains("hypersonic")) {
return new DatabaseType(DatabaseType.Name.HSQL, majorVersion, minorVersion);
} else if (name.contains("h2")) {
return new DatabaseType(DatabaseType.Name.H2, majorVersion, minorVersion);
} else if (name.contains("sqlite")) {
return new DatabaseType(DatabaseType.Name.SQLITE, majorVersion, minorVersion);
} else if (name.contains("db2")) {
return new DatabaseType(DatabaseType.Name.DB2, majorVersion, minorVersion);
} else if (name.contains("informix")) {
return new DatabaseType(DatabaseType.Name.INFORMIX, majorVersion, minorVersion);
} else if (name.contains("interbase")) {
return new DatabaseType(DatabaseType.Name.INTERBASE, majorVersion, minorVersion);
} else if (name.contains("firebird")) {
return new DatabaseType(DatabaseType.Name.FIREBIRD, majorVersion, minorVersion);
} else if (name.contains("sqlserver") || name.toLowerCase().contains("microsoft")) {
return new DatabaseType(DatabaseType.Name.SQLSERVER, majorVersion, minorVersion);
} else if (name.contains("access")) {
return new DatabaseType(DatabaseType.Name.ACCESS, majorVersion, minorVersion);
} else if (name.contains("oracle")) {
return new DatabaseType(DatabaseType.Name.ORACLE, majorVersion, minorVersion);
} else if (name.contains("adaptive")) {
return new DatabaseType(DatabaseType.Name.SYBASE, majorVersion, minorVersion);
} else if (name.contains("cassandra")) {
return new DatabaseType(DatabaseType.Name.CASSANDRA, majorVersion, minorVersion);
}
return DatabaseType.UNKNOWN;
} | [
"public",
"static",
"DatabaseType",
"determineType",
"(",
"DatabaseMetaData",
"metaData",
")",
"throws",
"SQLException",
"{",
"metaData",
"=",
"Objects",
".",
"requireNonNull",
"(",
"metaData",
",",
"\"metaData cannot be null\"",
")",
";",
"int",
"majorVersion",
"=",
... | Determine the type of a database, based on the metadata information from the DB metadata.
@param metaData a {@link DatabaseMetaData} instance, may not be null
@return a {@link DatabaseType} instance, never null
@throws SQLException if a database access error occurs
or this method is called on a closed connection | [
"Determine",
"the",
"type",
"of",
"a",
"database",
"based",
"on",
"the",
"metadata",
"information",
"from",
"the",
"DB",
"metadata",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/database/DatabaseUtil.java#L41-L78 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.addConsumer | @SuppressWarnings( "unchecked" )
public synchronized void addConsumer( MessageConsumer<? extends Serializable> consumer ) {
consumers.add((MessageConsumer<Serializable>)consumer);
} | java | @SuppressWarnings( "unchecked" )
public synchronized void addConsumer( MessageConsumer<? extends Serializable> consumer ) {
consumers.add((MessageConsumer<Serializable>)consumer);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"synchronized",
"void",
"addConsumer",
"(",
"MessageConsumer",
"<",
"?",
"extends",
"Serializable",
">",
"consumer",
")",
"{",
"consumers",
".",
"add",
"(",
"(",
"MessageConsumer",
"<",
"Serializable",
... | Adds a new message consumer to this service.
@param consumer a {@link MessageConsumer} instance. | [
"Adds",
"a",
"new",
"message",
"consumer",
"to",
"this",
"service",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L141-L144 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.shutdown | public synchronized boolean shutdown() {
if (channel == null) {
return false;
}
Address address = channel.getAddress();
LOGGER.debug("{0} shutting down clustering service...", address);
consumers.clear();
// Mark this as not accepting any more ...
isOpen.set(false);
try {
// Disconnect from the channel and close it ...
channel.disconnect();
channel.removeChannelListener(listener);
channel.setReceiver(null);
channel.close();
LOGGER.debug("{0} successfully closed main channel", address);
} finally {
channel = null;
}
membersInCluster.set(1);
return true;
} | java | public synchronized boolean shutdown() {
if (channel == null) {
return false;
}
Address address = channel.getAddress();
LOGGER.debug("{0} shutting down clustering service...", address);
consumers.clear();
// Mark this as not accepting any more ...
isOpen.set(false);
try {
// Disconnect from the channel and close it ...
channel.disconnect();
channel.removeChannelListener(listener);
channel.setReceiver(null);
channel.close();
LOGGER.debug("{0} successfully closed main channel", address);
} finally {
channel = null;
}
membersInCluster.set(1);
return true;
} | [
"public",
"synchronized",
"boolean",
"shutdown",
"(",
")",
"{",
"if",
"(",
"channel",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Address",
"address",
"=",
"channel",
".",
"getAddress",
"(",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"{0} shuttin... | Shuts down and clears resources held by this service.
@return {@code true} if the service has been shutdown or {@code false} if it had already been shut down. | [
"Shuts",
"down",
"and",
"clears",
"resources",
"held",
"by",
"this",
"service",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L151-L174 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.sendMessage | public boolean sendMessage( Serializable payload ) {
if (!isOpen() || !multipleMembersInCluster()) {
return false;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{0} SENDING {1} ", toString(), payload);
}
try {
byte[] messageData = toByteArray(payload);
Message jgMessage = new Message(null, channel.getAddress(), messageData);
channel.send(jgMessage);
return true;
} catch (Exception e) {
// Something went wrong here
throw new SystemFailureException(ClusteringI18n.errorSendingMessage.text(clusterName()), e);
}
} | java | public boolean sendMessage( Serializable payload ) {
if (!isOpen() || !multipleMembersInCluster()) {
return false;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("{0} SENDING {1} ", toString(), payload);
}
try {
byte[] messageData = toByteArray(payload);
Message jgMessage = new Message(null, channel.getAddress(), messageData);
channel.send(jgMessage);
return true;
} catch (Exception e) {
// Something went wrong here
throw new SystemFailureException(ClusteringI18n.errorSendingMessage.text(clusterName()), e);
}
} | [
"public",
"boolean",
"sendMessage",
"(",
"Serializable",
"payload",
")",
"{",
"if",
"(",
"!",
"isOpen",
"(",
")",
"||",
"!",
"multipleMembersInCluster",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"LOGGER",
".",
"isDebugEnabled",
"(",
")"... | Sends a message of a given type across a cluster.
@param payload the main body of the message; must not be {@code null}
@return {@code true} if the send operation was successful, {@code false} otherwise | [
"Sends",
"a",
"message",
"of",
"a",
"given",
"type",
"across",
"a",
"cluster",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L227-L244 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.startStandalone | public static ClusteringService startStandalone( String clusterName,
String jgroupsConfig ) {
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, jgroupsConfig);
clusteringService.init();
return clusteringService;
} | java | public static ClusteringService startStandalone( String clusterName,
String jgroupsConfig ) {
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, jgroupsConfig);
clusteringService.init();
return clusteringService;
} | [
"public",
"static",
"ClusteringService",
"startStandalone",
"(",
"String",
"clusterName",
",",
"String",
"jgroupsConfig",
")",
"{",
"ClusteringService",
"clusteringService",
"=",
"new",
"StandaloneClusteringService",
"(",
"clusterName",
",",
"jgroupsConfig",
")",
";",
"... | Starts a standalone clustering service which in turn will start & connect its own JGroup channel.
@param clusterName the name of the cluster to which the JGroups channel should connect; may not be null
@param jgroupsConfig either the path or the XML content of a JGroups configuration file; may not be null
@return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null | [
"Starts",
"a",
"standalone",
"clustering",
"service",
"which",
"in",
"turn",
"will",
"start",
"&",
"connect",
"its",
"own",
"JGroup",
"channel",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L260-L265 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.startStandalone | public static ClusteringService startStandalone(String clusterName, Channel channel) {
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel);
clusteringService.init();
return clusteringService;
} | java | public static ClusteringService startStandalone(String clusterName, Channel channel) {
ClusteringService clusteringService = new StandaloneClusteringService(clusterName, channel);
clusteringService.init();
return clusteringService;
} | [
"public",
"static",
"ClusteringService",
"startStandalone",
"(",
"String",
"clusterName",
",",
"Channel",
"channel",
")",
"{",
"ClusteringService",
"clusteringService",
"=",
"new",
"StandaloneClusteringService",
"(",
"clusterName",
",",
"channel",
")",
";",
"clusteringS... | Starts a standalone clustering service which uses the supplied channel.
@param clusterName the name of the cluster to which the JGroups channel should connect; may not be null
@param channel a {@link Channel} instance, may not be {@code null}
@return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null | [
"Starts",
"a",
"standalone",
"clustering",
"service",
"which",
"uses",
"the",
"supplied",
"channel",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L275-L279 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java | ClusteringService.startForked | public static ClusteringService startForked( Channel mainChannel ) {
if (!mainChannel.isConnected()) {
throw new IllegalStateException(ClusteringI18n.channelNotConnected.text());
}
ClusteringService clusteringService = new ForkedClusteringService(mainChannel);
clusteringService.init();
return clusteringService;
} | java | public static ClusteringService startForked( Channel mainChannel ) {
if (!mainChannel.isConnected()) {
throw new IllegalStateException(ClusteringI18n.channelNotConnected.text());
}
ClusteringService clusteringService = new ForkedClusteringService(mainChannel);
clusteringService.init();
return clusteringService;
} | [
"public",
"static",
"ClusteringService",
"startForked",
"(",
"Channel",
"mainChannel",
")",
"{",
"if",
"(",
"!",
"mainChannel",
".",
"isConnected",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"ClusteringI18n",
".",
"channelNotConnected",
".",... | Starts a new clustering service by forking a channel of an existing JGroups channel.
@param mainChannel a {@link Channel} instance; may not be null.
@return a {@link org.modeshape.jcr.clustering.ClusteringService} instance, never null | [
"Starts",
"a",
"new",
"clustering",
"service",
"by",
"forking",
"a",
"channel",
"of",
"an",
"existing",
"JGroups",
"channel",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/clustering/ClusteringService.java#L287-L294 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.isNotOneOf | public boolean isNotOneOf( Type first,
Type... rest ) {
return isNotOneOf(EnumSet.of(first, rest));
} | java | public boolean isNotOneOf( Type first,
Type... rest ) {
return isNotOneOf(EnumSet.of(first, rest));
} | [
"public",
"boolean",
"isNotOneOf",
"(",
"Type",
"first",
",",
"Type",
"...",
"rest",
")",
"{",
"return",
"isNotOneOf",
"(",
"EnumSet",
".",
"of",
"(",
"first",
",",
"rest",
")",
")",
";",
"}"
] | Return true if this node's type does not match any of the supplied types
@param first the type to compare
@param rest the additional types to compare
@return true if this node's type is different than all of those supplied, or false if matches one of the supplied types | [
"Return",
"true",
"if",
"this",
"node",
"s",
"type",
"does",
"not",
"match",
"any",
"of",
"the",
"supplied",
"types"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L343-L346 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.isOneOf | public boolean isOneOf( Type first,
Type... rest ) {
return isOneOf(EnumSet.of(first, rest));
} | java | public boolean isOneOf( Type first,
Type... rest ) {
return isOneOf(EnumSet.of(first, rest));
} | [
"public",
"boolean",
"isOneOf",
"(",
"Type",
"first",
",",
"Type",
"...",
"rest",
")",
"{",
"return",
"isOneOf",
"(",
"EnumSet",
".",
"of",
"(",
"first",
",",
"rest",
")",
")",
";",
"}"
] | Return true if this node's type matches one of the supplied types
@param first the type to compare
@param rest the additional types to compare
@return true if this node's type is one of those supplied, or false otherwise | [
"Return",
"true",
"if",
"this",
"node",
"s",
"type",
"matches",
"one",
"of",
"the",
"supplied",
"types"
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L375-L378 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.isBelow | public boolean isBelow( PlanNode possibleAncestor ) {
PlanNode node = this;
while (node != null) {
if (node == possibleAncestor) return true;
node = node.getParent();
}
return false;
} | java | public boolean isBelow( PlanNode possibleAncestor ) {
PlanNode node = this;
while (node != null) {
if (node == possibleAncestor) return true;
node = node.getParent();
}
return false;
} | [
"public",
"boolean",
"isBelow",
"(",
"PlanNode",
"possibleAncestor",
")",
"{",
"PlanNode",
"node",
"=",
"this",
";",
"while",
"(",
"node",
"!=",
"null",
")",
"{",
"if",
"(",
"node",
"==",
"possibleAncestor",
")",
"return",
"true",
";",
"node",
"=",
"node... | Determine if the supplied node is an ancestor of this node.
@param possibleAncestor the node that is to be determined if it is an ancestor
@return true if the supplied node is indeed an ancestor, or false if it is not an ancestor | [
"Determine",
"if",
"the",
"supplied",
"node",
"is",
"an",
"ancestor",
"of",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L396-L403 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.replaceChild | public boolean replaceChild( PlanNode child,
PlanNode replacement ) {
assert child != null;
assert replacement != null;
if (child.parent == this) {
int i = this.children.indexOf(child);
if (replacement.parent == this) {
// Swapping the positions ...
int j = this.children.indexOf(replacement);
this.children.set(i, replacement);
this.children.set(j, child);
return true;
}
// The replacement is not yet a child ...
this.children.set(i, replacement);
replacement.removeFromParent();
replacement.parent = this;
child.parent = null;
return true;
}
return false;
} | java | public boolean replaceChild( PlanNode child,
PlanNode replacement ) {
assert child != null;
assert replacement != null;
if (child.parent == this) {
int i = this.children.indexOf(child);
if (replacement.parent == this) {
// Swapping the positions ...
int j = this.children.indexOf(replacement);
this.children.set(i, replacement);
this.children.set(j, child);
return true;
}
// The replacement is not yet a child ...
this.children.set(i, replacement);
replacement.removeFromParent();
replacement.parent = this;
child.parent = null;
return true;
}
return false;
} | [
"public",
"boolean",
"replaceChild",
"(",
"PlanNode",
"child",
",",
"PlanNode",
"replacement",
")",
"{",
"assert",
"child",
"!=",
"null",
";",
"assert",
"replacement",
"!=",
"null",
";",
"if",
"(",
"child",
".",
"parent",
"==",
"this",
")",
"{",
"int",
"... | Replace the supplied child with another node. If the replacement is already a child of this node, this method effectively
swaps the position of the child and replacement nodes.
@param child the node that is already a child and that is to be replaced; may not be null and must be a child
@param replacement the node that is to replace the 'child' node; may not be null
@return true if the child was successfully replaced | [
"Replace",
"the",
"supplied",
"child",
"with",
"another",
"node",
".",
"If",
"the",
"replacement",
"is",
"already",
"a",
"child",
"of",
"this",
"node",
"this",
"method",
"effectively",
"swaps",
"the",
"position",
"of",
"the",
"child",
"and",
"replacement",
"... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L541-L562 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.getPropertyKeys | public Set<Property> getPropertyKeys() {
return nodeProperties != null ? nodeProperties.keySet() : Collections.<Property>emptySet();
} | java | public Set<Property> getPropertyKeys() {
return nodeProperties != null ? nodeProperties.keySet() : Collections.<Property>emptySet();
} | [
"public",
"Set",
"<",
"Property",
">",
"getPropertyKeys",
"(",
")",
"{",
"return",
"nodeProperties",
"!=",
"null",
"?",
"nodeProperties",
".",
"keySet",
"(",
")",
":",
"Collections",
".",
"<",
"Property",
">",
"emptySet",
"(",
")",
";",
"}"
] | Get the keys for the property values that are set on this node.
@return the property keys; never null but possibly empty | [
"Get",
"the",
"keys",
"for",
"the",
"property",
"values",
"that",
"are",
"set",
"on",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L708-L710 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.getProperty | public Object getProperty( Property propertyId ) {
return nodeProperties != null ? nodeProperties.get(propertyId) : null;
} | java | public Object getProperty( Property propertyId ) {
return nodeProperties != null ? nodeProperties.get(propertyId) : null;
} | [
"public",
"Object",
"getProperty",
"(",
"Property",
"propertyId",
")",
"{",
"return",
"nodeProperties",
"!=",
"null",
"?",
"nodeProperties",
".",
"get",
"(",
"propertyId",
")",
":",
"null",
";",
"}"
] | Get the node's value for this supplied property.
@param propertyId the property identifier
@return the value, or null if there is no property on this node | [
"Get",
"the",
"node",
"s",
"value",
"for",
"this",
"supplied",
"property",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L718-L720 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.getProperty | public <ValueType> ValueType getProperty( Property propertyId,
Class<ValueType> type ) {
return nodeProperties != null ? type.cast(nodeProperties.get(propertyId)) : null;
} | java | public <ValueType> ValueType getProperty( Property propertyId,
Class<ValueType> type ) {
return nodeProperties != null ? type.cast(nodeProperties.get(propertyId)) : null;
} | [
"public",
"<",
"ValueType",
">",
"ValueType",
"getProperty",
"(",
"Property",
"propertyId",
",",
"Class",
"<",
"ValueType",
">",
"type",
")",
"{",
"return",
"nodeProperties",
"!=",
"null",
"?",
"type",
".",
"cast",
"(",
"nodeProperties",
".",
"get",
"(",
"... | Get the node's value for this supplied property, casting the result to the supplied type.
@param <ValueType> the type of the value expected
@param propertyId the property identifier
@param type the class denoting the type of value expected; may not be null
@return the value, or null if there is no property on this node | [
"Get",
"the",
"node",
"s",
"value",
"for",
"this",
"supplied",
"property",
"casting",
"the",
"result",
"to",
"the",
"supplied",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L730-L733 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.setProperty | public Object setProperty( Property propertyId,
Object value ) {
if (value == null) {
// Removing this property ...
return nodeProperties != null ? nodeProperties.remove(propertyId) : null;
}
// Otherwise, we're adding the property
if (nodeProperties == null) nodeProperties = new TreeMap<Property, Object>();
return nodeProperties.put(propertyId, value);
} | java | public Object setProperty( Property propertyId,
Object value ) {
if (value == null) {
// Removing this property ...
return nodeProperties != null ? nodeProperties.remove(propertyId) : null;
}
// Otherwise, we're adding the property
if (nodeProperties == null) nodeProperties = new TreeMap<Property, Object>();
return nodeProperties.put(propertyId, value);
} | [
"public",
"Object",
"setProperty",
"(",
"Property",
"propertyId",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"// Removing this property ...",
"return",
"nodeProperties",
"!=",
"null",
"?",
"nodeProperties",
".",
"remove",
"(",
... | Set the node's value for the supplied property.
@param propertyId the property identifier
@param value the value, or null if the property is to be removed
@return the previous value that was overwritten by this call, or null if there was prior value | [
"Set",
"the",
"node",
"s",
"value",
"for",
"the",
"supplied",
"property",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L779-L788 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.removeProperty | public Object removeProperty( Object propertyId ) {
return nodeProperties != null ? nodeProperties.remove(propertyId) : null;
} | java | public Object removeProperty( Object propertyId ) {
return nodeProperties != null ? nodeProperties.remove(propertyId) : null;
} | [
"public",
"Object",
"removeProperty",
"(",
"Object",
"propertyId",
")",
"{",
"return",
"nodeProperties",
"!=",
"null",
"?",
"nodeProperties",
".",
"remove",
"(",
"propertyId",
")",
":",
"null",
";",
"}"
] | Remove the node's value for this supplied property.
@param propertyId the property identifier
@return the value that was removed, or null if there was no property on this node | [
"Remove",
"the",
"node",
"s",
"value",
"for",
"this",
"supplied",
"property",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L796-L798 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.hasCollectionProperty | public boolean hasCollectionProperty( Property propertyId ) {
Object value = getProperty(propertyId);
return (value instanceof Collection<?> && !((Collection<?>)value).isEmpty());
} | java | public boolean hasCollectionProperty( Property propertyId ) {
Object value = getProperty(propertyId);
return (value instanceof Collection<?> && !((Collection<?>)value).isEmpty());
} | [
"public",
"boolean",
"hasCollectionProperty",
"(",
"Property",
"propertyId",
")",
"{",
"Object",
"value",
"=",
"getProperty",
"(",
"propertyId",
")",
";",
"return",
"(",
"value",
"instanceof",
"Collection",
"<",
"?",
">",
"&&",
"!",
"(",
"(",
"Collection",
"... | Indicates if there is a non-null and non-empty Collection value for the property.
@param propertyId the property identifier
@return true if this node has value for the supplied property and that value is a non-empty Collection | [
"Indicates",
"if",
"there",
"is",
"a",
"non",
"-",
"null",
"and",
"non",
"-",
"empty",
"Collection",
"value",
"for",
"the",
"property",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L816-L819 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.replaceSelector | public boolean replaceSelector( SelectorName original,
SelectorName replacement ) {
if (original != null && replacement != null) {
if (selectors.remove(original)) {
selectors.add(replacement);
return true;
}
}
return false;
} | java | public boolean replaceSelector( SelectorName original,
SelectorName replacement ) {
if (original != null && replacement != null) {
if (selectors.remove(original)) {
selectors.add(replacement);
return true;
}
}
return false;
} | [
"public",
"boolean",
"replaceSelector",
"(",
"SelectorName",
"original",
",",
"SelectorName",
"replacement",
")",
"{",
"if",
"(",
"original",
"!=",
"null",
"&&",
"replacement",
"!=",
"null",
")",
"{",
"if",
"(",
"selectors",
".",
"remove",
"(",
"original",
"... | Replace this plan's use of the named selector with the replacement. to this plan node. This method does nothing if either
of the supplied selector names is null, or if the supplied original selector name is not found.
@param original the selector name to be replaced
@param replacement the selector name to replace the original
@return true if the replacement was made, or false otherwise | [
"Replace",
"this",
"plan",
"s",
"use",
"of",
"the",
"named",
"selector",
"with",
"the",
"replacement",
".",
"to",
"this",
"plan",
"node",
".",
"This",
"method",
"does",
"nothing",
"if",
"either",
"of",
"the",
"supplied",
"selector",
"names",
"is",
"null",
... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L872-L881 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAllFirstNodesAtOrBelow | public List<PlanNode> findAllFirstNodesAtOrBelow( Type typeToFind ) {
List<PlanNode> results = new LinkedList<PlanNode>();
LinkedList<PlanNode> queue = new LinkedList<PlanNode>();
queue.add(this);
while (!queue.isEmpty()) {
PlanNode aNode = queue.poll();
if (aNode.getType() == Type.PROJECT) {
results.add(aNode);
} else {
queue.addAll(0, aNode.getChildren());
}
}
return results;
} | java | public List<PlanNode> findAllFirstNodesAtOrBelow( Type typeToFind ) {
List<PlanNode> results = new LinkedList<PlanNode>();
LinkedList<PlanNode> queue = new LinkedList<PlanNode>();
queue.add(this);
while (!queue.isEmpty()) {
PlanNode aNode = queue.poll();
if (aNode.getType() == Type.PROJECT) {
results.add(aNode);
} else {
queue.addAll(0, aNode.getChildren());
}
}
return results;
} | [
"public",
"List",
"<",
"PlanNode",
">",
"findAllFirstNodesAtOrBelow",
"(",
"Type",
"typeToFind",
")",
"{",
"List",
"<",
"PlanNode",
">",
"results",
"=",
"new",
"LinkedList",
"<",
"PlanNode",
">",
"(",
")",
";",
"LinkedList",
"<",
"PlanNode",
">",
"queue",
... | Look at nodes below this node, searching for nodes that have the supplied type. As soon as a node with a matching type is
found, then no other nodes below it are searched.
@param typeToFind the type of node to find; may not be null
@return the collection of nodes that are at or below this node that all have the supplied type; never null but possibly
empty | [
"Look",
"at",
"nodes",
"below",
"this",
"node",
"searching",
"for",
"nodes",
"that",
"have",
"the",
"supplied",
"type",
".",
"As",
"soon",
"as",
"a",
"node",
"with",
"a",
"matching",
"type",
"is",
"found",
"then",
"no",
"other",
"nodes",
"below",
"it",
... | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1150-L1163 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.apply | public void apply( Traversal order,
final Operation operation,
final Type type ) {
apply(order, new Operation() {
@Override
public void apply( PlanNode node ) {
if (node.getType() == type) operation.apply(node);
}
});
} | java | public void apply( Traversal order,
final Operation operation,
final Type type ) {
apply(order, new Operation() {
@Override
public void apply( PlanNode node ) {
if (node.getType() == type) operation.apply(node);
}
});
} | [
"public",
"void",
"apply",
"(",
"Traversal",
"order",
",",
"final",
"Operation",
"operation",
",",
"final",
"Type",
"type",
")",
"{",
"apply",
"(",
"order",
",",
"new",
"Operation",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"apply",
"(",
"PlanNod... | Walk the plan tree starting in the specified traversal order, and apply the supplied operation to every plan node with a
type that matches the given type.
@param order the order in which the subtree should be traversed; may not be null
@param operation the operation that should be applied; may not be null
@param type the type of node to which the operation should be applied; may not be null | [
"Walk",
"the",
"plan",
"tree",
"starting",
"in",
"the",
"specified",
"traversal",
"order",
"and",
"apply",
"the",
"supplied",
"operation",
"to",
"every",
"plan",
"node",
"with",
"a",
"type",
"that",
"matches",
"the",
"given",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1188-L1197 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.apply | public void apply( Traversal order,
Operation operation ) {
assert order != null;
switch (order) {
case LEVEL_ORDER:
operation.apply(this);
applyLevelOrder(order, operation);
break;
case PRE_ORDER:
operation.apply(this);
for (PlanNode child : this) {
child.apply(order, operation);
}
break;
case POST_ORDER:
for (PlanNode child : this) {
child.apply(order, operation);
}
operation.apply(this);
break;
}
} | java | public void apply( Traversal order,
Operation operation ) {
assert order != null;
switch (order) {
case LEVEL_ORDER:
operation.apply(this);
applyLevelOrder(order, operation);
break;
case PRE_ORDER:
operation.apply(this);
for (PlanNode child : this) {
child.apply(order, operation);
}
break;
case POST_ORDER:
for (PlanNode child : this) {
child.apply(order, operation);
}
operation.apply(this);
break;
}
} | [
"public",
"void",
"apply",
"(",
"Traversal",
"order",
",",
"Operation",
"operation",
")",
"{",
"assert",
"order",
"!=",
"null",
";",
"switch",
"(",
"order",
")",
"{",
"case",
"LEVEL_ORDER",
":",
"operation",
".",
"apply",
"(",
"this",
")",
";",
"applyLev... | Walk the plan tree starting in the specified traversal order, and apply the supplied operation to every plan node.
@param order the order in which the subtree should be traversed; may not be null
@param operation the operation that should be applied; may not be null | [
"Walk",
"the",
"plan",
"tree",
"starting",
"in",
"the",
"specified",
"traversal",
"order",
"and",
"apply",
"the",
"supplied",
"operation",
"to",
"every",
"plan",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1240-L1261 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.applyToAncestorsUpTo | public void applyToAncestorsUpTo( Type stopType,
Operation operation ) {
PlanNode ancestor = getParent();
while (ancestor != null) {
if (ancestor.getType() == stopType) return;
operation.apply(ancestor);
ancestor = ancestor.getParent();
}
} | java | public void applyToAncestorsUpTo( Type stopType,
Operation operation ) {
PlanNode ancestor = getParent();
while (ancestor != null) {
if (ancestor.getType() == stopType) return;
operation.apply(ancestor);
ancestor = ancestor.getParent();
}
} | [
"public",
"void",
"applyToAncestorsUpTo",
"(",
"Type",
"stopType",
",",
"Operation",
"operation",
")",
"{",
"PlanNode",
"ancestor",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"ancestor",
"!=",
"null",
")",
"{",
"if",
"(",
"ancestor",
".",
"getType",
"(... | Apply the operation to all ancestor nodes below a node of the given type.
@param stopType the type of node that should not be included in the results; may not be null
@param operation the operation to apply to each of the ancestor nodes below the given type; may not be null | [
"Apply",
"the",
"operation",
"to",
"all",
"ancestor",
"nodes",
"below",
"a",
"node",
"of",
"the",
"given",
"type",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1279-L1287 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.applyToAncestors | public void applyToAncestors( Operation operation ) {
PlanNode ancestor = getParent();
while (ancestor != null) {
operation.apply(ancestor);
ancestor = ancestor.getParent();
}
} | java | public void applyToAncestors( Operation operation ) {
PlanNode ancestor = getParent();
while (ancestor != null) {
operation.apply(ancestor);
ancestor = ancestor.getParent();
}
} | [
"public",
"void",
"applyToAncestors",
"(",
"Operation",
"operation",
")",
"{",
"PlanNode",
"ancestor",
"=",
"getParent",
"(",
")",
";",
"while",
"(",
"ancestor",
"!=",
"null",
")",
"{",
"operation",
".",
"apply",
"(",
"ancestor",
")",
";",
"ancestor",
"=",... | Apply the operation to all ancestor nodes.
@param operation the operation to apply to each of the ancestor nodes; may not be null | [
"Apply",
"the",
"operation",
"to",
"all",
"ancestor",
"nodes",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1294-L1300 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAllAtOrBelow | public List<PlanNode> findAllAtOrBelow( Traversal order ) {
assert order != null;
LinkedList<PlanNode> results = new LinkedList<PlanNode>();
LinkedList<PlanNode> queue = new LinkedList<PlanNode>();
queue.add(this);
while (!queue.isEmpty()) {
PlanNode aNode = queue.poll();
switch (order) {
case LEVEL_ORDER:
results.add(aNode);
queue.addAll(aNode.getChildren());
break;
case PRE_ORDER:
results.add(aNode);
queue.addAll(0, aNode.getChildren());
break;
case POST_ORDER:
queue.addAll(0, aNode.getChildren());
results.addFirst(aNode);
break;
}
}
return results;
} | java | public List<PlanNode> findAllAtOrBelow( Traversal order ) {
assert order != null;
LinkedList<PlanNode> results = new LinkedList<PlanNode>();
LinkedList<PlanNode> queue = new LinkedList<PlanNode>();
queue.add(this);
while (!queue.isEmpty()) {
PlanNode aNode = queue.poll();
switch (order) {
case LEVEL_ORDER:
results.add(aNode);
queue.addAll(aNode.getChildren());
break;
case PRE_ORDER:
results.add(aNode);
queue.addAll(0, aNode.getChildren());
break;
case POST_ORDER:
queue.addAll(0, aNode.getChildren());
results.addFirst(aNode);
break;
}
}
return results;
} | [
"public",
"List",
"<",
"PlanNode",
">",
"findAllAtOrBelow",
"(",
"Traversal",
"order",
")",
"{",
"assert",
"order",
"!=",
"null",
";",
"LinkedList",
"<",
"PlanNode",
">",
"results",
"=",
"new",
"LinkedList",
"<",
"PlanNode",
">",
"(",
")",
";",
"LinkedList... | Find all of the nodes that are at or below this node.
@param order the order to traverse; may not be null
@return the collection of nodes that are at or below this node; never null and never empty | [
"Find",
"all",
"of",
"the",
"nodes",
"that",
"are",
"at",
"or",
"below",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1317-L1340 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAllAtOrBelow | public List<PlanNode> findAllAtOrBelow( Traversal order,
Type typeToFind ) {
return findAllAtOrBelow(order, EnumSet.of(typeToFind));
} | java | public List<PlanNode> findAllAtOrBelow( Traversal order,
Type typeToFind ) {
return findAllAtOrBelow(order, EnumSet.of(typeToFind));
} | [
"public",
"List",
"<",
"PlanNode",
">",
"findAllAtOrBelow",
"(",
"Traversal",
"order",
",",
"Type",
"typeToFind",
")",
"{",
"return",
"findAllAtOrBelow",
"(",
"order",
",",
"EnumSet",
".",
"of",
"(",
"typeToFind",
")",
")",
";",
"}"
] | Find all of the nodes of the specified type that are at or below this node.
@param order the order to traverse; may not be null
@param typeToFind the type of node to find; may not be null
@return the collection of nodes that are at or below this node that all have the supplied type; never null but possibly
empty | [
"Find",
"all",
"of",
"the",
"nodes",
"of",
"the",
"specified",
"type",
"that",
"are",
"at",
"or",
"below",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1385-L1388 | train |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java | PlanNode.findAtOrBelow | public PlanNode findAtOrBelow( Traversal order,
Type typeToFind ) {
return findAtOrBelow(order, EnumSet.of(typeToFind));
} | java | public PlanNode findAtOrBelow( Traversal order,
Type typeToFind ) {
return findAtOrBelow(order, EnumSet.of(typeToFind));
} | [
"public",
"PlanNode",
"findAtOrBelow",
"(",
"Traversal",
"order",
",",
"Type",
"typeToFind",
")",
"{",
"return",
"findAtOrBelow",
"(",
"order",
",",
"EnumSet",
".",
"of",
"(",
"typeToFind",
")",
")",
";",
"}"
] | Find the first node with the specified type that are at or below this node.
@param order the order to traverse; may not be null
@param typeToFind the type of node to find; may not be null
@return the first node that is at or below this node that has the supplied type; or null if there is no such node | [
"Find",
"the",
"first",
"node",
"with",
"the",
"specified",
"type",
"that",
"are",
"at",
"or",
"below",
"this",
"node",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/plan/PlanNode.java#L1484-L1487 | train |
ModeShape/modeshape | connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/Nodes.java | Nodes.findJcrName | public String findJcrName( String cmisName ) {
for (Relation aList : list) {
if (aList.cmisName.equals(cmisName)) {
return aList.jcrName;
}
}
return cmisName;
} | java | public String findJcrName( String cmisName ) {
for (Relation aList : list) {
if (aList.cmisName.equals(cmisName)) {
return aList.jcrName;
}
}
return cmisName;
} | [
"public",
"String",
"findJcrName",
"(",
"String",
"cmisName",
")",
"{",
"for",
"(",
"Relation",
"aList",
":",
"list",
")",
"{",
"if",
"(",
"aList",
".",
"cmisName",
".",
"equals",
"(",
"cmisName",
")",
")",
"{",
"return",
"aList",
".",
"jcrName",
";",
... | Gets the name of the given property in JCR domain.
@param cmisName the name of the given property in CMIS domain.
@return the name of the given property in JCR domain. | [
"Gets",
"the",
"name",
"of",
"the",
"given",
"property",
"in",
"JCR",
"domain",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/Nodes.java#L40-L47 | train |
ModeShape/modeshape | connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/Nodes.java | Nodes.findCmisName | public String findCmisName( String jcrName ) {
for (Relation aList : list) {
if (aList.jcrName.equals(jcrName)) {
return aList.cmisName;
}
}
return jcrName;
} | java | public String findCmisName( String jcrName ) {
for (Relation aList : list) {
if (aList.jcrName.equals(jcrName)) {
return aList.cmisName;
}
}
return jcrName;
} | [
"public",
"String",
"findCmisName",
"(",
"String",
"jcrName",
")",
"{",
"for",
"(",
"Relation",
"aList",
":",
"list",
")",
"{",
"if",
"(",
"aList",
".",
"jcrName",
".",
"equals",
"(",
"jcrName",
")",
")",
"{",
"return",
"aList",
".",
"cmisName",
";",
... | Gets the name of the given property in CMIS domain.
@param jcrName the name of the given property in JCR domain.
@return the name of the given property in CMIS domain. | [
"Gets",
"the",
"name",
"of",
"the",
"given",
"property",
"in",
"CMIS",
"domain",
"."
] | 794cfdabb67a90f24629c4fff0424a6125f8f95b | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/Nodes.java#L55-L62 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.