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
cocoahero/android-geojson
androidgeojson/src/main/java/com/cocoahero/android/geojson/GeometryCollection.java
GeometryCollection.setGeometries
public void setGeometries(List<Geometry> geometries) { this.mGeometries.clear(); if (geometries != null) { this.mGeometries.addAll(geometries); } }
java
public void setGeometries(List<Geometry> geometries) { this.mGeometries.clear(); if (geometries != null) { this.mGeometries.addAll(geometries); } }
[ "public", "void", "setGeometries", "(", "List", "<", "Geometry", ">", "geometries", ")", "{", "this", ".", "mGeometries", ".", "clear", "(", ")", ";", "if", "(", "geometries", "!=", "null", ")", "{", "this", ".", "mGeometries", ".", "addAll", "(", "geo...
Sets the list of geometries contained within this geometry collection. All previously existing geometries are removed as a result of setting this property. @param geometries
[ "Sets", "the", "list", "of", "geometries", "contained", "within", "this", "geometry", "collection", ".", "All", "previously", "existing", "geometries", "are", "removed", "as", "a", "result", "of", "setting", "this", "property", "." ]
eec45c0a5429d5c8fb0c2536e135084f87aa958a
https://github.com/cocoahero/android-geojson/blob/eec45c0a5429d5c8fb0c2536e135084f87aa958a/androidgeojson/src/main/java/com/cocoahero/android/geojson/GeometryCollection.java#L112-L117
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/cluster/DistributedTreeUtil.java
DistributedTreeUtil.parent
public static String parent(String node) { final int index = node.lastIndexOf('/'); if (index < 0) return null; return node.substring(0, index); }
java
public static String parent(String node) { final int index = node.lastIndexOf('/'); if (index < 0) return null; return node.substring(0, index); }
[ "public", "static", "String", "parent", "(", "String", "node", ")", "{", "final", "int", "index", "=", "node", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "<", "0", ")", "return", "null", ";", "return", "node", ".", "substring", ...
Returns the parent tree node of a given node. @param node A tree node's full path. @return The full path of the given node's parent.
[ "Returns", "the", "parent", "tree", "node", "of", "a", "given", "node", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/cluster/DistributedTreeUtil.java#L29-L34
train
puniverse/galaxy
src/main/java/co/paralleluniverse/common/spring/Service.java
Service.addDependency
public void addDependency(Service service) { assertDuringInitialization(); LOG.info("Adding a dependency on {} to {}", service.getName(), getName()); addDependsOn(service); service.addDependedBy(this); }
java
public void addDependency(Service service) { assertDuringInitialization(); LOG.info("Adding a dependency on {} to {}", service.getName(), getName()); addDependsOn(service); service.addDependedBy(this); }
[ "public", "void", "addDependency", "(", "Service", "service", ")", "{", "assertDuringInitialization", "(", ")", ";", "LOG", ".", "info", "(", "\"Adding a dependency on {} to {}\"", ",", "service", ".", "getName", "(", ")", ",", "getName", "(", ")", ")", ";", ...
Adds a service this service depends on. @param service The service this service depends on.
[ "Adds", "a", "service", "this", "service", "depends", "on", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/spring/Service.java#L59-L64
train
puniverse/galaxy
src/main/java/co/paralleluniverse/common/spring/Service.java
Service.setReady
protected void setReady(boolean ready) { synchronized (SERVICE_AVILABILITY_LOCK) { LOG.info("Service {} is now {}", getName(), ready ? "READY" : "NOT READY"); this.ready = ready; checkAvailability(); } runAvailableMethod(); // call outside lock }
java
protected void setReady(boolean ready) { synchronized (SERVICE_AVILABILITY_LOCK) { LOG.info("Service {} is now {}", getName(), ready ? "READY" : "NOT READY"); this.ready = ready; checkAvailability(); } runAvailableMethod(); // call outside lock }
[ "protected", "void", "setReady", "(", "boolean", "ready", ")", "{", "synchronized", "(", "SERVICE_AVILABILITY_LOCK", ")", "{", "LOG", ".", "info", "(", "\"Service {} is now {}\"", ",", "getName", "(", ")", ",", "ready", "?", "\"READY\"", ":", "\"NOT READY\"", ...
Sets the readiness of this service. If this service is ready and all its dependencies are available, than this service becomes available. @param ready
[ "Sets", "the", "readiness", "of", "this", "service", ".", "If", "this", "service", "is", "ready", "and", "all", "its", "dependencies", "are", "available", "than", "this", "service", "becomes", "available", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/spring/Service.java#L164-L171
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java
ReplicatedTree.create
public void create(String fqn, boolean ephemeral) { awaitRunning(); try { LOG.trace("Creating {} {}", fqn, ephemeral ? "(ephemeral)" : ""); channel.send(new Message(null, new Request(Request.CREATE, fqn, ephemeral))); synchronized (updateCondition) { w...
java
public void create(String fqn, boolean ephemeral) { awaitRunning(); try { LOG.trace("Creating {} {}", fqn, ephemeral ? "(ephemeral)" : ""); channel.send(new Message(null, new Request(Request.CREATE, fqn, ephemeral))); synchronized (updateCondition) { w...
[ "public", "void", "create", "(", "String", "fqn", ",", "boolean", "ephemeral", ")", "{", "awaitRunning", "(", ")", ";", "try", "{", "LOG", ".", "trace", "(", "\"Creating {} {}\"", ",", "fqn", ",", "ephemeral", "?", "\"(ephemeral)\"", ":", "\"\"", ")", ";...
Adds a new node to the tree. If the node does not exist yet, it will be created. Also, parent nodes will be created if non-existent. If the node already exists, this is a no-op, it's status as ephemeral may change. @param fqn The fully qualified name of the new node @param data The new data. May be null if no data sho...
[ "Adds", "a", "new", "node", "to", "the", "tree", ".", "If", "the", "node", "does", "not", "exist", "yet", "it", "will", "be", "created", ".", "Also", "parent", "nodes", "will", "be", "created", "if", "non", "-", "existent", ".", "If", "the", "node", ...
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java#L135-L147
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java
ReplicatedTree.get
public byte[] get(String fqn) { final Node n = findNode(fqn); if (n == null) return null; final byte[] buffer = n.getData(); if (buffer == null) return null; return Arrays.copyOf(buffer, buffer.length); }
java
public byte[] get(String fqn) { final Node n = findNode(fqn); if (n == null) return null; final byte[] buffer = n.getData(); if (buffer == null) return null; return Arrays.copyOf(buffer, buffer.length); }
[ "public", "byte", "[", "]", "get", "(", "String", "fqn", ")", "{", "final", "Node", "n", "=", "findNode", "(", "fqn", ")", ";", "if", "(", "n", "==", "null", ")", "return", "null", ";", "final", "byte", "[", "]", "buffer", "=", "n", ".", "getDa...
Finds a node given its name and returns the data associated with it. Returns null if the node was not found in the tree or the data is null. @param fqn The fully qualified name of the node. @return The data associated with the node, or <code>null</code> if none or node is nonexistent.
[ "Finds", "a", "node", "given", "its", "name", "and", "returns", "the", "data", "associated", "with", "it", ".", "Returns", "null", "if", "the", "node", "was", "not", "found", "in", "the", "tree", "or", "the", "data", "is", "null", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java#L208-L216
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java
ReplicatedTree.getChildren
public List<String> getChildren(String fqn) { final Node n = findNode(fqn); if (n == null) return null; final Set<String> names = n.getChildrenNames(); return new ArrayList<String>(names); }
java
public List<String> getChildren(String fqn) { final Node n = findNode(fqn); if (n == null) return null; final Set<String> names = n.getChildrenNames(); return new ArrayList<String>(names); }
[ "public", "List", "<", "String", ">", "getChildren", "(", "String", "fqn", ")", "{", "final", "Node", "n", "=", "findNode", "(", "fqn", ")", ";", "if", "(", "n", "==", "null", ")", "return", "null", ";", "final", "Set", "<", "String", ">", "names",...
Returns all children of a given node. @param fqn The fully qualified name of the node @return A list of child names (as Strings)
[ "Returns", "all", "children", "of", "a", "given", "node", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/jgroups/ReplicatedTree.java#L235-L241
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/objects/DistributedReference.java
DistributedReference.write
@Override public void write(ByteBuffer buffer) { // if (obj instanceof Persistable) // ((Persistable) obj).write(buffer); // else { if (obj != null) buffer.put(getSerialized()); tmpBuffer = null; // } }
java
@Override public void write(ByteBuffer buffer) { // if (obj instanceof Persistable) // ((Persistable) obj).write(buffer); // else { if (obj != null) buffer.put(getSerialized()); tmpBuffer = null; // } }
[ "@", "Override", "public", "void", "write", "(", "ByteBuffer", "buffer", ")", "{", "// if (obj instanceof Persistable)", "// ((Persistable) obj).write(buffer);", "// else {", "if", "(", "obj", "!=", "null", ")", "buffer", ".", "put", "(", "getSe...
This method is not thread safe!
[ "This", "method", "is", "not", "thread", "safe!" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/objects/DistributedReference.java#L98-L107
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/netty/OneToOneCodec.java
OneToOneCodec.handleDownstream
@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws Exception { if (!(evt instanceof MessageEvent)) { ctx.sendDownstream(evt); return; } final MessageEvent e = (MessageEvent) evt; final Object originalMessage = e.getMess...
java
@Override public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws Exception { if (!(evt instanceof MessageEvent)) { ctx.sendDownstream(evt); return; } final MessageEvent e = (MessageEvent) evt; final Object originalMessage = e.getMess...
[ "@", "Override", "public", "void", "handleDownstream", "(", "ChannelHandlerContext", "ctx", ",", "ChannelEvent", "evt", ")", "throws", "Exception", "{", "if", "(", "!", "(", "evt", "instanceof", "MessageEvent", ")", ")", "{", "ctx", ".", "sendDownstream", "(",...
Code copied from org.jboss.netty.handler.codec.oneone.OneToOneEncoder and org.jboss.netty.handler.codec.oneone.OneToOneDecoder
[ "Code", "copied", "from", "org", ".", "jboss", ".", "netty", ".", "handler", ".", "codec", ".", "oneone", ".", "OneToOneEncoder", "and", "org", ".", "jboss", ".", "netty", ".", "handler", ".", "codec", ".", "oneone", ".", "OneToOneDecoder" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/netty/OneToOneCodec.java#L34-L48
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/core/AbstractCluster.java
AbstractCluster.postInit
@Override protected void postInit() throws Exception { if (controlTree == null) { throw new RuntimeException("controlTree not set"); } controlTree.create(NODES, false); controlTree.create(LEADERS, false); if (controlTree.exists(myNodeInfo.treeNodePath)) { ...
java
@Override protected void postInit() throws Exception { if (controlTree == null) { throw new RuntimeException("controlTree not set"); } controlTree.create(NODES, false); controlTree.create(LEADERS, false); if (controlTree.exists(myNodeInfo.treeNodePath)) { ...
[ "@", "Override", "protected", "void", "postInit", "(", ")", "throws", "Exception", "{", "if", "(", "controlTree", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"controlTree not set\"", ")", ";", "}", "controlTree", ".", "create", "(", "N...
This is perhaps ugly, but overriding implementations must call this method at the end, or, at least, after calling setControlTree @throws Exception
[ "This", "is", "perhaps", "ugly", "but", "overriding", "implementations", "must", "call", "this", "method", "at", "the", "end", "or", "at", "least", "after", "calling", "setControlTree" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/core/AbstractCluster.java#L173-L251
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/netty/UDPComm.java
UDPComm.sendToNode
@Override protected void sendToNode(Message message, short node, InetSocketAddress address) { try { if (LOG.isDebugEnabled()) LOG.debug("Sending to node {} ({}): {}", new Object[]{node, address, message}); message.cloneDataBuffers(); // important, as we're going ...
java
@Override protected void sendToNode(Message message, short node, InetSocketAddress address) { try { if (LOG.isDebugEnabled()) LOG.debug("Sending to node {} ({}): {}", new Object[]{node, address, message}); message.cloneDataBuffers(); // important, as we're going ...
[ "@", "Override", "protected", "void", "sendToNode", "(", "Message", "message", ",", "short", "node", ",", "InetSocketAddress", "address", ")", "{", "try", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "LOG", ".", "debug", "(", "\"Sending to ...
Can block if buffer is full
[ "Can", "block", "if", "buffer", "is", "full" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/netty/UDPComm.java#L399-L418
train
puniverse/galaxy
src/main/java/co/paralleluniverse/common/util/Exceptions.java
Exceptions.unwrap
public static Throwable unwrap(Throwable t) { for (;;) { if (t == null) throw new NullPointerException(); if (t instanceof java.util.concurrent.ExecutionException) t = t.getCause(); else if (t instanceof java.lang.reflect.InvocationTargetExcep...
java
public static Throwable unwrap(Throwable t) { for (;;) { if (t == null) throw new NullPointerException(); if (t instanceof java.util.concurrent.ExecutionException) t = t.getCause(); else if (t instanceof java.lang.reflect.InvocationTargetExcep...
[ "public", "static", "Throwable", "unwrap", "(", "Throwable", "t", ")", "{", "for", "(", ";", ";", ")", "{", "if", "(", "t", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "t", "instanceof", "java", ".", "util", ...
Unwraps several common wrapper exceptions and returns the underlying cause. @param t @return
[ "Unwraps", "several", "common", "wrapper", "exceptions", "and", "returns", "the", "underlying", "cause", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/util/Exceptions.java#L35-L49
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/core/Message.java
Message.read
public void read(ByteBuffer buffer) { Persistables.persistable(streamableNoBuffers()).read(buffer); final int n = getNumDataBuffers(); int lengthsPosition = buffer.position(); buffer.position(buffer.position() + 2 * n); // skip positions for (int i = 0; i < n; i++) { ...
java
public void read(ByteBuffer buffer) { Persistables.persistable(streamableNoBuffers()).read(buffer); final int n = getNumDataBuffers(); int lengthsPosition = buffer.position(); buffer.position(buffer.position() + 2 * n); // skip positions for (int i = 0; i < n; i++) { ...
[ "public", "void", "read", "(", "ByteBuffer", "buffer", ")", "{", "Persistables", ".", "persistable", "(", "streamableNoBuffers", "(", ")", ")", ".", "read", "(", "buffer", ")", ";", "final", "int", "n", "=", "getNumDataBuffers", "(", ")", ";", "int", "le...
Note that you cannot use this method to read a buffer wrapping the array returned from toByteArray as the internal representation is different! @param buffer
[ "Note", "that", "you", "cannot", "use", "this", "method", "to", "read", "a", "buffer", "wrapping", "the", "array", "returned", "from", "toByteArray", "as", "the", "internal", "representation", "is", "different!" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/core/Message.java#L558-L571
train
puniverse/galaxy
src/main/java/co/paralleluniverse/common/io/Streamables.java
Streamables.calcUtfLength
public static int calcUtfLength(String str) { final int strlen = str.length(); int utflen = 0; for (int i = 0; i < strlen; i++) { int c = str.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { ...
java
public static int calcUtfLength(String str) { final int strlen = str.length(); int utflen = 0; for (int i = 0; i < strlen; i++) { int c = str.charAt(i); if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { ...
[ "public", "static", "int", "calcUtfLength", "(", "String", "str", ")", "{", "final", "int", "strlen", "=", "str", ".", "length", "(", ")", ";", "int", "utflen", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strlen", ";", "i", ...
Returns the length in bytes of a string's UTF-8 encoding. @param str The string to measure. @return The length in bytes of a string's UTF-8 encoding.
[ "Returns", "the", "length", "in", "bytes", "of", "a", "string", "s", "UTF", "-", "8", "encoding", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/io/Streamables.java#L124-L138
train
puniverse/galaxy
src/main/java/co/paralleluniverse/common/spring/SpringContainerHelper.java
SpringContainerHelper.createBeanFactory
private static DefaultListableBeanFactory createBeanFactory() { return new DefaultListableBeanFactory() { { final InstantiationStrategy is = getInstantiationStrategy(); setInstantiationStrategy(new InstantiationStrategy() { @Override ...
java
private static DefaultListableBeanFactory createBeanFactory() { return new DefaultListableBeanFactory() { { final InstantiationStrategy is = getInstantiationStrategy(); setInstantiationStrategy(new InstantiationStrategy() { @Override ...
[ "private", "static", "DefaultListableBeanFactory", "createBeanFactory", "(", ")", "{", "return", "new", "DefaultListableBeanFactory", "(", ")", "{", "{", "final", "InstantiationStrategy", "is", "=", "getInstantiationStrategy", "(", ")", ";", "setInstantiationStrategy", ...
adds hooks to capture autowired constructor args and add them as dependencies @return
[ "adds", "hooks", "to", "capture", "autowired", "constructor", "args", "and", "add", "them", "as", "dependencies" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/common/spring/SpringContainerHelper.java#L193-L230
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/core/Cache.java
Cache.doOp
private Object doOp(Op op) throws TimeoutException { try { if (op.txn != null) op.txn.add(op); Object result = runOp(op); if (result == PENDING) return op.getResult(timeout, TimeUnit.MILLISECONDS); else if (result == null && op.isCa...
java
private Object doOp(Op op) throws TimeoutException { try { if (op.txn != null) op.txn.add(op); Object result = runOp(op); if (result == PENDING) return op.getResult(timeout, TimeUnit.MILLISECONDS); else if (result == null && op.isCa...
[ "private", "Object", "doOp", "(", "Op", "op", ")", "throws", "TimeoutException", "{", "try", "{", "if", "(", "op", ".", "txn", "!=", "null", ")", "op", ".", "txn", ".", "add", "(", "op", ")", ";", "Object", "result", "=", "runOp", "(", "op", ")",...
This one blocks! @param op @return
[ "This", "one", "blocks!" ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/core/Cache.java#L564-L586
train
puniverse/galaxy
src/main/java/co/paralleluniverse/galaxy/core/Cache.java
Cache.handleMessageMessengerMsg
private boolean handleMessageMessengerMsg(Message.MSG message) { if (!message.isMessenger()) return false; if (receiver == null) return true; setOwnerClockPut(message); if (message.getLine() == -1) { receiver.receive(message); if (message...
java
private boolean handleMessageMessengerMsg(Message.MSG message) { if (!message.isMessenger()) return false; if (receiver == null) return true; setOwnerClockPut(message); if (message.getLine() == -1) { receiver.receive(message); if (message...
[ "private", "boolean", "handleMessageMessengerMsg", "(", "Message", ".", "MSG", "message", ")", "{", "if", "(", "!", "message", ".", "isMessenger", "(", ")", ")", "return", "false", ";", "if", "(", "receiver", "==", "null", ")", "return", "true", ";", "se...
Special handling for msg.
[ "Special", "handling", "for", "msg", "." ]
1d077532c4a5bcd6c52ff670770c31e98420ff63
https://github.com/puniverse/galaxy/blob/1d077532c4a5bcd6c52ff670770c31e98420ff63/src/main/java/co/paralleluniverse/galaxy/core/Cache.java#L910-L942
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/predicate/PropertyReference.java
PropertyReference.propertyRef
public static P<Object> propertyRef(Compare p,String columnName){ return new RefP(p, new PropertyReference(columnName)); }
java
public static P<Object> propertyRef(Compare p,String columnName){ return new RefP(p, new PropertyReference(columnName)); }
[ "public", "static", "P", "<", "Object", ">", "propertyRef", "(", "Compare", "p", ",", "String", "columnName", ")", "{", "return", "new", "RefP", "(", "p", ",", "new", "PropertyReference", "(", "columnName", ")", ")", ";", "}" ]
build a predicate from a compare operation and a column name @param p @param columnName @return
[ "build", "a", "predicate", "from", "a", "compare", "operation", "and", "a", "column", "name" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/predicate/PropertyReference.java#L39-L41
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.constructDuplicatePathSql
private String constructDuplicatePathSql(SqlgGraph sqlgGraph, List<LinkedList<SchemaTableTree>> subQueryLinkedLists, Set<SchemaTableTree> leftJoinOn) { StringBuilder singlePathSql = new StringBuilder("\nFROM ("); int count = 1; SchemaTableTree lastOfPrevious = null; for (LinkedList<Schem...
java
private String constructDuplicatePathSql(SqlgGraph sqlgGraph, List<LinkedList<SchemaTableTree>> subQueryLinkedLists, Set<SchemaTableTree> leftJoinOn) { StringBuilder singlePathSql = new StringBuilder("\nFROM ("); int count = 1; SchemaTableTree lastOfPrevious = null; for (LinkedList<Schem...
[ "private", "String", "constructDuplicatePathSql", "(", "SqlgGraph", "sqlgGraph", ",", "List", "<", "LinkedList", "<", "SchemaTableTree", ">", ">", "subQueryLinkedLists", ",", "Set", "<", "SchemaTableTree", ">", "leftJoinOn", ")", "{", "StringBuilder", "singlePathSql",...
Construct a sql statement for one original path to a leaf node. As the path contains the same label more than once its been split into a List of Stacks.
[ "Construct", "a", "sql", "statement", "for", "one", "original", "path", "to", "a", "leaf", "node", ".", "As", "the", "path", "contains", "the", "same", "label", "more", "than", "once", "its", "been", "split", "into", "a", "List", "of", "Stacks", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L523-L560
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.constructSinglePathSql
private String constructSinglePathSql( SqlgGraph sqlgGraph, boolean partOfDuplicateQuery, LinkedList<SchemaTableTree> distinctQueryStack, SchemaTableTree lastOfPrevious, SchemaTableTree firstOfNextStack, Set<SchemaTableTree> leftJoinOn, ...
java
private String constructSinglePathSql( SqlgGraph sqlgGraph, boolean partOfDuplicateQuery, LinkedList<SchemaTableTree> distinctQueryStack, SchemaTableTree lastOfPrevious, SchemaTableTree firstOfNextStack, Set<SchemaTableTree> leftJoinOn, ...
[ "private", "String", "constructSinglePathSql", "(", "SqlgGraph", "sqlgGraph", ",", "boolean", "partOfDuplicateQuery", ",", "LinkedList", "<", "SchemaTableTree", ">", "distinctQueryStack", ",", "SchemaTableTree", "lastOfPrevious", ",", "SchemaTableTree", "firstOfNextStack", ...
Constructs a sql select statement from the SchemaTableTree call stack. The SchemaTableTree is not used as a tree. It is used only as as SchemaTable with a direction. first and last is needed to facilitate generating the from statement. If both first and last is true then the gremlin does not contain duplicate labels in...
[ "Constructs", "a", "sql", "select", "statement", "from", "the", "SchemaTableTree", "call", "stack", ".", "The", "SchemaTableTree", "is", "not", "used", "as", "a", "tree", ".", "It", "is", "used", "only", "as", "as", "SchemaTable", "with", "a", "direction", ...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L766-L783
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.duplicatesInStack
public boolean duplicatesInStack(LinkedList<SchemaTableTree> distinctQueryStack) { Set<SchemaTable> alreadyVisited = new HashSet<>(); for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (!alreadyVisited.contains(schemaTableTree.getSchemaTable())) { alreadyVisited....
java
public boolean duplicatesInStack(LinkedList<SchemaTableTree> distinctQueryStack) { Set<SchemaTable> alreadyVisited = new HashSet<>(); for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (!alreadyVisited.contains(schemaTableTree.getSchemaTable())) { alreadyVisited....
[ "public", "boolean", "duplicatesInStack", "(", "LinkedList", "<", "SchemaTableTree", ">", "distinctQueryStack", ")", "{", "Set", "<", "SchemaTable", ">", "alreadyVisited", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "SchemaTableTree", "schemaTableTree"...
Checks if the stack has the same element more than once. @param distinctQueryStack @return true is there are duplicates else false
[ "Checks", "if", "the", "stack", "has", "the", "same", "element", "more", "than", "once", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L1573-L1583
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.constructEmitFromClause
private static void constructEmitFromClause(LinkedList<SchemaTableTree> distinctQueryStack, ColumnList cols) { int count = 1; for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (count > 1) { if (!schemaTableTree.getSchemaTable().isEdgeTable() && schemaTableTree.i...
java
private static void constructEmitFromClause(LinkedList<SchemaTableTree> distinctQueryStack, ColumnList cols) { int count = 1; for (SchemaTableTree schemaTableTree : distinctQueryStack) { if (count > 1) { if (!schemaTableTree.getSchemaTable().isEdgeTable() && schemaTableTree.i...
[ "private", "static", "void", "constructEmitFromClause", "(", "LinkedList", "<", "SchemaTableTree", ">", "distinctQueryStack", ",", "ColumnList", "cols", ")", "{", "int", "count", "=", "1", ";", "for", "(", "SchemaTableTree", "schemaTableTree", ":", "distinctQuerySta...
If emit is true then the edge id also needs to be printed. This is required when there are multiple edges to the same vertex. Only by having access to the edge id can on tell if the vertex needs to be emitted.
[ "If", "emit", "is", "true", "then", "the", "edge", "id", "also", "needs", "to", "be", "printed", ".", "This", "is", "required", "when", "there", "are", "multiple", "edges", "to", "the", "same", "vertex", ".", "Only", "by", "having", "access", "to", "th...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L1818-L1829
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.removeOrTransformHasContainers
private void removeOrTransformHasContainers(final SchemaTableTree schemaTableTree) { Set<HasContainer> toRemove = new HashSet<>(); Set<HasContainer> toAdd = new HashSet<>(); for (HasContainer hasContainer : schemaTableTree.hasContainers) { if (hasContainer.getKey().equals(label.getAc...
java
private void removeOrTransformHasContainers(final SchemaTableTree schemaTableTree) { Set<HasContainer> toRemove = new HashSet<>(); Set<HasContainer> toAdd = new HashSet<>(); for (HasContainer hasContainer : schemaTableTree.hasContainers) { if (hasContainer.getKey().equals(label.getAc...
[ "private", "void", "removeOrTransformHasContainers", "(", "final", "SchemaTableTree", "schemaTableTree", ")", "{", "Set", "<", "HasContainer", ">", "toRemove", "=", "new", "HashSet", "<>", "(", ")", ";", "Set", "<", "HasContainer", ">", "toAdd", "=", "new", "H...
remove "has" containers that are not valid anymore transform "has" containers that are equivalent to simpler statements. @param schemaTableTree the current table tree
[ "remove", "has", "containers", "that", "are", "not", "valid", "anymore", "transform", "has", "containers", "that", "are", "equivalent", "to", "simpler", "statements", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L2329-L2354
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.invalidateByHas
@SuppressWarnings("unchecked") private boolean invalidateByHas(SchemaTableTree schemaTableTree) { for (HasContainer hasContainer : schemaTableTree.hasContainers) { if (!hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_SQLG_SCHEMA) && !hasContainer.getKey().equals(TopologyStrategy...
java
@SuppressWarnings("unchecked") private boolean invalidateByHas(SchemaTableTree schemaTableTree) { for (HasContainer hasContainer : schemaTableTree.hasContainers) { if (!hasContainer.getKey().equals(TopologyStrategy.TOPOLOGY_SELECTION_SQLG_SCHEMA) && !hasContainer.getKey().equals(TopologyStrategy...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "boolean", "invalidateByHas", "(", "SchemaTableTree", "schemaTableTree", ")", "{", "for", "(", "HasContainer", "hasContainer", ":", "schemaTableTree", ".", "hasContainers", ")", "{", "if", "(", "!", "h...
verify the "has" containers we have are valid with the schema table tree given @param schemaTableTree @return true if any has container does NOT match, false if everything is fine
[ "verify", "the", "has", "containers", "we", "have", "are", "valid", "with", "the", "schema", "table", "tree", "given" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L2386-L2435
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.shouldSelectProperty
public boolean shouldSelectProperty(String property) { // no restriction if (getRoot().eagerLoad || restrictedProperties == null) { return true; } // explicit restriction if (getRoot().eagerLoad || restrictedProperties.contains(property)) { return true; ...
java
public boolean shouldSelectProperty(String property) { // no restriction if (getRoot().eagerLoad || restrictedProperties == null) { return true; } // explicit restriction if (getRoot().eagerLoad || restrictedProperties.contains(property)) { return true; ...
[ "public", "boolean", "shouldSelectProperty", "(", "String", "property", ")", "{", "// no restriction", "if", "(", "getRoot", "(", ")", ".", "eagerLoad", "||", "restrictedProperties", "==", "null", ")", "{", "return", "true", ";", "}", "// explicit restriction", ...
should we select the given property? @param property the property name @return true if the property should be part of the select clause, false otherwise
[ "should", "we", "select", "the", "given", "property?" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L2736-L2746
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java
SchemaTableTree.calculatePropertyRestrictions
private void calculatePropertyRestrictions() { if (restrictedProperties == null) { return; } // we use aliases for ordering, so we need the property in the select clause for (org.javatuples.Pair<Traversal.Admin<?, ?>, Comparator<?>> comparator : this.getDbComparators()) { ...
java
private void calculatePropertyRestrictions() { if (restrictedProperties == null) { return; } // we use aliases for ordering, so we need the property in the select clause for (org.javatuples.Pair<Traversal.Admin<?, ?>, Comparator<?>> comparator : this.getDbComparators()) { ...
[ "private", "void", "calculatePropertyRestrictions", "(", ")", "{", "if", "(", "restrictedProperties", "==", "null", ")", "{", "return", ";", "}", "// we use aliases for ordering, so we need the property in the select clause", "for", "(", "org", ".", "javatuples", ".", "...
calculate property restrictions from explicit restrictions and required properties
[ "calculate", "property", "restrictions", "from", "explicit", "restrictions", "and", "required", "properties" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/SchemaTableTree.java#L2751-L2782
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStepTree.java
ReplacedStepTree.orderByHasSelectOneStepAndForLabelNotInTree
public boolean orderByHasSelectOneStepAndForLabelNotInTree() { Set<String> labels = new HashSet<>(); for (ReplacedStep<?, ?> replacedStep : linearPathToLeafNode()) { for (String label : labels) { labels.add(SqlgUtil.originalLabel(label)); } for (Pair<T...
java
public boolean orderByHasSelectOneStepAndForLabelNotInTree() { Set<String> labels = new HashSet<>(); for (ReplacedStep<?, ?> replacedStep : linearPathToLeafNode()) { for (String label : labels) { labels.add(SqlgUtil.originalLabel(label)); } for (Pair<T...
[ "public", "boolean", "orderByHasSelectOneStepAndForLabelNotInTree", "(", ")", "{", "Set", "<", "String", ">", "labels", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "ReplacedStep", "<", "?", ",", "?", ">", "replacedStep", ":", "linearPathToLeafNode"...
This happens when a SqlgVertexStep has a SelectOne step where the label is for an element on the path that is before the current optimized steps. @return
[ "This", "happens", "when", "a", "SqlgVertexStep", "has", "a", "SelectOne", "step", "where", "the", "label", "is", "for", "an", "element", "on", "the", "path", "that", "is", "before", "the", "current", "optimized", "steps", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStepTree.java#L126-L152
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java
TopologyManager.updateGraph
public static String updateGraph(SqlgGraph sqlgGraph, String version) { Connection conn = sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); GraphTraversalSource traversalSource = sqlgGraph.topology(); List<Vertex> graphVertices = tr...
java
public static String updateGraph(SqlgGraph sqlgGraph, String version) { Connection conn = sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); GraphTraversalSource traversalSource = sqlgGraph.topology(); List<Vertex> graphVertices = tr...
[ "public", "static", "String", "updateGraph", "(", "SqlgGraph", "sqlgGraph", ",", "String", "version", ")", "{", "Connection", "conn", "=", "sqlgGraph", ".", "tx", "(", ")", ".", "getConnection", "(", ")", ";", "try", "{", "DatabaseMetaData", "metadata", "=",...
Updates sqlg_schema.V_graph's version to the new version and returns the old version. @param sqlgGraph The graph. @param version The new version. @return The old version.
[ "Updates", "sqlg_schema", ".", "V_graph", "s", "version", "to", "the", "new", "version", "and", "returns", "the", "old", "version", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L58-L76
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java
TopologyManager.addIndex
public static void addIndex(SqlgGraph sqlgGraph, String schema, String label, boolean vertex, String index, IndexType indexType, List<String> properties) { BatchManager.BatchModeType batchModeType = flushAndSetTxToNone(sqlgGraph); try { //get the abstractLabel's vertex GraphTrave...
java
public static void addIndex(SqlgGraph sqlgGraph, String schema, String label, boolean vertex, String index, IndexType indexType, List<String> properties) { BatchManager.BatchModeType batchModeType = flushAndSetTxToNone(sqlgGraph); try { //get the abstractLabel's vertex GraphTrave...
[ "public", "static", "void", "addIndex", "(", "SqlgGraph", "sqlgGraph", ",", "String", "schema", ",", "String", "label", ",", "boolean", "vertex", ",", "String", "index", ",", "IndexType", "indexType", ",", "List", "<", "String", ">", "properties", ")", "{", ...
add an index from information schema @param sqlgGraph the graph @param schema the schema name @param label the label name @param vertex is it a vertex or an edge label? @param index the index name @param indexType index type @param properties the column names
[ "add", "an", "index", "from", "information", "schema" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L966-L1029
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java
TopologyManager.addSubPartition
public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) { AbstractLabel abstractLabel = partition.getAbstractLabel(); addSubPartition( sqlgGraph, partition.getParentPartition().getParentPartition() != null, abstractLabel instanceof Ver...
java
public static void addSubPartition(SqlgGraph sqlgGraph, Partition partition) { AbstractLabel abstractLabel = partition.getAbstractLabel(); addSubPartition( sqlgGraph, partition.getParentPartition().getParentPartition() != null, abstractLabel instanceof Ver...
[ "public", "static", "void", "addSubPartition", "(", "SqlgGraph", "sqlgGraph", ",", "Partition", "partition", ")", "{", "AbstractLabel", "abstractLabel", "=", "partition", ".", "getAbstractLabel", "(", ")", ";", "addSubPartition", "(", "sqlgGraph", ",", "partition", ...
Adds the partition to a partition. A new Vertex with label Partition is added and in linked to its parent with the SQLG_SCHEMA_PARTITION_PARTITION_EDGE edge label. @param sqlgGraph
[ "Adds", "the", "partition", "to", "a", "partition", ".", "A", "new", "Vertex", "with", "label", "Partition", "is", "added", "and", "in", "linked", "to", "its", "parent", "with", "the", "SQLG_SCHEMA_PARTITION_PARTITION_EDGE", "edge", "label", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/TopologyManager.java#L1215-L1232
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/TransactionCache.java
TransactionCache.putVertexIfAbsent
SqlgVertex putVertexIfAbsent(SqlgGraph sqlgGraph, String schema, String table, Long id) { RecordId recordId = RecordId.from(SchemaTable.of(schema, table), id); SqlgVertex sqlgVertex; if (this.cacheVertices) { sqlgVertex = this.vertexCache.get(recordId); if (sqlgVertex == ...
java
SqlgVertex putVertexIfAbsent(SqlgGraph sqlgGraph, String schema, String table, Long id) { RecordId recordId = RecordId.from(SchemaTable.of(schema, table), id); SqlgVertex sqlgVertex; if (this.cacheVertices) { sqlgVertex = this.vertexCache.get(recordId); if (sqlgVertex == ...
[ "SqlgVertex", "putVertexIfAbsent", "(", "SqlgGraph", "sqlgGraph", ",", "String", "schema", ",", "String", "table", ",", "Long", "id", ")", "{", "RecordId", "recordId", "=", "RecordId", ".", "from", "(", "SchemaTable", ".", "of", "(", "schema", ",", "table", ...
The recordId is not referenced in the SqlgVertex. It is important that the value of the WeakHashMap does not reference the key. @param sqlgGraph The graph @return the vertex. If cacheVertices is true and the vertex is cached then the cached vertex will be returned else a the vertex will be instantiated.
[ "The", "recordId", "is", "not", "referenced", "in", "the", "SqlgVertex", ".", "It", "is", "important", "that", "the", "value", "of", "the", "WeakHashMap", "does", "not", "reference", "the", "key", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/TransactionCache.java#L105-L119
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/GlobalUniqueIndex.java
GlobalUniqueIndex.toJson
private JsonNode toJson(){ ObjectNode result = new ObjectNode(Topology.OBJECT_MAPPER.getNodeFactory()); ArrayNode propertyArrayNode = new ArrayNode(Topology.OBJECT_MAPPER.getNodeFactory()); for (PropertyColumn property : this.properties) { ObjectNode objectNode = property.toNotifyJson()...
java
private JsonNode toJson(){ ObjectNode result = new ObjectNode(Topology.OBJECT_MAPPER.getNodeFactory()); ArrayNode propertyArrayNode = new ArrayNode(Topology.OBJECT_MAPPER.getNodeFactory()); for (PropertyColumn property : this.properties) { ObjectNode objectNode = property.toNotifyJson()...
[ "private", "JsonNode", "toJson", "(", ")", "{", "ObjectNode", "result", "=", "new", "ObjectNode", "(", "Topology", ".", "OBJECT_MAPPER", ".", "getNodeFactory", "(", ")", ")", ";", "ArrayNode", "propertyArrayNode", "=", "new", "ArrayNode", "(", "Topology", ".",...
JSON representation of committed state @return
[ "JSON", "representation", "of", "committed", "state" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/GlobalUniqueIndex.java#L154-L166
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStep.java
ReplacedStep.from
public static ReplacedStep from(Topology topology) { ReplacedStep replacedStep = new ReplacedStep<>(); replacedStep.step = null; replacedStep.labels = new HashSet<>(); replacedStep.topology = topology; replacedStep.fake = true; return replacedStep; }
java
public static ReplacedStep from(Topology topology) { ReplacedStep replacedStep = new ReplacedStep<>(); replacedStep.step = null; replacedStep.labels = new HashSet<>(); replacedStep.topology = topology; replacedStep.fake = true; return replacedStep; }
[ "public", "static", "ReplacedStep", "from", "(", "Topology", "topology", ")", "{", "ReplacedStep", "replacedStep", "=", "new", "ReplacedStep", "<>", "(", ")", ";", "replacedStep", ".", "step", "=", "null", ";", "replacedStep", ".", "labels", "=", "new", "Has...
Used for SqlgVertexStepStrategy. It is a fake ReplacedStep to simulate the incoming vertex from which the traversal continues. @param topology @return
[ "Used", "for", "SqlgVertexStepStrategy", ".", "It", "is", "a", "fake", "ReplacedStep", "to", "simulate", "the", "incoming", "vertex", "from", "which", "the", "traversal", "continues", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStep.java#L88-L95
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStep.java
ReplacedStep.groupIdsBySchemaTable
private Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> groupIdsBySchemaTable() { Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> result = new HashMap<>(); for (HasContainer idHasContainer : this.idHasContainers) { Map<SchemaTable, Boolean> newHasContainerMap = new HashMap<>...
java
private Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> groupIdsBySchemaTable() { Map<SchemaTable, List<Multimap<BiPredicate, RecordId>>> result = new HashMap<>(); for (HasContainer idHasContainer : this.idHasContainers) { Map<SchemaTable, Boolean> newHasContainerMap = new HashMap<>...
[ "private", "Map", "<", "SchemaTable", ",", "List", "<", "Multimap", "<", "BiPredicate", ",", "RecordId", ">", ">", ">", "groupIdsBySchemaTable", "(", ")", "{", "Map", "<", "SchemaTable", ",", "List", "<", "Multimap", "<", "BiPredicate", ",", "RecordId", ">...
Groups the idHasContainers by SchemaTable. Each SchemaTable has a list representing the idHasContainers with the relevant BiPredicate and RecordId @return
[ "Groups", "the", "idHasContainers", "by", "SchemaTable", ".", "Each", "SchemaTable", "has", "a", "list", "representing", "the", "idHasContainers", "with", "the", "relevant", "BiPredicate", "and", "RecordId" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ReplacedStep.java#L592-L637
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/strategy/SqlgWhereStrategy.java
SqlgWhereStrategy.captureLabels
private void captureLabels(Step<?,?> step,Map<String,Object> stepsByLabel){ for (String s:step.getLabels()){ stepsByLabel.put(s, step); } // labels on replaced steps are not bubbled up to the graphstep if (step instanceof SqlgGraphStep<?, ?>){ SqlgGraphStep<?, ?> sgs=(SqlgGra...
java
private void captureLabels(Step<?,?> step,Map<String,Object> stepsByLabel){ for (String s:step.getLabels()){ stepsByLabel.put(s, step); } // labels on replaced steps are not bubbled up to the graphstep if (step instanceof SqlgGraphStep<?, ?>){ SqlgGraphStep<?, ?> sgs=(SqlgGra...
[ "private", "void", "captureLabels", "(", "Step", "<", "?", ",", "?", ">", "step", ",", "Map", "<", "String", ",", "Object", ">", "stepsByLabel", ")", "{", "for", "(", "String", "s", ":", "step", ".", "getLabels", "(", ")", ")", "{", "stepsByLabel", ...
add all labels for the step in the given map @param step @param stepsByLabel the map to fill up
[ "add", "all", "labels", "for", "the", "step", "in", "the", "given", "map" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/strategy/SqlgWhereStrategy.java#L91-L108
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java
SqlgStartupManager.createOrUpdateGraph
private String createOrUpdateGraph(String version) { String oldVersion = null; Connection conn = this.sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); String[] types = new String[]{"TABLE"}; //load the vertices ...
java
private String createOrUpdateGraph(String version) { String oldVersion = null; Connection conn = this.sqlgGraph.tx().getConnection(); try { DatabaseMetaData metadata = conn.getMetaData(); String[] types = new String[]{"TABLE"}; //load the vertices ...
[ "private", "String", "createOrUpdateGraph", "(", "String", "version", ")", "{", "String", "oldVersion", "=", "null", ";", "Connection", "conn", "=", "this", ".", "sqlgGraph", ".", "tx", "(", ")", ".", "getConnection", "(", ")", ";", "try", "{", "DatabaseMe...
create or update the graph metadata @param version the new version of the graph @return the old version of the graph, or null if there was no graph
[ "create", "or", "update", "the", "graph", "metadata" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java#L176-L214
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java
SqlgStartupManager.getBuildVersion
String getBuildVersion() { if (this.buildVersion == null) { Properties prop = new Properties(); try { // try system URL u = ClassLoader.getSystemResource(SQLG_APPLICATION_PROPERTIES); if (u == null) { // try own class lo...
java
String getBuildVersion() { if (this.buildVersion == null) { Properties prop = new Properties(); try { // try system URL u = ClassLoader.getSystemResource(SQLG_APPLICATION_PROPERTIES); if (u == null) { // try own class lo...
[ "String", "getBuildVersion", "(", ")", "{", "if", "(", "this", ".", "buildVersion", "==", "null", ")", "{", "Properties", "prop", "=", "new", "Properties", "(", ")", ";", "try", "{", "// try system", "URL", "u", "=", "ClassLoader", ".", "getSystemResource"...
get the build version @return the build version, or null if unknown
[ "get", "the", "build", "version" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgStartupManager.java#L626-L647
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgGraph.java
SqlgGraph.query
public String query(String query) { try { Connection conn = this.tx().getConnection(); ObjectNode result = this.mapper.createObjectNode(); ArrayNode dataNode = this.mapper.createArrayNode(); ArrayNode metaNode = this.mapper.createArrayNode(); Statement...
java
public String query(String query) { try { Connection conn = this.tx().getConnection(); ObjectNode result = this.mapper.createObjectNode(); ArrayNode dataNode = this.mapper.createArrayNode(); ArrayNode metaNode = this.mapper.createArrayNode(); Statement...
[ "public", "String", "query", "(", "String", "query", ")", "{", "try", "{", "Connection", "conn", "=", "this", ".", "tx", "(", ")", ".", "getConnection", "(", ")", ";", "ObjectNode", "result", "=", "this", ".", "mapper", ".", "createObjectNode", "(", ")...
This is executes a sql query and returns the result as a json string. @param query The sql to executeRegularQuery. @return The query result as json.
[ "This", "is", "executes", "a", "sql", "query", "and", "returns", "the", "result", "as", "a", "json", "string", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgGraph.java#L1052-L1090
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgCompiledResultIterator.java
SqlgCompiledResultIterator.nextLazy
@SuppressWarnings("unchecked") private E nextLazy() { //noinspection unchecked List<Emit<SqlgElement>> result = this.elements; this.elements = null; return (E) result; }
java
@SuppressWarnings("unchecked") private E nextLazy() { //noinspection unchecked List<Emit<SqlgElement>> result = this.elements; this.elements = null; return (E) result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "E", "nextLazy", "(", ")", "{", "//noinspection unchecked", "List", "<", "Emit", "<", "SqlgElement", ">>", "result", "=", "this", ".", "elements", ";", "this", ".", "elements", "=", "null", ";", ...
return the next lazy results @return
[ "return", "the", "next", "lazy", "results" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/SqlgCompiledResultIterator.java#L238-L244
train
pietermartin/sqlg
sqlg-cockroachdb-parent/sqlg-cockroachdb-dialect/src/main/java/org/umlg/sqlg/sql/dialect/CockroachdbDialect.java
CockroachdbDialect.shiftDST
@SuppressWarnings("deprecation") private static Time shiftDST(LocalTime lt) { Time t = Time.valueOf(lt); int offset = Calendar.getInstance().get(Calendar.DST_OFFSET) / 1000; // I know this are deprecated methods, but it's so much clearer than alternatives int m = t.getSeconds(); ...
java
@SuppressWarnings("deprecation") private static Time shiftDST(LocalTime lt) { Time t = Time.valueOf(lt); int offset = Calendar.getInstance().get(Calendar.DST_OFFSET) / 1000; // I know this are deprecated methods, but it's so much clearer than alternatives int m = t.getSeconds(); ...
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "Time", "shiftDST", "(", "LocalTime", "lt", ")", "{", "Time", "t", "=", "Time", ".", "valueOf", "(", "lt", ")", ";", "int", "offset", "=", "Calendar", ".", "getInstance", "(", ")"...
Postgres gets confused by DST, it sets the timezone badly and then reads the wrong value out, so we convert the value to "winter time" @param lt the current time @return the time in "winter time" if there is DST in effect today
[ "Postgres", "gets", "confused", "by", "DST", "it", "sets", "the", "timezone", "badly", "and", "then", "reads", "the", "wrong", "value", "out", "so", "we", "convert", "the", "value", "to", "winter", "time" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-cockroachdb-parent/sqlg-cockroachdb-dialect/src/main/java/org/umlg/sqlg/sql/dialect/CockroachdbDialect.java#L1656-L1664
train
pietermartin/sqlg
sqlg-postgres-parent/sqlg-postgres-dialect/src/main/java/org/umlg/sqlg/sql/dialect/PostgresDialect.java
PostgresDialect.sqlTypeToPropertyType
@Override public PropertyType sqlTypeToPropertyType(SqlgGraph sqlgGraph, String schema, String table, String column, int sqlType, String typeName, ListIterator<Triple<String, Integer, String>> metaDataIter) { switch (sqlType) { case Types.BIT: return PropertyType.BOOLEAN; ...
java
@Override public PropertyType sqlTypeToPropertyType(SqlgGraph sqlgGraph, String schema, String table, String column, int sqlType, String typeName, ListIterator<Triple<String, Integer, String>> metaDataIter) { switch (sqlType) { case Types.BIT: return PropertyType.BOOLEAN; ...
[ "@", "Override", "public", "PropertyType", "sqlTypeToPropertyType", "(", "SqlgGraph", "sqlgGraph", ",", "String", "schema", ",", "String", "table", ",", "String", "column", ",", "int", "sqlType", ",", "String", "typeName", ",", "ListIterator", "<", "Triple", "<"...
This is only used for upgrading from pre sqlg_schema sqlg to a sqlg_schema
[ "This", "is", "only", "used", "for", "upgrading", "from", "pre", "sqlg_schema", "sqlg", "to", "a", "sqlg_schema" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-postgres-parent/sqlg-postgres-dialect/src/main/java/org/umlg/sqlg/sql/dialect/PostgresDialect.java#L2108-L2152
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java
SqlgVertexStep.elements
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("stre...
java
private ListIterator<List<Emit<E>>> elements(SchemaTable schemaTable, SchemaTableTree rootSchemaTableTree) { this.sqlgGraph.tx().readWrite(); if (this.sqlgGraph.getSqlDialect().supportsBatchMode() && this.sqlgGraph.tx().getBatchManager().isStreaming()) { throw new IllegalStateException("stre...
[ "private", "ListIterator", "<", "List", "<", "Emit", "<", "E", ">", ">", ">", "elements", "(", "SchemaTable", "schemaTable", ",", "SchemaTableTree", "rootSchemaTableTree", ")", "{", "this", ".", "sqlgGraph", ".", "tx", "(", ")", ".", "readWrite", "(", ")",...
Called from SqlgVertexStepCompiler which compiled VertexStep and HasSteps. This is only called when not in BatchMode
[ "Called", "from", "SqlgVertexStepCompiler", "which", "compiled", "VertexStep", "and", "HasSteps", ".", "This", "is", "only", "called", "when", "not", "in", "BatchMode" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/step/SqlgVertexStep.java#L238-L248
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java
AbstractLabel.removeColumn
void removeColumn(String schema, String table, String column) { StringBuilder sql = new StringBuilder("ALTER TABLE "); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema)); sql.append("."); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table)); sql.append(" DR...
java
void removeColumn(String schema, String table, String column) { StringBuilder sql = new StringBuilder("ALTER TABLE "); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(schema)); sql.append("."); sql.append(sqlgGraph.getSqlDialect().maybeWrapInQoutes(table)); sql.append(" DR...
[ "void", "removeColumn", "(", "String", "schema", ",", "String", "table", ",", "String", "column", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", "\"ALTER TABLE \"", ")", ";", "sql", ".", "append", "(", "sqlgGraph", ".", "getSqlDialect", ...
remove a column from the table @param schema the schema @param table the table name @param column the column name
[ "remove", "a", "column", "from", "the", "table" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1002-L1024
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java
AbstractLabel.removeIndex
void removeIndex(Index idx, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedIndexes.contains(idx.getName())) { uncommittedRemovedIndexes.add(idx.getName()); TopologyManager.removeIndex(this.sqlgGraph, idx); if (!preserveData) { ...
java
void removeIndex(Index idx, boolean preserveData) { this.getSchema().getTopology().lock(); if (!uncommittedRemovedIndexes.contains(idx.getName())) { uncommittedRemovedIndexes.add(idx.getName()); TopologyManager.removeIndex(this.sqlgGraph, idx); if (!preserveData) { ...
[ "void", "removeIndex", "(", "Index", "idx", ",", "boolean", "preserveData", ")", "{", "this", ".", "getSchema", "(", ")", ".", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "if", "(", "!", "uncommittedRemovedIndexes", ".", "contains", "(", "idx", ...
remove a given index that was on this label @param idx the index @param preserveData should we keep the SQL data
[ "remove", "a", "given", "index", "that", "was", "on", "this", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/AbstractLabel.java#L1032-L1042
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java
SqlgUtil.setKeyValuesAsParameterUsingPropertyColumn
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, Pair<PropertyType, Object>> properties) throws SQLException { i = setKeyValuesAsParameterUsingPropertyColumn(sqlgGraph, true, i, preparedStatement, properties.values()); ...
java
public static int setKeyValuesAsParameterUsingPropertyColumn(SqlgGraph sqlgGraph, int i, PreparedStatement preparedStatement, Map<String, Pair<PropertyType, Object>> properties) throws SQLException { i = setKeyValuesAsParameterUsingPropertyColumn(sqlgGraph, true, i, preparedStatement, properties.values()); ...
[ "public", "static", "int", "setKeyValuesAsParameterUsingPropertyColumn", "(", "SqlgGraph", "sqlgGraph", ",", "int", "i", ",", "PreparedStatement", "preparedStatement", ",", "Map", "<", "String", ",", "Pair", "<", "PropertyType", ",", "Object", ">", ">", "properties"...
This is called for inserts
[ "This", "is", "called", "for", "inserts" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java#L323-L326
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java
SqlgUtil.validateVertexKeysValues
public static Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues) { Map<String, Object> resultAllValues = new LinkedHashMap<>(); Map<String, Object> resultNotNullValues = new LinkedHashMap<>(); Map<String...
java
public static Triple<Map<String, PropertyType>, Map<String, Object>, Map<String, Object>> validateVertexKeysValues(SqlDialect sqlDialect, Object[] keyValues) { Map<String, Object> resultAllValues = new LinkedHashMap<>(); Map<String, Object> resultNotNullValues = new LinkedHashMap<>(); Map<String...
[ "public", "static", "Triple", "<", "Map", "<", "String", ",", "PropertyType", ">", ",", "Map", "<", "String", ",", "Object", ">", ",", "Map", "<", "String", ",", "Object", ">", ">", "validateVertexKeysValues", "(", "SqlDialect", "sqlDialect", ",", "Object"...
Validates the key values and converts it into a Triple with three maps. The left map is a map of keys together with their PropertyType. The middle map is a map of keys together with their values. The right map is a map of keys with values where the values are guaranteed not to be null. @param sqlDialect The dialect. ...
[ "Validates", "the", "key", "values", "and", "converts", "it", "into", "a", "Triple", "with", "three", "maps", ".", "The", "left", "map", "is", "a", "map", "of", "keys", "together", "with", "their", "PropertyType", ".", "The", "middle", "map", "is", "a", ...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/util/SqlgUtil.java#L616-L647
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/GremlinParser.java
GremlinParser.parse
public SchemaTableTree parse(SchemaTable schemaTable, ReplacedStepTree replacedStepTree) { ReplacedStep<?, ?> rootReplacedStep = replacedStepTree.root().getReplacedStep(); Preconditions.checkArgument(!rootReplacedStep.isGraphStep(), "Expected VertexStep, found GraphStep"); Set<SchemaTableTree> ...
java
public SchemaTableTree parse(SchemaTable schemaTable, ReplacedStepTree replacedStepTree) { ReplacedStep<?, ?> rootReplacedStep = replacedStepTree.root().getReplacedStep(); Preconditions.checkArgument(!rootReplacedStep.isGraphStep(), "Expected VertexStep, found GraphStep"); Set<SchemaTableTree> ...
[ "public", "SchemaTableTree", "parse", "(", "SchemaTable", "schemaTable", ",", "ReplacedStepTree", "replacedStepTree", ")", "{", "ReplacedStep", "<", "?", ",", "?", ">", "rootReplacedStep", "=", "replacedStepTree", ".", "root", "(", ")", ".", "getReplacedStep", "("...
This is only called for vertex steps. Constructs the label paths from the given schemaTable to the leaf vertex labels for the gremlin query. For each path Sqlg will executeRegularQuery a sql query. The union of the queries is the result the gremlin query. The vertex labels can be calculated from the steps. @param sche...
[ "This", "is", "only", "called", "for", "vertex", "steps", ".", "Constructs", "the", "label", "paths", "from", "the", "given", "schemaTable", "to", "the", "leaf", "vertex", "labels", "for", "the", "gremlin", "query", ".", "For", "each", "path", "Sqlg", "wil...
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/GremlinParser.java#L53-L71
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.createSchemaOnDb
private void createSchemaOnDb() { StringBuilder sql = new StringBuilder(); sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { ...
java
private void createSchemaOnDb() { StringBuilder sql = new StringBuilder(); sql.append(topology.getSqlgGraph().getSqlDialect().createSchemaStatement(this.name)); if (this.sqlgGraph.getSqlDialect().needsSemicolon()) { sql.append(";"); } if (logger.isDebugEnabled()) { ...
[ "private", "void", "createSchemaOnDb", "(", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "topology", ".", "getSqlgGraph", "(", ")", ".", "getSqlDialect", "(", ")", ".", "createSchemaStatement", "(",...
Creates a new schema on the database. i.e. 'CREATE SCHEMA...' sql statement.
[ "Creates", "a", "new", "schema", "on", "the", "database", ".", "i", ".", "e", ".", "CREATE", "SCHEMA", "...", "sql", "statement", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L569-L585
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.getAllTables
Map<String, Map<String, PropertyType>> getAllTables() { Map<String, Map<String, PropertyType>> result = new HashMap<>(); for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.vertexLabels.entrySet()) { String vertexQualifiedName = this.name + "." + VERTEX_PREFIX + vertexLabelEntry.getV...
java
Map<String, Map<String, PropertyType>> getAllTables() { Map<String, Map<String, PropertyType>> result = new HashMap<>(); for (Map.Entry<String, VertexLabel> vertexLabelEntry : this.vertexLabels.entrySet()) { String vertexQualifiedName = this.name + "." + VERTEX_PREFIX + vertexLabelEntry.getV...
[ "Map", "<", "String", ",", "Map", "<", "String", ",", "PropertyType", ">", ">", "getAllTables", "(", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "PropertyType", ">", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "fo...
remove in favour of PropertyColumn
[ "remove", "in", "favour", "of", "PropertyColumn" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L676-L694
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.loadVertexIndices
void loadVertexIndices(GraphTraversalSource traversalSource, Vertex schemaVertex) { List<Path> indices = traversalSource .V(schemaVertex) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).as("vertex") .out(SQLG_SCHEMA_VERTEX_INDEX_EDGE).as("index") .outE(SQLG_S...
java
void loadVertexIndices(GraphTraversalSource traversalSource, Vertex schemaVertex) { List<Path> indices = traversalSource .V(schemaVertex) .out(SQLG_SCHEMA_SCHEMA_VERTEX_EDGE).as("vertex") .out(SQLG_SCHEMA_VERTEX_INDEX_EDGE).as("index") .outE(SQLG_S...
[ "void", "loadVertexIndices", "(", "GraphTraversalSource", "traversalSource", ",", "Vertex", "schemaVertex", ")", "{", "List", "<", "Path", ">", "indices", "=", "traversalSource", ".", "V", "(", "schemaVertex", ")", ".", "out", "(", "SQLG_SCHEMA_SCHEMA_VERTEX_EDGE", ...
load indices for all vertices in schema @param traversalSource @param schemaVertex
[ "load", "indices", "for", "all", "vertices", "in", "schema" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1205-L1266
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeEdgeLabel
void removeEdgeLabel(EdgeLabel edgeLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + EDGE_PREFIX + edgeLabel.getName(); if (!uncommittedRemovedEdgeLabels.contains(fn)) { uncommittedRemovedEdgeLabels.add(fn); TopologyManager.removeEdgeLabe...
java
void removeEdgeLabel(EdgeLabel edgeLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + EDGE_PREFIX + edgeLabel.getName(); if (!uncommittedRemovedEdgeLabels.contains(fn)) { uncommittedRemovedEdgeLabels.add(fn); TopologyManager.removeEdgeLabe...
[ "void", "removeEdgeLabel", "(", "EdgeLabel", "edgeLabel", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "this", ".", "name", "+", "\".\"", "+", "EDGE_PREFIX", "+", "edgeLabel", ".", "g...
remove a given edge label @param edgeLabel the edge label @param preserveData should we keep the SQL data
[ "remove", "a", "given", "edge", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1757-L1776
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeVertexLabel
void removeVertexLabel(VertexLabel vertexLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + VERTEX_PREFIX + vertexLabel.getName(); if (!uncommittedRemovedVertexLabels.contains(fn)) { uncommittedRemovedVertexLabels.add(fn); TopologyManager.r...
java
void removeVertexLabel(VertexLabel vertexLabel, boolean preserveData) { getTopology().lock(); String fn = this.name + "." + VERTEX_PREFIX + vertexLabel.getName(); if (!uncommittedRemovedVertexLabels.contains(fn)) { uncommittedRemovedVertexLabels.add(fn); TopologyManager.r...
[ "void", "removeVertexLabel", "(", "VertexLabel", "vertexLabel", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "this", ".", "name", "+", "\".\"", "+", "VERTEX_PREFIX", "+", "vertexLabel", ...
remove a given vertex label @param vertexLabel the vertex label @param preserveData should we keep the SQL data
[ "remove", "a", "given", "vertex", "label" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1784-L1802
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.removeGlobalUniqueIndex
void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) { getTopology().lock(); String fn = index.getName(); if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) { uncommittedRemovedGlobalUniqueIndexes.add(fn); TopologyManager.removeGlobalUniqueInd...
java
void removeGlobalUniqueIndex(GlobalUniqueIndex index, boolean preserveData) { getTopology().lock(); String fn = index.getName(); if (!uncommittedRemovedGlobalUniqueIndexes.contains(fn)) { uncommittedRemovedGlobalUniqueIndexes.add(fn); TopologyManager.removeGlobalUniqueInd...
[ "void", "removeGlobalUniqueIndex", "(", "GlobalUniqueIndex", "index", ",", "boolean", "preserveData", ")", "{", "getTopology", "(", ")", ".", "lock", "(", ")", ";", "String", "fn", "=", "index", ".", "getName", "(", ")", ";", "if", "(", "!", "uncommittedRe...
remove the given global unique index @param index the index to remove @param preserveData should we keep the sql data?
[ "remove", "the", "given", "global", "unique", "index" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1810-L1822
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java
Schema.delete
void delete() { StringBuilder sql = new StringBuilder(); sql.append("DROP SCHEMA "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().supportsCascade()) { sql.append(" CASCADE"); } if (this.sqlgGraph.g...
java
void delete() { StringBuilder sql = new StringBuilder(); sql.append("DROP SCHEMA "); sql.append(this.sqlgGraph.getSqlDialect().maybeWrapInQoutes(this.name)); if (this.sqlgGraph.getSqlDialect().supportsCascade()) { sql.append(" CASCADE"); } if (this.sqlgGraph.g...
[ "void", "delete", "(", ")", "{", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\"DROP SCHEMA \"", ")", ";", "sql", ".", "append", "(", "this", ".", "sqlgGraph", ".", "getSqlDialect", "(", ")", ".", "may...
delete schema in DB
[ "delete", "schema", "in", "DB" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Schema.java#L1827-L1847
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.getOutEdgeLabel
public Optional<EdgeLabel> getOutEdgeLabel(String edgeLabelName) { EdgeLabel edgeLabel = getOutEdgeLabels().get(this.schema.getName() + "." + edgeLabelName); if (edgeLabel != null) { return Optional.of(edgeLabel); } return Optional.empty(); }
java
public Optional<EdgeLabel> getOutEdgeLabel(String edgeLabelName) { EdgeLabel edgeLabel = getOutEdgeLabels().get(this.schema.getName() + "." + edgeLabelName); if (edgeLabel != null) { return Optional.of(edgeLabel); } return Optional.empty(); }
[ "public", "Optional", "<", "EdgeLabel", ">", "getOutEdgeLabel", "(", "String", "edgeLabelName", ")", "{", "EdgeLabel", "edgeLabel", "=", "getOutEdgeLabels", "(", ")", ".", "get", "(", "this", ".", "schema", ".", "getName", "(", ")", "+", "\".\"", "+", "edg...
Out EdgeLabels are always in the same schema as the this VertexLabel' schema. So the edgeLabelName must not contain the schema prefix @param edgeLabelName @return
[ "Out", "EdgeLabels", "are", "always", "in", "the", "same", "schema", "as", "the", "this", "VertexLabel", "schema", ".", "So", "the", "edgeLabelName", "must", "not", "contain", "the", "schema", "prefix" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L209-L215
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java
VertexLabel.removeEdgeRole
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support...
java
void removeEdgeRole(EdgeRole er, boolean preserveData) { if (er.getVertexLabel() != this) { throw new IllegalStateException("Trying to remove a EdgeRole from a non owner VertexLabel"); } Collection<VertexLabel> ers; switch (er.getDirection()) { // we don't support...
[ "void", "removeEdgeRole", "(", "EdgeRole", "er", ",", "boolean", "preserveData", ")", "{", "if", "(", "er", ".", "getVertexLabel", "(", ")", "!=", "this", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Trying to remove a EdgeRole from a non owner VertexL...
remove a given edge role @param er the edge role @param preserveData should we keep the SQL data
[ "remove", "a", "given", "edge", "role" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/VertexLabel.java#L1061-L1103
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/dialect/BaseSqlDialect.java
BaseSqlDialect.escapeQuotes
protected String escapeQuotes(Object o) { if (o != null) { return o.toString().replace("'", "''"); } return null; }
java
protected String escapeQuotes(Object o) { if (o != null) { return o.toString().replace("'", "''"); } return null; }
[ "protected", "String", "escapeQuotes", "(", "Object", "o", ")", "{", "if", "(", "o", "!=", "null", ")", "{", "return", "o", ".", "toString", "(", ")", ".", "replace", "(", "\"'\"", ",", "\"''\"", ")", ";", "}", "return", "null", ";", "}" ]
escape quotes by doubling them when we need a string inside quotes @param o @return
[ "escape", "quotes", "by", "doubling", "them", "when", "we", "need", "a", "string", "inside", "quotes" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/dialect/BaseSqlDialect.java#L1197-L1202
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.delete
void delete() { String schema = getSchema().getName(); String tableName = EDGE_PREFIX + getLabel(); SqlDialect sqlDialect = this.sqlgGraph.getSqlDialect(); sqlDialect.assertTableName(tableName); StringBuilder sql = new StringBuilder("DROP TABLE IF EXISTS "); sql.append(s...
java
void delete() { String schema = getSchema().getName(); String tableName = EDGE_PREFIX + getLabel(); SqlDialect sqlDialect = this.sqlgGraph.getSqlDialect(); sqlDialect.assertTableName(tableName); StringBuilder sql = new StringBuilder("DROP TABLE IF EXISTS "); sql.append(s...
[ "void", "delete", "(", ")", "{", "String", "schema", "=", "getSchema", "(", ")", ".", "getName", "(", ")", ";", "String", "tableName", "=", "EDGE_PREFIX", "+", "getLabel", "(", ")", ";", "SqlDialect", "sqlDialect", "=", "this", ".", "sqlgGraph", ".", "...
delete the table
[ "delete", "the", "table" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1190-L1215
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeOutVertexLabel
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
java
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedOutVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); } }
[ "void", "removeOutVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedOutVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", ...
remove a vertex label from the out collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "out", "collection" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1232-L1237
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java
EdgeLabel.removeInVertexLabel
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
java
void removeInVertexLabel(VertexLabel lbl, boolean preserveData) { this.uncommittedRemovedInVertexLabels.add(lbl); if (!preserveData) { deleteColumn(lbl.getFullName() + Topology.IN_VERTEX_COLUMN_END); } }
[ "void", "removeInVertexLabel", "(", "VertexLabel", "lbl", ",", "boolean", "preserveData", ")", "{", "this", ".", "uncommittedRemovedInVertexLabels", ".", "add", "(", "lbl", ")", ";", "if", "(", "!", "preserveData", ")", "{", "deleteColumn", "(", "lbl", ".", ...
remove a vertex label from the in collection @param lbl the vertex label @param preserveData should we keep the sql data?
[ "remove", "a", "vertex", "label", "from", "the", "in", "collection" ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/EdgeLabel.java#L1245-L1250
train
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/strategy/VertexStrategy.java
VertexStrategy.doFirst
@SuppressWarnings("unchecked") @Override protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) { if (step instanceof SelectOneStep) { if (stepIterator.hasNext()) { stepIterator.next(); return true; ...
java
@SuppressWarnings("unchecked") @Override protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) { if (step instanceof SelectOneStep) { if (stepIterator.hasNext()) { stepIterator.next(); return true; ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "protected", "boolean", "doFirst", "(", "ListIterator", "<", "Step", "<", "?", ",", "?", ">", ">", "stepIterator", ",", "Step", "<", "?", ",", "?", ">", "step", ",", "MutableInt", "path...
EdgeOtherVertexStep can not be optimized as the direction information is lost. @param stepIterator The steps to iterate. Unused for the VertexStrategy @param step The current step. @param pathCount The path count. @return true if the optimization can continue else false.
[ "EdgeOtherVertexStep", "can", "not", "be", "optimized", "as", "the", "direction", "information", "is", "lost", "." ]
c1845a1b31328a5ffda646873b0369ee72af56a7
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/strategy/VertexStrategy.java#L92-L122
train
adminfaces/admin-persistence
src/main/java/com/github/adminfaces/persistence/service/CrudService.java
CrudService.count
public Long count(Criteria<T, T> criteria) { SingularAttribute<? super T, PK> id = getEntityManager().getMetamodel().entity(entityClass).getId(entityKey); return criteria.select(Long.class, countDistinct(id)) .getSingleResult(); }
java
public Long count(Criteria<T, T> criteria) { SingularAttribute<? super T, PK> id = getEntityManager().getMetamodel().entity(entityClass).getId(entityKey); return criteria.select(Long.class, countDistinct(id)) .getSingleResult(); }
[ "public", "Long", "count", "(", "Criteria", "<", "T", ",", "T", ">", "criteria", ")", "{", "SingularAttribute", "<", "?", "super", "T", ",", "PK", ">", "id", "=", "getEntityManager", "(", ")", ".", "getMetamodel", "(", ")", ".", "entity", "(", "entit...
Count using a pre populated criteria @param criteria @return
[ "Count", "using", "a", "pre", "populated", "criteria" ]
fe065eed73781d01f14a4eb11910acc6a4150b9e
https://github.com/adminfaces/admin-persistence/blob/fe065eed73781d01f14a4eb11910acc6a4150b9e/src/main/java/com/github/adminfaces/persistence/service/CrudService.java#L192-L196
train
adminfaces/admin-persistence
src/main/java/com/github/adminfaces/persistence/bean/CrudMB.java
CrudMB.init
public void init() { if (FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest()) { return; } if (id != null && !"".equals(id)) { entity = crudService.findById(id); if (entity == null) { log.info(String.format("Entity not fou...
java
public void init() { if (FacesContext.getCurrentInstance().getPartialViewContext().isAjaxRequest()) { return; } if (id != null && !"".equals(id)) { entity = crudService.findById(id); if (entity == null) { log.info(String.format("Entity not fou...
[ "public", "void", "init", "(", ")", "{", "if", "(", "FacesContext", ".", "getCurrentInstance", "(", ")", ".", "getPartialViewContext", "(", ")", ".", "isAjaxRequest", "(", ")", ")", "{", "return", ";", "}", "if", "(", "id", "!=", "null", "&&", "!", "...
called via preRenderView or viewAction
[ "called", "via", "preRenderView", "or", "viewAction" ]
fe065eed73781d01f14a4eb11910acc6a4150b9e
https://github.com/adminfaces/admin-persistence/blob/fe065eed73781d01f14a4eb11910acc6a4150b9e/src/main/java/com/github/adminfaces/persistence/bean/CrudMB.java#L86-L99
train
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/paramhelper/ListSerializer.java
ListSerializer.handle
@Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); ...
java
@Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); ...
[ "@", "Override", "public", "String", "handle", "(", "final", "Object", "value", ")", "{", "final", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "value", "instanceof", "List", ")", "{", "final", "List", "<", "?", ">", "l"...
Converts the list to a comma separated representation. @return a comma separated list of values @see fr.dudie.nominatim.client.request.paramhelper.QueryParameterSerializer#handle(java.lang.Object)
[ "Converts", "the", "list", "to", "a", "comma", "separated", "representation", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/paramhelper/ListSerializer.java#L40-L55
train
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/NominatimOptions.java
NominatimOptions.mergeTo
void mergeTo(final NominatimSearchRequest request) { if (null == request.getBounded() && null != bounded) { request.setBounded(bounded); } if (null == request.getViewBox()) { request.setViewBox(viewBox); } if (null == request.getPolygonFormat()) { ...
java
void mergeTo(final NominatimSearchRequest request) { if (null == request.getBounded() && null != bounded) { request.setBounded(bounded); } if (null == request.getViewBox()) { request.setViewBox(viewBox); } if (null == request.getPolygonFormat()) { ...
[ "void", "mergeTo", "(", "final", "NominatimSearchRequest", "request", ")", "{", "if", "(", "null", "==", "request", ".", "getBounded", "(", ")", "&&", "null", "!=", "bounded", ")", "{", "request", ".", "setBounded", "(", "bounded", ")", ";", "}", "if", ...
Merge this default options to the given request. @param request the request where the result is merged
[ "Merge", "this", "default", "options", "to", "the", "given", "request", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/NominatimOptions.java#L132-L145
train
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java
QueryParameterAnnotationHandler.getValue
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final Illegal...
java
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final Illegal...
[ "private", "static", "Object", "getValue", "(", "final", "Object", "o", ",", "final", "Field", "f", ")", "{", "try", "{", "f", ".", "setAccessible", "(", "true", ")", ";", "return", "f", ".", "get", "(", "o", ")", ";", "}", "catch", "(", "final", ...
Gets a field value regardless of reflection errors. @param o the object instance @param f the field @return the field value or null if a reflection error occurred
[ "Gets", "a", "field", "value", "regardless", "of", "reflection", "errors", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java#L149-L159
train
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java
NominatimSearchRequest.addExcludedlaceId
public void addExcludedlaceId(final String placeId) { if (null == this.countryCodes) { this.excludePlaceIds = new ArrayList<String>(); } this.excludePlaceIds.add(placeId); }
java
public void addExcludedlaceId(final String placeId) { if (null == this.countryCodes) { this.excludePlaceIds = new ArrayList<String>(); } this.excludePlaceIds.add(placeId); }
[ "public", "void", "addExcludedlaceId", "(", "final", "String", "placeId", ")", "{", "if", "(", "null", "==", "this", ".", "countryCodes", ")", "{", "this", ".", "excludePlaceIds", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "}", "this", ...
If you do not want certain openstreetmap objects to appear in the search result, give a list of the place_id's you want to skip. @param placeId the place id to exclude
[ "If", "you", "do", "not", "want", "certain", "openstreetmap", "objects", "to", "appear", "in", "the", "search", "result", "give", "a", "list", "of", "the", "place_id", "s", "you", "want", "to", "skip", "." ]
faf3ff1003a9989eb5cc48f449b3a22c567843bf
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/NominatimSearchRequest.java#L329-L334
train
hammock-project/hammock
core/src/main/java/ws/ament/hammock/core/config/CLIPropertySource.java
CLIPropertySource.parseMainArgs
public static ConfigSource parseMainArgs(String...args) { Map<String, String> result; if (args == null) { result = Collections.emptyMap(); } else { result = new HashMap<>(); String prefix = System.getProperty("main.args.prefix",""); String key = nu...
java
public static ConfigSource parseMainArgs(String...args) { Map<String, String> result; if (args == null) { result = Collections.emptyMap(); } else { result = new HashMap<>(); String prefix = System.getProperty("main.args.prefix",""); String key = nu...
[ "public", "static", "ConfigSource", "parseMainArgs", "(", "String", "...", "args", ")", "{", "Map", "<", "String", ",", "String", ">", "result", ";", "if", "(", "args", "==", "null", ")", "{", "result", "=", "Collections", ".", "emptyMap", "(", ")", ";...
Configure the main arguments, herby parsing and mapping the main arguments into configuration properties. @return the parsed main arguments as key/value pairs.
[ "Configure", "the", "main", "arguments", "herby", "parsing", "and", "mapping", "the", "main", "arguments", "into", "configuration", "properties", "." ]
0bed53f5ded295f020d74861645954abfbd69a4b
https://github.com/hammock-project/hammock/blob/0bed53f5ded295f020d74861645954abfbd69a4b/core/src/main/java/ws/ament/hammock/core/config/CLIPropertySource.java#L49-L81
train
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.addPath
private List<String> addPath(List<String> filenames, String additionalPath) { ArrayList<String> newFilenames = new ArrayList<String>(filenames.size()); for (String filename : filenames) { newFilenames.add(additionalPath + '/' + filename); } return newFilenames; }
java
private List<String> addPath(List<String> filenames, String additionalPath) { ArrayList<String> newFilenames = new ArrayList<String>(filenames.size()); for (String filename : filenames) { newFilenames.add(additionalPath + '/' + filename); } return newFilenames; }
[ "private", "List", "<", "String", ">", "addPath", "(", "List", "<", "String", ">", "filenames", ",", "String", "additionalPath", ")", "{", "ArrayList", "<", "String", ">", "newFilenames", "=", "new", "ArrayList", "<", "String", ">", "(", "filenames", ".", ...
Modifies a String list of filenames to include an additional path. @param filenames @param additionalPath @return
[ "Modifies", "a", "String", "list", "of", "filenames", "to", "include", "an", "additional", "path", "." ]
4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L576-L583
train
federkasten/appbundle-maven-plugin
src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java
CreateApplicationBundleMojo.scanFileSet
private List<String> scanFileSet(File sourceDirectory, FileSet fileSet) { final String[] emptyStringArray = {}; DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(sourceDirectory); if (fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty()) { s...
java
private List<String> scanFileSet(File sourceDirectory, FileSet fileSet) { final String[] emptyStringArray = {}; DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir(sourceDirectory); if (fileSet.getIncludes() != null && !fileSet.getIncludes().isEmpty()) { s...
[ "private", "List", "<", "String", ">", "scanFileSet", "(", "File", "sourceDirectory", ",", "FileSet", "fileSet", ")", "{", "final", "String", "[", "]", "emptyStringArray", "=", "{", "}", ";", "DirectoryScanner", "scanner", "=", "new", "DirectoryScanner", "(", ...
Scan a fileset and get a list of files which it contains. @param fileset @return list of files contained within a fileset. @throws FileNotFoundException
[ "Scan", "a", "fileset", "and", "get", "a", "list", "of", "files", "which", "it", "contains", "." ]
4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f
https://github.com/federkasten/appbundle-maven-plugin/blob/4cdaf7e0da95c83bc8a045ba40cb3eef45d25a5f/src/main/java/sh/tak/appbundler/CreateApplicationBundleMojo.java#L709-L732
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.open
public CompletableFuture<Void> open() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> register(new RegisterAttempt(1, future))); return future; }
java
public CompletableFuture<Void> open() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> register(new RegisterAttempt(1, future))); return future; }
[ "public", "CompletableFuture", "<", "Void", ">", "open", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "context", ".", "executor", "(", ")", ".", "execute", "(", "(", ")", "->", "r...
Opens the session manager. @return A completable future to be called once the session manager is opened.
[ "Opens", "the", "session", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L59-L63
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.expire
public CompletableFuture<Void> expire() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.EXPIRED); future.complete(null); }); return future; }
java
public CompletableFuture<Void> expire() { CompletableFuture<Void> future = new CompletableFuture<>(); context.executor().execute(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.EXPIRED); future.complete(null); }); return future; }
[ "public", "CompletableFuture", "<", "Void", ">", "expire", "(", ")", "{", "CompletableFuture", "<", "Void", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "context", ".", "executor", "(", ")", ".", "execute", "(", "(", ")", "->", ...
Expires the manager. @return A completable future to be completed once the session has been expired.
[ "Expires", "the", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L70-L79
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.unregister
private void unregister(boolean retryOnFailure, CompletableFuture<Void> future) { long sessionId = state.getSessionId(); // If the session is already closed, skip the unregister attempt. if (state.getState() == Session.State.CLOSED) { future.complete(null); return; } state.getLogger()....
java
private void unregister(boolean retryOnFailure, CompletableFuture<Void> future) { long sessionId = state.getSessionId(); // If the session is already closed, skip the unregister attempt. if (state.getState() == Session.State.CLOSED) { future.complete(null); return; } state.getLogger()....
[ "private", "void", "unregister", "(", "boolean", "retryOnFailure", ",", "CompletableFuture", "<", "Void", ">", "future", ")", "{", "long", "sessionId", "=", "state", ".", "getSessionId", "(", ")", ";", "// If the session is already closed, skip the unregister attempt.",...
Unregisters the session. @param future A completable future to be completed once the session is unregistered.
[ "Unregisters", "the", "session", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L224-L290
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java
ClientSessionManager.kill
public CompletableFuture<Void> kill() { return CompletableFuture.runAsync(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.CLOSED); }, context.executor()); }
java
public CompletableFuture<Void> kill() { return CompletableFuture.runAsync(() -> { if (keepAlive != null) keepAlive.cancel(); state.setState(Session.State.CLOSED); }, context.executor()); }
[ "public", "CompletableFuture", "<", "Void", ">", "kill", "(", ")", "{", "return", "CompletableFuture", ".", "runAsync", "(", "(", ")", "->", "{", "if", "(", "keepAlive", "!=", "null", ")", "keepAlive", ".", "cancel", "(", ")", ";", "state", ".", "setSt...
Kills the client session manager. @return A completable future to be completed once the session manager is killed.
[ "Kills", "the", "client", "session", "manager", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/session/ClientSessionManager.java#L297-L303
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.handleAppend
protected AppendResponse handleAppend(AppendRequest request) { // If the request term is less than the current term then immediately // reply false and return our current term. The leader will receive // the updated term and step down. if (request.term() < context.getTerm()) { LOGGER.debug("{} - R...
java
protected AppendResponse handleAppend(AppendRequest request) { // If the request term is less than the current term then immediately // reply false and return our current term. The leader will receive // the updated term and step down. if (request.term() < context.getTerm()) { LOGGER.debug("{} - R...
[ "protected", "AppendResponse", "handleAppend", "(", "AppendRequest", "request", ")", "{", "// If the request term is less than the current term then immediately", "// reply false and return our current term. The leader will receive", "// the updated term and step down.", "if", "(", "reques...
Handles an append request.
[ "Handles", "an", "append", "request", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L120-L135
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.checkGlobalIndex
protected AppendResponse checkGlobalIndex(AppendRequest request) { // If the globalIndex has changed and is not present in the local log, truncate the log. // This ensures that if major compaction progressed on any server beyond the entries in this // server's log that this server receives all entries after...
java
protected AppendResponse checkGlobalIndex(AppendRequest request) { // If the globalIndex has changed and is not present in the local log, truncate the log. // This ensures that if major compaction progressed on any server beyond the entries in this // server's log that this server receives all entries after...
[ "protected", "AppendResponse", "checkGlobalIndex", "(", "AppendRequest", "request", ")", "{", "// If the globalIndex has changed and is not present in the local log, truncate the log.", "// This ensures that if major compaction progressed on any server beyond the entries in this", "// server's l...
Checks whether the log needs to be truncated based on the globalIndex.
[ "Checks", "whether", "the", "log", "needs", "to", "be", "truncated", "based", "on", "the", "globalIndex", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L140-L161
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.checkPreviousEntry
protected AppendResponse checkPreviousEntry(AppendRequest request) { if (request.logIndex() != 0 && context.getLog().isEmpty()) { LOGGER.debug("{} - Rejected {}: Previous index ({}) is greater than the local log's last index ({})", context.getCluster().member().address(), request, request.logIndex(), context....
java
protected AppendResponse checkPreviousEntry(AppendRequest request) { if (request.logIndex() != 0 && context.getLog().isEmpty()) { LOGGER.debug("{} - Rejected {}: Previous index ({}) is greater than the local log's last index ({})", context.getCluster().member().address(), request, request.logIndex(), context....
[ "protected", "AppendResponse", "checkPreviousEntry", "(", "AppendRequest", "request", ")", "{", "if", "(", "request", ".", "logIndex", "(", ")", "!=", "0", "&&", "context", ".", "getLog", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "LOGGER", ".", "debu...
Checks the previous entry in the append request for consistency.
[ "Checks", "the", "previous", "entry", "in", "the", "append", "request", "for", "consistency", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L166-L185
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.appendEntries
protected AppendResponse appendEntries(AppendRequest request) { // Get the last entry index or default to the request log index. long lastEntryIndex = request.logIndex(); if (!request.entries().isEmpty()) { lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex(); } // ...
java
protected AppendResponse appendEntries(AppendRequest request) { // Get the last entry index or default to the request log index. long lastEntryIndex = request.logIndex(); if (!request.entries().isEmpty()) { lastEntryIndex = request.entries().get(request.entries().size() - 1).getIndex(); } // ...
[ "protected", "AppendResponse", "appendEntries", "(", "AppendRequest", "request", ")", "{", "// Get the last entry index or default to the request log index.", "long", "lastEntryIndex", "=", "request", ".", "logIndex", "(", ")", ";", "if", "(", "!", "request", ".", "entr...
Appends entries to the local log.
[ "Appends", "entries", "to", "the", "local", "log", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L190-L228
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/PassiveState.java
PassiveState.queryLocal
protected CompletableFuture<QueryResponse> queryLocal(QueryEntry entry) { CompletableFuture<QueryResponse> future = new CompletableFuture<>(); sequenceQuery(entry, future); return future; }
java
protected CompletableFuture<QueryResponse> queryLocal(QueryEntry entry) { CompletableFuture<QueryResponse> future = new CompletableFuture<>(); sequenceQuery(entry, future); return future; }
[ "protected", "CompletableFuture", "<", "QueryResponse", ">", "queryLocal", "(", "QueryEntry", "entry", ")", "{", "CompletableFuture", "<", "QueryResponse", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "sequenceQuery", "(", "entry", ",", "...
Performs a local query.
[ "Performs", "a", "local", "query", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/PassiveState.java#L290-L294
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ServerCommitPool.java
ServerCommitPool.acquire
public ServerCommit acquire(OperationEntry entry, ServerSessionContext session, long timestamp) { ServerCommit commit = pool.poll(); if (commit == null) { commit = new ServerCommit(this, log); } commit.reset(entry, session, timestamp); return commit; }
java
public ServerCommit acquire(OperationEntry entry, ServerSessionContext session, long timestamp) { ServerCommit commit = pool.poll(); if (commit == null) { commit = new ServerCommit(this, log); } commit.reset(entry, session, timestamp); return commit; }
[ "public", "ServerCommit", "acquire", "(", "OperationEntry", "entry", ",", "ServerSessionContext", "session", ",", "long", "timestamp", ")", "{", "ServerCommit", "commit", "=", "pool", ".", "poll", "(", ")", ";", "if", "(", "commit", "==", "null", ")", "{", ...
Acquires a commit from the pool. @param entry The entry for which to acquire the commit. @return The commit to acquire.
[ "Acquires", "a", "commit", "from", "the", "pool", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ServerCommitPool.java#L49-L56
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.getReserveMemberStates
List<MemberState> getReserveMemberStates(Comparator<MemberState> comparator) { List<MemberState> reserveMembers = new ArrayList<>(getReserveMemberStates()); Collections.sort(reserveMembers, comparator); return reserveMembers; }
java
List<MemberState> getReserveMemberStates(Comparator<MemberState> comparator) { List<MemberState> reserveMembers = new ArrayList<>(getReserveMemberStates()); Collections.sort(reserveMembers, comparator); return reserveMembers; }
[ "List", "<", "MemberState", ">", "getReserveMemberStates", "(", "Comparator", "<", "MemberState", ">", "comparator", ")", "{", "List", "<", "MemberState", ">", "reserveMembers", "=", "new", "ArrayList", "<>", "(", "getReserveMemberStates", "(", ")", ")", ";", ...
Returns a list of reserve members. @param comparator A comparator with which to sort the members list. @return The sorted members list.
[ "Returns", "a", "list", "of", "reserve", "members", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L281-L285
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.identify
CompletableFuture<Void> identify() { Member leader = context.getLeader(); if (joinFuture != null && leader != null) { if (context.getLeader().equals(member())) { if (context.getState() == CopycatServer.State.LEADER && !((LeaderState) context.getServerState()).configuring()) { if (joinFut...
java
CompletableFuture<Void> identify() { Member leader = context.getLeader(); if (joinFuture != null && leader != null) { if (context.getLeader().equals(member())) { if (context.getState() == CopycatServer.State.LEADER && !((LeaderState) context.getServerState()).configuring()) { if (joinFut...
[ "CompletableFuture", "<", "Void", ">", "identify", "(", ")", "{", "Member", "leader", "=", "context", ".", "getLeader", "(", ")", ";", "if", "(", "joinFuture", "!=", "null", "&&", "leader", "!=", "null", ")", "{", "if", "(", "context", ".", "getLeader"...
Identifies this server to the leader.
[ "Identifies", "this", "server", "to", "the", "leader", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L436-L480
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.cancelJoinTimer
private void cancelJoinTimer() { if (joinTimeout != null) { LOGGER.trace("{} - Cancelling join timeout", member().address()); joinTimeout.cancel(); joinTimeout = null; } }
java
private void cancelJoinTimer() { if (joinTimeout != null) { LOGGER.trace("{} - Cancelling join timeout", member().address()); joinTimeout.cancel(); joinTimeout = null; } }
[ "private", "void", "cancelJoinTimer", "(", ")", "{", "if", "(", "joinTimeout", "!=", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"{} - Cancelling join timeout\"", ",", "member", "(", ")", ".", "address", "(", ")", ")", ";", "joinTimeout", ".", "cancel...
Cancels the join timeout.
[ "Cancels", "the", "join", "timeout", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L495-L501
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.cancelLeaveTimer
private void cancelLeaveTimer() { if (leaveTimeout != null) { LOGGER.trace("{} - Cancelling leave timeout", member().address()); leaveTimeout.cancel(); leaveTimeout = null; } }
java
private void cancelLeaveTimer() { if (leaveTimeout != null) { LOGGER.trace("{} - Cancelling leave timeout", member().address()); leaveTimeout.cancel(); leaveTimeout = null; } }
[ "private", "void", "cancelLeaveTimer", "(", ")", "{", "if", "(", "leaveTimeout", "!=", "null", ")", "{", "LOGGER", ".", "trace", "(", "\"{} - Cancelling leave timeout\"", ",", "member", "(", ")", ".", "address", "(", ")", ")", ";", "leaveTimeout", ".", "ca...
Cancels the leave timeout.
[ "Cancels", "the", "leave", "timeout", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L570-L576
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.reassign
private void reassign() { if (member.type() == Member.Type.ACTIVE && !member.equals(context.getLeader())) { // Calculate this server's index within the collection of active members, excluding the leader. // This is done in a deterministic way by sorting the list of active members by ID. int index ...
java
private void reassign() { if (member.type() == Member.Type.ACTIVE && !member.equals(context.getLeader())) { // Calculate this server's index within the collection of active members, excluding the leader. // This is done in a deterministic way by sorting the list of active members by ID. int index ...
[ "private", "void", "reassign", "(", ")", "{", "if", "(", "member", ".", "type", "(", ")", "==", "Member", ".", "Type", ".", "ACTIVE", "&&", "!", "member", ".", "equals", "(", "context", ".", "getLeader", "(", ")", ")", ")", "{", "// Calculate this se...
Rebuilds assigned member states.
[ "Rebuilds", "assigned", "member", "states", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L716-L737
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/state/ClusterState.java
ClusterState.assignMembers
private List<MemberState> assignMembers(int index, List<MemberState> sortedMembers) { List<MemberState> members = new ArrayList<>(sortedMembers.size()); for (int i = 0; i < sortedMembers.size(); i++) { if ((i + 1) % index == 0) { members.add(sortedMembers.get(i)); } } return members;...
java
private List<MemberState> assignMembers(int index, List<MemberState> sortedMembers) { List<MemberState> members = new ArrayList<>(sortedMembers.size()); for (int i = 0; i < sortedMembers.size(); i++) { if ((i + 1) % index == 0) { members.add(sortedMembers.get(i)); } } return members;...
[ "private", "List", "<", "MemberState", ">", "assignMembers", "(", "int", "index", ",", "List", "<", "MemberState", ">", "sortedMembers", ")", "{", "List", "<", "MemberState", ">", "members", "=", "new", "ArrayList", "<>", "(", "sortedMembers", ".", "size", ...
Assigns members using consistent hashing.
[ "Assigns", "members", "using", "consistent", "hashing", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/state/ClusterState.java#L742-L750
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.copyPredicates
private void copyPredicates() { predicates = new ArrayList<>(groups.size()); for (List<Segment> group : groups) { List<OffsetPredicate> groupPredicates = new ArrayList<>(group.size()); for (Segment segment : group) { groupPredicates.add(segment.offsetPredicate().copy()); } predic...
java
private void copyPredicates() { predicates = new ArrayList<>(groups.size()); for (List<Segment> group : groups) { List<OffsetPredicate> groupPredicates = new ArrayList<>(group.size()); for (Segment segment : group) { groupPredicates.add(segment.offsetPredicate().copy()); } predic...
[ "private", "void", "copyPredicates", "(", ")", "{", "predicates", "=", "new", "ArrayList", "<>", "(", "groups", ".", "size", "(", ")", ")", ";", "for", "(", "List", "<", "Segment", ">", "group", ":", "groups", ")", "{", "List", "<", "OffsetPredicate", ...
Creates a copy of offset predicates prior to compacting segments to prevent race conditions.
[ "Creates", "a", "copy", "of", "offset", "predicates", "prior", "to", "compacting", "segments", "to", "prevent", "race", "conditions", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L119-L128
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactGroup
private Segment compactGroup(List<Segment> segments, List<OffsetPredicate> predicates) { // Get the first segment which contains the first index being compacted. The compact segment will be written // as a newer version of the earliest segment being rewritten. Segment firstSegment = segments.iterator().next...
java
private Segment compactGroup(List<Segment> segments, List<OffsetPredicate> predicates) { // Get the first segment which contains the first index being compacted. The compact segment will be written // as a newer version of the earliest segment being rewritten. Segment firstSegment = segments.iterator().next...
[ "private", "Segment", "compactGroup", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ")", "{", "// Get the first segment which contains the first index being compacted. The compact segment will be written", "// as a newer ver...
Compacts a group.
[ "Compacts", "a", "group", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L146-L166
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactGroup
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compac...
java
private void compactGroup(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { // Iterate through all segments being compacted and write entries to a single compact segment. for (int i = 0; i < segments.size(); i++) { compactSegment(segments.get(i), predicates.get(i), compac...
[ "private", "void", "compactGroup", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "// Iterate through all segments being compacted and write entries to a single compact segment....
Compacts segments in a group sequentially. @param segments The segments to compact. @param compactSegment The compact segment.
[ "Compacts", "segments", "in", "a", "group", "sequentially", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L174-L179
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactSegment
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
java
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
[ "private", "void", "compactSegment", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "lastIndex"...
Compacts the given segment. @param segment The segment to compact. @param compactSegment The segment to which to write the compacted segment.
[ "Compacts", "the", "given", "segment", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L187-L191
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactEntry
private void compactEntry(long index, Segment segment, Segment compactSegment) { compactSegment.skip(1); LOGGER.trace("Compacted entry {} from segment {}", index, segment.descriptor().id()); }
java
private void compactEntry(long index, Segment segment, Segment compactSegment) { compactSegment.skip(1); LOGGER.trace("Compacted entry {} from segment {}", index, segment.descriptor().id()); }
[ "private", "void", "compactEntry", "(", "long", "index", ",", "Segment", "segment", ",", "Segment", "compactSegment", ")", "{", "compactSegment", ".", "skip", "(", "1", ")", ";", "LOGGER", ".", "trace", "(", "\"Compacted entry {} from segment {}\"", ",", "index"...
Compacts an entry from the given segment.
[ "Compacts", "an", "entry", "from", "the", "given", "segment", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L274-L277
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.isLive
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
java
private boolean isLive(long index, Segment segment, OffsetPredicate predicate) { long offset = segment.offset(index); return offset != -1 && predicate.test(offset); }
[ "private", "boolean", "isLive", "(", "long", "index", ",", "Segment", "segment", ",", "OffsetPredicate", "predicate", ")", "{", "long", "offset", "=", "segment", ".", "offset", "(", "index", ")", ";", "return", "offset", "!=", "-", "1", "&&", "predicate", ...
Returns a boolean value indicating whether the given index is release.
[ "Returns", "a", "boolean", "value", "indicating", "whether", "the", "given", "index", "is", "release", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L289-L292
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.mergeReleased
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
java
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
[ "private", "void", "mergeReleased", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "segments", ".", "size"...
Updates the new compact segment with entries that were released during compaction.
[ "Updates", "the", "new", "compact", "segment", "with", "entries", "that", "were", "released", "during", "compaction", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L297-L301
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.mergeReleasedEntries
private void mergeReleasedEntries(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { long offset = segment.offset(i); if (offset != -1 && !predicate.test(offset)) { compactSegment.release(i); } } ...
java
private void mergeReleasedEntries(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { long offset = segment.offset(i); if (offset != -1 && !predicate.test(offset)) { compactSegment.release(i); } } ...
[ "private", "void", "mergeReleasedEntries", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "last...
Updates the new compact segment with entries that were released in the given segment during compaction.
[ "Updates", "the", "new", "compact", "segment", "with", "entries", "that", "were", "released", "in", "the", "given", "segment", "during", "compaction", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L306-L313
train
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.deleteGroup
private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); oldSegment.delete(); } }
java
private void deleteGroup(List<Segment> group) { // Delete the old segments. for (Segment oldSegment : group) { oldSegment.close(); oldSegment.delete(); } }
[ "private", "void", "deleteGroup", "(", "List", "<", "Segment", ">", "group", ")", "{", "// Delete the old segments.", "for", "(", "Segment", "oldSegment", ":", "group", ")", "{", "oldSegment", ".", "close", "(", ")", ";", "oldSegment", ".", "delete", "(", ...
Completes compaction by deleting old segments.
[ "Completes", "compaction", "by", "deleting", "old", "segments", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L318-L324
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.reset
public ClientConnection reset(Address leader, Collection<Address> servers) { selector.reset(leader, servers); return this; }
java
public ClientConnection reset(Address leader, Collection<Address> servers) { selector.reset(leader, servers); return this; }
[ "public", "ClientConnection", "reset", "(", "Address", "leader", ",", "Collection", "<", "Address", ">", "servers", ")", "{", "selector", ".", "reset", "(", "leader", ",", "servers", ")", ";", "return", "this", ";", "}" ]
Resets the client connection. @param leader The current cluster leader. @param servers The current servers. @return The client connection.
[ "Resets", "the", "client", "connection", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L99-L102
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.sendRequest
private <T extends Request, U> void sendRequest(T request, BiFunction<Request, Connection, CompletableFuture<U>> sender, Connection connection, Throwable error, CompletableFuture<U> future) { if (open) { if (error == null) { if (connection != null) { LOGGER.trace("{} - Sending {}", id, reque...
java
private <T extends Request, U> void sendRequest(T request, BiFunction<Request, Connection, CompletableFuture<U>> sender, Connection connection, Throwable error, CompletableFuture<U> future) { if (open) { if (error == null) { if (connection != null) { LOGGER.trace("{} - Sending {}", id, reque...
[ "private", "<", "T", "extends", "Request", ",", "U", ">", "void", "sendRequest", "(", "T", "request", ",", "BiFunction", "<", "Request", ",", "Connection", ",", "CompletableFuture", "<", "U", ">", ">", "sender", ",", "Connection", "connection", ",", "Throw...
Sends the given request attempt to the cluster via the given connection if connected.
[ "Sends", "the", "given", "request", "attempt", "to", "the", "cluster", "via", "the", "given", "connection", "if", "connected", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L130-L150
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.connect
private void connect(CompletableFuture<Connection> future) { if (!selector.hasNext()) { LOGGER.debug("{} - Failed to connect to the cluster", id); future.complete(null); } else { Address address = selector.next(); LOGGER.debug("{} - Connecting to {}", id, address); client.connect(a...
java
private void connect(CompletableFuture<Connection> future) { if (!selector.hasNext()) { LOGGER.debug("{} - Failed to connect to the cluster", id); future.complete(null); } else { Address address = selector.next(); LOGGER.debug("{} - Connecting to {}", id, address); client.connect(a...
[ "private", "void", "connect", "(", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "!", "selector", ".", "hasNext", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"{} - Failed to connect to the cluster\"", ",", "id", ")", ";",...
Attempts to connect to the cluster.
[ "Attempts", "to", "connect", "to", "the", "cluster", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L238-L247
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.handleConnection
private void handleConnection(Address address, Connection connection, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { setupConnection(address, connection, future); } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); co...
java
private void handleConnection(Address address, Connection connection, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { setupConnection(address, connection, future); } else { LOGGER.debug("{} - Failed to connect! Reason: {}", id, error); co...
[ "private", "void", "handleConnection", "(", "Address", "address", ",", "Connection", "connection", ",", "Throwable", "error", ",", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "open", ")", "{", "if", "(", "error", "==", "null",...
Handles a connection to a server.
[ "Handles", "a", "connection", "to", "a", "server", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L252-L261
train
atomix/copycat
client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java
ClientConnection.handleConnectResponse
private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // If the connection was successfully created, immediately send a keep-alive request //...
java
private void handleConnectResponse(ConnectResponse response, Throwable error, CompletableFuture<Connection> future) { if (open) { if (error == null) { LOGGER.trace("{} - Received {}", id, response); // If the connection was successfully created, immediately send a keep-alive request //...
[ "private", "void", "handleConnectResponse", "(", "ConnectResponse", "response", ",", "Throwable", "error", ",", "CompletableFuture", "<", "Connection", ">", "future", ")", "{", "if", "(", "open", ")", "{", "if", "(", "error", "==", "null", ")", "{", "LOGGER"...
Handles a connect response.
[ "Handles", "a", "connect", "response", "." ]
c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/client/src/main/java/io/atomix/copycat/client/util/ClientConnection.java#L302-L319
train