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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/ChatConfig.java | ChatConfig.buildComapiConfig | ComapiConfig buildComapiConfig() {
return new ComapiConfig()
.apiSpaceId(apiSpaceId)
.authenticator(authenticator)
.logConfig(logConfig)
.apiConfiguration(apiConfig)
.logSizeLimitKilobytes(logSizeLimit)
.pushMessageListener(pushMessageListener)
.fcmEnabled(fcmEnabled);
} | java | ComapiConfig buildComapiConfig() {
return new ComapiConfig()
.apiSpaceId(apiSpaceId)
.authenticator(authenticator)
.logConfig(logConfig)
.apiConfiguration(apiConfig)
.logSizeLimitKilobytes(logSizeLimit)
.pushMessageListener(pushMessageListener)
.fcmEnabled(fcmEnabled);
} | [
"ComapiConfig",
"buildComapiConfig",
"(",
")",
"{",
"return",
"new",
"ComapiConfig",
"(",
")",
".",
"apiSpaceId",
"(",
"apiSpaceId",
")",
".",
"authenticator",
"(",
"authenticator",
")",
".",
"logConfig",
"(",
"logConfig",
")",
".",
"apiConfiguration",
"(",
"a... | Build config for foundation SDK initialisation.
@return Build config for foundation SDK initialisation. | [
"Build",
"config",
"for",
"foundation",
"SDK",
"initialisation",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatConfig.java#L220-L229 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.matchLength | int matchLength(List<CharRange> prefix)
{
DFAState<T> state = this;
int len = 0;
for (CharRange range : prefix)
{
state = state.transit(range);
if (state == null)
{
break;
}
len++;
}
return len;
} | java | int matchLength(List<CharRange> prefix)
{
DFAState<T> state = this;
int len = 0;
for (CharRange range : prefix)
{
state = state.transit(range);
if (state == null)
{
break;
}
len++;
}
return len;
} | [
"int",
"matchLength",
"(",
"List",
"<",
"CharRange",
">",
"prefix",
")",
"{",
"DFAState",
"<",
"T",
">",
"state",
"=",
"this",
";",
"int",
"len",
"=",
"0",
";",
"for",
"(",
"CharRange",
"range",
":",
"prefix",
")",
"{",
"state",
"=",
"state",
".",
... | Returns true if dfa starting from this state can accept a prefix constructed from
a list of ranges
@param prefix
@return | [
"Returns",
"true",
"if",
"dfa",
"starting",
"from",
"this",
"state",
"can",
"accept",
"a",
"prefix",
"constructed",
"from",
"a",
"list",
"of",
"ranges"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L171-L185 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.getTransitionSelectivity | public int getTransitionSelectivity()
{
int count = 0;
for (Transition<DFAState<T>> t : transitions.values())
{
CharRange range = t.getCondition();
count += range.getTo()-range.getFrom();
}
return count/transitions.size();
} | java | public int getTransitionSelectivity()
{
int count = 0;
for (Transition<DFAState<T>> t : transitions.values())
{
CharRange range = t.getCondition();
count += range.getTo()-range.getFrom();
}
return count/transitions.size();
} | [
"public",
"int",
"getTransitionSelectivity",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Transition",
"<",
"DFAState",
"<",
"T",
">",
">",
"t",
":",
"transitions",
".",
"values",
"(",
")",
")",
"{",
"CharRange",
"range",
"=",
"t",
".",... | Calculates a value of how selective transitions are from this state.
Returns 1 if all ranges accept exactly one character. Greater number
means less selectivity
@return | [
"Calculates",
"a",
"value",
"of",
"how",
"selective",
"transitions",
"are",
"from",
"this",
"state",
".",
"Returns",
"1",
"if",
"all",
"ranges",
"accept",
"exactly",
"one",
"character",
".",
"Greater",
"number",
"means",
"less",
"selectivity"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L192-L201 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.hasBoundaryMatches | public boolean hasBoundaryMatches()
{
for (Transition<DFAState<T>> t : transitions.values())
{
CharRange range = t.getCondition();
if (range.getFrom() < 0)
{
return true;
}
}
return false;
} | java | public boolean hasBoundaryMatches()
{
for (Transition<DFAState<T>> t : transitions.values())
{
CharRange range = t.getCondition();
if (range.getFrom() < 0)
{
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasBoundaryMatches",
"(",
")",
"{",
"for",
"(",
"Transition",
"<",
"DFAState",
"<",
"T",
">",
">",
"t",
":",
"transitions",
".",
"values",
"(",
")",
")",
"{",
"CharRange",
"range",
"=",
"t",
".",
"getCondition",
"(",
")",
";",
"... | Return true if one of transition ranges is a boundary match.
@return | [
"Return",
"true",
"if",
"one",
"of",
"transition",
"ranges",
"is",
"a",
"boundary",
"match",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L206-L217 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.optimizeTransitions | void optimizeTransitions()
{
HashMap<DFAState<T>,RangeSet> hml = new HashMap<>();
for (Transition<DFAState<T>> t : transitions.values())
{
RangeSet rs = hml.get(t.getTo());
if (rs == null)
{
rs = new RangeSet();
hml.put(t.getTo(), rs);
}
rs.add(t.getCondition());
}
transitions.clear();
for (DFAState<T> dfa : hml.keySet())
{
RangeSet rs = RangeSet.merge(hml.get(dfa));
for (CharRange r : rs)
{
addTransition(r, dfa);
}
}
} | java | void optimizeTransitions()
{
HashMap<DFAState<T>,RangeSet> hml = new HashMap<>();
for (Transition<DFAState<T>> t : transitions.values())
{
RangeSet rs = hml.get(t.getTo());
if (rs == null)
{
rs = new RangeSet();
hml.put(t.getTo(), rs);
}
rs.add(t.getCondition());
}
transitions.clear();
for (DFAState<T> dfa : hml.keySet())
{
RangeSet rs = RangeSet.merge(hml.get(dfa));
for (CharRange r : rs)
{
addTransition(r, dfa);
}
}
} | [
"void",
"optimizeTransitions",
"(",
")",
"{",
"HashMap",
"<",
"DFAState",
"<",
"T",
">",
",",
"RangeSet",
">",
"hml",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Transition",
"<",
"DFAState",
"<",
"T",
">",
">",
"t",
":",
"transitions",
... | Optimizes transition by merging ranges | [
"Optimizes",
"transition",
"by",
"merging",
"ranges"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L221-L243 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.possibleMoves | RangeSet possibleMoves()
{
List<RangeSet> list = new ArrayList<>();
for (NFAState<T> nfa : nfaSet)
{
list.add(nfa.getConditions());
}
return RangeSet.split(list);
} | java | RangeSet possibleMoves()
{
List<RangeSet> list = new ArrayList<>();
for (NFAState<T> nfa : nfaSet)
{
list.add(nfa.getConditions());
}
return RangeSet.split(list);
} | [
"RangeSet",
"possibleMoves",
"(",
")",
"{",
"List",
"<",
"RangeSet",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"NFAState",
"<",
"T",
">",
"nfa",
":",
"nfaSet",
")",
"{",
"list",
".",
"add",
"(",
"nfa",
".",
"getConditio... | Return a RangeSet containing all ranges
@return | [
"Return",
"a",
"RangeSet",
"containing",
"all",
"ranges"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L248-L256 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.removeDeadEndTransitions | void removeDeadEndTransitions()
{
Iterator<CharRange> it = transitions.keySet().iterator();
while (it.hasNext())
{
CharRange r = it.next();
if (transitions.get(r).getTo().isDeadEnd())
{
it.remove();
}
}
} | java | void removeDeadEndTransitions()
{
Iterator<CharRange> it = transitions.keySet().iterator();
while (it.hasNext())
{
CharRange r = it.next();
if (transitions.get(r).getTo().isDeadEnd())
{
it.remove();
}
}
} | [
"void",
"removeDeadEndTransitions",
"(",
")",
"{",
"Iterator",
"<",
"CharRange",
">",
"it",
"=",
"transitions",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"CharRange",
"r",
"=",
"i... | Removes transition to states that doesn't contain any outbound transition
and that are not accepting states | [
"Removes",
"transition",
"to",
"states",
"that",
"doesn",
"t",
"contain",
"any",
"outbound",
"transition",
"and",
"that",
"are",
"not",
"accepting",
"states"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L275-L286 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.isDeadEnd | boolean isDeadEnd()
{
if (isAccepting())
{
return false;
}
for (Transition<DFAState<T>> next : transitions.values())
{
if (next.getTo() != this)
{
return false;
}
}
return true;
} | java | boolean isDeadEnd()
{
if (isAccepting())
{
return false;
}
for (Transition<DFAState<T>> next : transitions.values())
{
if (next.getTo() != this)
{
return false;
}
}
return true;
} | [
"boolean",
"isDeadEnd",
"(",
")",
"{",
"if",
"(",
"isAccepting",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"Transition",
"<",
"DFAState",
"<",
"T",
">",
">",
"next",
":",
"transitions",
".",
"values",
"(",
")",
")",
"{",
"if",
... | Returns true if state doesn't contain any outbound transition
and is not accepting state
@return | [
"Returns",
"true",
"if",
"state",
"doesn",
"t",
"contain",
"any",
"outbound",
"transition",
"and",
"is",
"not",
"accepting",
"state"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L292-L306 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.nfaTransitsFor | Set<NFAState<T>> nfaTransitsFor(CharRange condition)
{
Set<NFAState<T>> nset = new NumSet<>();
for (NFAState<T> nfa : nfaSet)
{
nset.addAll(nfa.transit(condition));
}
return nset;
} | java | Set<NFAState<T>> nfaTransitsFor(CharRange condition)
{
Set<NFAState<T>> nset = new NumSet<>();
for (NFAState<T> nfa : nfaSet)
{
nset.addAll(nfa.transit(condition));
}
return nset;
} | [
"Set",
"<",
"NFAState",
"<",
"T",
">",
">",
"nfaTransitsFor",
"(",
"CharRange",
"condition",
")",
"{",
"Set",
"<",
"NFAState",
"<",
"T",
">>",
"nset",
"=",
"new",
"NumSet",
"<>",
"(",
")",
";",
"for",
"(",
"NFAState",
"<",
"T",
">",
"nfa",
":",
"... | Returns a set of nfA states to where it is possible to move by nfa transitions.
@param condition
@return | [
"Returns",
"a",
"set",
"of",
"nfA",
"states",
"to",
"where",
"it",
"is",
"possible",
"to",
"move",
"by",
"nfa",
"transitions",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L320-L328 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/grammar/state/DFAState.java | DFAState.addTransition | void addTransition(CharRange condition, DFAState<T> to)
{
Transition<DFAState<T>> t = new Transition<>(condition, this, to);
t = transitions.put(t.getCondition(), t);
assert t == null;
edges.add(to);
to.inStates.add(this);
} | java | void addTransition(CharRange condition, DFAState<T> to)
{
Transition<DFAState<T>> t = new Transition<>(condition, this, to);
t = transitions.put(t.getCondition(), t);
assert t == null;
edges.add(to);
to.inStates.add(this);
} | [
"void",
"addTransition",
"(",
"CharRange",
"condition",
",",
"DFAState",
"<",
"T",
">",
"to",
")",
"{",
"Transition",
"<",
"DFAState",
"<",
"T",
">>",
"t",
"=",
"new",
"Transition",
"<>",
"(",
"condition",
",",
"this",
",",
"to",
")",
";",
"t",
"=",
... | Adds a new transition
@param condition
@param to | [
"Adds",
"a",
"new",
"transition"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/state/DFAState.java#L369-L376 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/common/MsgPhrase.java | MsgPhrase.load | private void load()
throws EFapsException
{
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.MsgPhraseConfigAbstract);
queryBldr.addWhereAttrEqValue(CIAdminCommon.MsgPhraseConfigAbstract.AbstractLink, getId());
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminCommon.MsgPhraseConfigAbstract.CompanyLink,
CIAdminCommon.MsgPhraseConfigAbstract.LanguageLink,
CIAdminCommon.MsgPhraseConfigAbstract.Value,
CIAdminCommon.MsgPhraseConfigAbstract.Int1);
multi.executeWithoutAccessCheck();
while (multi.next()) {
AbstractConfig conf = null;
if (multi.getCurrentInstance().getType().isCIType(CIAdminCommon.MsgPhraseArgument)) {
conf = new Argument();
((Argument) conf).setIndex(multi.<Integer>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.Int1));
arguments.add((Argument) conf);
} else if (multi.getCurrentInstance().getType().isCIType(CIAdminCommon.MsgPhraseLabel)) {
conf = new Label();
labels.add((Label) conf);
}
if (conf == null) {
LOG.error("Wrong type: ", this);
} else {
conf.setCompanyId(multi.<Long>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.CompanyLink));
conf.setLanguageId(multi.<Long>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.LanguageLink));
conf.setValue(multi.<String>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.Value));
}
}
} | java | private void load()
throws EFapsException
{
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.MsgPhraseConfigAbstract);
queryBldr.addWhereAttrEqValue(CIAdminCommon.MsgPhraseConfigAbstract.AbstractLink, getId());
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminCommon.MsgPhraseConfigAbstract.CompanyLink,
CIAdminCommon.MsgPhraseConfigAbstract.LanguageLink,
CIAdminCommon.MsgPhraseConfigAbstract.Value,
CIAdminCommon.MsgPhraseConfigAbstract.Int1);
multi.executeWithoutAccessCheck();
while (multi.next()) {
AbstractConfig conf = null;
if (multi.getCurrentInstance().getType().isCIType(CIAdminCommon.MsgPhraseArgument)) {
conf = new Argument();
((Argument) conf).setIndex(multi.<Integer>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.Int1));
arguments.add((Argument) conf);
} else if (multi.getCurrentInstance().getType().isCIType(CIAdminCommon.MsgPhraseLabel)) {
conf = new Label();
labels.add((Label) conf);
}
if (conf == null) {
LOG.error("Wrong type: ", this);
} else {
conf.setCompanyId(multi.<Long>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.CompanyLink));
conf.setLanguageId(multi.<Long>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.LanguageLink));
conf.setValue(multi.<String>getAttribute(CIAdminCommon.MsgPhraseConfigAbstract.Value));
}
}
} | [
"private",
"void",
"load",
"(",
")",
"throws",
"EFapsException",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"CIAdminCommon",
".",
"MsgPhraseConfigAbstract",
")",
";",
"queryBldr",
".",
"addWhereAttrEqValue",
"(",
"CIAdminCommon",
"."... | load the phrase.
@throws EFapsException on error | [
"load",
"the",
"phrase",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/common/MsgPhrase.java#L177-L206 | train |
labai/ted | ted-driver/src/main/java/ted/driver/sys/BatchWaitManager.java | BatchWaitManager.processBatchWaitTasks | void processBatchWaitTasks() {
Channel channel = context.registry.getChannelOrSystem(Model.CHANNEL_BATCH); // channel TedBW or TedSS
int maxTask = context.taskManager.calcChannelBufferFree(channel);
Map<String, Integer> channelSizes = new HashMap<String, Integer>();
channelSizes.put(Model.CHANNEL_BATCH, maxTask);
List<TaskRec> batches = context.tedDao.reserveTaskPortion(channelSizes);
if (batches.isEmpty())
return;
for (final TaskRec batchTask : batches) {
channel.workers.execute(new TedRunnable(batchTask) {
@Override
public void run() {
processBatchWaitTask(batchTask);
}
});
}
} | java | void processBatchWaitTasks() {
Channel channel = context.registry.getChannelOrSystem(Model.CHANNEL_BATCH); // channel TedBW or TedSS
int maxTask = context.taskManager.calcChannelBufferFree(channel);
Map<String, Integer> channelSizes = new HashMap<String, Integer>();
channelSizes.put(Model.CHANNEL_BATCH, maxTask);
List<TaskRec> batches = context.tedDao.reserveTaskPortion(channelSizes);
if (batches.isEmpty())
return;
for (final TaskRec batchTask : batches) {
channel.workers.execute(new TedRunnable(batchTask) {
@Override
public void run() {
processBatchWaitTask(batchTask);
}
});
}
} | [
"void",
"processBatchWaitTasks",
"(",
")",
"{",
"Channel",
"channel",
"=",
"context",
".",
"registry",
".",
"getChannelOrSystem",
"(",
"Model",
".",
"CHANNEL_BATCH",
")",
";",
"// channel TedBW or TedSS",
"int",
"maxTask",
"=",
"context",
".",
"taskManager",
".",
... | if finished, then move this batchTask to his channel and then will be processed as regular task | [
"if",
"finished",
"then",
"move",
"this",
"batchTask",
"to",
"his",
"channel",
"and",
"then",
"will",
"be",
"processed",
"as",
"regular",
"task"
] | 2ee197246a78d842c18d6780c48fd903b00608a6 | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/BatchWaitManager.java#L40-L57 | train |
ggrandes/figaro | src/main/java/org/javastack/figaro/GossipMonger.java | GossipMonger.send | public boolean send(Whisper<?> whisper) {
if (isShutdown.get())
return false;
// Internal Queue (Local Thread) for INPLACE multiple recursive calls
final ArrayDeque<Whisper<?>> localQueue = ref.get();
if (!localQueue.isEmpty()) {
localQueue.addLast(whisper);
return true;
}
localQueue.addLast(whisper);
while ((whisper = localQueue.peekFirst()) != null) {
final Integer type = whisper.dest;
final Set<Talker> set = map.get(type);
if (set != null) {
for (final Talker talker : set) {
final TalkerContext ctx = talker.getState();
switch (ctx.type) {
case INPLACE_UNSYNC:
talker.newMessage(whisper);
break;
case INPLACE_SYNC:
synchronized (talker) {
talker.newMessage(whisper);
}
break;
case QUEUED_UNBOUNDED:
case QUEUED_BOUNDED:
while (!ctx.queueMessage(whisper))
;
break;
}
}
}
localQueue.pollFirst();
}
return true;
} | java | public boolean send(Whisper<?> whisper) {
if (isShutdown.get())
return false;
// Internal Queue (Local Thread) for INPLACE multiple recursive calls
final ArrayDeque<Whisper<?>> localQueue = ref.get();
if (!localQueue.isEmpty()) {
localQueue.addLast(whisper);
return true;
}
localQueue.addLast(whisper);
while ((whisper = localQueue.peekFirst()) != null) {
final Integer type = whisper.dest;
final Set<Talker> set = map.get(type);
if (set != null) {
for (final Talker talker : set) {
final TalkerContext ctx = talker.getState();
switch (ctx.type) {
case INPLACE_UNSYNC:
talker.newMessage(whisper);
break;
case INPLACE_SYNC:
synchronized (talker) {
talker.newMessage(whisper);
}
break;
case QUEUED_UNBOUNDED:
case QUEUED_BOUNDED:
while (!ctx.queueMessage(whisper))
;
break;
}
}
}
localQueue.pollFirst();
}
return true;
} | [
"public",
"boolean",
"send",
"(",
"Whisper",
"<",
"?",
">",
"whisper",
")",
"{",
"if",
"(",
"isShutdown",
".",
"get",
"(",
")",
")",
"return",
"false",
";",
"// Internal Queue (Local Thread) for INPLACE multiple recursive calls",
"final",
"ArrayDeque",
"<",
"Whisp... | Send message and optionally wait response
@param whisper
@return true if message is sended | [
"Send",
"message",
"and",
"optionally",
"wait",
"response"
] | 2834f94a6c24635bbe775edac4f5bdbcf81c0825 | https://github.com/ggrandes/figaro/blob/2834f94a6c24635bbe775edac4f5bdbcf81c0825/src/main/java/org/javastack/figaro/GossipMonger.java#L129-L165 | train |
ggrandes/figaro | src/main/java/org/javastack/figaro/GossipMonger.java | GossipMonger.shutdown | public void shutdown() {
singleton = null;
log.info("Shuting down GossipMonger");
isShutdown.set(true);
threadPool.shutdown(); // Disable new tasks from being submitted
// TODO: Wait for messages to end processing
shutdownAndAwaitTermination(threadPool);
// Clean ThreadLocal
ref.remove();
} | java | public void shutdown() {
singleton = null;
log.info("Shuting down GossipMonger");
isShutdown.set(true);
threadPool.shutdown(); // Disable new tasks from being submitted
// TODO: Wait for messages to end processing
shutdownAndAwaitTermination(threadPool);
// Clean ThreadLocal
ref.remove();
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"singleton",
"=",
"null",
";",
"log",
".",
"info",
"(",
"\"Shuting down GossipMonger\"",
")",
";",
"isShutdown",
".",
"set",
"(",
"true",
")",
";",
"threadPool",
".",
"shutdown",
"(",
")",
";",
"// Disable new t... | Shutdown GossipMonger and associated Threads | [
"Shutdown",
"GossipMonger",
"and",
"associated",
"Threads"
] | 2834f94a6c24635bbe775edac4f5bdbcf81c0825 | https://github.com/ggrandes/figaro/blob/2834f94a6c24635bbe775edac4f5bdbcf81c0825/src/main/java/org/javastack/figaro/GossipMonger.java#L207-L216 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/RegexMatcher.java | RegexMatcher.addExpression | public RegexMatcher addExpression(String expr, T attach, Option... options)
{
if (nfa == null)
{
nfa = parser.createNFA(nfaScope, expr, attach, options);
}
else
{
NFA<T> nfa2 = parser.createNFA(nfaScope, expr, attach, options);
nfa = new NFA<>(nfaScope, nfa, nfa2);
}
return this;
} | java | public RegexMatcher addExpression(String expr, T attach, Option... options)
{
if (nfa == null)
{
nfa = parser.createNFA(nfaScope, expr, attach, options);
}
else
{
NFA<T> nfa2 = parser.createNFA(nfaScope, expr, attach, options);
nfa = new NFA<>(nfaScope, nfa, nfa2);
}
return this;
} | [
"public",
"RegexMatcher",
"addExpression",
"(",
"String",
"expr",
",",
"T",
"attach",
",",
"Option",
"...",
"options",
")",
"{",
"if",
"(",
"nfa",
"==",
"null",
")",
"{",
"nfa",
"=",
"parser",
".",
"createNFA",
"(",
"nfaScope",
",",
"expr",
",",
"attac... | Add expression.
@param expr
@param attach
@param options
@return | [
"Add",
"expression",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L76-L88 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/RegexMatcher.java | RegexMatcher.match | public T match(CharSequence text, boolean matchPrefix)
{
if (root == null)
{
throw new IllegalStateException("not compiled");
}
int length = text.length();
for (int ii=0;ii<length;ii++)
{
switch (match(text.charAt(ii)))
{
case Error:
return null;
case Ok:
if (matchPrefix)
{
T uniqueMatch = state.getUniqueMatch();
if (uniqueMatch != null)
{
state = root;
return uniqueMatch;
}
}
break;
case Match:
return getMatched();
}
}
return null;
} | java | public T match(CharSequence text, boolean matchPrefix)
{
if (root == null)
{
throw new IllegalStateException("not compiled");
}
int length = text.length();
for (int ii=0;ii<length;ii++)
{
switch (match(text.charAt(ii)))
{
case Error:
return null;
case Ok:
if (matchPrefix)
{
T uniqueMatch = state.getUniqueMatch();
if (uniqueMatch != null)
{
state = root;
return uniqueMatch;
}
}
break;
case Match:
return getMatched();
}
}
return null;
} | [
"public",
"T",
"match",
"(",
"CharSequence",
"text",
",",
"boolean",
"matchPrefix",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"not compiled\"",
")",
";",
"}",
"int",
"length",
"=",
"text",
".",
"... | Matches given text. Returns associated token if match, otherwise null.
If matchPrefix is true returns also the only possible match.
@param text
@param matchPrefix
@return | [
"Matches",
"given",
"text",
".",
"Returns",
"associated",
"token",
"if",
"match",
"otherwise",
"null",
".",
"If",
"matchPrefix",
"is",
"true",
"returns",
"also",
"the",
"only",
"possible",
"match",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L146-L175 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/RegexMatcher.java | RegexMatcher.match | public T match(OfInt text)
{
if (root == null)
{
throw new IllegalStateException("not compiled");
}
while (text.hasNext())
{
switch (match(text.nextInt()))
{
case Error:
return null;
case Match:
return getMatched();
}
}
return null;
} | java | public T match(OfInt text)
{
if (root == null)
{
throw new IllegalStateException("not compiled");
}
while (text.hasNext())
{
switch (match(text.nextInt()))
{
case Error:
return null;
case Match:
return getMatched();
}
}
return null;
} | [
"public",
"T",
"match",
"(",
"OfInt",
"text",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"not compiled\"",
")",
";",
"}",
"while",
"(",
"text",
".",
"hasNext",
"(",
")",
")",
"{",
"switch",
"(... | Matches given text as int-iterator. Returns associated token if match, otherwise null.
@param text
@return | [
"Matches",
"given",
"text",
"as",
"int",
"-",
"iterator",
".",
"Returns",
"associated",
"token",
"if",
"match",
"otherwise",
"null",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L181-L198 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/RegexMatcher.java | RegexMatcher.split | public static Stream<CharSequence> split(CharSequence seq, String regex, Option... options)
{
return StreamSupport.stream(new SpliteratorImpl(seq, regex, options), false);
} | java | public static Stream<CharSequence> split(CharSequence seq, String regex, Option... options)
{
return StreamSupport.stream(new SpliteratorImpl(seq, regex, options), false);
} | [
"public",
"static",
"Stream",
"<",
"CharSequence",
">",
"split",
"(",
"CharSequence",
"seq",
",",
"String",
"regex",
",",
"Option",
"...",
"options",
")",
"{",
"return",
"StreamSupport",
".",
"stream",
"(",
"new",
"SpliteratorImpl",
"(",
"seq",
",",
"regex",... | Returns stream that contains subsequences delimited by given regex
@param seq
@param regex
@param options
@return | [
"Returns",
"stream",
"that",
"contains",
"subsequences",
"delimited",
"by",
"given",
"regex"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/RegexMatcher.java#L261-L264 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/internal/CallLimiter.java | CallLimiter.checkAndIncrease | public boolean checkAndIncrease() {
long newTimestamp = System.currentTimeMillis();
if (isShutdown) {
if (newTimestamp > shutdownEndTime) {
isShutdown = false;
largeLimitCalls = 0;
smallLimitCalls = 0;
} else {
return false;
}
}
if (newTimestamp - smallLimitTimestamp > smallTimeFrame) {
smallLimitCalls = 0;
smallLimitTimestamp = newTimestamp;
} else {
if (smallLimitCalls >= smallCallLimit) {
return false;
} else {
smallLimitCalls += 1;
}
}
if (newTimestamp - largeLimitTimestamp > largeTimeFrame) {
largeLimitCalls = 0;
largeLimitTimestamp = newTimestamp;
} else {
if (largeLimitCalls >= largeCallsLimit) {
isShutdown = true;
shutdownEndTime = newTimestamp + shutdownPeriod;
return false;
} else {
largeLimitCalls += 1;
}
}
return true;
} | java | public boolean checkAndIncrease() {
long newTimestamp = System.currentTimeMillis();
if (isShutdown) {
if (newTimestamp > shutdownEndTime) {
isShutdown = false;
largeLimitCalls = 0;
smallLimitCalls = 0;
} else {
return false;
}
}
if (newTimestamp - smallLimitTimestamp > smallTimeFrame) {
smallLimitCalls = 0;
smallLimitTimestamp = newTimestamp;
} else {
if (smallLimitCalls >= smallCallLimit) {
return false;
} else {
smallLimitCalls += 1;
}
}
if (newTimestamp - largeLimitTimestamp > largeTimeFrame) {
largeLimitCalls = 0;
largeLimitTimestamp = newTimestamp;
} else {
if (largeLimitCalls >= largeCallsLimit) {
isShutdown = true;
shutdownEndTime = newTimestamp + shutdownPeriod;
return false;
} else {
largeLimitCalls += 1;
}
}
return true;
} | [
"public",
"boolean",
"checkAndIncrease",
"(",
")",
"{",
"long",
"newTimestamp",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(",
"isShutdown",
")",
"{",
"if",
"(",
"newTimestamp",
">",
"shutdownEndTime",
")",
"{",
"isShutdown",
"=",
"false"... | Check if next call is allowed and increase the counts.
@return True if a next call is allowed. | [
"Check",
"if",
"next",
"call",
"is",
"allowed",
"and",
"increase",
"the",
"counts",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/internal/CallLimiter.java#L58-L97 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java | AnnotatedExtensions.findMethod | public static Method findMethod(String name, Class<?> cls) {
for(Method method : cls.getDeclaredMethods()) {
if(method.getName().equals(name)) {
return method;
}
}
throw new ExecutionException("invalid auto-function: no '" + name + "' method declared", null);
} | java | public static Method findMethod(String name, Class<?> cls) {
for(Method method : cls.getDeclaredMethods()) {
if(method.getName().equals(name)) {
return method;
}
}
throw new ExecutionException("invalid auto-function: no '" + name + "' method declared", null);
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"cls",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"if",
"(",
"method",
".",
"getName",
"(",
")",... | Finds a named declared method on the given class.
@param name Name of declared method to retrieve
@param cls Class to retrieve method from
@return Named method on class | [
"Finds",
"a",
"named",
"declared",
"method",
"on",
"the",
"given",
"class",
"."
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java#L57-L66 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java | AnnotatedExtensions.exec | public static Object exec(Method method, String[] paramNames, Map<String,?> params, Object instance) throws Throwable {
Object[] paramValues = new Object[paramNames.length];
for(int c=0; c < paramNames.length; ++c) {
paramValues[c] = params.get(paramNames[c]);
}
try {
return method.invoke(instance, paramValues);
}
catch (IllegalAccessException e) {
//Shouldn't happen
throw new RuntimeException(e);
}
catch (IllegalArgumentException e) {
throw new InvocationException("invalid arguments", e, null);
}
catch (InvocationTargetException e) {
throw e.getTargetException();
}
} | java | public static Object exec(Method method, String[] paramNames, Map<String,?> params, Object instance) throws Throwable {
Object[] paramValues = new Object[paramNames.length];
for(int c=0; c < paramNames.length; ++c) {
paramValues[c] = params.get(paramNames[c]);
}
try {
return method.invoke(instance, paramValues);
}
catch (IllegalAccessException e) {
//Shouldn't happen
throw new RuntimeException(e);
}
catch (IllegalArgumentException e) {
throw new InvocationException("invalid arguments", e, null);
}
catch (InvocationTargetException e) {
throw e.getTargetException();
}
} | [
"public",
"static",
"Object",
"exec",
"(",
"Method",
"method",
",",
"String",
"[",
"]",
"paramNames",
",",
"Map",
"<",
"String",
",",
"?",
">",
"params",
",",
"Object",
"instance",
")",
"throws",
"Throwable",
"{",
"Object",
"[",
"]",
"paramValues",
"=",
... | Invokes the given method mapping named parameters to positions based on a
given list of parameter names.
@param method Method to invoke
@param paramNames Positioned list of parameter names to map direct mapping
@param params Named parameters to use
@param instance Instance to invoke method on
@return Result of method invocation
@throws Throwable | [
"Invokes",
"the",
"given",
"method",
"mapping",
"named",
"parameters",
"to",
"positions",
"based",
"on",
"a",
"given",
"list",
"of",
"parameter",
"names",
"."
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedExtensions.java#L79-L101 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/AbstractAdminObject.java | AbstractAdminObject.setLinkProperty | protected void setLinkProperty(final UUID _linkTypeUUID,
final long _toId,
final UUID _toTypeUUID,
final String _toName)
throws EFapsException
{
setDirty();
} | java | protected void setLinkProperty(final UUID _linkTypeUUID,
final long _toId,
final UUID _toTypeUUID,
final String _toName)
throws EFapsException
{
setDirty();
} | [
"protected",
"void",
"setLinkProperty",
"(",
"final",
"UUID",
"_linkTypeUUID",
",",
"final",
"long",
"_toId",
",",
"final",
"UUID",
"_toTypeUUID",
",",
"final",
"String",
"_toName",
")",
"throws",
"EFapsException",
"{",
"setDirty",
"(",
")",
";",
"}"
] | Sets the link properties for this object.
@param _linkTypeUUID UUID of the type of the link property
@param _toId to id
@param _toTypeUUID UUDI of the to type
@param _toName to name
@throws EFapsException on error | [
"Sets",
"the",
"link",
"properties",
"for",
"this",
"object",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/AbstractAdminObject.java#L163-L170 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/AbstractAdminObject.java | AbstractAdminObject.addEvent | public void addEvent(final EventType _eventtype,
final EventDefinition _eventdef)
throws CacheReloadException
{
List<EventDefinition> evenList = this.events.get(_eventtype);
if (evenList == null) {
evenList = new ArrayList<>();
this.events.put(_eventtype, evenList);
}
if (!evenList.contains(_eventdef)) {
evenList.add(_eventdef);
}
// if there are more than one event they must be sorted by their index
// position
if (evenList.size() > 1) {
Collections.sort(evenList, new Comparator<EventDefinition>()
{
@Override
public int compare(final EventDefinition _eventDef0,
final EventDefinition _eventDef1)
{
return Long.compare(_eventDef0.getIndexPos(), _eventDef1.getIndexPos());
}
});
}
setDirty();
} | java | public void addEvent(final EventType _eventtype,
final EventDefinition _eventdef)
throws CacheReloadException
{
List<EventDefinition> evenList = this.events.get(_eventtype);
if (evenList == null) {
evenList = new ArrayList<>();
this.events.put(_eventtype, evenList);
}
if (!evenList.contains(_eventdef)) {
evenList.add(_eventdef);
}
// if there are more than one event they must be sorted by their index
// position
if (evenList.size() > 1) {
Collections.sort(evenList, new Comparator<EventDefinition>()
{
@Override
public int compare(final EventDefinition _eventDef0,
final EventDefinition _eventDef1)
{
return Long.compare(_eventDef0.getIndexPos(), _eventDef1.getIndexPos());
}
});
}
setDirty();
} | [
"public",
"void",
"addEvent",
"(",
"final",
"EventType",
"_eventtype",
",",
"final",
"EventDefinition",
"_eventdef",
")",
"throws",
"CacheReloadException",
"{",
"List",
"<",
"EventDefinition",
">",
"evenList",
"=",
"this",
".",
"events",
".",
"get",
"(",
"_event... | Adds a new event to this AdminObject.
@param _eventtype Eventtype class name to add
@param _eventdef EventDefinition to add
@see #events
@throws CacheReloadException on error | [
"Adds",
"a",
"new",
"event",
"to",
"this",
"AdminObject",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/AbstractAdminObject.java#L253-L279 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/AbstractAdminObject.java | AbstractAdminObject.getEvents | public List<EventDefinition> getEvents(final EventType _eventType)
{
if (!this.eventChecked) {
this.eventChecked = true;
try {
EventDefinition.addEvents(this);
} catch (final EFapsException e) {
AbstractAdminObject.LOG.error("Could not read events for Name:; {}', UUID: {}", this.name, this.uuid);
}
}
return this.events.get(_eventType);
} | java | public List<EventDefinition> getEvents(final EventType _eventType)
{
if (!this.eventChecked) {
this.eventChecked = true;
try {
EventDefinition.addEvents(this);
} catch (final EFapsException e) {
AbstractAdminObject.LOG.error("Could not read events for Name:; {}', UUID: {}", this.name, this.uuid);
}
}
return this.events.get(_eventType);
} | [
"public",
"List",
"<",
"EventDefinition",
">",
"getEvents",
"(",
"final",
"EventType",
"_eventType",
")",
"{",
"if",
"(",
"!",
"this",
".",
"eventChecked",
")",
"{",
"this",
".",
"eventChecked",
"=",
"true",
";",
"try",
"{",
"EventDefinition",
".",
"addEve... | Returns the list of events defined for given event type.
@param _eventType event type
@return list of events for the given event type | [
"Returns",
"the",
"list",
"of",
"events",
"defined",
"for",
"given",
"event",
"type",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/AbstractAdminObject.java#L287-L298 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/AbstractAdminObject.java | AbstractAdminObject.hasEvents | public boolean hasEvents(final EventType _eventtype)
{
if (!this.eventChecked) {
this.eventChecked = true;
try {
EventDefinition.addEvents(this);
} catch (final EFapsException e) {
AbstractAdminObject.LOG.error("Could not read events for Name:; {}', UUID: {}", this.name, this.uuid);
}
}
return this.events.get(_eventtype) != null;
} | java | public boolean hasEvents(final EventType _eventtype)
{
if (!this.eventChecked) {
this.eventChecked = true;
try {
EventDefinition.addEvents(this);
} catch (final EFapsException e) {
AbstractAdminObject.LOG.error("Could not read events for Name:; {}', UUID: {}", this.name, this.uuid);
}
}
return this.events.get(_eventtype) != null;
} | [
"public",
"boolean",
"hasEvents",
"(",
"final",
"EventType",
"_eventtype",
")",
"{",
"if",
"(",
"!",
"this",
".",
"eventChecked",
")",
"{",
"this",
".",
"eventChecked",
"=",
"true",
";",
"try",
"{",
"EventDefinition",
".",
"addEvents",
"(",
"this",
")",
... | Does this instance have Event, for the specified EventType ?
@param _eventtype type of event to check for
@return <i>true</i>, if this instance has a trigger, otherwise
<i>false</i>. | [
"Does",
"this",
"instance",
"have",
"Event",
"for",
"the",
"specified",
"EventType",
"?"
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/AbstractAdminObject.java#L307-L318 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedCallablePreparableBase.java | AnnotatedCallablePreparableBase.call | public Object call(Map<String, ?> params) throws Throwable {
return AnnotatedExtensions.exec(getCallMethod(), getParameterNames(), params, this);
} | java | public Object call(Map<String, ?> params) throws Throwable {
return AnnotatedExtensions.exec(getCallMethod(), getParameterNames(), params, this);
} | [
"public",
"Object",
"call",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"params",
")",
"throws",
"Throwable",
"{",
"return",
"AnnotatedExtensions",
".",
"exec",
"(",
"getCallMethod",
"(",
")",
",",
"getParameterNames",
"(",
")",
",",
"params",
",",
"this",
... | Executes a method named "doCall" by mapping parameters by name to
parameters annotated with the Named annotation
@see com.impossibl.stencil.api.Named | [
"Executes",
"a",
"method",
"named",
"doCall",
"by",
"mapping",
"parameters",
"by",
"name",
"to",
"parameters",
"annotated",
"with",
"the",
"Named",
"annotation"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/AnnotatedCallablePreparableBase.java#L45-L47 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.getLanguageId | private Long getLanguageId(final String _language)
{
Long ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language);
queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue().getId();
} else {
ret = insertNewLanguage(_language);
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getLanguageId()", e);
}
return ret;
} | java | private Long getLanguageId(final String _language)
{
Long ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(CIAdmin.Language);
queryBldr.addWhereAttrEqValue(CIAdmin.Language.Language, _language);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue().getId();
} else {
ret = insertNewLanguage(_language);
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getLanguageId()", e);
}
return ret;
} | [
"private",
"Long",
"getLanguageId",
"(",
"final",
"String",
"_language",
")",
"{",
"Long",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"CIAdmin",
".",
"Language",
")",
";",
"queryBldr",
".",
"... | find out the Id of the language used for this properties.
@param _language Language
@return ID of the Language | [
"find",
"out",
"the",
"Id",
"of",
"the",
"language",
"used",
"for",
"this",
"properties",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L141-L158 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.insertNewLanguage | private long insertNewLanguage(final String _language)
{
Long ret = null;
try {
final Insert insert = new Insert(CIAdmin.Language);
insert.add(CIAdmin.Language.Language, _language);
insert.executeWithoutAccessCheck();
ret = insert.getId();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewLanguage()", e);
}
return ret;
} | java | private long insertNewLanguage(final String _language)
{
Long ret = null;
try {
final Insert insert = new Insert(CIAdmin.Language);
insert.add(CIAdmin.Language.Language, _language);
insert.executeWithoutAccessCheck();
ret = insert.getId();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewLanguage()", e);
}
return ret;
} | [
"private",
"long",
"insertNewLanguage",
"(",
"final",
"String",
"_language",
")",
"{",
"Long",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"Insert",
"insert",
"=",
"new",
"Insert",
"(",
"CIAdmin",
".",
"Language",
")",
";",
"insert",
".",
"add",
"(",
... | inserts a new language into the Database.
@param _language language to be inserted
@return ID of the new language | [
"inserts",
"a",
"new",
"language",
"into",
"the",
"Database",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L166-L179 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.insertNewBundle | private Instance insertNewBundle()
{
Instance ret = null;
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES_BUNDLE);
insert.add("Name", this.bundlename);
insert.add("UUID", this.bundeluuid);
insert.add("Sequence", this.bundlesequence);
insert.add("CacheOnStart", this.cacheOnStart);
insert.executeWithoutAccessCheck();
ret = insert.getInstance();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewBundle()", e);
}
return ret;
} | java | private Instance insertNewBundle()
{
Instance ret = null;
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES_BUNDLE);
insert.add("Name", this.bundlename);
insert.add("UUID", this.bundeluuid);
insert.add("Sequence", this.bundlesequence);
insert.add("CacheOnStart", this.cacheOnStart);
insert.executeWithoutAccessCheck();
ret = insert.getInstance();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewBundle()", e);
}
return ret;
} | [
"private",
"Instance",
"insertNewBundle",
"(",
")",
"{",
"Instance",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"Insert",
"insert",
"=",
"new",
"Insert",
"(",
"DBPropertiesUpdate",
".",
"TYPE_PROPERTIES_BUNDLE",
")",
";",
"insert",
".",
"add",
"(",
"\"Nam... | Insert a new Bundle into the Database.
@return ID of the new Bundle | [
"Insert",
"a",
"new",
"Bundle",
"into",
"the",
"Database",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L186-L202 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.importFromProperties | private void importFromProperties(final URL _url)
{
try {
final InputStream propInFile = _url.openStream();
final Properties props = new Properties();
props.load(propInFile);
final Iterator<Entry<Object, Object>> iter = props.entrySet().iterator();
while (iter.hasNext()) {
final Entry<Object, Object> element = iter.next();
final Instance existing = getExistingKey(element.getKey().toString());
if (existing == null) {
insertNewProp(element.getKey().toString(), element.getValue().toString());
} else {
updateDefault(existing, element.getValue().toString());
}
}
} catch (final IOException e) {
DBPropertiesUpdate.LOG.error("ImportFromProperties() - I/O failed.", e);
}
} | java | private void importFromProperties(final URL _url)
{
try {
final InputStream propInFile = _url.openStream();
final Properties props = new Properties();
props.load(propInFile);
final Iterator<Entry<Object, Object>> iter = props.entrySet().iterator();
while (iter.hasNext()) {
final Entry<Object, Object> element = iter.next();
final Instance existing = getExistingKey(element.getKey().toString());
if (existing == null) {
insertNewProp(element.getKey().toString(), element.getValue().toString());
} else {
updateDefault(existing, element.getValue().toString());
}
}
} catch (final IOException e) {
DBPropertiesUpdate.LOG.error("ImportFromProperties() - I/O failed.", e);
}
} | [
"private",
"void",
"importFromProperties",
"(",
"final",
"URL",
"_url",
")",
"{",
"try",
"{",
"final",
"InputStream",
"propInFile",
"=",
"_url",
".",
"openStream",
"(",
")",
";",
"final",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"pro... | Import Properties from a Properties-File as default, if the key is
already existing, the default will be replaced with the new default.
@param _url Complete Path/Name of the property file to import | [
"Import",
"Properties",
"from",
"a",
"Properties",
"-",
"File",
"as",
"default",
"if",
"the",
"key",
"is",
"already",
"existing",
"the",
"default",
"will",
"be",
"replaced",
"with",
"the",
"new",
"default",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L210-L231 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.getExistingLocale | private Instance getExistingLocale(final long _propertyid,
final String _language)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL));
queryBldr.addWhereAttrEqValue("PropertyID", _propertyid);
queryBldr.addWhereAttrEqValue("LanguageID", getLanguageId(_language));
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExistingLocale(String)", e);
}
return ret;
} | java | private Instance getExistingLocale(final long _propertyid,
final String _language)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL));
queryBldr.addWhereAttrEqValue("PropertyID", _propertyid);
queryBldr.addWhereAttrEqValue("LanguageID", getLanguageId(_language));
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExistingLocale(String)", e);
}
return ret;
} | [
"private",
"Instance",
"getExistingLocale",
"(",
"final",
"long",
"_propertyid",
",",
"final",
"String",
"_language",
")",
"{",
"Instance",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"Type",
".",... | Is a localized value already existing.
@param _propertyid ID of the Property, the localized value is related to
@param _language Language of the property
@return OID of the value, otherwise null | [
"Is",
"a",
"localized",
"value",
"already",
"existing",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L277-L294 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.insertNewLocal | private void insertNewLocal(final long _propertyid,
final String _value,
final String _language)
{
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL);
insert.add("Value", _value);
insert.add("PropertyID", _propertyid);
insert.add("LanguageID", getLanguageId(_language));
insert.executeWithoutAccessCheck();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewLocal(String)", e);
}
} | java | private void insertNewLocal(final long _propertyid,
final String _value,
final String _language)
{
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES_LOCAL);
insert.add("Value", _value);
insert.add("PropertyID", _propertyid);
insert.add("LanguageID", getLanguageId(_language));
insert.executeWithoutAccessCheck();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("insertNewLocal(String)", e);
}
} | [
"private",
"void",
"insertNewLocal",
"(",
"final",
"long",
"_propertyid",
",",
"final",
"String",
"_value",
",",
"final",
"String",
"_language",
")",
"{",
"try",
"{",
"final",
"Insert",
"insert",
"=",
"new",
"Insert",
"(",
"DBPropertiesUpdate",
".",
"TYPE_PROP... | Insert a new localized Value.
@param _propertyid ID of the Property, the localized value is related to
@param _value Value of the Property
@param _language Language of the property | [
"Insert",
"a",
"new",
"localized",
"Value",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L303-L317 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.updateLocale | private void updateLocale(final Instance _localeInst,
final String _value)
{
try {
final Update update = new Update(_localeInst);
update.add("Value", _value);
update.execute();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("updateLocale(String, String)", e);
}
} | java | private void updateLocale(final Instance _localeInst,
final String _value)
{
try {
final Update update = new Update(_localeInst);
update.add("Value", _value);
update.execute();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("updateLocale(String, String)", e);
}
} | [
"private",
"void",
"updateLocale",
"(",
"final",
"Instance",
"_localeInst",
",",
"final",
"String",
"_value",
")",
"{",
"try",
"{",
"final",
"Update",
"update",
"=",
"new",
"Update",
"(",
"_localeInst",
")",
";",
"update",
".",
"add",
"(",
"\"Value\"",
","... | Update a localized Value.
@param _localeInst OID, of the localized Value
@param _value Value | [
"Update",
"a",
"localized",
"Value",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L325-L335 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.getExistingKey | private Instance getExistingKey(final String _key)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES));
queryBldr.addWhereAttrEqValue("Key", _key);
queryBldr.addWhereAttrEqValue("BundleID", this.bundleInstance);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExisting()", e);
}
return ret;
} | java | private Instance getExistingKey(final String _key)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES));
queryBldr.addWhereAttrEqValue("Key", _key);
queryBldr.addWhereAttrEqValue("BundleID", this.bundleInstance);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExisting()", e);
}
return ret;
} | [
"private",
"Instance",
"getExistingKey",
"(",
"final",
"String",
"_key",
")",
"{",
"Instance",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"Type",
".",
"get",
"(",
"DBPropertiesUpdate",
".",
"TY... | Is a key already existing.
@param _key Key to search for
@return OID of the key, otherwise null | [
"Is",
"a",
"key",
"already",
"existing",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L343-L359 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.updateDefault | private void updateDefault(final Instance _inst,
final String _value)
{
try {
final Update update = new Update(_inst);
update.add("Default", _value);
update.execute();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("updateDefault(String, String)", e);
}
} | java | private void updateDefault(final Instance _inst,
final String _value)
{
try {
final Update update = new Update(_inst);
update.add("Default", _value);
update.execute();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("updateDefault(String, String)", e);
}
} | [
"private",
"void",
"updateDefault",
"(",
"final",
"Instance",
"_inst",
",",
"final",
"String",
"_value",
")",
"{",
"try",
"{",
"final",
"Update",
"update",
"=",
"new",
"Update",
"(",
"_inst",
")",
";",
"update",
".",
"add",
"(",
"\"Default\"",
",",
"_val... | Update a Default.
@param _inst OID of the value to update
@param _value value | [
"Update",
"a",
"Default",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L367-L377 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.insertNewProp | private Instance insertNewProp(final String _key,
final String _value)
{
Instance ret = null;
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES);
insert.add("BundleID", this.bundleInstance);
insert.add("Key", _key);
insert.add("Default", _value);
insert.executeWithoutAccessCheck();
ret = insert.getInstance();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("InsertNew(String, String)", e);
}
return ret;
} | java | private Instance insertNewProp(final String _key,
final String _value)
{
Instance ret = null;
try {
final Insert insert = new Insert(DBPropertiesUpdate.TYPE_PROPERTIES);
insert.add("BundleID", this.bundleInstance);
insert.add("Key", _key);
insert.add("Default", _value);
insert.executeWithoutAccessCheck();
ret = insert.getInstance();
insert.close();
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("InsertNew(String, String)", e);
}
return ret;
} | [
"private",
"Instance",
"insertNewProp",
"(",
"final",
"String",
"_key",
",",
"final",
"String",
"_value",
")",
"{",
"Instance",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"Insert",
"insert",
"=",
"new",
"Insert",
"(",
"DBPropertiesUpdate",
".",
"TYPE_PROP... | Insert a new Property.
@param _key Key to insert
@param _value value to insert
@return ID of the new Property | [
"Insert",
"a",
"new",
"Property",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L386-L403 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java | DBPropertiesUpdate.getExistingBundle | private Instance getExistingBundle(final String _uuid)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_BUNDLE));
queryBldr.addWhereAttrEqValue("UUID", _uuid);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExistingBundle(String)", e);
}
return ret;
} | java | private Instance getExistingBundle(final String _uuid)
{
Instance ret = null;
try {
final QueryBuilder queryBldr = new QueryBuilder(Type.get(DBPropertiesUpdate.TYPE_PROPERTIES_BUNDLE));
queryBldr.addWhereAttrEqValue("UUID", _uuid);
final InstanceQuery query = queryBldr.getQuery();
query.executeWithoutAccessCheck();
if (query.next()) {
ret = query.getCurrentValue();
}
} catch (final EFapsException e) {
DBPropertiesUpdate.LOG.error("getExistingBundle(String)", e);
}
return ret;
} | [
"private",
"Instance",
"getExistingBundle",
"(",
"final",
"String",
"_uuid",
")",
"{",
"Instance",
"ret",
"=",
"null",
";",
"try",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"Type",
".",
"get",
"(",
"DBPropertiesUpdate",
".",
... | Is the Bundle allready existing.
@param _uuid UUID of the Bundle
@return ID of the Bundle if existing, else null | [
"Is",
"the",
"Bundle",
"allready",
"existing",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/dbproperty/DBPropertiesUpdate.java#L411-L426 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/jaas/SetPasswordHandler.java | SetPasswordHandler.setPassword | public boolean setPassword(final String _name,
final String _newpasswd,
final String _oldpasswd)
throws LoginException
{
boolean ret = false;
final LoginContext login = new LoginContext(
this.application,
new SetPasswordCallbackHandler(ActionCallback.Mode.SET_PASSWORD, _name, _newpasswd, _oldpasswd));
login.login();
ret = true;
return ret;
} | java | public boolean setPassword(final String _name,
final String _newpasswd,
final String _oldpasswd)
throws LoginException
{
boolean ret = false;
final LoginContext login = new LoginContext(
this.application,
new SetPasswordCallbackHandler(ActionCallback.Mode.SET_PASSWORD, _name, _newpasswd, _oldpasswd));
login.login();
ret = true;
return ret;
} | [
"public",
"boolean",
"setPassword",
"(",
"final",
"String",
"_name",
",",
"final",
"String",
"_newpasswd",
",",
"final",
"String",
"_oldpasswd",
")",
"throws",
"LoginException",
"{",
"boolean",
"ret",
"=",
"false",
";",
"final",
"LoginContext",
"login",
"=",
"... | Set the password.
@param _name Username
@param _newpasswd new passowrd
@param _oldpasswd old passowrd
@return true if successful
@throws LoginException on error | [
"Set",
"the",
"password",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jaas/SetPasswordHandler.java#L78-L91 | train |
isisaddons-legacy/isis-module-command | fixture/src/main/java/org/isisaddons/module/command/fixture/dom/SomeCommandAnnotatedObject.java | SomeCommandAnnotatedObject.toggleForBulkActions | @Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(
describedAs = "Toggle, for testing (direct) bulk actions"
)
public void toggleForBulkActions() {
boolean flag = getFlag() != null? getFlag(): false;
setFlag(!flag);
} | java | @Action(invokeOn = InvokeOn.OBJECT_AND_COLLECTION)
@ActionLayout(
describedAs = "Toggle, for testing (direct) bulk actions"
)
public void toggleForBulkActions() {
boolean flag = getFlag() != null? getFlag(): false;
setFlag(!flag);
} | [
"@",
"Action",
"(",
"invokeOn",
"=",
"InvokeOn",
".",
"OBJECT_AND_COLLECTION",
")",
"@",
"ActionLayout",
"(",
"describedAs",
"=",
"\"Toggle, for testing (direct) bulk actions\"",
")",
"public",
"void",
"toggleForBulkActions",
"(",
")",
"{",
"boolean",
"flag",
"=",
"... | region > toggleForBulkActions | [
"region",
">",
"toggleForBulkActions"
] | 0bfdb7fcbe92247a1f92633bde8856e4df5556c8 | https://github.com/isisaddons-legacy/isis-module-command/blob/0bfdb7fcbe92247a1f92633bde8856e4df5556c8/fixture/src/main/java/org/isisaddons/module/command/fixture/dom/SomeCommandAnnotatedObject.java#L281-L288 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addMeasureToVerb | public boolean addMeasureToVerb(Map<String, Object> properties)
{
String[] pathKeys = {"verb"};
return addChild("measure", properties, pathKeys);
} | java | public boolean addMeasureToVerb(Map<String, Object> properties)
{
String[] pathKeys = {"verb"};
return addChild("measure", properties, pathKeys);
} | [
"public",
"boolean",
"addMeasureToVerb",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"[",
"]",
"pathKeys",
"=",
"{",
"\"verb\"",
"}",
";",
"return",
"addChild",
"(",
"\"measure\"",
",",
"properties",
",",
"pathKeys",
")... | Add an arbitrary map of key-value pairs as a measure to the verb
@param properties
@return True if added, false if not (due to missing required fields or lack of "verb") | [
"Add",
"an",
"arbitrary",
"map",
"of",
"key",
"-",
"value",
"pairs",
"as",
"a",
"measure",
"to",
"the",
"verb"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L165-L169 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addMeasureToVerb | public boolean addMeasureToVerb(String measureType, Number value, Number scaleMin, Number scaleMax, Number sampleSize)
{
Map<String, Object> container = new HashMap<String, Object>();
if (measureType != null)
{
container.put("measureType", measureType);
}
else
{
return false;
}
if (value != null)
{
container.put("value", value);
}
else
{
return false;
}
if (scaleMin != null)
{
container.put("scaleMin", scaleMin);
}
if (scaleMax != null)
{
container.put("scaleMax", scaleMax);
}
if (sampleSize != null)
{
container.put("sampleSize", sampleSize);
}
return addMeasureToVerb(container);
} | java | public boolean addMeasureToVerb(String measureType, Number value, Number scaleMin, Number scaleMax, Number sampleSize)
{
Map<String, Object> container = new HashMap<String, Object>();
if (measureType != null)
{
container.put("measureType", measureType);
}
else
{
return false;
}
if (value != null)
{
container.put("value", value);
}
else
{
return false;
}
if (scaleMin != null)
{
container.put("scaleMin", scaleMin);
}
if (scaleMax != null)
{
container.put("scaleMax", scaleMax);
}
if (sampleSize != null)
{
container.put("sampleSize", sampleSize);
}
return addMeasureToVerb(container);
} | [
"public",
"boolean",
"addMeasureToVerb",
"(",
"String",
"measureType",
",",
"Number",
"value",
",",
"Number",
"scaleMin",
",",
"Number",
"scaleMax",
",",
"Number",
"sampleSize",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"Ha... | Add a mesure object to the verb within this activity
@param measureType The name of the type of measure to be added (required)
@param value The value of this measure (required)
@param scaleMin The low end of the scale represented
@param scaleMax The high end of the scale represented
@param sampleSize the number of samples represented by this data
@return True if added, false if not (due to missing required fields or lack of "verb") | [
"Add",
"a",
"mesure",
"object",
"to",
"the",
"verb",
"within",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L182-L216 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addContextToVerb | public boolean addContextToVerb(String objectType, String id, String description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (description != null)
{
container.put("description", description);
}
String[] pathKeys = {"verb"};
return addChild("context", container, pathKeys);
} | java | public boolean addContextToVerb(String objectType, String id, String description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (description != null)
{
container.put("description", description);
}
String[] pathKeys = {"verb"};
return addChild("context", container, pathKeys);
} | [
"public",
"boolean",
"addContextToVerb",
"(",
"String",
"objectType",
",",
"String",
"id",
",",
"String",
"description",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
... | Add a context object to the verb within this activity
@param objectType The type of context
@param id The id of the context
@param description Description of the context
@return True if added, false if not (due to lack of "verb") | [
"Add",
"a",
"context",
"object",
"to",
"the",
"verb",
"within",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L238-L257 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addVerb | public boolean addVerb(String action, Date dateStart, Date dateEnd, String[] description, String comment)
{
Map<String, Object> container = new HashMap<String, Object>();
if (action != null)
{
container.put("action", action);
}
else
{
return false;
}
if (dateStart != null && dateEnd != null)
{
container.put("date", df.format(dateStart) + "/" + df.format(dateEnd));
}
else if (dateStart != null)
{
container.put("date", df.format(dateStart));
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
if (comment != null)
{
container.put("comment", comment);
}
return addChild("verb", container, null);
} | java | public boolean addVerb(String action, Date dateStart, Date dateEnd, String[] description, String comment)
{
Map<String, Object> container = new HashMap<String, Object>();
if (action != null)
{
container.put("action", action);
}
else
{
return false;
}
if (dateStart != null && dateEnd != null)
{
container.put("date", df.format(dateStart) + "/" + df.format(dateEnd));
}
else if (dateStart != null)
{
container.put("date", df.format(dateStart));
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
if (comment != null)
{
container.put("comment", comment);
}
return addChild("verb", container, null);
} | [
"public",
"boolean",
"addVerb",
"(",
"String",
"action",
",",
"Date",
"dateStart",
",",
"Date",
"dateEnd",
",",
"String",
"[",
"]",
"description",
",",
"String",
"comment",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"Has... | Add a verb object to this activity
@param action The action type of the verb (required)
@param dateStart The start date of the action described
@param dateEnd The end date of the action described
@param description An array of descriptions of this action
@param comment A comment on this verb
@return True if added, false if not (due to missing required fields) | [
"Add",
"a",
"verb",
"object",
"to",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L298-L328 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addActor | public boolean addActor(String objectType, String displayName, String url, String[] description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
else
{
return false;
}
if (displayName != null)
{
container.put("displayName", displayName);
}
if (url != null)
{
container.put("url", url);
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
return addChild("actor", container, null);
} | java | public boolean addActor(String objectType, String displayName, String url, String[] description)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
else
{
return false;
}
if (displayName != null)
{
container.put("displayName", displayName);
}
if (url != null)
{
container.put("url", url);
}
if (description != null && description.length > 0)
{
container.put("description", description);
}
return addChild("actor", container, null);
} | [
"public",
"boolean",
"addActor",
"(",
"String",
"objectType",
",",
"String",
"displayName",
",",
"String",
"url",
",",
"String",
"[",
"]",
"description",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"HashMap",
"<",
"String",... | Add an actor object to this activity
@param objectType The type of actor (required)
@param displayName Name of the actor
@param url URL of a page representing the actor
@param description Array of descriptiosn of this actor
@return True if added, false if not (due to missing required fields) | [
"Add",
"an",
"actor",
"object",
"to",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L339-L365 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addObject | public boolean addObject(String objectType, String id, String content)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (content != null)
{
container.put("content", content);
}
return addChild("object", container, null);
} | java | public boolean addObject(String objectType, String id, String content)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
if (id != null)
{
container.put("id", id);
}
if (content != null)
{
container.put("content", content);
}
return addChild("object", container, null);
} | [
"public",
"boolean",
"addObject",
"(",
"String",
"objectType",
",",
"String",
"id",
",",
"String",
"content",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"if"... | Add an object to this activity
@param objectType The type of object (required)
@param id Id of the object
@param content String describing the content of the object
@return True if added, false if not | [
"Add",
"an",
"object",
"to",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L375-L393 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addRelatedObject | public boolean addRelatedObject(String objectType, String id, String content)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
else
{
return false;
}
if (id != null)
{
container.put("id", id);
}
if (content != null)
{
container.put("content", content);
}
related.add(container);
return true;
} | java | public boolean addRelatedObject(String objectType, String id, String content)
{
Map<String, Object> container = new HashMap<String, Object>();
if (objectType != null)
{
container.put("objectType", objectType);
}
else
{
return false;
}
if (id != null)
{
container.put("id", id);
}
if (content != null)
{
container.put("content", content);
}
related.add(container);
return true;
} | [
"public",
"boolean",
"addRelatedObject",
"(",
"String",
"objectType",
",",
"String",
"id",
",",
"String",
"content",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"container",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",... | Add a related object to this activity
@param objectType The type of the object (required)
@param id Id of the ojbect
@param content String describing the content of the object
@return True if added, false if not (due to missing required fields) | [
"Add",
"a",
"related",
"object",
"to",
"this",
"activity"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L403-L426 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.getMap | private Map<String, Object> getMap(String[] pathKeys)
{
if (pathKeys == null)
{
return (Map<String, Object>)resourceData;
}
Map<String, Object> selected = (Map<String, Object>)resourceData;
for(int i = 0; i < pathKeys.length; i++)
{
if (selected.containsKey(pathKeys[i]) && selected.get(pathKeys[i]).getClass().equals(resourceData.getClass()))
{
selected = (Map<String, Object>) selected.get(pathKeys[i]);
}
else
{
return null;
}
}
return selected;
} | java | private Map<String, Object> getMap(String[] pathKeys)
{
if (pathKeys == null)
{
return (Map<String, Object>)resourceData;
}
Map<String, Object> selected = (Map<String, Object>)resourceData;
for(int i = 0; i < pathKeys.length; i++)
{
if (selected.containsKey(pathKeys[i]) && selected.get(pathKeys[i]).getClass().equals(resourceData.getClass()))
{
selected = (Map<String, Object>) selected.get(pathKeys[i]);
}
else
{
return null;
}
}
return selected;
} | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"getMap",
"(",
"String",
"[",
"]",
"pathKeys",
")",
"{",
"if",
"(",
"pathKeys",
"==",
"null",
")",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"resourceData",
";",
"}",
"Ma... | Get a map embedded in the activity following a set of keys
@param pathKeys An array of keys to follow to get to the requested map
@return The requested map or null if it does not exist | [
"Get",
"a",
"map",
"embedded",
"in",
"the",
"activity",
"following",
"a",
"set",
"of",
"keys"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L445-L467 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LRActivity.java | LRActivity.addChild | private boolean addChild(String name, Object value, String[] pathKeys)
{
Map<String, Object> selected = (Map<String, Object>)resourceData;
if (pathKeys != null)
{
selected = getMap(pathKeys);
}
if (selected != null && !selected.containsKey(name))
{
selected.put(name, value);
return true;
}
return false;
} | java | private boolean addChild(String name, Object value, String[] pathKeys)
{
Map<String, Object> selected = (Map<String, Object>)resourceData;
if (pathKeys != null)
{
selected = getMap(pathKeys);
}
if (selected != null && !selected.containsKey(name))
{
selected.put(name, value);
return true;
}
return false;
} | [
"private",
"boolean",
"addChild",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"String",
"[",
"]",
"pathKeys",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"selected",
"=",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"resourceData... | Add a child object to the activity at the specified path
@param name Name of the object to add
@param value Object to add
@param pathKeys The path in which to add the object
@return True if added, false if not (due to bad path or duplicate name at destination) | [
"Add",
"a",
"child",
"object",
"to",
"the",
"activity",
"at",
"the",
"specified",
"path"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L477-L493 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.process | public void process(TemplateImpl template, Writer out) throws IOException {
Environment env = new Environment(template.getPath(), out);
currentScope.declaringEnvironment = env;
Environment prevEnv = switchEnvironment(env);
TemplateContext tmpl = template.getContext();
HeaderContext hdr = tmpl.hdr;
if (hdr != null &&
hdr.hdrSig != null &&
hdr.hdrSig.callSig != null &&
hdr.hdrSig.callSig.paramDecls != null) {
for (ParameterDeclContext paramDecl : hdr.hdrSig.callSig.paramDecls) {
String paramId = paramDecl.id.getText();
if (!currentScope.values.containsKey(paramId)) {
currentScope.declare(paramId, eval(paramDecl.expr));
}
}
}
try {
tmpl.accept(visitor);
}
finally {
switchEnvironment(prevEnv);
}
} | java | public void process(TemplateImpl template, Writer out) throws IOException {
Environment env = new Environment(template.getPath(), out);
currentScope.declaringEnvironment = env;
Environment prevEnv = switchEnvironment(env);
TemplateContext tmpl = template.getContext();
HeaderContext hdr = tmpl.hdr;
if (hdr != null &&
hdr.hdrSig != null &&
hdr.hdrSig.callSig != null &&
hdr.hdrSig.callSig.paramDecls != null) {
for (ParameterDeclContext paramDecl : hdr.hdrSig.callSig.paramDecls) {
String paramId = paramDecl.id.getText();
if (!currentScope.values.containsKey(paramId)) {
currentScope.declare(paramId, eval(paramDecl.expr));
}
}
}
try {
tmpl.accept(visitor);
}
finally {
switchEnvironment(prevEnv);
}
} | [
"public",
"void",
"process",
"(",
"TemplateImpl",
"template",
",",
"Writer",
"out",
")",
"throws",
"IOException",
"{",
"Environment",
"env",
"=",
"new",
"Environment",
"(",
"template",
".",
"getPath",
"(",
")",
",",
"out",
")",
";",
"currentScope",
".",
"d... | Processes a template into its text representation | [
"Processes",
"a",
"template",
"into",
"its",
"text",
"representation"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2357-L2392 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.load | private TemplateImpl load(String path, ParserRuleContext errCtx) {
path = Paths.resolvePath(currentEnvironment.path, path);
try {
return (TemplateImpl) engine.load(path);
}
catch (IOException | ParseException e) {
throw new ExecutionException("error importing " + path, e, getLocation(errCtx));
}
} | java | private TemplateImpl load(String path, ParserRuleContext errCtx) {
path = Paths.resolvePath(currentEnvironment.path, path);
try {
return (TemplateImpl) engine.load(path);
}
catch (IOException | ParseException e) {
throw new ExecutionException("error importing " + path, e, getLocation(errCtx));
}
} | [
"private",
"TemplateImpl",
"load",
"(",
"String",
"path",
",",
"ParserRuleContext",
"errCtx",
")",
"{",
"path",
"=",
"Paths",
".",
"resolvePath",
"(",
"currentEnvironment",
".",
"path",
",",
"path",
")",
";",
"try",
"{",
"return",
"(",
"TemplateImpl",
")",
... | Loads a template from the supplied template loader. | [
"Loads",
"a",
"template",
"from",
"the",
"supplied",
"template",
"loader",
"."
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2398-L2408 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.switchEnvironment | private Environment switchEnvironment(Environment env) {
Environment prev = currentEnvironment;
currentEnvironment = env;
return prev;
} | java | private Environment switchEnvironment(Environment env) {
Environment prev = currentEnvironment;
currentEnvironment = env;
return prev;
} | [
"private",
"Environment",
"switchEnvironment",
"(",
"Environment",
"env",
")",
"{",
"Environment",
"prev",
"=",
"currentEnvironment",
";",
"currentEnvironment",
"=",
"env",
";",
"return",
"prev",
";",
"}"
] | Switch to a new environment
@param env Environment to switch to
@returns Previous environment | [
"Switch",
"to",
"a",
"new",
"environment"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2428-L2432 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.switchScope | private Scope switchScope(Scope scope) {
Scope prev = currentScope;
currentScope = scope;
return prev;
} | java | private Scope switchScope(Scope scope) {
Scope prev = currentScope;
currentScope = scope;
return prev;
} | [
"private",
"Scope",
"switchScope",
"(",
"Scope",
"scope",
")",
"{",
"Scope",
"prev",
"=",
"currentScope",
";",
"currentScope",
"=",
"scope",
";",
"return",
"prev",
";",
"}"
] | Switch to a completely new scope stack
@param scope Top of scope stack to switch to
@return Top of previous scope stack | [
"Switch",
"to",
"a",
"completely",
"new",
"scope",
"stack"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2440-L2444 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.bindBlocks | private Map<String, Object> bindBlocks(PrepareSignatureContext sig, PrepareInvocationContext inv) {
if(inv == null) {
return Collections.emptyMap();
}
BlockDeclContext allDecl = null;
BlockDeclContext unnamedDecl = null;
List<NamedOutputBlockContext> namedBlocks = new ArrayList<>(inv.namedBlocks);
Map<String, Object> blocks = new HashMap<>();
for (BlockDeclContext blockDecl : sig.blockDecls) {
if (blockDecl.flag != null) {
if (blockDecl.flag.getText().equals("*")) {
if (allDecl != null) {
throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(blockDecl));
}
allDecl = blockDecl;
}
else if (blockDecl.flag.getText().equals("+")) {
if (unnamedDecl != null) {
throw new ExecutionException("only a single parameter can be marked with '+'", getLocation(blockDecl));
}
unnamedDecl = blockDecl;
}
else {
throw new ExecutionException("unknown block declaration flag", getLocation(blockDecl));
}
continue;
}
//Find the block
ParserRuleContext paramBlock = findAndRemoveBlock(namedBlocks, name(blockDecl));
//Bind the block
BoundParamOutputBlock boundBlock = bindBlock(paramBlock);
blocks.put(name(blockDecl), boundBlock);
}
//
// Bind unnamed block (if requested)
//
if (unnamedDecl != null) {
UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
BoundParamOutputBlock boundUnnamedBlock = bindBlock(unnamedBlock);
blocks.put(unnamedDecl.id.getText(), boundUnnamedBlock);
}
//
// Bind rest of blocks (if requested)
//
if (allDecl != null) {
Map<String, Block> otherBlocks = new HashMap<>();
// Add unnamed block if it wasn't bound explicitly
if (inv.unnamedBlock != null && unnamedDecl == null) {
UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
BoundParamOutputBlock boundUnnamedBlock = new BoundParamOutputBlock(unnamedBlock, mode(unnamedBlock), currentScope);
otherBlocks.put("", boundUnnamedBlock);
}
// Add all other unbound blocks
for (NamedOutputBlockContext namedBlock : namedBlocks) {
String blockName = nullToEmpty(name(namedBlock));
BoundParamOutputBlock boundNamedBlock = new BoundParamOutputBlock(namedBlock, mode(namedBlock), currentScope);
otherBlocks.put(blockName, boundNamedBlock);
}
blocks.put(allDecl.id.getText(), otherBlocks);
}
return blocks;
} | java | private Map<String, Object> bindBlocks(PrepareSignatureContext sig, PrepareInvocationContext inv) {
if(inv == null) {
return Collections.emptyMap();
}
BlockDeclContext allDecl = null;
BlockDeclContext unnamedDecl = null;
List<NamedOutputBlockContext> namedBlocks = new ArrayList<>(inv.namedBlocks);
Map<String, Object> blocks = new HashMap<>();
for (BlockDeclContext blockDecl : sig.blockDecls) {
if (blockDecl.flag != null) {
if (blockDecl.flag.getText().equals("*")) {
if (allDecl != null) {
throw new ExecutionException("only a single parameter can be marked with '*'", getLocation(blockDecl));
}
allDecl = blockDecl;
}
else if (blockDecl.flag.getText().equals("+")) {
if (unnamedDecl != null) {
throw new ExecutionException("only a single parameter can be marked with '+'", getLocation(blockDecl));
}
unnamedDecl = blockDecl;
}
else {
throw new ExecutionException("unknown block declaration flag", getLocation(blockDecl));
}
continue;
}
//Find the block
ParserRuleContext paramBlock = findAndRemoveBlock(namedBlocks, name(blockDecl));
//Bind the block
BoundParamOutputBlock boundBlock = bindBlock(paramBlock);
blocks.put(name(blockDecl), boundBlock);
}
//
// Bind unnamed block (if requested)
//
if (unnamedDecl != null) {
UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
BoundParamOutputBlock boundUnnamedBlock = bindBlock(unnamedBlock);
blocks.put(unnamedDecl.id.getText(), boundUnnamedBlock);
}
//
// Bind rest of blocks (if requested)
//
if (allDecl != null) {
Map<String, Block> otherBlocks = new HashMap<>();
// Add unnamed block if it wasn't bound explicitly
if (inv.unnamedBlock != null && unnamedDecl == null) {
UnnamedOutputBlockContext unnamedBlock = inv.unnamedBlock;
BoundParamOutputBlock boundUnnamedBlock = new BoundParamOutputBlock(unnamedBlock, mode(unnamedBlock), currentScope);
otherBlocks.put("", boundUnnamedBlock);
}
// Add all other unbound blocks
for (NamedOutputBlockContext namedBlock : namedBlocks) {
String blockName = nullToEmpty(name(namedBlock));
BoundParamOutputBlock boundNamedBlock = new BoundParamOutputBlock(namedBlock, mode(namedBlock), currentScope);
otherBlocks.put(blockName, boundNamedBlock);
}
blocks.put(allDecl.id.getText(), otherBlocks);
}
return blocks;
} | [
"private",
"Map",
"<",
"String",
",",
"Object",
">",
"bindBlocks",
"(",
"PrepareSignatureContext",
"sig",
",",
"PrepareInvocationContext",
"inv",
")",
"{",
"if",
"(",
"inv",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyMap",
"(",
")",
";",
"... | Bind block values to names based on prepare signature
@param sig Signature of output block preparation
@param inv Invocation of output block
@return Map of Name => BoundParamBlocks representing Macro blocks | [
"Bind",
"block",
"values",
"to",
"names",
"based",
"on",
"prepare",
"signature"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2637-L2730 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.findAndRemoveBlock | private NamedOutputBlockContext findAndRemoveBlock(List<NamedOutputBlockContext> blocks, String name) {
if(blocks == null) {
return null;
}
Iterator<NamedOutputBlockContext> blockIter = blocks.iterator();
while (blockIter.hasNext()) {
NamedOutputBlockContext block = blockIter.next();
String blockName = name(block);
if(name.equals(blockName)) {
blockIter.remove();
return block;
}
}
return null;
} | java | private NamedOutputBlockContext findAndRemoveBlock(List<NamedOutputBlockContext> blocks, String name) {
if(blocks == null) {
return null;
}
Iterator<NamedOutputBlockContext> blockIter = blocks.iterator();
while (blockIter.hasNext()) {
NamedOutputBlockContext block = blockIter.next();
String blockName = name(block);
if(name.equals(blockName)) {
blockIter.remove();
return block;
}
}
return null;
} | [
"private",
"NamedOutputBlockContext",
"findAndRemoveBlock",
"(",
"List",
"<",
"NamedOutputBlockContext",
">",
"blocks",
",",
"String",
"name",
")",
"{",
"if",
"(",
"blocks",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Iterator",
"<",
"NamedOutputBlockCo... | Find and remove block with specific name
@param blocks List of ParamOutputBlocks to search
@param name Name of block to find
@return ParamOutputBlock with specified name | [
"Find",
"and",
"remove",
"block",
"with",
"specific",
"name"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2758-L2775 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.findAndRemoveValue | private ExpressionContext findAndRemoveValue(List<NamedValueContext> namedValues, String name) {
Iterator<NamedValueContext> namedValueIter = namedValues.iterator();
while (namedValueIter.hasNext()) {
NamedValueContext namedValue = namedValueIter.next();
if (name.equals(value(namedValue.name))) {
namedValueIter.remove();
return namedValue.expr;
}
}
return null;
} | java | private ExpressionContext findAndRemoveValue(List<NamedValueContext> namedValues, String name) {
Iterator<NamedValueContext> namedValueIter = namedValues.iterator();
while (namedValueIter.hasNext()) {
NamedValueContext namedValue = namedValueIter.next();
if (name.equals(value(namedValue.name))) {
namedValueIter.remove();
return namedValue.expr;
}
}
return null;
} | [
"private",
"ExpressionContext",
"findAndRemoveValue",
"(",
"List",
"<",
"NamedValueContext",
">",
"namedValues",
",",
"String",
"name",
")",
"{",
"Iterator",
"<",
"NamedValueContext",
">",
"namedValueIter",
"=",
"namedValues",
".",
"iterator",
"(",
")",
";",
"whil... | Find and remove named value with specific name
@param namedValues List of NamedValues to search
@param name Name of value to find
@return Expression for value with specified name | [
"Find",
"and",
"remove",
"named",
"value",
"with",
"specific",
"name"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2784-L2796 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.eval | private Object eval(ExpressionContext expr) {
Object res = expr;
while(res instanceof ExpressionContext)
res = ((ExpressionContext)res).accept(visitor);
if(res instanceof LValue)
res = ((LValue) res).get(expr);
return res;
} | java | private Object eval(ExpressionContext expr) {
Object res = expr;
while(res instanceof ExpressionContext)
res = ((ExpressionContext)res).accept(visitor);
if(res instanceof LValue)
res = ((LValue) res).get(expr);
return res;
} | [
"private",
"Object",
"eval",
"(",
"ExpressionContext",
"expr",
")",
"{",
"Object",
"res",
"=",
"expr",
";",
"while",
"(",
"res",
"instanceof",
"ExpressionContext",
")",
"res",
"=",
"(",
"(",
"ExpressionContext",
")",
"res",
")",
".",
"accept",
"(",
"visito... | Evaluate an expression into a value
@param expr Expression to evaluate
@return Result of expression evaluate | [
"Evaluate",
"an",
"expression",
"into",
"a",
"value"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2804-L2811 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.eval | private List<Object> eval(Iterable<ExpressionContext> expressions) {
List<Object> results = new ArrayList<Object>();
for (ExpressionContext expression : expressions) {
results.add(eval(expression));
}
return results;
} | java | private List<Object> eval(Iterable<ExpressionContext> expressions) {
List<Object> results = new ArrayList<Object>();
for (ExpressionContext expression : expressions) {
results.add(eval(expression));
}
return results;
} | [
"private",
"List",
"<",
"Object",
">",
"eval",
"(",
"Iterable",
"<",
"ExpressionContext",
">",
"expressions",
")",
"{",
"List",
"<",
"Object",
">",
"results",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")",
";",
"for",
"(",
"ExpressionContext",
"e... | Evaluates a list of expressions into their values
@param expressions List of expressions to evaluate
@return List of related expression values | [
"Evaluates",
"a",
"list",
"of",
"expressions",
"into",
"their",
"values"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2827-L2836 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.exec | private Object exec(StatementContext statement) {
if (statement == null)
return null;
return statement.accept(visitor);
} | java | private Object exec(StatementContext statement) {
if (statement == null)
return null;
return statement.accept(visitor);
} | [
"private",
"Object",
"exec",
"(",
"StatementContext",
"statement",
")",
"{",
"if",
"(",
"statement",
"==",
"null",
")",
"return",
"null",
";",
"return",
"statement",
".",
"accept",
"(",
"visitor",
")",
";",
"}"
] | Execute a statement block until the first
return statement is reached.
@param block StatementBlock to evaluate
@return Result of expression evaluate | [
"Execute",
"a",
"statement",
"block",
"until",
"the",
"first",
"return",
"statement",
"is",
"reached",
"."
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2845-L2849 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java | StencilInterpreter.getLocation | ExecutionLocation getLocation(ParserRuleContext object) {
Token start = object.getStart();
return new ExecutionLocation(currentScope.declaringEnvironment.path, start.getLine(), start.getCharPositionInLine() + 1);
} | java | ExecutionLocation getLocation(ParserRuleContext object) {
Token start = object.getStart();
return new ExecutionLocation(currentScope.declaringEnvironment.path, start.getLine(), start.getCharPositionInLine() + 1);
} | [
"ExecutionLocation",
"getLocation",
"(",
"ParserRuleContext",
"object",
")",
"{",
"Token",
"start",
"=",
"object",
".",
"getStart",
"(",
")",
";",
"return",
"new",
"ExecutionLocation",
"(",
"currentScope",
".",
"declaringEnvironment",
".",
"path",
",",
"start",
... | Retrieves location information for a model object
@param object Model object to locate
@return Location for the provided model object | [
"Retrieves",
"location",
"information",
"for",
"a",
"model",
"object"
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilInterpreter.java#L2903-L2906 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/regex/EnumPrefixFinder.java | EnumPrefixFinder.find | public T find(String text)
{
T match = matcher.match(text, true);
if (match != null)
{
String name = match.name();
if (name.substring(0, Math.min(name.length(), text.length())).equalsIgnoreCase(text))
{
return match;
}
}
return null;
} | java | public T find(String text)
{
T match = matcher.match(text, true);
if (match != null)
{
String name = match.name();
if (name.substring(0, Math.min(name.length(), text.length())).equalsIgnoreCase(text))
{
return match;
}
}
return null;
} | [
"public",
"T",
"find",
"(",
"String",
"text",
")",
"{",
"T",
"match",
"=",
"matcher",
".",
"match",
"(",
"text",
",",
"true",
")",
";",
"if",
"(",
"match",
"!=",
"null",
")",
"{",
"String",
"name",
"=",
"match",
".",
"name",
"(",
")",
";",
"if"... | Returns enum for text if it is unique prefix.
@param text
@return | [
"Returns",
"enum",
"for",
"text",
"if",
"it",
"is",
"unique",
"prefix",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/regex/EnumPrefixFinder.java#L70-L82 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/jms/JmsHandler.java | JmsHandler.stop | public static void stop()
throws EFapsException
{
for (final QueueConnection queCon : JmsHandler.QUEUE2QUECONN.values()) {
try {
queCon.close();
} catch (final JMSException e) {
throw new EFapsException("JMSException", e);
}
}
for (final TopicConnection queCon : JmsHandler.TOPIC2QUECONN.values()) {
try {
queCon.close();
} catch (final JMSException e) {
throw new EFapsException("JMSException", e);
}
}
JmsHandler.TOPIC2QUECONN.clear();
JmsHandler.QUEUE2QUECONN.clear();
JmsHandler.NAME2DEF.clear();
} | java | public static void stop()
throws EFapsException
{
for (final QueueConnection queCon : JmsHandler.QUEUE2QUECONN.values()) {
try {
queCon.close();
} catch (final JMSException e) {
throw new EFapsException("JMSException", e);
}
}
for (final TopicConnection queCon : JmsHandler.TOPIC2QUECONN.values()) {
try {
queCon.close();
} catch (final JMSException e) {
throw new EFapsException("JMSException", e);
}
}
JmsHandler.TOPIC2QUECONN.clear();
JmsHandler.QUEUE2QUECONN.clear();
JmsHandler.NAME2DEF.clear();
} | [
"public",
"static",
"void",
"stop",
"(",
")",
"throws",
"EFapsException",
"{",
"for",
"(",
"final",
"QueueConnection",
"queCon",
":",
"JmsHandler",
".",
"QUEUE2QUECONN",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"queCon",
".",
"close",
"(",
")",
";"... | Stop the jms.
@throws EFapsException on error | [
"Stop",
"the",
"jms",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jms/JmsHandler.java#L240-L260 | train |
javabits/yar | yar-api/src/main/java/org/javabits/yar/TimeoutException.java | TimeoutException.getTimeoutMessage | public static String getTimeoutMessage(long timeout, TimeUnit unit) {
return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit"));
} | java | public static String getTimeoutMessage(long timeout, TimeUnit unit) {
return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit"));
} | [
"public",
"static",
"String",
"getTimeoutMessage",
"(",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"String",
".",
"format",
"(",
"\"Timeout of %d %s reached\"",
",",
"timeout",
",",
"requireNonNull",
"(",
"unit",
",",
"\"unit\"",
")",
")",
... | Utility method that produce the message of the timeout.
@param timeout the maximum time to wait.
@param unit the time unit of the timeout argument
@return formatted string that contains the timeout information. | [
"Utility",
"method",
"that",
"produce",
"the",
"message",
"of",
"the",
"timeout",
"."
] | e146a86611ca4831e8334c9a98fd7086cee9c03e | https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-api/src/main/java/org/javabits/yar/TimeoutException.java#L91-L93 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/delete/AbstractDelete.java | AbstractDelete.checkAccess | protected void checkAccess()
throws EFapsException
{
for (final Instance instance : getInstances()) {
if (!instance.getType().hasAccess(instance, AccessTypeEnums.DELETE.getAccessType(), null)) {
LOG.error("Delete not permitted for Person: {} on Instance: {}", Context.getThreadContext().getPerson(),
instance);
throw new EFapsException(getClass(), "execute.NoAccess", instance);
}
}
} | java | protected void checkAccess()
throws EFapsException
{
for (final Instance instance : getInstances()) {
if (!instance.getType().hasAccess(instance, AccessTypeEnums.DELETE.getAccessType(), null)) {
LOG.error("Delete not permitted for Person: {} on Instance: {}", Context.getThreadContext().getPerson(),
instance);
throw new EFapsException(getClass(), "execute.NoAccess", instance);
}
}
} | [
"protected",
"void",
"checkAccess",
"(",
")",
"throws",
"EFapsException",
"{",
"for",
"(",
"final",
"Instance",
"instance",
":",
"getInstances",
"(",
")",
")",
"{",
"if",
"(",
"!",
"instance",
".",
"getType",
"(",
")",
".",
"hasAccess",
"(",
"instance",
... | Check access for all Instances. If one does not have access an error will be thrown.
@throws EFapsException the eFaps exception | [
"Check",
"access",
"for",
"all",
"Instances",
".",
"If",
"one",
"does",
"not",
"have",
"access",
"an",
"error",
"will",
"be",
"thrown",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/delete/AbstractDelete.java#L53-L63 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.set | public void set(double eyeX, double eyeY, double eyeZ,
double centerX, double centerY, double centerZ,
double upX, double upY, double upZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
this.centerX = centerX;
this.centerY = centerY;
this.centerZ = centerZ;
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | java | public void set(double eyeX, double eyeY, double eyeZ,
double centerX, double centerY, double centerZ,
double upX, double upY, double upZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
this.centerX = centerX;
this.centerY = centerY;
this.centerZ = centerZ;
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | [
"public",
"void",
"set",
"(",
"double",
"eyeX",
",",
"double",
"eyeY",
",",
"double",
"eyeZ",
",",
"double",
"centerX",
",",
"double",
"centerY",
",",
"double",
"centerZ",
",",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
")",
"{",
"thi... | Sets the eye position, the center of the scene and which axis is facing upward.
@param eyeX
The x-coordinate for the eye.
@param eyeY
The y-coordinate for the eye.
@param eyeZ
The z-coordinate for the eye.
@param centerX
The x-coordinate for the center of the scene.
@param centerY
The y-coordinate for the center of the scene.
@param centerZ
The z-coordinate for the center of the scene.
@param upX
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upY
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upZ
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0. | [
"Sets",
"the",
"eye",
"position",
"the",
"center",
"of",
"the",
"scene",
"and",
"which",
"axis",
"is",
"facing",
"upward",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L122-L135 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.setEye | public void setEye(double eyeX, double eyeY, double eyeZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
} | java | public void setEye(double eyeX, double eyeY, double eyeZ) {
this.eyeX = eyeX;
this.eyeY = eyeY;
this.eyeZ = eyeZ;
} | [
"public",
"void",
"setEye",
"(",
"double",
"eyeX",
",",
"double",
"eyeY",
",",
"double",
"eyeZ",
")",
"{",
"this",
".",
"eyeX",
"=",
"eyeX",
";",
"this",
".",
"eyeY",
"=",
"eyeY",
";",
"this",
".",
"eyeZ",
"=",
"eyeZ",
";",
"}"
] | Sets the eye position of this Camera.
@param eyeX
The x-coordinate for the eye.
@param eyeY
The y-coordinate for the eye.
@param eyeZ
The z-coordinate for the eye. | [
"Sets",
"the",
"eye",
"position",
"of",
"this",
"Camera",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L147-L151 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.setCenter | public void setCenter(double centerX, double centerY, double centerZ) {
this.centerX = centerX;
this.centerY = centerY;
this.centerZ = centerZ;
} | java | public void setCenter(double centerX, double centerY, double centerZ) {
this.centerX = centerX;
this.centerY = centerY;
this.centerZ = centerZ;
} | [
"public",
"void",
"setCenter",
"(",
"double",
"centerX",
",",
"double",
"centerY",
",",
"double",
"centerZ",
")",
"{",
"this",
".",
"centerX",
"=",
"centerX",
";",
"this",
".",
"centerY",
"=",
"centerY",
";",
"this",
".",
"centerZ",
"=",
"centerZ",
";",
... | Sets the center of the scene of this Camera.
@param centerX
The x-coordinate for the center of the scene.
@param centerY
The y-coordinate for the center of the scene.
@param centerZ
The z-coordinate for the center of the scene. | [
"Sets",
"the",
"center",
"of",
"the",
"scene",
"of",
"this",
"Camera",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L163-L167 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.setOrientation | public void setOrientation(double upX, double upY, double upZ) {
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | java | public void setOrientation(double upX, double upY, double upZ) {
this.upX = upX;
this.upY = upY;
this.upZ = upZ;
} | [
"public",
"void",
"setOrientation",
"(",
"double",
"upX",
",",
"double",
"upY",
",",
"double",
"upZ",
")",
"{",
"this",
".",
"upX",
"=",
"upX",
";",
"this",
".",
"upY",
"=",
"upY",
";",
"this",
".",
"upZ",
"=",
"upZ",
";",
"}"
] | Sets which axis is facing upward.
@param upX
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upY
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0.
@param upZ
Setting which axis is facing upward; usually 0.0, 1.0, or -1.0. | [
"Sets",
"which",
"axis",
"is",
"facing",
"upward",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L179-L183 | train |
casmi/casmi | src/main/java/casmi/graphics/object/Camera.java | Camera.getCameraDirection | public double[] getCameraDirection() {
double[] cameraDirection = new double[3];
double l = Math.sqrt(Math.pow(this.eyeX - this.centerX, 2.0) + Math.pow(this.eyeZ - this.centerZ, 2.0) + Math.pow(this.eyeZ - this.centerZ, 2.0));
cameraDirection[0] = (this.centerX - this.eyeX) / l;
cameraDirection[1] = (this.centerY - this.eyeY) / l;
cameraDirection[2] = (this.centerZ - this.eyeZ) / l;
return cameraDirection;
} | java | public double[] getCameraDirection() {
double[] cameraDirection = new double[3];
double l = Math.sqrt(Math.pow(this.eyeX - this.centerX, 2.0) + Math.pow(this.eyeZ - this.centerZ, 2.0) + Math.pow(this.eyeZ - this.centerZ, 2.0));
cameraDirection[0] = (this.centerX - this.eyeX) / l;
cameraDirection[1] = (this.centerY - this.eyeY) / l;
cameraDirection[2] = (this.centerZ - this.eyeZ) / l;
return cameraDirection;
} | [
"public",
"double",
"[",
"]",
"getCameraDirection",
"(",
")",
"{",
"double",
"[",
"]",
"cameraDirection",
"=",
"new",
"double",
"[",
"3",
"]",
";",
"double",
"l",
"=",
"Math",
".",
"sqrt",
"(",
"Math",
".",
"pow",
"(",
"this",
".",
"eyeX",
"-",
"th... | Gets the eye direction of this Camera.
@return
The eye direction. | [
"Gets",
"the",
"eye",
"direction",
"of",
"this",
"Camera",
"."
] | 90f6514a9cbce0685186e7a92beb69e22a3b11c4 | https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/object/Camera.java#L323-L330 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/rest/AbstractRest.java | AbstractRest.hasAccess | protected boolean hasAccess()
throws EFapsException
{
//Admin_REST
return Context.getThreadContext().getPerson().isAssigned(Role.get(
UUID.fromString("2d142645-140d-46ad-af67-835161a8d732")));
} | java | protected boolean hasAccess()
throws EFapsException
{
//Admin_REST
return Context.getThreadContext().getPerson().isAssigned(Role.get(
UUID.fromString("2d142645-140d-46ad-af67-835161a8d732")));
} | [
"protected",
"boolean",
"hasAccess",
"(",
")",
"throws",
"EFapsException",
"{",
"//Admin_REST",
"return",
"Context",
".",
"getThreadContext",
"(",
")",
".",
"getPerson",
"(",
")",
".",
"isAssigned",
"(",
"Role",
".",
"get",
"(",
"UUID",
".",
"fromString",
"(... | Check if the logged in users has access to rest.
User must be assigned to the Role "Admin_Rest".
@return true if user is assigned to Roles "Admin_Rest", else false
@throws EFapsException on error | [
"Check",
"if",
"the",
"logged",
"in",
"users",
"has",
"access",
"to",
"rest",
".",
"User",
"must",
"be",
"assigned",
"to",
"the",
"Role",
"Admin_Rest",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/rest/AbstractRest.java#L55-L61 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/rest/AbstractRest.java | AbstractRest.getJSONReply | protected String getJSONReply(final Object _jsonObject)
{
String ret = "";
final ObjectMapper mapper = new ObjectMapper();
if (LOG.isDebugEnabled()) {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.registerModule(new JodaModule());
try {
ret = mapper.writeValueAsString(_jsonObject);
} catch (final JsonProcessingException e) {
LOG.error("Catched JsonProcessingException", e);
}
return ret;
} | java | protected String getJSONReply(final Object _jsonObject)
{
String ret = "";
final ObjectMapper mapper = new ObjectMapper();
if (LOG.isDebugEnabled()) {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
}
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.registerModule(new JodaModule());
try {
ret = mapper.writeValueAsString(_jsonObject);
} catch (final JsonProcessingException e) {
LOG.error("Catched JsonProcessingException", e);
}
return ret;
} | [
"protected",
"String",
"getJSONReply",
"(",
"final",
"Object",
"_jsonObject",
")",
"{",
"String",
"ret",
"=",
"\"\"",
";",
"final",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",... | Gets the JSON reply.
@param _jsonObject the _json object
@return the JSON reply
@throws JsonProcessingException the json processing exception | [
"Gets",
"the",
"JSON",
"reply",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/rest/AbstractRest.java#L70-L85 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/jms/JmsSession.java | JmsSession.login | public static String login(final String _userName,
final String _passwd,
final String _applicationKey)
throws EFapsException
{
String ret = null;
if (JmsSession.checkLogin(_userName, _passwd, _applicationKey)) {
final JmsSession session = new JmsSession(_userName);
JmsSession.CACHE.put(session.getSessionKey(), session);
ret = session.getSessionKey();
}
return ret;
} | java | public static String login(final String _userName,
final String _passwd,
final String _applicationKey)
throws EFapsException
{
String ret = null;
if (JmsSession.checkLogin(_userName, _passwd, _applicationKey)) {
final JmsSession session = new JmsSession(_userName);
JmsSession.CACHE.put(session.getSessionKey(), session);
ret = session.getSessionKey();
}
return ret;
} | [
"public",
"static",
"String",
"login",
"(",
"final",
"String",
"_userName",
",",
"final",
"String",
"_passwd",
",",
"final",
"String",
"_applicationKey",
")",
"throws",
"EFapsException",
"{",
"String",
"ret",
"=",
"null",
";",
"if",
"(",
"JmsSession",
".",
"... | Login and create a Session.
@param _userName Name of the user to login
@param _passwd Password of the user to login
@param _applicationKey key of the application that requests
@return SessionKey if login successful, else null
@throws EFapsException on error | [
"Login",
"and",
"create",
"a",
"Session",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/jms/JmsSession.java#L214-L226 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/ChecksumWrapper.java | ChecksumWrapper.update | void update(long index, int b)
{
if (size > 0)
{
assert index <= hi;
if (index < lo)
{
throw new IllegalStateException("lookaheadLength() too small in ChecksumProvider implementation");
}
hi = index;
if ((lo == hi - size))
{
checksum.update(lookahead[(int)(lo % size)]);
lo++;
}
lookahead[(int)(hi++ % size)] = b;
}
else
{
if (index == hi)
{
checksum.update(b);
hi = index+1;
}
else
{
if (index != hi -1)
{
throw new IllegalStateException("lookahead needed for checksum");
}
}
}
} | java | void update(long index, int b)
{
if (size > 0)
{
assert index <= hi;
if (index < lo)
{
throw new IllegalStateException("lookaheadLength() too small in ChecksumProvider implementation");
}
hi = index;
if ((lo == hi - size))
{
checksum.update(lookahead[(int)(lo % size)]);
lo++;
}
lookahead[(int)(hi++ % size)] = b;
}
else
{
if (index == hi)
{
checksum.update(b);
hi = index+1;
}
else
{
if (index != hi -1)
{
throw new IllegalStateException("lookahead needed for checksum");
}
}
}
} | [
"void",
"update",
"(",
"long",
"index",
",",
"int",
"b",
")",
"{",
"if",
"(",
"size",
">",
"0",
")",
"{",
"assert",
"index",
"<=",
"hi",
";",
"if",
"(",
"index",
"<",
"lo",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"lookaheadLength() ... | Update with character index.
@param index
@param b | [
"Update",
"with",
"character",
"index",
"."
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/ChecksumWrapper.java#L56-L88 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java | AbstractSourceImporter.execute | public void execute()
throws InstallationException
{
Instance instance = searchInstance();
if (instance == null) {
instance = createInstance();
}
updateDB(instance);
} | java | public void execute()
throws InstallationException
{
Instance instance = searchInstance();
if (instance == null) {
instance = createInstance();
}
updateDB(instance);
} | [
"public",
"void",
"execute",
"(",
")",
"throws",
"InstallationException",
"{",
"Instance",
"instance",
"=",
"searchInstance",
"(",
")",
";",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"instance",
"=",
"createInstance",
"(",
")",
";",
"}",
"updateDB",
"... | Import related source code into the eFaps DataBase. If the source code
does not exists, the source code is created in eFaps.
@throws InstallationException on error
@see #searchInstance()
@see #createInstance()
@see #updateDB(Instance) | [
"Import",
"related",
"source",
"code",
"into",
"the",
"eFaps",
"DataBase",
".",
"If",
"the",
"source",
"code",
"does",
"not",
"exists",
"the",
"source",
"code",
"is",
"created",
"in",
"eFaps",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java#L174-L182 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java | AbstractSourceImporter.createInstance | protected Instance createInstance()
throws InstallationException
{
final Insert insert;
try {
insert = new Insert(getCiType());
insert.add("Name", this.programName);
if (getEFapsUUID() != null) {
insert.add("UUID", getEFapsUUID().toString());
}
insert.execute();
} catch (final EFapsException e) {
throw new InstallationException("Could not create " + getCiType() + " " + getProgramName(), e);
}
return insert.getInstance();
} | java | protected Instance createInstance()
throws InstallationException
{
final Insert insert;
try {
insert = new Insert(getCiType());
insert.add("Name", this.programName);
if (getEFapsUUID() != null) {
insert.add("UUID", getEFapsUUID().toString());
}
insert.execute();
} catch (final EFapsException e) {
throw new InstallationException("Could not create " + getCiType() + " " + getProgramName(), e);
}
return insert.getInstance();
} | [
"protected",
"Instance",
"createInstance",
"(",
")",
"throws",
"InstallationException",
"{",
"final",
"Insert",
"insert",
";",
"try",
"{",
"insert",
"=",
"new",
"Insert",
"(",
"getCiType",
"(",
")",
")",
";",
"insert",
".",
"add",
"(",
"\"Name\"",
",",
"th... | Creates an instance of a source object in eFaps for given name.
@return new created instance
@throws InstallationException on error
@see #programName | [
"Creates",
"an",
"instance",
"of",
"a",
"source",
"object",
"in",
"eFaps",
"for",
"given",
"name",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java#L218-L233 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java | AbstractSourceImporter.updateDB | public void updateDB(final Instance _instance)
throws InstallationException
{
try {
final InputStream is = newCodeInputStream();
final Checkin checkin = new Checkin(_instance);
checkin.executeWithoutAccessCheck(getProgramName(), is, is.available());
} catch (final UnsupportedEncodingException e) {
throw new InstallationException("Encoding failed for " + this.programName, e);
} catch (final EFapsException e) {
throw new InstallationException("Could not check in " + this.programName, e);
} catch (final IOException e) {
throw new InstallationException("Reading from inoutstream faild for " + this.programName, e);
}
} | java | public void updateDB(final Instance _instance)
throws InstallationException
{
try {
final InputStream is = newCodeInputStream();
final Checkin checkin = new Checkin(_instance);
checkin.executeWithoutAccessCheck(getProgramName(), is, is.available());
} catch (final UnsupportedEncodingException e) {
throw new InstallationException("Encoding failed for " + this.programName, e);
} catch (final EFapsException e) {
throw new InstallationException("Could not check in " + this.programName, e);
} catch (final IOException e) {
throw new InstallationException("Reading from inoutstream faild for " + this.programName, e);
}
} | [
"public",
"void",
"updateDB",
"(",
"final",
"Instance",
"_instance",
")",
"throws",
"InstallationException",
"{",
"try",
"{",
"final",
"InputStream",
"is",
"=",
"newCodeInputStream",
"(",
")",
";",
"final",
"Checkin",
"checkin",
"=",
"new",
"Checkin",
"(",
"_i... | Stores the read source code in eFaps. This is done with a check in.
@param _instance instance (object id) of the source code object
in eFaps
@throws InstallationException if source code in eFaps could not
updated or the source code could not encoded | [
"Stores",
"the",
"read",
"source",
"code",
"in",
"eFaps",
".",
"This",
"is",
"done",
"with",
"a",
"check",
"in",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/update/schema/program/AbstractSourceImporter.java#L243-L257 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/init/StartupDatabaseConnection.java | StartupDatabaseConnection.startup | public static void startup(final String _classDBType,
final String _classDSFactory,
final String _propConnection,
final String _classTM,
final String _classTSR,
final String _eFapsProps)
throws StartupException
{
StartupDatabaseConnection.startup(_classDBType,
_classDSFactory,
StartupDatabaseConnection.convertToMap(_propConnection),
_classTM,
_classTSR,
StartupDatabaseConnection.convertToMap(_eFapsProps));
} | java | public static void startup(final String _classDBType,
final String _classDSFactory,
final String _propConnection,
final String _classTM,
final String _classTSR,
final String _eFapsProps)
throws StartupException
{
StartupDatabaseConnection.startup(_classDBType,
_classDSFactory,
StartupDatabaseConnection.convertToMap(_propConnection),
_classTM,
_classTSR,
StartupDatabaseConnection.convertToMap(_eFapsProps));
} | [
"public",
"static",
"void",
"startup",
"(",
"final",
"String",
"_classDBType",
",",
"final",
"String",
"_classDSFactory",
",",
"final",
"String",
"_propConnection",
",",
"final",
"String",
"_classTM",
",",
"final",
"String",
"_classTSR",
",",
"final",
"String",
... | Initialize the database information set for given parameter values.
@param _classDBType class name of the database type
@param _classDSFactory class name of the SQL data source factory
@param _propConnection string with properties for the JDBC connection
@param _classTM class name of the transaction manager
@param _classTSR class name of TransactionSynchronizationRegistry
@param _eFapsProps tring with properties
@throws StartupException if the database connection or transaction manager could not be initialized
@see StartupDatabaseConnection#startup(String, String, Map, String, Integer)
@see StartupDatabaseConnection#convertToMap(String) | [
"Initialize",
"the",
"database",
"information",
"set",
"for",
"given",
"parameter",
"values",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/init/StartupDatabaseConnection.java#L252-L266 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/init/StartupDatabaseConnection.java | StartupDatabaseConnection.configureEFapsProperties | protected static void configureEFapsProperties(final Context _compCtx,
final Map<String, String> _eFapsProps)
throws StartupException
{
try {
Util.bind(_compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES, _eFapsProps);
} catch (final NamingException e) {
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
}
} | java | protected static void configureEFapsProperties(final Context _compCtx,
final Map<String, String> _eFapsProps)
throws StartupException
{
try {
Util.bind(_compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES, _eFapsProps);
} catch (final NamingException e) {
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
// CHECKSTYLE:OFF
} catch (final Exception e) {
// CHECKSTYLE:ON
throw new StartupException("could not bind eFaps Properties '" + _eFapsProps + "'", e);
}
} | [
"protected",
"static",
"void",
"configureEFapsProperties",
"(",
"final",
"Context",
"_compCtx",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"_eFapsProps",
")",
"throws",
"StartupException",
"{",
"try",
"{",
"Util",
".",
"bind",
"(",
"_compCtx",
","... | Add the eFaps Properties to the JNDI binding.
@param _compCtx Java root naming context
@param _eFapsProps Properties to bind
@throws StartupException on error | [
"Add",
"the",
"eFaps",
"Properties",
"to",
"the",
"JNDI",
"binding",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/init/StartupDatabaseConnection.java#L349-L362 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/init/StartupDatabaseConnection.java | StartupDatabaseConnection.shutdown | public static void shutdown()
throws StartupException
{
final Context compCtx;
try {
final InitialContext context = new InitialContext();
compCtx = (javax.naming.Context) context.lookup("java:comp");
} catch (final NamingException e) {
throw new StartupException("Could not initialize JNDI", e);
}
try {
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_DATASOURCE);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_DBTYPE);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_TRANSMANAG);
} catch (final NamingException e) {
throw new StartupException("unbind of the database connection failed", e);
}
} | java | public static void shutdown()
throws StartupException
{
final Context compCtx;
try {
final InitialContext context = new InitialContext();
compCtx = (javax.naming.Context) context.lookup("java:comp");
} catch (final NamingException e) {
throw new StartupException("Could not initialize JNDI", e);
}
try {
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_DATASOURCE);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_DBTYPE);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_CONFIGPROPERTIES);
Util.unbind(compCtx, "env/" + INamingBinds.RESOURCE_TRANSMANAG);
} catch (final NamingException e) {
throw new StartupException("unbind of the database connection failed", e);
}
} | [
"public",
"static",
"void",
"shutdown",
"(",
")",
"throws",
"StartupException",
"{",
"final",
"Context",
"compCtx",
";",
"try",
"{",
"final",
"InitialContext",
"context",
"=",
"new",
"InitialContext",
"(",
")",
";",
"compCtx",
"=",
"(",
"javax",
".",
"naming... | Shutdowns the connection to the database.
@throws StartupException if shutdown failed | [
"Shutdowns",
"the",
"connection",
"to",
"the",
"database",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/init/StartupDatabaseConnection.java#L552-L570 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/wrapper/AbstractSQLInsertUpdate.java | AbstractSQLInsertUpdate.columnWithCurrentTimestamp | @SuppressWarnings("unchecked")
public STMT columnWithCurrentTimestamp(final String _columnName)
{
this.columnWithSQLValues.add(
new AbstractSQLInsertUpdate.ColumnWithSQLValue(_columnName,
Context.getDbType().getCurrentTimeStamp()));
return (STMT) this;
} | java | @SuppressWarnings("unchecked")
public STMT columnWithCurrentTimestamp(final String _columnName)
{
this.columnWithSQLValues.add(
new AbstractSQLInsertUpdate.ColumnWithSQLValue(_columnName,
Context.getDbType().getCurrentTimeStamp()));
return (STMT) this;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"STMT",
"columnWithCurrentTimestamp",
"(",
"final",
"String",
"_columnName",
")",
"{",
"this",
".",
"columnWithSQLValues",
".",
"add",
"(",
"new",
"AbstractSQLInsertUpdate",
".",
"ColumnWithSQLValue",
"(",
... | Adds a new column which will have the current time stamp to append.
@param _columnName name of column to append for which current time
stamp must be set
@return this SQL update instance | [
"Adds",
"a",
"new",
"column",
"which",
"will",
"have",
"the",
"current",
"time",
"stamp",
"to",
"append",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/wrapper/AbstractSQLInsertUpdate.java#L131-L138 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/eql/InvokerUtil.java | InvokerUtil.getInvoker | public static EQLInvoker getInvoker()
{
final EQLInvoker ret = new EQLInvoker()
{
@Override
protected AbstractPrintStmt getPrint()
{
return new PrintStmt();
}
@Override
protected AbstractInsertStmt getInsert()
{
return new InsertStmt();
}
@Override
protected AbstractExecStmt getExec()
{
return new ExecStmt();
}
@Override
protected AbstractUpdateStmt getUpdate()
{
return new UpdateStmt();
}
@Override
protected AbstractDeleteStmt getDelete()
{
return new DeleteStmt();
}
@Override
protected INestedQueryStmtPart getNestedQuery()
{
return super.getNestedQuery();
}
@Override
protected AbstractCIPrintStmt getCIPrint()
{
return new CIPrintStmt();
}
};
ret.getValidator().setDiagnosticClazz(EFapsDiagnostic.class);
ret.getValidator().addValidation("EQLJavaValidator.type", new TypeValidation());
return ret;
} | java | public static EQLInvoker getInvoker()
{
final EQLInvoker ret = new EQLInvoker()
{
@Override
protected AbstractPrintStmt getPrint()
{
return new PrintStmt();
}
@Override
protected AbstractInsertStmt getInsert()
{
return new InsertStmt();
}
@Override
protected AbstractExecStmt getExec()
{
return new ExecStmt();
}
@Override
protected AbstractUpdateStmt getUpdate()
{
return new UpdateStmt();
}
@Override
protected AbstractDeleteStmt getDelete()
{
return new DeleteStmt();
}
@Override
protected INestedQueryStmtPart getNestedQuery()
{
return super.getNestedQuery();
}
@Override
protected AbstractCIPrintStmt getCIPrint()
{
return new CIPrintStmt();
}
};
ret.getValidator().setDiagnosticClazz(EFapsDiagnostic.class);
ret.getValidator().addValidation("EQLJavaValidator.type", new TypeValidation());
return ret;
} | [
"public",
"static",
"EQLInvoker",
"getInvoker",
"(",
")",
"{",
"final",
"EQLInvoker",
"ret",
"=",
"new",
"EQLInvoker",
"(",
")",
"{",
"@",
"Override",
"protected",
"AbstractPrintStmt",
"getPrint",
"(",
")",
"{",
"return",
"new",
"PrintStmt",
"(",
")",
";",
... | Gets the invoker.
@return the invoker | [
"Gets",
"the",
"invoker",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/eql/InvokerUtil.java#L54-L103 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/stmt/filter/Filter.java | Filter.append2SQLSelect | public void append2SQLSelect(final SQLSelect _sqlSelect)
{
if (iWhere != null) {
final SQLWhere sqlWhere = _sqlSelect.getWhere();
for (final IWhereTerm<?> term : iWhere.getTerms()) {
if (term instanceof IWhereElementTerm) {
final IWhereElement element = ((IWhereElementTerm) term).getElement();
if (element.getAttribute() != null)
{
final String attrName = element.getAttribute();
for (final Type type : types) {
final Attribute attr = type.getAttribute(attrName);
if (attr != null) {
addAttr(_sqlSelect, sqlWhere, attr, term, element);
break;
}
}
} else if (element.getSelect() != null) {
final IWhereSelect select = element.getSelect();
for (final ISelectElement ele : select.getElements()) {
if (ele instanceof IBaseSelectElement) {
switch (((IBaseSelectElement) ele).getElement()) {
case STATUS:
for (final Type type : types) {
final Attribute attr = type.getStatusAttribute();
if (attr != null) {
addAttr(_sqlSelect, sqlWhere, attr, term, element);
break;
}
}
break;
default:
break;
}
} else if (ele instanceof IAttributeSelectElement) {
final String attrName = ((IAttributeSelectElement) ele).getName();
for (final Type type : types) {
addAttr(_sqlSelect, sqlWhere, type.getAttribute(attrName), term, element);
}
}
}
}
}
}
}
if (iOrder != null) {
final SQLOrder sqlOrder = _sqlSelect.getOrder();
for (final IOrderElement element: iOrder.getElements()) {
for (final Type type : types) {
final Attribute attr = type.getAttribute(element.getKey());
if (attr != null) {
final SQLTable table = attr.getTable();
final String tableName = table.getSqlTable();
final TableIdx tableidx = _sqlSelect.getIndexer().getTableIdx(tableName);
sqlOrder.addElement(tableidx.getIdx(), attr.getSqlColNames(), element.isDesc());
break;
}
}
}
}
} | java | public void append2SQLSelect(final SQLSelect _sqlSelect)
{
if (iWhere != null) {
final SQLWhere sqlWhere = _sqlSelect.getWhere();
for (final IWhereTerm<?> term : iWhere.getTerms()) {
if (term instanceof IWhereElementTerm) {
final IWhereElement element = ((IWhereElementTerm) term).getElement();
if (element.getAttribute() != null)
{
final String attrName = element.getAttribute();
for (final Type type : types) {
final Attribute attr = type.getAttribute(attrName);
if (attr != null) {
addAttr(_sqlSelect, sqlWhere, attr, term, element);
break;
}
}
} else if (element.getSelect() != null) {
final IWhereSelect select = element.getSelect();
for (final ISelectElement ele : select.getElements()) {
if (ele instanceof IBaseSelectElement) {
switch (((IBaseSelectElement) ele).getElement()) {
case STATUS:
for (final Type type : types) {
final Attribute attr = type.getStatusAttribute();
if (attr != null) {
addAttr(_sqlSelect, sqlWhere, attr, term, element);
break;
}
}
break;
default:
break;
}
} else if (ele instanceof IAttributeSelectElement) {
final String attrName = ((IAttributeSelectElement) ele).getName();
for (final Type type : types) {
addAttr(_sqlSelect, sqlWhere, type.getAttribute(attrName), term, element);
}
}
}
}
}
}
}
if (iOrder != null) {
final SQLOrder sqlOrder = _sqlSelect.getOrder();
for (final IOrderElement element: iOrder.getElements()) {
for (final Type type : types) {
final Attribute attr = type.getAttribute(element.getKey());
if (attr != null) {
final SQLTable table = attr.getTable();
final String tableName = table.getSqlTable();
final TableIdx tableidx = _sqlSelect.getIndexer().getTableIdx(tableName);
sqlOrder.addElement(tableidx.getIdx(), attr.getSqlColNames(), element.isDesc());
break;
}
}
}
}
} | [
"public",
"void",
"append2SQLSelect",
"(",
"final",
"SQLSelect",
"_sqlSelect",
")",
"{",
"if",
"(",
"iWhere",
"!=",
"null",
")",
"{",
"final",
"SQLWhere",
"sqlWhere",
"=",
"_sqlSelect",
".",
"getWhere",
"(",
")",
";",
"for",
"(",
"final",
"IWhereTerm",
"<"... | Append two SQL select.
@param _sqlSelect the sql select | [
"Append",
"two",
"SQL",
"select",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/filter/Filter.java#L87-L147 | train |
labai/ted | ted-driver/src/main/java/ted/driver/sys/PrimeInstance.java | PrimeInstance.init | void init() {
if (! isEnabled()) {
loggerConfig.info("Ted prime instance check is disabled");
return;
}
this.primeTaskId = context.tedDaoExt.findPrimeTaskId();
int periodMs = context.config.intervalDriverMs();
this.postponeSec = (int)Math.round((1.0 * periodMs * TICK_SKIP_COUNT + 500 + 500) / 1000); // 500ms reserve, 500 for rounding up
becomePrime();
loggerConfig.info("Ted prime instance check is enabled, primeTaskId={} isPrime={} postponeSec={}", primeTaskId, isPrime, postponeSec);
initiated = true;
} | java | void init() {
if (! isEnabled()) {
loggerConfig.info("Ted prime instance check is disabled");
return;
}
this.primeTaskId = context.tedDaoExt.findPrimeTaskId();
int periodMs = context.config.intervalDriverMs();
this.postponeSec = (int)Math.round((1.0 * periodMs * TICK_SKIP_COUNT + 500 + 500) / 1000); // 500ms reserve, 500 for rounding up
becomePrime();
loggerConfig.info("Ted prime instance check is enabled, primeTaskId={} isPrime={} postponeSec={}", primeTaskId, isPrime, postponeSec);
initiated = true;
} | [
"void",
"init",
"(",
")",
"{",
"if",
"(",
"!",
"isEnabled",
"(",
")",
")",
"{",
"loggerConfig",
".",
"info",
"(",
"\"Ted prime instance check is disabled\"",
")",
";",
"return",
";",
"}",
"this",
".",
"primeTaskId",
"=",
"context",
".",
"tedDaoExt",
".",
... | after configs read | [
"after",
"configs",
"read"
] | 2ee197246a78d842c18d6780c48fd903b00608a6 | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/PrimeInstance.java#L63-L77 | train |
impossibl/stencil | engine/src/main/java/com/impossibl/stencil/api/impl/URLTemplateSourceLoader.java | URLTemplateSourceLoader.find | @Override
public TemplateSource find(String path) throws IOException {
return new URLTemplateSource(new URL("file", null, path));
} | java | @Override
public TemplateSource find(String path) throws IOException {
return new URLTemplateSource(new URL("file", null, path));
} | [
"@",
"Override",
"public",
"TemplateSource",
"find",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"return",
"new",
"URLTemplateSource",
"(",
"new",
"URL",
"(",
"\"file\"",
",",
"null",
",",
"path",
")",
")",
";",
"}"
] | Maps the given path to a file URL and builds a URLTemplateSource for
it.
@return URLTemplateSource for the path
@see URLTemplateSource | [
"Maps",
"the",
"given",
"path",
"to",
"a",
"file",
"URL",
"and",
"builds",
"a",
"URLTemplateSource",
"for",
"it",
"."
] | 4aac1be605542b4248be95bf8916be4e2f755d1c | https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/api/impl/URLTemplateSourceLoader.java#L23-L26 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/program/bundle/BundleMaker.java | BundleMaker.initialize | public static void initialize()
throws CacheReloadException
{
if (InfinispanCache.get().exists(BundleMaker.NAMECACHE)) {
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE).clear();
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE).clear();
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP).clear();
} else {
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE)
.addListener(new CacheLogListener(BundleMaker.LOG));
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE)
.addListener(new CacheLogListener(BundleMaker.LOG));
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP)
.addListener(new CacheLogListener(BundleMaker.LOG));
}
} | java | public static void initialize()
throws CacheReloadException
{
if (InfinispanCache.get().exists(BundleMaker.NAMECACHE)) {
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE).clear();
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE).clear();
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP).clear();
} else {
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.NAMECACHE)
.addListener(new CacheLogListener(BundleMaker.LOG));
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLE)
.addListener(new CacheLogListener(BundleMaker.LOG));
InfinispanCache.get().<UUID, Type>getCache(BundleMaker.CACHE4BUNDLEMAP)
.addListener(new CacheLogListener(BundleMaker.LOG));
}
} | [
"public",
"static",
"void",
"initialize",
"(",
")",
"throws",
"CacheReloadException",
"{",
"if",
"(",
"InfinispanCache",
".",
"get",
"(",
")",
".",
"exists",
"(",
"BundleMaker",
".",
"NAMECACHE",
")",
")",
"{",
"InfinispanCache",
".",
"get",
"(",
")",
".",... | Init this class.
@throws CacheReloadException on error | [
"Init",
"this",
"class",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/program/bundle/BundleMaker.java#L80-L95 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/program/bundle/BundleMaker.java | BundleMaker.containsKey | public static boolean containsKey(final String _key)
{
final Cache<String, BundleInterface> cache = InfinispanCache.get()
.<String, BundleInterface>getIgnReCache(BundleMaker.CACHE4BUNDLE);
return cache.containsKey(_key);
} | java | public static boolean containsKey(final String _key)
{
final Cache<String, BundleInterface> cache = InfinispanCache.get()
.<String, BundleInterface>getIgnReCache(BundleMaker.CACHE4BUNDLE);
return cache.containsKey(_key);
} | [
"public",
"static",
"boolean",
"containsKey",
"(",
"final",
"String",
"_key",
")",
"{",
"final",
"Cache",
"<",
"String",
",",
"BundleInterface",
">",
"cache",
"=",
"InfinispanCache",
".",
"get",
"(",
")",
".",
"<",
"String",
",",
"BundleInterface",
">",
"g... | Does a Bundle for the Key exist.
@param _key key to search for
@return true if found, else false | [
"Does",
"a",
"Bundle",
"for",
"the",
"Key",
"exist",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/program/bundle/BundleMaker.java#L137-L142 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/program/bundle/BundleMaker.java | BundleMaker.createNewKey | private static String createNewKey(final List<String> _names,
final Class<?> _bundleclass)
throws EFapsException
{
final StringBuilder builder = new StringBuilder();
final List<String> oids = new ArrayList<>();
String ret = null;
try {
for (final String name : _names) {
if (builder.length() > 0) {
builder.append("-");
}
final Cache<String, StaticCompiledSource> cache = InfinispanCache.get()
.<String, StaticCompiledSource>getIgnReCache(BundleMaker.NAMECACHE);
if (!cache.containsKey(name)) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.StaticCompiled);
queryBldr.addWhereAttrEqValue(CIAdminProgram.StaticCompiled.Name, name);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminProgram.StaticCompiled.Name);
multi.execute();
while (multi.next()) {
final String statName = multi.<String>getAttribute(CIAdminProgram.StaticCompiled.Name);
final StaticCompiledSource source = new StaticCompiledSource(multi.getCurrentInstance()
.getOid(),
statName);
cache.put(source.getName(), source);
}
}
if (cache.containsKey(name)) {
final String oid = cache.get(name).getOid();
builder.append(oid);
oids.add(oid);
}
}
ret = builder.toString();
final BundleInterface bundle =
(BundleInterface) _bundleclass.newInstance();
bundle.setKey(ret, oids);
final Cache<String, BundleInterface> cache = InfinispanCache.get()
.<String, BundleInterface>getIgnReCache(BundleMaker.CACHE4BUNDLE);
cache.put(ret, bundle);
} catch (final InstantiationException e) {
throw new EFapsException(BundleMaker.class,
"createNewKey.InstantiationException", e, _bundleclass);
} catch (final IllegalAccessException e) {
throw new EFapsException(BundleMaker.class,
"createNewKey.IllegalAccessException", e, _bundleclass);
}
return ret;
} | java | private static String createNewKey(final List<String> _names,
final Class<?> _bundleclass)
throws EFapsException
{
final StringBuilder builder = new StringBuilder();
final List<String> oids = new ArrayList<>();
String ret = null;
try {
for (final String name : _names) {
if (builder.length() > 0) {
builder.append("-");
}
final Cache<String, StaticCompiledSource> cache = InfinispanCache.get()
.<String, StaticCompiledSource>getIgnReCache(BundleMaker.NAMECACHE);
if (!cache.containsKey(name)) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.StaticCompiled);
queryBldr.addWhereAttrEqValue(CIAdminProgram.StaticCompiled.Name, name);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminProgram.StaticCompiled.Name);
multi.execute();
while (multi.next()) {
final String statName = multi.<String>getAttribute(CIAdminProgram.StaticCompiled.Name);
final StaticCompiledSource source = new StaticCompiledSource(multi.getCurrentInstance()
.getOid(),
statName);
cache.put(source.getName(), source);
}
}
if (cache.containsKey(name)) {
final String oid = cache.get(name).getOid();
builder.append(oid);
oids.add(oid);
}
}
ret = builder.toString();
final BundleInterface bundle =
(BundleInterface) _bundleclass.newInstance();
bundle.setKey(ret, oids);
final Cache<String, BundleInterface> cache = InfinispanCache.get()
.<String, BundleInterface>getIgnReCache(BundleMaker.CACHE4BUNDLE);
cache.put(ret, bundle);
} catch (final InstantiationException e) {
throw new EFapsException(BundleMaker.class,
"createNewKey.InstantiationException", e, _bundleclass);
} catch (final IllegalAccessException e) {
throw new EFapsException(BundleMaker.class,
"createNewKey.IllegalAccessException", e, _bundleclass);
}
return ret;
} | [
"private",
"static",
"String",
"createNewKey",
"(",
"final",
"List",
"<",
"String",
">",
"_names",
",",
"final",
"Class",
"<",
"?",
">",
"_bundleclass",
")",
"throws",
"EFapsException",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"("... | Creates a new Key and instantiates the BundleInterface.
@param _names List of Names representing StaticSources
@param _bundleclass The Class to be instantiated
@return the Key to a Bundle
@throws EFapsException on error | [
"Creates",
"a",
"new",
"Key",
"and",
"instantiates",
"the",
"BundleInterface",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/program/bundle/BundleMaker.java#L184-L236 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/runlevel/RunLevel.java | RunLevel.init | public static void init(final String _runLevel)
throws EFapsException
{
RunLevel.ALL_RUNLEVELS.clear();
RunLevel.RUNLEVEL = new RunLevel(_runLevel);
} | java | public static void init(final String _runLevel)
throws EFapsException
{
RunLevel.ALL_RUNLEVELS.clear();
RunLevel.RUNLEVEL = new RunLevel(_runLevel);
} | [
"public",
"static",
"void",
"init",
"(",
"final",
"String",
"_runLevel",
")",
"throws",
"EFapsException",
"{",
"RunLevel",
".",
"ALL_RUNLEVELS",
".",
"clear",
"(",
")",
";",
"RunLevel",
".",
"RUNLEVEL",
"=",
"new",
"RunLevel",
"(",
"_runLevel",
")",
";",
"... | The static method first removes all values in the caches. Then the cache
is initialized automatically depending on the desired RunLevel
@param _runLevel name of run level to initialize
@throws EFapsException on error | [
"The",
"static",
"method",
"first",
"removes",
"all",
"values",
"in",
"the",
"caches",
".",
"Then",
"the",
"cache",
"is",
"initialized",
"automatically",
"depending",
"on",
"the",
"desired",
"RunLevel"
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/runlevel/RunLevel.java#L155-L160 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/runlevel/RunLevel.java | RunLevel.getAllInitializers | private List<String> getAllInitializers()
{
final List<String> ret = new ArrayList<>();
for (final CacheMethod cacheMethod : this.cacheMethods) {
ret.add(cacheMethod.className);
}
if (this.parent != null) {
ret.addAll(this.parent.getAllInitializers());
}
return ret;
} | java | private List<String> getAllInitializers()
{
final List<String> ret = new ArrayList<>();
for (final CacheMethod cacheMethod : this.cacheMethods) {
ret.add(cacheMethod.className);
}
if (this.parent != null) {
ret.addAll(this.parent.getAllInitializers());
}
return ret;
} | [
"private",
"List",
"<",
"String",
">",
"getAllInitializers",
"(",
")",
"{",
"final",
"List",
"<",
"String",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"CacheMethod",
"cacheMethod",
":",
"this",
".",
"cacheMethods",
")"... | Returns the list of all initializers.
@return list of all initializers | [
"Returns",
"the",
"list",
"of",
"all",
"initializers",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/runlevel/RunLevel.java#L227-L237 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/runlevel/RunLevel.java | RunLevel.initialize | protected void initialize(final String _sql)
throws EFapsException
{
Connection con = null;
try {
con = Context.getConnection();
Statement stmt = null;
long parentId = 0;
try {
stmt = con.createStatement();
// read run level itself
ResultSet rs = stmt.executeQuery(_sql);
if (rs.next()) {
this.id = rs.getLong(1);
parentId = rs.getLong(2);
} else {
RunLevel.LOG.error("RunLevel not found");
}
rs.close();
// read all methods for one run level
rs = stmt.executeQuery(RunLevel.SELECT_DEF_PRE.getCopy()
.addPart(SQLPart.WHERE)
.addColumnPart(0, "RUNLEVELID")
.addPart(SQLPart.EQUAL)
.addValuePart(this.id)
.addPart(SQLPart.ORDERBY)
.addColumnPart(0, "PRIORITY").getSQL());
/**
* Order part of the SQL select statement.
*/
//private static final String SQL_DEF_POST = " order by PRIORITY";
while (rs.next()) {
if (rs.getString(3) != null) {
this.cacheMethods.add(new CacheMethod(rs.getString(1).trim(),
rs.getString(2).trim(),
rs.getString(3).trim()));
} else {
this.cacheMethods.add(new CacheMethod(rs.getString(1).trim(),
rs.getString(2).trim()));
}
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
con.close();
RunLevel.ALL_RUNLEVELS.put(this.id, this);
if (parentId != 0) {
this.parent = RunLevel.ALL_RUNLEVELS.get(parentId);
if (this.parent == null) {
this.parent = new RunLevel(parentId);
}
}
} catch (final EFapsException e) {
RunLevel.LOG.error("initialise()", e);
} catch (final SQLException e) {
RunLevel.LOG.error("initialise()", e);
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
} | java | protected void initialize(final String _sql)
throws EFapsException
{
Connection con = null;
try {
con = Context.getConnection();
Statement stmt = null;
long parentId = 0;
try {
stmt = con.createStatement();
// read run level itself
ResultSet rs = stmt.executeQuery(_sql);
if (rs.next()) {
this.id = rs.getLong(1);
parentId = rs.getLong(2);
} else {
RunLevel.LOG.error("RunLevel not found");
}
rs.close();
// read all methods for one run level
rs = stmt.executeQuery(RunLevel.SELECT_DEF_PRE.getCopy()
.addPart(SQLPart.WHERE)
.addColumnPart(0, "RUNLEVELID")
.addPart(SQLPart.EQUAL)
.addValuePart(this.id)
.addPart(SQLPart.ORDERBY)
.addColumnPart(0, "PRIORITY").getSQL());
/**
* Order part of the SQL select statement.
*/
//private static final String SQL_DEF_POST = " order by PRIORITY";
while (rs.next()) {
if (rs.getString(3) != null) {
this.cacheMethods.add(new CacheMethod(rs.getString(1).trim(),
rs.getString(2).trim(),
rs.getString(3).trim()));
} else {
this.cacheMethods.add(new CacheMethod(rs.getString(1).trim(),
rs.getString(2).trim()));
}
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
con.close();
RunLevel.ALL_RUNLEVELS.put(this.id, this);
if (parentId != 0) {
this.parent = RunLevel.ALL_RUNLEVELS.get(parentId);
if (this.parent == null) {
this.parent = new RunLevel(parentId);
}
}
} catch (final EFapsException e) {
RunLevel.LOG.error("initialise()", e);
} catch (final SQLException e) {
RunLevel.LOG.error("initialise()", e);
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
} | [
"protected",
"void",
"initialize",
"(",
"final",
"String",
"_sql",
")",
"throws",
"EFapsException",
"{",
"Connection",
"con",
"=",
"null",
";",
"try",
"{",
"con",
"=",
"Context",
".",
"getConnection",
"(",
")",
";",
"Statement",
"stmt",
"=",
"null",
";",
... | Reads the id and the parent id of this RunLevel. All defined methods for
this run level are loaded. If a parent id is defined, the parent is
initialized.
@param _sql SQL statement to get the id and parent id for this run
level
@see #parent
@see #cacheMethods
@throws EFapsException on error | [
"Reads",
"the",
"id",
"and",
"the",
"parent",
"id",
"of",
"this",
"RunLevel",
".",
"All",
"defined",
"methods",
"for",
"this",
"run",
"level",
"are",
"loaded",
".",
"If",
"a",
"parent",
"id",
"is",
"defined",
"the",
"parent",
"is",
"initialized",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/runlevel/RunLevel.java#L267-L340 | train |
labai/ted | ted-driver/src/main/java/ted/driver/sys/ConfigUtils.java | ConfigUtils.getInteger | static Integer getInteger(Properties properties, String key, Integer defaultValue) {
if (properties == null)
return defaultValue;
String value = properties.getProperty(key);
if (value == null || value.isEmpty())
return defaultValue;
int intVal;
try {
intVal = Integer.parseInt(value);
} catch (NumberFormatException e) {
logger.warn("Cannot read property '" + key + "'. Expected integer, but got '" + value + "'. Setting default value = '" + defaultValue + "'", e.getMessage());
return defaultValue;
}
logger.trace("Read property '" + key + "' value '" + intVal + "'");
return intVal;
} | java | static Integer getInteger(Properties properties, String key, Integer defaultValue) {
if (properties == null)
return defaultValue;
String value = properties.getProperty(key);
if (value == null || value.isEmpty())
return defaultValue;
int intVal;
try {
intVal = Integer.parseInt(value);
} catch (NumberFormatException e) {
logger.warn("Cannot read property '" + key + "'. Expected integer, but got '" + value + "'. Setting default value = '" + defaultValue + "'", e.getMessage());
return defaultValue;
}
logger.trace("Read property '" + key + "' value '" + intVal + "'");
return intVal;
} | [
"static",
"Integer",
"getInteger",
"(",
"Properties",
"properties",
",",
"String",
"key",
",",
"Integer",
"defaultValue",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"return",
"defaultValue",
";",
"String",
"value",
"=",
"properties",
".",
"getProper... | returns int value of property or defaultValue if not found or invalid | [
"returns",
"int",
"value",
"of",
"property",
"or",
"defaultValue",
"if",
"not",
"found",
"or",
"invalid"
] | 2ee197246a78d842c18d6780c48fd903b00608a6 | https://github.com/labai/ted/blob/2ee197246a78d842c18d6780c48fd903b00608a6/ted-driver/src/main/java/ted/driver/sys/ConfigUtils.java#L185-L200 | train |
tvesalainen/lpg | src/main/java/org/vesalainen/parser/util/DelayedExecutor.java | DelayedExecutor.execute | public void execute(T target) throws Throwable
{
try
{
for (Invokation invokation : queue)
{
invokation.invoke(target);
}
}
catch (InvocationTargetException ex)
{
throw ex.getCause();
}
catch (ReflectiveOperationException ex)
{
throw new RuntimeException(ex);
}
} | java | public void execute(T target) throws Throwable
{
try
{
for (Invokation invokation : queue)
{
invokation.invoke(target);
}
}
catch (InvocationTargetException ex)
{
throw ex.getCause();
}
catch (ReflectiveOperationException ex)
{
throw new RuntimeException(ex);
}
} | [
"public",
"void",
"execute",
"(",
"T",
"target",
")",
"throws",
"Throwable",
"{",
"try",
"{",
"for",
"(",
"Invokation",
"invokation",
":",
"queue",
")",
"{",
"invokation",
".",
"invoke",
"(",
"target",
")",
";",
"}",
"}",
"catch",
"(",
"InvocationTargetE... | Executes delayed invocations
@param target
@throws Throwable From one of the called methods. | [
"Executes",
"delayed",
"invocations"
] | 0917b8d295e9772b9f8a0affc258a08530cd567a | https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/DelayedExecutor.java#L58-L75 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LREnvelope.java | LREnvelope.getSignableData | protected Map<String, Object> getSignableData()
{
final Map<String, Object> doc = getSendableData();
// remove node-specific data
for (int i = 0; i < excludedFields.length; i++) {
doc.remove(excludedFields[i]);
}
return doc;
} | java | protected Map<String, Object> getSignableData()
{
final Map<String, Object> doc = getSendableData();
// remove node-specific data
for (int i = 0; i < excludedFields.length; i++) {
doc.remove(excludedFields[i]);
}
return doc;
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"getSignableData",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"doc",
"=",
"getSendableData",
"(",
")",
";",
"// remove node-specific data",
"for",
"(",
"int",
"i",
"=",
"0",
";... | Builds and returns a map of the envelope data, suitable for signing with the included signer
@return map of envelope data, suitable for signing | [
"Builds",
"and",
"returns",
"a",
"map",
"of",
"the",
"envelope",
"data",
"suitable",
"for",
"signing",
"with",
"the",
"included",
"signer"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LREnvelope.java#L119-L128 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LREnvelope.java | LREnvelope.getSendableData | protected Map<String, Object> getSendableData()
{
Map<String, Object> doc = new LinkedHashMap<String, Object>();
MapUtil.put(doc, docTypeField, docType);
MapUtil.put(doc, docVersionField, docVersion);
MapUtil.put(doc, activeField, true);
MapUtil.put(doc, resourceDataTypeField, resourceDataType);
Map<String, Object> docId = new HashMap<String, Object>();
MapUtil.put(docId, submitterTypeField, submitterType);
MapUtil.put(docId, submitterField, submitter);
MapUtil.put(docId, curatorField, curator);
MapUtil.put(docId, ownerField, owner);
MapUtil.put(docId, signerField, signer);
MapUtil.put(doc, identityField, docId);
MapUtil.put(doc, submitterTTLField, submitterTTL);
Map<String, Object> docTOS = new HashMap<String, Object>();
MapUtil.put(docTOS, submissionTOSField, submissionTOS);
MapUtil.put(docTOS, submissionAttributionField, submissionAttribution);
MapUtil.put(doc, TOSField, docTOS);
MapUtil.put(doc, resourceLocatorField, resourceLocator);
MapUtil.put(doc, payloadPlacementField, payloadPlacement);
MapUtil.put(doc, payloadSchemaField, payloadSchema);
MapUtil.put(doc, payloadSchemaLocatorField, payloadSchemaLocator);
MapUtil.put(doc, keysField, tags);
MapUtil.put(doc, resourceDataField, getEncodedResourceData());
MapUtil.put(doc, replacesField, replaces);
if (signed)
{
Map<String, Object> sig = new HashMap<String, Object>();
String[] keys = {publicKeyLocation};
MapUtil.put(sig, keyLocationField, keys);
MapUtil.put(sig, signingMethodField, signingMethod);
MapUtil.put(sig, signatureField, clearSignedMessage);
MapUtil.put(doc, digitalSignatureField, sig);
}
return doc;
} | java | protected Map<String, Object> getSendableData()
{
Map<String, Object> doc = new LinkedHashMap<String, Object>();
MapUtil.put(doc, docTypeField, docType);
MapUtil.put(doc, docVersionField, docVersion);
MapUtil.put(doc, activeField, true);
MapUtil.put(doc, resourceDataTypeField, resourceDataType);
Map<String, Object> docId = new HashMap<String, Object>();
MapUtil.put(docId, submitterTypeField, submitterType);
MapUtil.put(docId, submitterField, submitter);
MapUtil.put(docId, curatorField, curator);
MapUtil.put(docId, ownerField, owner);
MapUtil.put(docId, signerField, signer);
MapUtil.put(doc, identityField, docId);
MapUtil.put(doc, submitterTTLField, submitterTTL);
Map<String, Object> docTOS = new HashMap<String, Object>();
MapUtil.put(docTOS, submissionTOSField, submissionTOS);
MapUtil.put(docTOS, submissionAttributionField, submissionAttribution);
MapUtil.put(doc, TOSField, docTOS);
MapUtil.put(doc, resourceLocatorField, resourceLocator);
MapUtil.put(doc, payloadPlacementField, payloadPlacement);
MapUtil.put(doc, payloadSchemaField, payloadSchema);
MapUtil.put(doc, payloadSchemaLocatorField, payloadSchemaLocator);
MapUtil.put(doc, keysField, tags);
MapUtil.put(doc, resourceDataField, getEncodedResourceData());
MapUtil.put(doc, replacesField, replaces);
if (signed)
{
Map<String, Object> sig = new HashMap<String, Object>();
String[] keys = {publicKeyLocation};
MapUtil.put(sig, keyLocationField, keys);
MapUtil.put(sig, signingMethodField, signingMethod);
MapUtil.put(sig, signatureField, clearSignedMessage);
MapUtil.put(doc, digitalSignatureField, sig);
}
return doc;
} | [
"protected",
"Map",
"<",
"String",
",",
"Object",
">",
"getSendableData",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"doc",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"MapUtil",
".",
"put",
"(",
"doc"... | Builds and returns a map of the envelope data including any signing data, suitable for sending to a Learning Registry node
@return map of the envelope data, including signing data | [
"Builds",
"and",
"returns",
"a",
"map",
"of",
"the",
"envelope",
"data",
"including",
"any",
"signing",
"data",
"suitable",
"for",
"sending",
"to",
"a",
"Learning",
"Registry",
"node"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LREnvelope.java#L135-L174 | train |
navnorth/LRJavaLib | src/com/navnorth/learningregistry/LREnvelope.java | LREnvelope.addSigningData | public void addSigningData(String signingMethod, String publicKeyLocation, String clearSignedMessage)
{
this.signingMethod = signingMethod;
this.publicKeyLocation = publicKeyLocation;
this.clearSignedMessage = clearSignedMessage;
this.signed = true;
} | java | public void addSigningData(String signingMethod, String publicKeyLocation, String clearSignedMessage)
{
this.signingMethod = signingMethod;
this.publicKeyLocation = publicKeyLocation;
this.clearSignedMessage = clearSignedMessage;
this.signed = true;
} | [
"public",
"void",
"addSigningData",
"(",
"String",
"signingMethod",
",",
"String",
"publicKeyLocation",
",",
"String",
"clearSignedMessage",
")",
"{",
"this",
".",
"signingMethod",
"=",
"signingMethod",
";",
"this",
".",
"publicKeyLocation",
"=",
"publicKeyLocation",
... | Adds signing data to the envelope
@param signingMethod method used for signing this envelope
@param publicKeyLocation location of the public key for the signature on this envelope
@param clearSignedMessage clear signed message created for signing this envelope | [
"Adds",
"signing",
"data",
"to",
"the",
"envelope"
] | 27af28b9f80d772273592414e7d0dccffaac09e1 | https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LREnvelope.java#L183-L189 | train |
bripkens/Gravatar4Java | src/main/java/de/bripkens/gravatar/Gravatar.java | Gravatar.getUrl | public String getUrl(String email) {
if (email == null) {
throw new IllegalArgumentException("Email can't be null.");
}
String emailHash = DigestUtils.md5Hex(email.trim().toLowerCase());
boolean firstParameter = true;
// StringBuilder standard capacity is 16 characters while the minimum
// url is 63 characters long. The maximum length without
// customDefaultImage
// is 91.
StringBuilder builder = new StringBuilder(91)
.append(https ? HTTPS_URL : URL)
.append(emailHash)
.append(FILE_TYPE_EXTENSION);
if (size != DEFAULT_SIZE) {
addParameter(builder, "s", Integer.toString(size), firstParameter);
firstParameter = false;
}
if (forceDefault) {
addParameter(builder, "f", "y", firstParameter);
firstParameter = false;
}
if (rating != DEFAULT_RATING) {
addParameter(builder, "r", rating.getKey(), firstParameter);
firstParameter = false;
}
if (customDefaultImage != null) {
addParameter(builder, "d", customDefaultImage, firstParameter);
} else if (standardDefaultImage != null) {
addParameter(builder, "d", standardDefaultImage.getKey(), firstParameter);
}
return builder.toString();
} | java | public String getUrl(String email) {
if (email == null) {
throw new IllegalArgumentException("Email can't be null.");
}
String emailHash = DigestUtils.md5Hex(email.trim().toLowerCase());
boolean firstParameter = true;
// StringBuilder standard capacity is 16 characters while the minimum
// url is 63 characters long. The maximum length without
// customDefaultImage
// is 91.
StringBuilder builder = new StringBuilder(91)
.append(https ? HTTPS_URL : URL)
.append(emailHash)
.append(FILE_TYPE_EXTENSION);
if (size != DEFAULT_SIZE) {
addParameter(builder, "s", Integer.toString(size), firstParameter);
firstParameter = false;
}
if (forceDefault) {
addParameter(builder, "f", "y", firstParameter);
firstParameter = false;
}
if (rating != DEFAULT_RATING) {
addParameter(builder, "r", rating.getKey(), firstParameter);
firstParameter = false;
}
if (customDefaultImage != null) {
addParameter(builder, "d", customDefaultImage, firstParameter);
} else if (standardDefaultImage != null) {
addParameter(builder, "d", standardDefaultImage.getKey(), firstParameter);
}
return builder.toString();
} | [
"public",
"String",
"getUrl",
"(",
"String",
"email",
")",
"{",
"if",
"(",
"email",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Email can't be null.\"",
")",
";",
"}",
"String",
"emailHash",
"=",
"DigestUtils",
".",
"md5Hex",
... | Retrieve the gravatar URL for the given email.
@param email The email for which the avatar URL should be returned.
@return URL to the gravatar. | [
"Retrieve",
"the",
"gravatar",
"URL",
"for",
"the",
"given",
"email",
"."
] | c85e38b11ff8856079ae60abe6bb0f698af8ab07 | https://github.com/bripkens/Gravatar4Java/blob/c85e38b11ff8856079ae60abe6bb0f698af8ab07/src/main/java/de/bripkens/gravatar/Gravatar.java#L228-L264 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/event/EventDefinition.java | EventDefinition.setProperties | private void setProperties(final Instance _instance)
throws EFapsException
{
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.Property);
queryBldr.addWhereAttrEqValue(CIAdminCommon.Property.Abstract, _instance.getId());
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminCommon.Property.Name, CIAdminCommon.Property.Value);
multi.executeWithoutAccessCheck();
while (multi.next()) {
super.setProperty(multi.<String>getAttribute(CIAdminCommon.Property.Name),
multi.<String>getAttribute(CIAdminCommon.Property.Value));
}
} | java | private void setProperties(final Instance _instance)
throws EFapsException
{
final QueryBuilder queryBldr = new QueryBuilder(CIAdminCommon.Property);
queryBldr.addWhereAttrEqValue(CIAdminCommon.Property.Abstract, _instance.getId());
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute(CIAdminCommon.Property.Name, CIAdminCommon.Property.Value);
multi.executeWithoutAccessCheck();
while (multi.next()) {
super.setProperty(multi.<String>getAttribute(CIAdminCommon.Property.Name),
multi.<String>getAttribute(CIAdminCommon.Property.Value));
}
} | [
"private",
"void",
"setProperties",
"(",
"final",
"Instance",
"_instance",
")",
"throws",
"EFapsException",
"{",
"final",
"QueryBuilder",
"queryBldr",
"=",
"new",
"QueryBuilder",
"(",
"CIAdminCommon",
".",
"Property",
")",
";",
"queryBldr",
".",
"addWhereAttrEqValue... | Set the properties in the superclass.
@param _instance Instance of this EventDefinition
@throws EFapsException on error | [
"Set",
"the",
"properties",
"in",
"the",
"superclass",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/event/EventDefinition.java#L110-L122 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/event/EventDefinition.java | EventDefinition.checkProgramInstance | private void checkProgramInstance()
{
try {
if (EventDefinition.LOG.isDebugEnabled()) {
EventDefinition.LOG.debug("checking Instance: {} - {}", this.resourceName, this.methodName);
}
if (!EFapsClassLoader.getInstance().isOffline()) {
final Class<?> cls = Class.forName(this.resourceName, true, EFapsClassLoader.getInstance());
final Method method = cls.getMethod(this.methodName, new Class[] { Parameter.class });
final Object progInstance = cls.newInstance();
if (EventDefinition.LOG.isDebugEnabled()) {
EventDefinition.LOG.debug("found Class: {} and method {}", progInstance, method);
}
}
} catch (final ClassNotFoundException e) {
EventDefinition.LOG.error("could not find Class: '{}'", this.resourceName, e);
} catch (final InstantiationException e) {
EventDefinition.LOG.error("could not instantiat Class: '{}'", this.resourceName, e);
} catch (final IllegalAccessException e) {
EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
} catch (final SecurityException e) {
EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
} catch (final NoSuchMethodException e) {
EventDefinition.LOG.error("could not find method: '{}' in class '{}'",
new Object[] { this.methodName, this.resourceName, e });
}
} | java | private void checkProgramInstance()
{
try {
if (EventDefinition.LOG.isDebugEnabled()) {
EventDefinition.LOG.debug("checking Instance: {} - {}", this.resourceName, this.methodName);
}
if (!EFapsClassLoader.getInstance().isOffline()) {
final Class<?> cls = Class.forName(this.resourceName, true, EFapsClassLoader.getInstance());
final Method method = cls.getMethod(this.methodName, new Class[] { Parameter.class });
final Object progInstance = cls.newInstance();
if (EventDefinition.LOG.isDebugEnabled()) {
EventDefinition.LOG.debug("found Class: {} and method {}", progInstance, method);
}
}
} catch (final ClassNotFoundException e) {
EventDefinition.LOG.error("could not find Class: '{}'", this.resourceName, e);
} catch (final InstantiationException e) {
EventDefinition.LOG.error("could not instantiat Class: '{}'", this.resourceName, e);
} catch (final IllegalAccessException e) {
EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
} catch (final SecurityException e) {
EventDefinition.LOG.error("could not access Class: '{}'", this.resourceName, e);
} catch (final NoSuchMethodException e) {
EventDefinition.LOG.error("could not find method: '{}' in class '{}'",
new Object[] { this.methodName, this.resourceName, e });
}
} | [
"private",
"void",
"checkProgramInstance",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"EventDefinition",
".",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"EventDefinition",
".",
"LOG",
".",
"debug",
"(",
"\"checking Instance: {} - {}\"",
",",
"this",
".",
"... | Method to check if the instance of the esjp is valid. | [
"Method",
"to",
"check",
"if",
"the",
"instance",
"of",
"the",
"esjp",
"is",
"valid",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/event/EventDefinition.java#L149-L175 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/event/EventDefinition.java | EventDefinition.execute | @Override
public Return execute(final Parameter _parameter)
throws EFapsException
{
Return ret = null;
_parameter.put(ParameterValues.PROPERTIES, new HashMap<>(super.evalProperties()));
try {
EventDefinition.LOG.debug("Invoking method '{}' for Resource '{}'", this.methodName, this.resourceName);
final Class<?> cls = Class.forName(this.resourceName, true, EFapsClassLoader.getInstance());
final Method method = cls.getMethod(this.methodName, new Class[] { Parameter.class });
ret = (Return) method.invoke(cls.newInstance(), _parameter);
EventDefinition.LOG.debug("Terminated invokation of method '{}' for Resource '{}'",
this.methodName, this.resourceName);
} catch (final SecurityException e) {
EventDefinition.LOG.error("security wrong: '{}'", this.resourceName, e);
} catch (final IllegalArgumentException e) {
EventDefinition.LOG.error("arguments invalid : '{}'- '{}'", this.resourceName, this.methodName, e);
} catch (final IllegalAccessException e) {
EventDefinition.LOG.error("could not access class: '{}'", this.resourceName, e);
} catch (final InvocationTargetException e) {
EventDefinition.LOG.error("could not invoke method: '{}' in class: '{}'", this.methodName,
this.resourceName, e);
throw (EFapsException) e.getCause();
} catch (final ClassNotFoundException e) {
EventDefinition.LOG.error("class not found: '{}" + this.resourceName, e);
} catch (final NoSuchMethodException e) {
EventDefinition.LOG.error("could not find method: '{}' in class '{}'",
new Object[] { this.methodName, this.resourceName, e });
} catch (final InstantiationException e) {
EventDefinition.LOG.error("could not instantiat Class: '{}'", this.resourceName, e);
}
return ret;
} | java | @Override
public Return execute(final Parameter _parameter)
throws EFapsException
{
Return ret = null;
_parameter.put(ParameterValues.PROPERTIES, new HashMap<>(super.evalProperties()));
try {
EventDefinition.LOG.debug("Invoking method '{}' for Resource '{}'", this.methodName, this.resourceName);
final Class<?> cls = Class.forName(this.resourceName, true, EFapsClassLoader.getInstance());
final Method method = cls.getMethod(this.methodName, new Class[] { Parameter.class });
ret = (Return) method.invoke(cls.newInstance(), _parameter);
EventDefinition.LOG.debug("Terminated invokation of method '{}' for Resource '{}'",
this.methodName, this.resourceName);
} catch (final SecurityException e) {
EventDefinition.LOG.error("security wrong: '{}'", this.resourceName, e);
} catch (final IllegalArgumentException e) {
EventDefinition.LOG.error("arguments invalid : '{}'- '{}'", this.resourceName, this.methodName, e);
} catch (final IllegalAccessException e) {
EventDefinition.LOG.error("could not access class: '{}'", this.resourceName, e);
} catch (final InvocationTargetException e) {
EventDefinition.LOG.error("could not invoke method: '{}' in class: '{}'", this.methodName,
this.resourceName, e);
throw (EFapsException) e.getCause();
} catch (final ClassNotFoundException e) {
EventDefinition.LOG.error("class not found: '{}" + this.resourceName, e);
} catch (final NoSuchMethodException e) {
EventDefinition.LOG.error("could not find method: '{}' in class '{}'",
new Object[] { this.methodName, this.resourceName, e });
} catch (final InstantiationException e) {
EventDefinition.LOG.error("could not instantiat Class: '{}'", this.resourceName, e);
}
return ret;
} | [
"@",
"Override",
"public",
"Return",
"execute",
"(",
"final",
"Parameter",
"_parameter",
")",
"throws",
"EFapsException",
"{",
"Return",
"ret",
"=",
"null",
";",
"_parameter",
".",
"put",
"(",
"ParameterValues",
".",
"PROPERTIES",
",",
"new",
"HashMap",
"<>",
... | Method to execute the esjp.
@param _parameter Parameter
@return Return
@throws EFapsException on error | [
"Method",
"to",
"execute",
"the",
"esjp",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/event/EventDefinition.java#L184-L216 | train |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/Instance.java | Instance.getOid | public String getOid()
{
String ret = null;
if (isValid()) {
ret = getType().getId() + "." + getId();
}
return ret;
} | java | public String getOid()
{
String ret = null;
if (isValid()) {
ret = getType().getId() + "." + getId();
}
return ret;
} | [
"public",
"String",
"getOid",
"(",
")",
"{",
"String",
"ret",
"=",
"null",
";",
"if",
"(",
"isValid",
"(",
")",
")",
"{",
"ret",
"=",
"getType",
"(",
")",
".",
"getId",
"(",
")",
"+",
"\".\"",
"+",
"getId",
"(",
")",
";",
"}",
"return",
"ret",
... | The string representation which is defined by this instance is returned.
@return string representation of the object id | [
"The",
"string",
"representation",
"which",
"is",
"defined",
"by",
"this",
"instance",
"is",
"returned",
"."
] | 04b96548f518c2386a93f5ec2b9349f9b9063859 | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Instance.java#L179-L186 | train |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/internal/MissingEventsTracker.java | MissingEventsTracker.checkEventId | public boolean checkEventId(String conversationId, long conversationEventId, MissingEventsListener missingEventsListener) {
if (!idsPerConversation.containsKey(conversationId)) {
TreeSet<Long> ids = new TreeSet<>();
boolean added = ids.add(conversationEventId);
idsPerConversation.put(conversationId, ids);
return !added;
} else {
TreeSet<Long> ids = idsPerConversation.get(conversationId);
long last = ids.last();
boolean added = ids.add(conversationEventId);
if (last < conversationEventId - 1) {
missingEventsListener.missingEvents(conversationId, last + 1, (int) (conversationEventId - last));
}
while (ids.size() > 10) {
ids.pollFirst();
}
return !added;
}
} | java | public boolean checkEventId(String conversationId, long conversationEventId, MissingEventsListener missingEventsListener) {
if (!idsPerConversation.containsKey(conversationId)) {
TreeSet<Long> ids = new TreeSet<>();
boolean added = ids.add(conversationEventId);
idsPerConversation.put(conversationId, ids);
return !added;
} else {
TreeSet<Long> ids = idsPerConversation.get(conversationId);
long last = ids.last();
boolean added = ids.add(conversationEventId);
if (last < conversationEventId - 1) {
missingEventsListener.missingEvents(conversationId, last + 1, (int) (conversationEventId - last));
}
while (ids.size() > 10) {
ids.pollFirst();
}
return !added;
}
} | [
"public",
"boolean",
"checkEventId",
"(",
"String",
"conversationId",
",",
"long",
"conversationEventId",
",",
"MissingEventsListener",
"missingEventsListener",
")",
"{",
"if",
"(",
"!",
"idsPerConversation",
".",
"containsKey",
"(",
"conversationId",
")",
")",
"{",
... | Check conversation event id for duplicates or missing events.
@param conversationId Unique identifier of an conversation.
@param conversationEventId Unique per conversation, monotonically increasing conversation event id.
@return True if event with a given id already processed. | [
"Check",
"conversation",
"event",
"id",
"for",
"duplicates",
"or",
"missing",
"events",
"."
] | 388f37bfacb7793ce30c92ab70e5f32848bbe460 | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/internal/MissingEventsTracker.java#L52-L76 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.