content
stringlengths 15
442k
| obf_code
stringlengths 15
442k
| probability
float64 0
1
| obf_dict
stringlengths 0
13.5k
| lang
stringclasses 3
values | classification
stringclasses 5
values | confiability
stringlengths 1
10
|
---|---|---|---|---|---|---|
package com.wuba.acm.linked;
/**
* desc :
* date : 2018/12/11
*
* @author : dongSen
*/
class ListNode {
int val;
ListNode next;
ListNode(int x) {
val = x;
}
}
| package com.wuba.acm.linked;
/**
* desc :
* date : 2018/12/11
*
* @author : dongSen
*/
class CLASS_0 {
int val;
CLASS_0 next;
CLASS_0(int VAR_0) {
val = VAR_0;
}
}
| 0.168713 | {'CLASS_0': 'ListNode', 'VAR_0': 'x'} | java | OOP | 100.00% |
package revert.shredsheets.fragments;
import android.app.Dialog;
import androidx.fragment.app.DialogFragment;
import android.view.ViewGroup;
public class FullScreenFragment extends DialogFragment {
@Override
public void onStart()
{
super.onStart();
Dialog dialog = getDialog();
if (dialog != null)
{
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width, height);
}
}
}
| package revert.shredsheets.fragments;
import android.app.Dialog;
import androidx.fragment.app.DialogFragment;
import android.view.ViewGroup;
public class FullScreenFragment extends DialogFragment {
@Override
public void onStart()
{
super.onStart();
Dialog dialog = getDialog();
if (dialog != null)
{
int width = ViewGroup.LayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width, height);
}
}
}
| 0.076985 | {} | java | OOP | 100.00% |
/**
* Returns the number of labels present in both <code>Label</code> objects.
*
* @param other
* the <code>Label</code> object for comparison.
*
* @return the number of labels present in both <code>Label</code> objects.
*/
public int intersect(Label other) {
if (active.length != other.active.length) {
throw new IllegalArgumentException("Label size do not match: "
+ active.length + " expected, " + other.active.length
+ " found");
}
int count = 0;
for (int i = 0; i < active.length; i++) {
if (active[i] && other.active[i]) {
count++;
}
}
return count;
} | /**
* Returns the number of labels present in both <code>Label</code> objects.
*
* @param other
* the <code>Label</code> object for comparison.
*
* @return the number of labels present in both <code>Label</code> objects.
*/
public int FUNC_0(CLASS_0 VAR_0) {
if (VAR_1.VAR_2 != VAR_0.VAR_1.VAR_2) {
throw new CLASS_1("Label size do not match: "
+ VAR_1.VAR_2 + " expected, " + VAR_0.VAR_1.VAR_2
+ " found");
}
int VAR_3 = 0;
for (int VAR_4 = 0; VAR_4 < VAR_1.VAR_2; VAR_4++) {
if (VAR_1[VAR_4] && VAR_0.VAR_1[VAR_4]) {
VAR_3++;
}
}
return VAR_3;
} | 0.858336 | {'FUNC_0': 'intersect', 'CLASS_0': 'Label', 'VAR_0': 'other', 'VAR_1': 'active', 'VAR_2': 'length', 'CLASS_1': 'IllegalArgumentException', 'VAR_3': 'count', 'VAR_4': 'i'} | java | Procedural | 100.00% |
/**
* Html.fromHtml sometimes adds extra space at the bottom.
* This methods removes this space again.
* See https://github.com/SufficientlySecure/html-textview/issues/19
*/
@Nullable
private static Spanned removeHtmlBottomPadding(@Nullable Spanned text) {
if (text == null) {
return null;
}
while (text.length() > 0 && text.charAt(text.length() - 1) == '\n') {
text = (Spanned) text.subSequence(0, text.length() - 1);
}
return text;
} | /**
* Html.fromHtml sometimes adds extra space at the bottom.
* This methods removes this space again.
* See https://github.com/SufficientlySecure/html-textview/issues/19
*/
@VAR_0
private static Spanned FUNC_0(@VAR_0 Spanned VAR_1) {
if (VAR_1 == null) {
return null;
}
while (VAR_1.length() > 0 && VAR_1.FUNC_1(VAR_1.length() - 1) == '\n') {
VAR_1 = (Spanned) VAR_1.FUNC_2(0, VAR_1.length() - 1);
}
return VAR_1;
} | 0.685924 | {'VAR_0': 'Nullable', 'FUNC_0': 'removeHtmlBottomPadding', 'VAR_1': 'text', 'FUNC_1': 'charAt', 'FUNC_2': 'subSequence'} | java | Procedural | 63.16% |
/**
* {@link AbstractRequest} provides an abstract base class for implementing Volley {@link Request} and
* provides additional framework support for using Volley to implement Rest communication.
*
* @param <T_Response> The generic type of the response object.
*/
public abstract class AbstractRequest<T_Response> extends Request<T_Response> {
protected static final String PROTOCOL_CHARSET = "utf-8";
protected final Map<String, String> mHeaders;
protected Response.Listener<T_Response> mResponseListener;
protected AbstractRequest(final String url, final Listener<T_Response> responseListener, final ErrorListener errorListener) {
this(Method.GET, url, responseListener, errorListener);
}
protected AbstractRequest(final int pMethod, String url, final Listener<T_Response> responseListener, final ErrorListener errorListener) {
super(pMethod, url, errorListener);
mResponseListener = responseListener;
mHeaders = new HashMap<>();
}
@Override
protected abstract Response<T_Response> parseNetworkResponse(NetworkResponse response);
@Override
protected void deliverResponse(final T_Response response) {
if (mResponseListener != null) {
mResponseListener.onResponse(response);
}
}
public abstract void setBody(Object body);
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
if (mHeaders != null) {
return mHeaders;
}
return null;
}
public void setHeaders(final Map<String, String> headers) {
mHeaders.clear();
if (headers != null) {
mHeaders.putAll(headers);
}
}
} | /**
* {@link AbstractRequest} provides an abstract base class for implementing Volley {@link Request} and
* provides additional framework support for using Volley to implement Rest communication.
*
* @param <T_Response> The generic type of the response object.
*/
public abstract class AbstractRequest<T_Response> extends Request<T_Response> {
protected static final CLASS_0 PROTOCOL_CHARSET = "utf-8";
protected final Map<CLASS_0, CLASS_0> mHeaders;
protected Response.Listener<T_Response> mResponseListener;
protected AbstractRequest(final CLASS_0 url, final Listener<T_Response> responseListener, final ErrorListener errorListener) {
this(Method.GET, url, responseListener, errorListener);
}
protected AbstractRequest(final int pMethod, CLASS_0 url, final Listener<T_Response> responseListener, final ErrorListener errorListener) {
super(pMethod, url, errorListener);
mResponseListener = responseListener;
mHeaders = new CLASS_1<>();
}
@Override
protected abstract Response<T_Response> FUNC_0(NetworkResponse response);
@Override
protected void deliverResponse(final T_Response response) {
if (mResponseListener != null) {
mResponseListener.onResponse(response);
}
}
public abstract void setBody(CLASS_2 body);
@Override
public Map<CLASS_0, CLASS_0> getHeaders() throws AuthFailureError {
if (mHeaders != null) {
return mHeaders;
}
return null;
}
public void setHeaders(final Map<CLASS_0, CLASS_0> headers) {
mHeaders.clear();
if (headers != null) {
mHeaders.FUNC_1(headers);
}
}
} | 0.206469 | {'CLASS_0': 'String', 'CLASS_1': 'HashMap', 'FUNC_0': 'parseNetworkResponse', 'CLASS_2': 'Object', 'FUNC_1': 'putAll'} | java | Texto | 0.48% |
/**
* Method for easily delivering the response to the user, via the given callback-listener.
* @param response to deliver, may be null
* @param error to deliver, may be null
*/
public void deliverResponse(T response, ShopGunError error) {
if (mDebugger != null) {
mDebugger.onDelivery(this, response, error);
}
if (mListener != null) {
mListener.onComplete(response, error);
}
} | /**
* Method for easily delivering the response to the user, via the given callback-listener.
* @param response to deliver, may be null
* @param error to deliver, may be null
*/
public void deliverResponse(T response, ShopGunError VAR_0) {
if (mDebugger != null) {
mDebugger.onDelivery(this, response, VAR_0);
}
if (mListener != null) {
mListener.onComplete(response, VAR_0);
}
} | 0.210333 | {'VAR_0': 'error'} | java | Procedural | 100.00% |
/**
* A class used to collect provenance data from Galaxy that corresponds to a
* specific output file generated by an analysis submission.
*
*
*/
public class AnalysisProvenanceServiceGalaxy {
private static final Logger logger = LoggerFactory.getLogger(AnalysisProvenanceServiceGalaxy.class);
private static final Set<String> PARAMETERS_TO_IGNORE = Sets.newHashSet("chromInfo", "dbkey", "async_datasets",
"paramfile", "uuid", "__current_case__", "__index__", "__workflow_invocation_uuid__", "__input_ext");
private static final String ID_PARAM_KEY = "id";
private static final Joiner KEY_JOINER = Joiner.on(IridaToolParameter.PARAMETER_NAME_SEPARATOR).skipNulls();
private static final String JSON_TEXT_MAP_INDICATOR = JsonToken.START_OBJECT.asString(); // "{"
private static final String JSON_TEXT_ARRAY_INDICATOR = JsonToken.START_ARRAY.asString(); // "["
private static final String EMPTY_VALUE_PLACEHOLDER = null;
private static final ObjectMapper mapper = new ObjectMapper();
private static final String COLLECTION = "dataset_collection";
private final GalaxyHistoriesService galaxyHistoriesService;
private final ToolsClient toolsClient;
private final JobsClient jobsClient;
public AnalysisProvenanceServiceGalaxy(final GalaxyHistoriesService galaxyHistoriesService,
final ToolsClient toolsClient, final JobsClient jobsClient) {
this.galaxyHistoriesService = galaxyHistoriesService;
this.toolsClient = toolsClient;
this.jobsClient = jobsClient;
}
/**
* Get an empty value placeholder
* @return the placeholder for an empty value
*/
public static String emptyValuePlaceholder() {
return EMPTY_VALUE_PLACEHOLDER;
}
/**
* Build up a provenance report for a specific file that's attached to the
* outputs of an analysis submission.
*
* @param remoteAnalysisId
* the identifier of the submission history that the output file
* is attached to on the execution manager (i.e., Galaxy's
* history id).
* @param analysisOutputFilename
* the filename to build the report for. This should be the raw
* basename of the file (i.e., only the filename + extension
* part).
* @return the complete report for the file.
* @throws ExecutionManagerException
* if the history contents could not be shown for the specified
* file.
*/
public ToolExecution buildToolExecutionForOutputFile(final String remoteAnalysisId,
final String analysisOutputFilename) throws ExecutionManagerException {
final List<HistoryContents> historyContents = galaxyHistoriesService.showHistoryContents(remoteAnalysisId);
// group the history contents by name. The names that we're interested
// in starting from should match the filename of the output file.
final Map<String, List<HistoryContents>> historyContentsByName = historyContents.stream().
filter(content -> !COLLECTION.equals(content.getHistoryContentType())).
collect(Collectors.groupingBy(HistoryContents::getName));
final List<HistoryContents> currentContents = historyContentsByName.get(analysisOutputFilename);
if (currentContents == null || currentContents.isEmpty() || currentContents.size() > 1) {
throw new ExecutionManagerException("Could not load a unique history contents for the specified filename ["
+ analysisOutputFilename + "] in history with id [" + remoteAnalysisId + "]");
}
final HistoryContentsProvenance currentProvenance = galaxyHistoriesService.showProvenance(
remoteAnalysisId, currentContents.get(0).getId());
try {
final Tool toolDetails = toolsClient.showTool(currentProvenance.getToolId());
return buildToolExecutionForHistoryStep(toolDetails, currentProvenance, remoteAnalysisId);
} catch (final RuntimeException e) {
throw new ExecutionManagerException("Failed to build tool execution provenance.", e);
}
}
/**
* Build up a complete *tree* of ToolExecution from Galaxy's history
* contents provenance objects. Recursively follows predecessors from the
* current history.
*
* @param toolDetails
* the details of the current tool to build up tool execution
* details for.
* @param currentProvenance
* the provenance that corresponds to the tool details.
* @param historyId
* the Galaxy ID we should use to extract tool execution
* information.
* @return the entire tree of ToolExecutions for the tool and its
* provenance.
* @throws ExecutionManagerException
* if we could not get the history contents provenance or the
* tool details for a predecessor of the current tool details or
* provenance.
*/
private ToolExecution buildToolExecutionForHistoryStep(final Tool toolDetails,
final HistoryContentsProvenance currentProvenance, final String historyId) throws ExecutionManagerException {
final Map<String, Set<String>> predecessors = getPredecessors(currentProvenance);
final Map<String, Object> parameters = currentProvenance.getParameters();
// remove keys from parameters that are Galaxy-related (and thus
// ignorable), or keys that *match* input keys (as mentioned in
// getPredecessors, the input keys are going to have a numeric
// suffix and so don't equal the key that we want to remove from the
// key set):
/* @formatter:off */
final Set<String> parameterKeys = parameters.keySet().stream()
.filter(k -> !PARAMETERS_TO_IGNORE.contains(k))
.filter(k -> !predecessors.keySet().stream().anyMatch(p -> k.contains(p)))
.collect(Collectors.toSet());
/* @formatter:on */
final Map<String, Object> paramValues = new HashMap<>();
for (final String parameterKey : parameterKeys) {
paramValues.put(parameterKey, parameters.get(parameterKey));
}
final Set<ToolExecution> prevSteps = new HashSet<>();
final String toolName = toolDetails.getName();
final String toolVersion = toolDetails.getVersion();
final String jobId = currentProvenance.getJobId();
final JobDetails jobDetails = jobsClient.showJob(jobId);
final String commandLine = jobDetails.getCommandLine();
final Map<String, String> paramStrings = buildParamMap(paramValues);
for (final String predecessorKey : predecessors.keySet()) {
// arbitrarily select one of the predecessors from the set, then
// recurse on that predecessor:
final String predecessor = predecessors.get(predecessorKey).iterator().next();
final HistoryContentsProvenance previousProvenance = galaxyHistoriesService.showProvenance(historyId,
predecessor);
final Tool previousToolDetails = toolsClient.showTool(previousProvenance.getToolId());
final ToolExecution toolExecution = buildToolExecutionForHistoryStep(previousToolDetails,
previousProvenance, historyId);
prevSteps.add(toolExecution);
}
return new ToolExecution(prevSteps, toolName, toolVersion, jobId, paramStrings, commandLine);
}
/**
* Creates a key-value pair set of nodes that feed into the current workflow
* node by inspecting the parameters supplied to the current node in
* {@link HistoryContentsProvenance}.
*
* @param historyContentsProvenance
* the provenance node to find predecessors for.
* @return a key-value pair of all inputs, keyed on the name of the input
* collection and values with IDs of input steps.
*/
private Map<String, Set<String>> getPredecessors(final HistoryContentsProvenance historyContentsProvenance) {
final Map<String, Object> params = historyContentsProvenance.getParameters();
final Map<String, Set<String>> predecessors = new HashMap<>();
// iterate through the keys and see if any of them are a map. If any are
// a map, then check to see if any have a key of 'id', that's an input
// to this step in the workflow.
for (final Map.Entry<String, Object> param : params.entrySet()) {
// the keys in the map look like `freebayes_collection12`, and I
// want to have all values that were inputs from freebayes to be in
// the same set, so remove the numeric portion of the string. Phil
// says that this going to change in the next version of Galaxy.
final String paramKey = param.getKey().replaceAll("\\d+$", "");
final Object paramValue = param.getValue();
if (paramValue instanceof Map) {
// cast to map, then check to see if any of the keys in the map
// are "id":
@SuppressWarnings("unchecked")
final Map<String, Object> mapParam = (Map<String, Object>) paramValue;
if (mapParam.containsKey(ID_PARAM_KEY)) {
if (!predecessors.containsKey(paramKey)) {
predecessors.put(paramKey, new HashSet<>());
}
predecessors.get(paramKey).add(mapParam.get(ID_PARAM_KEY).toString());
}
} else {
logger.trace("Skipping parameter with key [" + paramKey + "]; not an ID parameter.");
}
}
return predecessors;
}
/**
* Build a map of parameter keys to parameter values. This method recurses
* on itself when a value in the supplied map contains yet another
* collection.
*
* @param valueMap
* the key/value collection to write to translate to Map<String,
* String>
* @param prefix
* the prefix to use for the keys (as we recurse into nested
* parameter values).
* @return a flat key/value collection of all parameters supplied to the in
* valueMap.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private static Map<String, String> buildParamMap(final Map<String, Object> valueMap, final String... prefix) {
final Map<String, String> paramStrings = new HashMap<>();
final Set<String> valueMapKeys = valueMap.keySet().stream().filter(k -> !PARAMETERS_TO_IGNORE.contains(k))
.collect(Collectors.toSet());
for (final String valueMapKey : valueMapKeys) {
// append the new key to the end of the prefixes, then create a key
// for the flattened map using all of the prefixes.
final String[] prefixes = Arrays.copyOf(prefix, prefix.length + 1);
prefixes[prefix.length] = valueMapKey;
final String key = KEY_JOINER.join(prefixes);
final Object value = valueMap.get(valueMapKey);
if (value == null) {
// if the string is empty, put a pre-defined "empty" value into
// the map.
logger.trace("There's a key with a null value [" + key + "]");
paramStrings.put(key, EMPTY_VALUE_PLACEHOLDER);
} else {
try {
if (value instanceof Map) {
// if we already have a map, straight up recurse on the
// map.
paramStrings.putAll(buildParamMap((Map<String, Object>) value, prefixes));
} else if (value instanceof List) {
// if it's a list, the contents are *probably*
// Map<String, Object>, or List<String>
// Check class of objects in List, if String just use toString() on List
if (((List)value).size() == 0 || String.class.equals(((List)value).get(0).getClass())) {
paramStrings.put(key, value.toString());
} else {
final List<Map<String, Object>> valueList = (List<Map<String, Object>>) value;
for (final Map<String, Object> listMap : valueList) {
paramStrings.putAll(buildParamMap(listMap, prefixes));
}
}
} else if (value.toString().trim().startsWith(JSON_TEXT_MAP_INDICATOR)) {
// if we have a JSON Map (something that has '{' as the
// first character in the String), then parse it with
// Jackson and then recurse on the parsed map.
Map<String, Object> jsonValueMap = mapper.readValue(value.toString(), Map.class);
paramStrings.putAll(buildParamMap(jsonValueMap, prefixes));
} else if (value.toString().trim().startsWith(JSON_TEXT_ARRAY_INDICATOR)) {
// if we have a JSON Array (something that has '[' as
// the first character in the String), then parse it
// with Jackson, then recurse on *each* of the parsed
// maps inside the array.
List list = mapper.readValue(value.toString(), List.class);
// Check class of objects in List, if String just use toString() on List
if (list.size() == 0 || String.class.equals(list.get(0).getClass())) {
paramStrings.put(key, list.toString());
} else {
List<Map<String, Object>> listMap = (List<Map<String, Object>>)list;
for (final Map<String, Object> jsonValueMap : listMap) {
paramStrings.putAll(buildParamMap(jsonValueMap, prefixes));
}
}
} else {
// if none of those things, then we'll just assume it's
// a string value that we can put into our map.
paramStrings.put(key, value.toString());
}
} catch (final IOException e) {
logger.error("Unable to parse key [" + key + "] with value (" + value
+ ") using Jackson, defaulting to calling toString() on this parameter branch.", e);
paramStrings.put(key, value.toString());
} catch (final ClassCastException e) {
logger.error("Unable to cast key [" + key + "] with value (" + value
+ "), defaulting to calling toString() on this parameter branch.", e);
paramStrings.put(key, value.toString());
} catch (final RuntimeException e) {
logger.error("Unable to handle key [" + key + "] with value (" + value
+ ") for unknown reasons. defaulting to calling toString() on this parameter branch.", e);
paramStrings.put(key, value.toString());
}
}
}
return paramStrings;
}
} | /**
* A class used to collect provenance data from Galaxy that corresponds to a
* specific output file generated by an analysis submission.
*
*
*/
public class CLASS_0 {
private static final Logger logger = VAR_0.FUNC_0(CLASS_0.class);
private static final Set<CLASS_1> PARAMETERS_TO_IGNORE = Sets.newHashSet("chromInfo", "dbkey", "async_datasets",
"paramfile", "uuid", "__current_case__", "__index__", "__workflow_invocation_uuid__", "__input_ext");
private static final CLASS_1 VAR_1 = "id";
private static final CLASS_2 VAR_3 = VAR_2.FUNC_1(VAR_4.VAR_5).FUNC_2();
private static final CLASS_1 VAR_6 = VAR_7.START_OBJECT.FUNC_3(); // "{"
private static final CLASS_1 VAR_8 = VAR_7.START_ARRAY.FUNC_3(); // "["
private static final CLASS_1 EMPTY_VALUE_PLACEHOLDER = null;
private static final CLASS_3 mapper = new CLASS_3();
private static final CLASS_1 VAR_9 = "dataset_collection";
private final CLASS_4 VAR_10;
private final ToolsClient VAR_11;
private final JobsClient VAR_12;
public CLASS_0(final CLASS_4 VAR_10,
final ToolsClient VAR_11, final JobsClient VAR_12) {
this.VAR_10 = VAR_10;
this.VAR_11 = VAR_11;
this.VAR_12 = VAR_12;
}
/**
* Get an empty value placeholder
* @return the placeholder for an empty value
*/
public static CLASS_1 emptyValuePlaceholder() {
return EMPTY_VALUE_PLACEHOLDER;
}
/**
* Build up a provenance report for a specific file that's attached to the
* outputs of an analysis submission.
*
* @param remoteAnalysisId
* the identifier of the submission history that the output file
* is attached to on the execution manager (i.e., Galaxy's
* history id).
* @param analysisOutputFilename
* the filename to build the report for. This should be the raw
* basename of the file (i.e., only the filename + extension
* part).
* @return the complete report for the file.
* @throws ExecutionManagerException
* if the history contents could not be shown for the specified
* file.
*/
public ToolExecution FUNC_4(final CLASS_1 VAR_13,
final CLASS_1 VAR_14) throws ExecutionManagerException {
final CLASS_5<CLASS_6> VAR_16 = VAR_10.FUNC_5(VAR_13);
// group the history contents by name. The names that we're interested
// in starting from should match the filename of the output file.
final CLASS_7<CLASS_1, CLASS_5<CLASS_6>> VAR_17 = VAR_16.FUNC_6().
filter(VAR_18 -> !VAR_9.FUNC_7(VAR_18.FUNC_8())).
FUNC_9(Collectors.FUNC_10(VAR_15::VAR_19));
final CLASS_5<CLASS_6> VAR_20 = VAR_17.get(VAR_14);
if (VAR_20 == null || VAR_20.isEmpty() || VAR_20.FUNC_12() > 1) {
throw new ExecutionManagerException("Could not load a unique history contents for the specified filename ["
+ VAR_14 + "] in history with id [" + VAR_13 + "]");
}
final CLASS_8 VAR_21 = VAR_10.FUNC_13(
VAR_13, VAR_20.get(0).FUNC_14());
try {
final Tool VAR_22 = VAR_11.showTool(VAR_21.FUNC_15());
return FUNC_16(VAR_22, VAR_21, VAR_13);
} catch (final CLASS_9 VAR_23) {
throw new ExecutionManagerException("Failed to build tool execution provenance.", VAR_23);
}
}
/**
* Build up a complete *tree* of ToolExecution from Galaxy's history
* contents provenance objects. Recursively follows predecessors from the
* current history.
*
* @param toolDetails
* the details of the current tool to build up tool execution
* details for.
* @param currentProvenance
* the provenance that corresponds to the tool details.
* @param historyId
* the Galaxy ID we should use to extract tool execution
* information.
* @return the entire tree of ToolExecutions for the tool and its
* provenance.
* @throws ExecutionManagerException
* if we could not get the history contents provenance or the
* tool details for a predecessor of the current tool details or
* provenance.
*/
private ToolExecution FUNC_16(final Tool VAR_22,
final CLASS_8 VAR_21, final CLASS_1 historyId) throws ExecutionManagerException {
final CLASS_7<CLASS_1, Set<CLASS_1>> VAR_24 = FUNC_17(VAR_21);
final CLASS_7<CLASS_1, Object> parameters = VAR_21.FUNC_18();
// remove keys from parameters that are Galaxy-related (and thus
// ignorable), or keys that *match* input keys (as mentioned in
// getPredecessors, the input keys are going to have a numeric
// suffix and so don't equal the key that we want to remove from the
// key set):
/* @formatter:off */
final Set<CLASS_1> VAR_25 = parameters.keySet().FUNC_6()
.filter(VAR_26 -> !PARAMETERS_TO_IGNORE.FUNC_19(VAR_26))
.filter(VAR_26 -> !VAR_24.keySet().FUNC_6().anyMatch(VAR_27 -> VAR_26.FUNC_19(VAR_27)))
.FUNC_9(Collectors.FUNC_20());
/* @formatter:on */
final CLASS_7<CLASS_1, Object> VAR_28 = new CLASS_10<>();
for (final CLASS_1 VAR_29 : VAR_25) {
VAR_28.FUNC_21(VAR_29, parameters.get(VAR_29));
}
final Set<ToolExecution> VAR_30 = new HashSet<>();
final CLASS_1 VAR_31 = VAR_22.FUNC_11();
final CLASS_1 VAR_32 = VAR_22.FUNC_22();
final CLASS_1 jobId = VAR_21.getJobId();
final CLASS_11 jobDetails = VAR_12.FUNC_23(jobId);
final CLASS_1 VAR_33 = jobDetails.FUNC_24();
final CLASS_7<CLASS_1, CLASS_1> VAR_34 = FUNC_25(VAR_28);
for (final CLASS_1 predecessorKey : VAR_24.keySet()) {
// arbitrarily select one of the predecessors from the set, then
// recurse on that predecessor:
final CLASS_1 VAR_35 = VAR_24.get(predecessorKey).iterator().next();
final CLASS_8 VAR_36 = VAR_10.FUNC_13(historyId,
VAR_35);
final Tool VAR_37 = VAR_11.showTool(VAR_36.FUNC_15());
final ToolExecution VAR_38 = FUNC_16(VAR_37,
VAR_36, historyId);
VAR_30.FUNC_26(VAR_38);
}
return new ToolExecution(VAR_30, VAR_31, VAR_32, jobId, VAR_34, VAR_33);
}
/**
* Creates a key-value pair set of nodes that feed into the current workflow
* node by inspecting the parameters supplied to the current node in
* {@link HistoryContentsProvenance}.
*
* @param historyContentsProvenance
* the provenance node to find predecessors for.
* @return a key-value pair of all inputs, keyed on the name of the input
* collection and values with IDs of input steps.
*/
private CLASS_7<CLASS_1, Set<CLASS_1>> FUNC_17(final CLASS_8 VAR_39) {
final CLASS_7<CLASS_1, Object> VAR_40 = VAR_39.FUNC_18();
final CLASS_7<CLASS_1, Set<CLASS_1>> VAR_24 = new CLASS_10<>();
// iterate through the keys and see if any of them are a map. If any are
// a map, then check to see if any have a key of 'id', that's an input
// to this step in the workflow.
for (final CLASS_7.Entry<CLASS_1, Object> param : VAR_40.entrySet()) {
// the keys in the map look like `freebayes_collection12`, and I
// want to have all values that were inputs from freebayes to be in
// the same set, so remove the numeric portion of the string. Phil
// says that this going to change in the next version of Galaxy.
final CLASS_1 VAR_41 = param.FUNC_27().replaceAll("\\d+$", "");
final Object VAR_42 = param.getValue();
if (VAR_42 instanceof CLASS_7) {
// cast to map, then check to see if any of the keys in the map
// are "id":
@VAR_43("unchecked")
final CLASS_7<CLASS_1, Object> VAR_44 = (CLASS_7<CLASS_1, Object>) VAR_42;
if (VAR_44.FUNC_28(VAR_1)) {
if (!VAR_24.FUNC_28(VAR_41)) {
VAR_24.FUNC_21(VAR_41, new HashSet<>());
}
VAR_24.get(VAR_41).FUNC_26(VAR_44.get(VAR_1).FUNC_29());
}
} else {
logger.FUNC_30("Skipping parameter with key [" + VAR_41 + "]; not an ID parameter.");
}
}
return VAR_24;
}
/**
* Build a map of parameter keys to parameter values. This method recurses
* on itself when a value in the supplied map contains yet another
* collection.
*
* @param valueMap
* the key/value collection to write to translate to Map<String,
* String>
* @param prefix
* the prefix to use for the keys (as we recurse into nested
* parameter values).
* @return a flat key/value collection of all parameters supplied to the in
* valueMap.
*/
@VAR_43({ "unchecked", "rawtypes" })
private static CLASS_7<CLASS_1, CLASS_1> FUNC_25(final CLASS_7<CLASS_1, Object> VAR_45, final CLASS_1... VAR_46) {
final CLASS_7<CLASS_1, CLASS_1> VAR_34 = new CLASS_10<>();
final Set<CLASS_1> valueMapKeys = VAR_45.keySet().FUNC_6().filter(VAR_26 -> !PARAMETERS_TO_IGNORE.FUNC_19(VAR_26))
.FUNC_9(Collectors.FUNC_20());
for (final CLASS_1 VAR_47 : valueMapKeys) {
// append the new key to the end of the prefixes, then create a key
// for the flattened map using all of the prefixes.
final CLASS_1[] prefixes = Arrays.FUNC_31(VAR_46, VAR_46.VAR_48 + 1);
prefixes[VAR_46.VAR_48] = VAR_47;
final CLASS_1 VAR_49 = VAR_3.join(prefixes);
final Object VAR_50 = VAR_45.get(VAR_47);
if (VAR_50 == null) {
// if the string is empty, put a pre-defined "empty" value into
// the map.
logger.FUNC_30("There's a key with a null value [" + VAR_49 + "]");
VAR_34.FUNC_21(VAR_49, EMPTY_VALUE_PLACEHOLDER);
} else {
try {
if (VAR_50 instanceof CLASS_7) {
// if we already have a map, straight up recurse on the
// map.
VAR_34.FUNC_32(FUNC_25((CLASS_7<CLASS_1, Object>) VAR_50, prefixes));
} else if (VAR_50 instanceof CLASS_5) {
// if it's a list, the contents are *probably*
// Map<String, Object>, or List<String>
// Check class of objects in List, if String just use toString() on List
if (((CLASS_5)VAR_50).FUNC_12() == 0 || CLASS_1.class.FUNC_7(((CLASS_5)VAR_50).get(0).getClass())) {
VAR_34.FUNC_21(VAR_49, VAR_50.FUNC_29());
} else {
final CLASS_5<CLASS_7<CLASS_1, Object>> VAR_51 = (CLASS_5<CLASS_7<CLASS_1, Object>>) VAR_50;
for (final CLASS_7<CLASS_1, Object> listMap : VAR_51) {
VAR_34.FUNC_32(FUNC_25(listMap, prefixes));
}
}
} else if (VAR_50.FUNC_29().FUNC_33().startsWith(VAR_6)) {
// if we have a JSON Map (something that has '{' as the
// first character in the String), then parse it with
// Jackson and then recurse on the parsed map.
CLASS_7<CLASS_1, Object> VAR_52 = mapper.FUNC_34(VAR_50.FUNC_29(), CLASS_7.class);
VAR_34.FUNC_32(FUNC_25(VAR_52, prefixes));
} else if (VAR_50.FUNC_29().FUNC_33().startsWith(VAR_8)) {
// if we have a JSON Array (something that has '[' as
// the first character in the String), then parse it
// with Jackson, then recurse on *each* of the parsed
// maps inside the array.
CLASS_5 VAR_53 = mapper.FUNC_34(VAR_50.FUNC_29(), CLASS_5.class);
// Check class of objects in List, if String just use toString() on List
if (VAR_53.FUNC_12() == 0 || CLASS_1.class.FUNC_7(VAR_53.get(0).getClass())) {
VAR_34.FUNC_21(VAR_49, VAR_53.FUNC_29());
} else {
CLASS_5<CLASS_7<CLASS_1, Object>> listMap = (CLASS_5<CLASS_7<CLASS_1, Object>>)VAR_53;
for (final CLASS_7<CLASS_1, Object> VAR_52 : listMap) {
VAR_34.FUNC_32(FUNC_25(VAR_52, prefixes));
}
}
} else {
// if none of those things, then we'll just assume it's
// a string value that we can put into our map.
VAR_34.FUNC_21(VAR_49, VAR_50.FUNC_29());
}
} catch (final IOException VAR_23) {
logger.error("Unable to parse key [" + VAR_49 + "] with value (" + VAR_50
+ ") using Jackson, defaulting to calling toString() on this parameter branch.", VAR_23);
VAR_34.FUNC_21(VAR_49, VAR_50.FUNC_29());
} catch (final CLASS_12 VAR_23) {
logger.error("Unable to cast key [" + VAR_49 + "] with value (" + VAR_50
+ "), defaulting to calling toString() on this parameter branch.", VAR_23);
VAR_34.FUNC_21(VAR_49, VAR_50.FUNC_29());
} catch (final CLASS_9 VAR_23) {
logger.error("Unable to handle key [" + VAR_49 + "] with value (" + VAR_50
+ ") for unknown reasons. defaulting to calling toString() on this parameter branch.", VAR_23);
VAR_34.FUNC_21(VAR_49, VAR_50.FUNC_29());
}
}
}
return VAR_34;
}
} | 0.702033 | {'CLASS_0': 'AnalysisProvenanceServiceGalaxy', 'VAR_0': 'LoggerFactory', 'FUNC_0': 'getLogger', 'CLASS_1': 'String', 'VAR_1': 'ID_PARAM_KEY', 'CLASS_2': 'Joiner', 'VAR_2': 'Joiner', 'VAR_3': 'KEY_JOINER', 'FUNC_1': 'on', 'VAR_4': 'IridaToolParameter', 'VAR_5': 'PARAMETER_NAME_SEPARATOR', 'FUNC_2': 'skipNulls', 'VAR_6': 'JSON_TEXT_MAP_INDICATOR', 'VAR_7': 'JsonToken', 'FUNC_3': 'asString', 'VAR_8': 'JSON_TEXT_ARRAY_INDICATOR', 'CLASS_3': 'ObjectMapper', 'VAR_9': 'COLLECTION', 'CLASS_4': 'GalaxyHistoriesService', 'VAR_10': 'galaxyHistoriesService', 'VAR_11': 'toolsClient', 'VAR_12': 'jobsClient', 'FUNC_4': 'buildToolExecutionForOutputFile', 'VAR_13': 'remoteAnalysisId', 'VAR_14': 'analysisOutputFilename', 'CLASS_5': 'List', 'CLASS_6': 'HistoryContents', 'VAR_15': 'HistoryContents', 'VAR_16': 'historyContents', 'FUNC_5': 'showHistoryContents', 'CLASS_7': 'Map', 'VAR_17': 'historyContentsByName', 'FUNC_6': 'stream', 'VAR_18': 'content', 'FUNC_7': 'equals', 'FUNC_8': 'getHistoryContentType', 'FUNC_9': 'collect', 'FUNC_10': 'groupingBy', 'VAR_19': 'getName', 'FUNC_11': 'getName', 'VAR_20': 'currentContents', 'FUNC_12': 'size', 'CLASS_8': 'HistoryContentsProvenance', 'VAR_21': 'currentProvenance', 'FUNC_13': 'showProvenance', 'FUNC_14': 'getId', 'VAR_22': 'toolDetails', 'FUNC_15': 'getToolId', 'FUNC_16': 'buildToolExecutionForHistoryStep', 'CLASS_9': 'RuntimeException', 'VAR_23': 'e', 'VAR_24': 'predecessors', 'FUNC_17': 'getPredecessors', 'FUNC_18': 'getParameters', 'VAR_25': 'parameterKeys', 'VAR_26': 'k', 'FUNC_19': 'contains', 'VAR_27': 'p', 'FUNC_20': 'toSet', 'VAR_28': 'paramValues', 'CLASS_10': 'HashMap', 'VAR_29': 'parameterKey', 'FUNC_21': 'put', 'VAR_30': 'prevSteps', 'VAR_31': 'toolName', 'VAR_32': 'toolVersion', 'FUNC_22': 'getVersion', 'CLASS_11': 'JobDetails', 'FUNC_23': 'showJob', 'VAR_33': 'commandLine', 'FUNC_24': 'getCommandLine', 'VAR_34': 'paramStrings', 'FUNC_25': 'buildParamMap', 'VAR_35': 'predecessor', 'VAR_36': 'previousProvenance', 'VAR_37': 'previousToolDetails', 'VAR_38': 'toolExecution', 'FUNC_26': 'add', 'VAR_39': 'historyContentsProvenance', 'VAR_40': 'params', 'VAR_41': 'paramKey', 'FUNC_27': 'getKey', 'VAR_42': 'paramValue', 'VAR_43': 'SuppressWarnings', 'VAR_44': 'mapParam', 'FUNC_28': 'containsKey', 'FUNC_29': 'toString', 'FUNC_30': 'trace', 'VAR_45': 'valueMap', 'VAR_46': 'prefix', 'VAR_47': 'valueMapKey', 'FUNC_31': 'copyOf', 'VAR_48': 'length', 'VAR_49': 'key', 'VAR_50': 'value', 'FUNC_32': 'putAll', 'VAR_51': 'valueList', 'FUNC_33': 'trim', 'VAR_52': 'jsonValueMap', 'FUNC_34': 'readValue', 'VAR_53': 'list', 'CLASS_12': 'ClassCastException'} | java | OOP | 1.95% |
/**
* Copyright 2016 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package edu.columbia.rdf.htsview.tracks;
/**
* The enum TitlePosition.
*/
public class TitleProperties {
/** The m pos. */
private TitlePosition mPos;
/** The m visible. */
private boolean mVisible;
/**
* Instantiates a new title properties.
*
* @param position the position
*/
public TitleProperties(TitlePosition position) {
this(position, true);
}
/**
* Instantiates a new title properties.
*
* @param position the position
* @param visible the visible
*/
public TitleProperties(TitlePosition position, boolean visible) {
mPos = position;
mVisible = visible;
}
/**
* Gets the position.
*
* @return the position
*/
public TitlePosition getPosition() {
return mPos;
}
/**
* Gets the visible.
*
* @return the visible
*/
public boolean getVisible() {
return mVisible;
}
}
| /**
* Copyright 2016 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package IMPORT_0.columbia.IMPORT_1.IMPORT_2.tracks;
/**
* The enum TitlePosition.
*/
public class TitleProperties {
/** The m pos. */
private TitlePosition mPos;
/** The m visible. */
private boolean mVisible;
/**
* Instantiates a new title properties.
*
* @param position the position
*/
public TitleProperties(TitlePosition position) {
this(position, true);
}
/**
* Instantiates a new title properties.
*
* @param position the position
* @param visible the visible
*/
public TitleProperties(TitlePosition position, boolean VAR_0) {
mPos = position;
mVisible = VAR_0;
}
/**
* Gets the position.
*
* @return the position
*/
public TitlePosition FUNC_0() {
return mPos;
}
/**
* Gets the visible.
*
* @return the visible
*/
public boolean FUNC_1() {
return mVisible;
}
}
| 0.608192 | {'IMPORT_0': 'edu', 'IMPORT_1': 'rdf', 'IMPORT_2': 'htsview', 'VAR_0': 'visible', 'FUNC_0': 'getPosition', 'FUNC_1': 'getVisible'} | java | Hibrido | 100.00% |
// Find a minimum value in the right subtree
public TreeNode minRightSubTree()
{
if (this.leftChild == null)
{
return this;
}
else
{
return leftChild.minRightSubTree();
}
} | // Find a minimum value in the right subtree
public TreeNode minRightSubTree()
{
if (this.leftChild == null)
{
return this;
}
else
{
return leftChild.minRightSubTree();
}
} | 0.085484 | {} | java | Procedural | 100.00% |
/*
* Enclose 'value' in quotes while escaping any quotes that are already in it
*/
private String quote(String value) {
StringBuilder sb = new StringBuilder();
sb.append(QUOTE);
sb.append(CharMatcher.is(QUOTE).replaceFrom(value, QUOTE_WITH_ESCAPE));
sb.append(QUOTE);
return sb.toString();
} | /*
* Enclose 'value' in quotes while escaping any quotes that are already in it
*/
private CLASS_0 FUNC_0(CLASS_0 VAR_0) {
CLASS_1 VAR_1 = new CLASS_1();
VAR_1.FUNC_1(VAR_2);
VAR_1.FUNC_1(VAR_3.FUNC_2(VAR_2).FUNC_3(VAR_0, VAR_4));
VAR_1.FUNC_1(VAR_2);
return VAR_1.FUNC_4();
} | 0.980229 | {'CLASS_0': 'String', 'FUNC_0': 'quote', 'VAR_0': 'value', 'CLASS_1': 'StringBuilder', 'VAR_1': 'sb', 'FUNC_1': 'append', 'VAR_2': 'QUOTE', 'VAR_3': 'CharMatcher', 'FUNC_2': 'is', 'FUNC_3': 'replaceFrom', 'VAR_4': 'QUOTE_WITH_ESCAPE', 'FUNC_4': 'toString'} | java | Procedural | 66.67% |
// Given a characters array letters that is sorted in non-decreasing order and a character target,
// return the smallest character in the array that is larger than target.
// Note that the letters wrap around.
// For example, if target == 'z' and letters == ['a', 'b'], the answer is 'a'.
// Example 1:
// Input: letters = ["c","f","j"], target = "a"
// Output: "c"
// Example 2:
// Input: letters = ["c","f","j"], target = "c"
// Output: "f"
// Example 3:
// Input: letters = ["c","f","j"], target = "d"
// Output: "f"
// Example 4:
// Input: letters = ["c","f","j"], target = "g"
// Output: "j"
// Example 5:
// Input: letters = ["c","f","j"], target = "j"
// Output: "c"
// Constraints:
// 2 <= letters.length <= 104
// letters[i] is a lowercase English letter.
// letters is sorted in non-decreasing order.
// letters contains at least two different characters.
// target is a lowercase English letter.
//METHOD 1
class Solution {
public char nextGreatestLetter(char[] letters, char target) {
for(char c : letters)
if(c > target)
return c;
return letters[0];
}
}
// METHOD 2
class Solution {
public char nextGreatestLetter(char[] letters, char target) {
int low = 0, high = letters.length;
while(low < high){
int mid = low + (high - low) / 2;
if(letters[mid] <= target)
low = mid + 1;
else high = mid;
}
return letters[low % letters.length];
}
} | // Given a characters array letters that is sorted in non-decreasing order and a character target,
// return the smallest character in the array that is larger than target.
// Note that the letters wrap around.
// For example, if target == 'z' and letters == ['a', 'b'], the answer is 'a'.
// Example 1:
// Input: letters = ["c","f","j"], target = "a"
// Output: "c"
// Example 2:
// Input: letters = ["c","f","j"], target = "c"
// Output: "f"
// Example 3:
// Input: letters = ["c","f","j"], target = "d"
// Output: "f"
// Example 4:
// Input: letters = ["c","f","j"], target = "g"
// Output: "j"
// Example 5:
// Input: letters = ["c","f","j"], target = "j"
// Output: "c"
// Constraints:
// 2 <= letters.length <= 104
// letters[i] is a lowercase English letter.
// letters is sorted in non-decreasing order.
// letters contains at least two different characters.
// target is a lowercase English letter.
//METHOD 1
class Solution {
public char nextGreatestLetter(char[] VAR_0, char target) {
for(char c : VAR_0)
if(c > target)
return c;
return VAR_0[0];
}
}
// METHOD 2
class Solution {
public char nextGreatestLetter(char[] VAR_0, char target) {
int low = 0, high = VAR_0.length;
while(low < high){
int VAR_1 = low + (high - low) / 2;
if(VAR_0[VAR_1] <= target)
low = VAR_1 + 1;
else high = VAR_1;
}
return VAR_0[low % VAR_0.length];
}
} | 0.37759 | {'VAR_0': 'letters', 'VAR_1': 'mid'} | java | OOP | 100.00% |
// later, if the API supports submitting commands in batch.
private static void wire(
AppConfig appConfig,
String party,
ContractQuery contractQuery,
Function<ActiveContractSet, Flowable<Command>> bot) {
LedgerClient ledgerClient = appConfig.getClientFor(party);
ledgerClient
.getActiveContracts(contractQuery)
.flatMap(bot::apply)
.forEach(command -> submitCommand(ledgerClient, command));
} | // later, if the API supports submitting commands in batch.
private static void wire(
AppConfig appConfig,
String party,
ContractQuery contractQuery,
Function<ActiveContractSet, Flowable<Command>> bot) {
LedgerClient VAR_0 = appConfig.getClientFor(party);
VAR_0
.getActiveContracts(contractQuery)
.FUNC_0(bot::apply)
.forEach(command -> submitCommand(VAR_0, command));
} | 0.207096 | {'VAR_0': 'ledgerClient', 'FUNC_0': 'flatMap'} | java | Procedural | 90.74% |
/**
* DataReader impl.
*
* @param <T>
* Topic data type.
*
* @author Matt Coley
*/
public class DataReaderImpl<T> extends EntityBase<DataReader<T>, DataReaderListener<T>, DataReaderQos>
implements DataReader<T> {
private final Subscriber parent;
private final TopicDescription<T> topic;
private final List<ReadCondition<T>> conditions = new ArrayList<>();
/**
* @param environment
* Environment context.
* @param parent
* Subscriber that this topic belongs to.
* @param topic
* Topic to read from.
* @param qos
* Quality of service of the reader.
* @param listener
* Optional reader listener.
* @param listenerStatuses
* Status filter mask for the listener.
*/
public DataReaderImpl(ServiceEnvironment environment, Subscriber parent, TopicDescription<T> topic,
DataReaderQos qos, DataReaderListener<T> listener,
Collection<Class<? extends Status>> listenerStatuses) {
super(environment);
this.parent = parent;
this.topic = topic;
setQos(qos);
setListener(listener, listenerStatuses);
}
@Override
protected void addInitialStatuses() {
// TODO: Should consider non-null default values for some of these?
registerStatus(new DataAvailableStatusImpl(getEnvironment()));
registerStatus(new SampleLostStatusImpl(getEnvironment(), 0, 0));
registerStatus(new RequestedDeadlineMissedStatusImpl(getEnvironment(), 0, 0, null));
registerStatus(new RequestedIncompatibleQosStatusImpl(getEnvironment(), 0, 0, null, null));
registerStatus(new LivelinessChangedStatusImpl(getEnvironment(), 0, 0, 0, 0, null));
registerStatus(new SubscriptionMatchedStatusImpl(getEnvironment(), 0, 0, 0, 0, null));
registerStatus(new SampleRejectedStatusImpl(getEnvironment(), 0, 0,
SampleRejectedStatus.Kind.NOT_REJECTED, null));
}
@Override
public void closeContainedEntities() {
conditions.forEach(ReadCondition::close);
conditions.clear();
}
@Override
public void close() {
super.close();
// TODO: Additional work on closure
// "A DataReader cannot be closed if it has any outstanding loans as a result of
// a call to DataReader.read(), DataReader.take(), or one of the variants thereof."
}
@Override
public void retain() {
// TODO: What to do here?
}
@Override
@SuppressWarnings("unchecked")
public <X> DataReader<X> cast() {
return (DataReader<X>) this;
}
@Override
public Selector<T> select() {
// TODO: Investigate enforcing defined constraints wherever this is used:
// - https://www.javadoc.io/static/org.omg.dds/java5-psm/1.0/org/omg/dds/sub/DataReader.html#take(org.omg.dds.sub.DataReader.Selector)
return new SelectorImpl<>(getEnvironment(), this);
}
@Override
public ReadCondition<T> createReadCondition(Subscriber.DataState states) {
ReadCondition<T> condition = new ReadConditionImpl<>(getEnvironment(), this, states);
conditions.add(condition);
return condition;
}
@Override
public QueryCondition<T> createQueryCondition(String queryExpression, List<String> queryParameters) {
return createQueryCondition(getParent().createDataState(), queryExpression, queryParameters);
}
@Override
public QueryCondition<T> createQueryCondition(Subscriber.DataState states, String queryExpression,
List<String> queryParameters) {
QueryCondition<T> condition =
new QueryConditionImpl<>(getEnvironment(), this, states, queryExpression, queryParameters);
conditions.add(condition);
return condition;
}
@Override
public SampleRejectedStatus getSampleRejectedStatus() {
// TODO: Track this info
// - Total samples rejected
// - Samples rejected since last query
// - Most recent rejection reason
return getStatus(SampleRejectedStatus.class);
}
@Override
public LivelinessChangedStatus getLivelinessChangedStatus() {
// TODO: Track this info
// - Current number of alive writers on the topic this reads from
// - Current number of dead writers on the topic this reads from
// - differences in these numbers from the last query
return getStatus(LivelinessChangedStatus.class);
}
@Override
public RequestedDeadlineMissedStatus getRequestedDeadlineMissedStatus() {
// TODO: Track this info
// - Total number of missed deadlines
// - Difference from last query
return getStatus(RequestedDeadlineMissedStatus.class);
}
@Override
public RequestedIncompatibleQosStatus getRequestedIncompatibleQosStatus() {
// TODO: Track this info
// - Total number of incompatibile writers on the same topic
// - Difference in number from last query
// - Last policy that was incompatible
// - Set of policy counts to summarize all total-incompatibilities for all policies
return getStatus(RequestedIncompatibleQosStatus.class);
}
@Override
public SubscriptionMatchedStatus getSubscriptionMatchedStatus() {
// TODO: Track this info
// - Total number of reader/writer compatibility matches
// - Difference in number from last query
// - Current number of reader/writer compatibility matches
// - Difference in number from last query
return getStatus(SubscriptionMatchedStatus.class);
}
@Override
public SampleLostStatus getSampleLostStatus() {
// TODO: Track this info
// - Lost samples across ALL instances (so it should be static?)
// - Difference from last query
return getStatus(SampleLostStatus.class);
}
@Override
public void waitForHistoricalData(long maxWait, TimeUnit unit) throws TimeoutException {
waitForHistoricalData(getEnvironment().getSPI().newDuration(maxWait, unit));
}
@Override
public void waitForHistoricalData(Duration maxWait) throws TimeoutException {
// Only used when (durability != Durability.Kind.VOLATILE)
// TODO: Wait until history data is received, block the current thread
// - Throw TimeoutException :: if maxWait elapsed before all the data was received.
}
@Override
public Set<InstanceHandle> getMatchedPublications() {
// TODO: Record matched DataWriters on the topic
// - Ignore when ignored by the parent DomainParticipant
// - Returned as a new collection
throw new UnsupportedOperationException();
}
@Override
public PublicationBuiltinTopicData getMatchedPublicationData(InstanceHandle publicationHandle) {
// TODO: Record matched DataWriters on the topic
// - Ignore when ignored by the parent DomainParticipant
throw new UnsupportedOperationException();
}
@Override
public Sample.Iterator<T> read() {
return read(select());
}
@Override
public Sample.Iterator<T> read(int maxSamples) {
return read(select().maxSamples(maxSamples));
}
@Override
public Sample.Iterator<T> read(Selector<T> query) {
return new SampleIteratorImpl<>(read(new ArrayList<>(), query));
}
@Override
public List<Sample<T>> read(List<Sample<T>> samples) {
return read(samples, select());
}
@Override
public List<Sample<T>> read(List<Sample<T>> samples, Selector<T> selector) {
// TODO: Read operation
// - Samples are not "loaned" but deep copied into the list
// - if (samples read < list.size(), the list will be trimmed to fit the samples read
// - if (list == null), the list size will be unbounded
// - if (samples read == 0), the list will be empty
throw new UnsupportedOperationException();
// return samples;
}
@Override
public Sample.Iterator<T> take() {
return new SampleIteratorImpl<>(take(new ArrayList<>()));
}
@Override
public Sample.Iterator<T> take(int maxSamples) {
return new SampleIteratorImpl<>(take(new ArrayList<>(), select().maxSamples(maxSamples)));
}
@Override
public Sample.Iterator<T> take(Selector<T> query) {
return new SampleIteratorImpl<>(take(new ArrayList<>(), query));
}
@Override
public List<Sample<T>> take(List<Sample<T>> samples) {
return take(samples, select());
}
@Override
public List<Sample<T>> take(List<Sample<T>> samples, Selector<T> query) {
// TODO: Take operation
// - Samples are not "loaned" but deep copied into the list
// - if (samples read < list.size(), the list will be trimmed to fit the samples read
// - if (list == null), the list size will be unbounded
// - if (samples read == 0), the list will be empty
throw new UnsupportedOperationException();
// return samples;
}
@Override
public boolean readNextSample(Sample<T> sample) {
List<Sample<T>> read = read(new ArrayList<>(), select()
.maxSamples(1)
.dataState(getParent().createDataState()
.with(SampleState.NOT_READ)
.withAnyViewState()
.withAnyInstanceState()
));
// TODO: Copy read value into "sample"
// - What is the point if we're not caching this anywhere to use?
return !read.isEmpty();
}
@Override
public boolean takeNextSample(Sample<T> sample) {
List<Sample<T>> take = take(new ArrayList<>(), select()
.maxSamples(1)
.dataState(getParent().createDataState()
.with(SampleState.NOT_READ)
.withAnyViewState()
.withAnyInstanceState()
));
// TODO: Copy take value into "sample"
// - What is the point if we're not caching this anywhere to use?
return !take.isEmpty();
}
@Override
public T getKeyValue(T keyHolder, InstanceHandle handle) {
// TODO: Implement?
// - "handle of the instance whose value to place into the holder
// - IllegalArgumentException - when handle does not map to a known object in the DataReader
// - Unspecified behavior if implementation does not track invalid handles
return keyHolder;
}
@Override
public ModifiableInstanceHandle lookupInstance(ModifiableInstanceHandle handle, T keyHolder) {
if (handle instanceof InstanceHandleImpl && keyHolder instanceof Entity) {
return ((InstanceHandleImpl) handle).withEntity((Entity<?, ?>) keyHolder);
} else {
// The spec says this needs to be a nil-handle, which should be an immutable handle to "null"...
// But the return type won't allow that, so we use a mutable handle that points to "null"...
return new InstanceHandleImpl(getEnvironment()).withEntity(null);
}
}
@Override
public InstanceHandle lookupInstance(T keyHolder) {
if (keyHolder instanceof Entity) {
return ((Entity<?, ?>) keyHolder).getInstanceHandle();
} else {
return getEnvironment().getSPI().nilHandle();
}
}
@Override
public TopicDescription<T> getTopicDescription() {
return topic;
}
@Override
public Subscriber getParent() {
return parent;
}
@Override
protected DataReaderQos fetchProviderQos(QosProvider provider) {
return provider.getDataReaderQos();
}
} | /**
* DataReader impl.
*
* @param <T>
* Topic data type.
*
* @author Matt Coley
*/
public class CLASS_0<CLASS_1> extends CLASS_2<DataReader<CLASS_1>, DataReaderListener<CLASS_1>, DataReaderQos>
implements DataReader<CLASS_1> {
private final CLASS_3 VAR_0;
private final CLASS_4<CLASS_1> VAR_1;
private final CLASS_5<CLASS_6<CLASS_1>> conditions = new CLASS_7<>();
/**
* @param environment
* Environment context.
* @param parent
* Subscriber that this topic belongs to.
* @param topic
* Topic to read from.
* @param qos
* Quality of service of the reader.
* @param listener
* Optional reader listener.
* @param listenerStatuses
* Status filter mask for the listener.
*/
public CLASS_0(CLASS_8 VAR_3, CLASS_3 VAR_0, CLASS_4<CLASS_1> VAR_1,
DataReaderQos VAR_4, DataReaderListener<CLASS_1> VAR_5,
CLASS_9<CLASS_10<? extends CLASS_11>> VAR_6) {
super(VAR_3);
this.VAR_0 = VAR_0;
this.VAR_1 = VAR_1;
FUNC_0(VAR_4);
FUNC_1(VAR_5, VAR_6);
}
@VAR_7
protected void FUNC_2() {
// TODO: Should consider non-null default values for some of these?
registerStatus(new CLASS_12(FUNC_3()));
registerStatus(new CLASS_13(FUNC_3(), 0, 0));
registerStatus(new CLASS_14(FUNC_3(), 0, 0, null));
registerStatus(new CLASS_15(FUNC_3(), 0, 0, null, null));
registerStatus(new CLASS_16(FUNC_3(), 0, 0, 0, 0, null));
registerStatus(new CLASS_17(FUNC_3(), 0, 0, 0, 0, null));
registerStatus(new CLASS_18(FUNC_3(), 0, 0,
VAR_8.VAR_9.VAR_10, null));
}
@VAR_7
public void FUNC_4() {
conditions.FUNC_5(VAR_2::VAR_11);
conditions.FUNC_7();
}
@VAR_7
public void FUNC_6() {
super.FUNC_6();
// TODO: Additional work on closure
// "A DataReader cannot be closed if it has any outstanding loans as a result of
// a call to DataReader.read(), DataReader.take(), or one of the variants thereof."
}
@VAR_7
public void retain() {
// TODO: What to do here?
}
@VAR_7
@VAR_12("unchecked")
public <CLASS_20> DataReader<CLASS_20> FUNC_8() {
return (DataReader<CLASS_20>) this;
}
@VAR_7
public CLASS_21<CLASS_1> FUNC_9() {
// TODO: Investigate enforcing defined constraints wherever this is used:
// - https://www.javadoc.io/static/org.omg.dds/java5-psm/1.0/org/omg/dds/sub/DataReader.html#take(org.omg.dds.sub.DataReader.Selector)
return new CLASS_22<>(FUNC_3(), this);
}
@VAR_7
public CLASS_6<CLASS_1> createReadCondition(CLASS_3.CLASS_23 states) {
CLASS_6<CLASS_1> VAR_13 = new CLASS_24<>(FUNC_3(), this, states);
conditions.add(VAR_13);
return VAR_13;
}
@VAR_7
public CLASS_25<CLASS_1> FUNC_10(CLASS_26 VAR_14, CLASS_5<CLASS_26> VAR_15) {
return FUNC_10(FUNC_11().FUNC_12(), VAR_14, VAR_15);
}
@VAR_7
public CLASS_25<CLASS_1> FUNC_10(CLASS_3.CLASS_23 states, CLASS_26 VAR_14,
CLASS_5<CLASS_26> VAR_15) {
CLASS_25<CLASS_1> VAR_13 =
new CLASS_27<>(FUNC_3(), this, states, VAR_14, VAR_15);
conditions.add(VAR_13);
return VAR_13;
}
@VAR_7
public CLASS_19 getSampleRejectedStatus() {
// TODO: Track this info
// - Total samples rejected
// - Samples rejected since last query
// - Most recent rejection reason
return FUNC_13(CLASS_19.class);
}
@VAR_7
public CLASS_28 FUNC_14() {
// TODO: Track this info
// - Current number of alive writers on the topic this reads from
// - Current number of dead writers on the topic this reads from
// - differences in these numbers from the last query
return FUNC_13(CLASS_28.class);
}
@VAR_7
public CLASS_29 FUNC_15() {
// TODO: Track this info
// - Total number of missed deadlines
// - Difference from last query
return FUNC_13(CLASS_29.class);
}
@VAR_7
public CLASS_30 getRequestedIncompatibleQosStatus() {
// TODO: Track this info
// - Total number of incompatibile writers on the same topic
// - Difference in number from last query
// - Last policy that was incompatible
// - Set of policy counts to summarize all total-incompatibilities for all policies
return FUNC_13(CLASS_30.class);
}
@VAR_7
public CLASS_31 FUNC_16() {
// TODO: Track this info
// - Total number of reader/writer compatibility matches
// - Difference in number from last query
// - Current number of reader/writer compatibility matches
// - Difference in number from last query
return FUNC_13(CLASS_31.class);
}
@VAR_7
public CLASS_32 getSampleLostStatus() {
// TODO: Track this info
// - Lost samples across ALL instances (so it should be static?)
// - Difference from last query
return FUNC_13(CLASS_32.class);
}
@VAR_7
public void waitForHistoricalData(long VAR_16, CLASS_33 unit) throws CLASS_34 {
waitForHistoricalData(FUNC_3().FUNC_17().FUNC_18(VAR_16, unit));
}
@VAR_7
public void waitForHistoricalData(CLASS_35 VAR_16) throws CLASS_34 {
// Only used when (durability != Durability.Kind.VOLATILE)
// TODO: Wait until history data is received, block the current thread
// - Throw TimeoutException :: if maxWait elapsed before all the data was received.
}
@VAR_7
public Set<InstanceHandle> FUNC_19() {
// TODO: Record matched DataWriters on the topic
// - Ignore when ignored by the parent DomainParticipant
// - Returned as a new collection
throw new CLASS_36();
}
@VAR_7
public CLASS_37 FUNC_20(InstanceHandle VAR_17) {
// TODO: Record matched DataWriters on the topic
// - Ignore when ignored by the parent DomainParticipant
throw new CLASS_36();
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_21() {
return FUNC_21(FUNC_9());
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_21(int VAR_19) {
return FUNC_21(FUNC_9().FUNC_22(VAR_19));
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_21(CLASS_21<CLASS_1> VAR_20) {
return new CLASS_40<>(FUNC_21(new CLASS_7<>(), VAR_20));
}
@VAR_7
public CLASS_5<CLASS_38<CLASS_1>> FUNC_21(CLASS_5<CLASS_38<CLASS_1>> VAR_21) {
return FUNC_21(VAR_21, FUNC_9());
}
@VAR_7
public CLASS_5<CLASS_38<CLASS_1>> FUNC_21(CLASS_5<CLASS_38<CLASS_1>> VAR_21, CLASS_21<CLASS_1> VAR_22) {
// TODO: Read operation
// - Samples are not "loaned" but deep copied into the list
// - if (samples read < list.size(), the list will be trimmed to fit the samples read
// - if (list == null), the list size will be unbounded
// - if (samples read == 0), the list will be empty
throw new CLASS_36();
// return samples;
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_23() {
return new CLASS_40<>(FUNC_23(new CLASS_7<>()));
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_23(int VAR_19) {
return new CLASS_40<>(FUNC_23(new CLASS_7<>(), FUNC_9().FUNC_22(VAR_19)));
}
@VAR_7
public CLASS_38.CLASS_39<CLASS_1> FUNC_23(CLASS_21<CLASS_1> VAR_20) {
return new CLASS_40<>(FUNC_23(new CLASS_7<>(), VAR_20));
}
@VAR_7
public CLASS_5<CLASS_38<CLASS_1>> FUNC_23(CLASS_5<CLASS_38<CLASS_1>> VAR_21) {
return FUNC_23(VAR_21, FUNC_9());
}
@VAR_7
public CLASS_5<CLASS_38<CLASS_1>> FUNC_23(CLASS_5<CLASS_38<CLASS_1>> VAR_21, CLASS_21<CLASS_1> VAR_20) {
// TODO: Take operation
// - Samples are not "loaned" but deep copied into the list
// - if (samples read < list.size(), the list will be trimmed to fit the samples read
// - if (list == null), the list size will be unbounded
// - if (samples read == 0), the list will be empty
throw new CLASS_36();
// return samples;
}
@VAR_7
public boolean FUNC_24(CLASS_38<CLASS_1> VAR_24) {
CLASS_5<CLASS_38<CLASS_1>> VAR_18 = FUNC_21(new CLASS_7<>(), FUNC_9()
.FUNC_22(1)
.dataState(FUNC_11().FUNC_12()
.FUNC_25(VAR_25.VAR_26)
.FUNC_26()
.withAnyInstanceState()
));
// TODO: Copy read value into "sample"
// - What is the point if we're not caching this anywhere to use?
return !VAR_18.FUNC_27();
}
@VAR_7
public boolean FUNC_28(CLASS_38<CLASS_1> VAR_24) {
CLASS_5<CLASS_38<CLASS_1>> VAR_23 = FUNC_23(new CLASS_7<>(), FUNC_9()
.FUNC_22(1)
.dataState(FUNC_11().FUNC_12()
.FUNC_25(VAR_25.VAR_26)
.FUNC_26()
.withAnyInstanceState()
));
// TODO: Copy take value into "sample"
// - What is the point if we're not caching this anywhere to use?
return !VAR_23.FUNC_27();
}
@VAR_7
public CLASS_1 FUNC_29(CLASS_1 VAR_27, InstanceHandle VAR_28) {
// TODO: Implement?
// - "handle of the instance whose value to place into the holder
// - IllegalArgumentException - when handle does not map to a known object in the DataReader
// - Unspecified behavior if implementation does not track invalid handles
return VAR_27;
}
@VAR_7
public CLASS_41 FUNC_30(CLASS_41 VAR_28, CLASS_1 VAR_27) {
if (VAR_28 instanceof CLASS_42 && VAR_27 instanceof Entity) {
return ((CLASS_42) VAR_28).FUNC_31((Entity<?, ?>) VAR_27);
} else {
// The spec says this needs to be a nil-handle, which should be an immutable handle to "null"...
// But the return type won't allow that, so we use a mutable handle that points to "null"...
return new CLASS_42(FUNC_3()).FUNC_31(null);
}
}
@VAR_7
public InstanceHandle FUNC_30(CLASS_1 VAR_27) {
if (VAR_27 instanceof Entity) {
return ((Entity<?, ?>) VAR_27).FUNC_32();
} else {
return FUNC_3().FUNC_17().FUNC_33();
}
}
@VAR_7
public CLASS_4<CLASS_1> FUNC_34() {
return VAR_1;
}
@VAR_7
public CLASS_3 FUNC_11() {
return VAR_0;
}
@VAR_7
protected DataReaderQos FUNC_35(CLASS_43 VAR_29) {
return VAR_29.FUNC_36();
}
} | 0.840763 | {'CLASS_0': 'DataReaderImpl', 'CLASS_1': 'T', 'CLASS_2': 'EntityBase', 'CLASS_3': 'Subscriber', 'VAR_0': 'parent', 'CLASS_4': 'TopicDescription', 'VAR_1': 'topic', 'CLASS_5': 'List', 'CLASS_6': 'ReadCondition', 'VAR_2': 'ReadCondition', 'CLASS_7': 'ArrayList', 'CLASS_8': 'ServiceEnvironment', 'VAR_3': 'environment', 'VAR_4': 'qos', 'VAR_5': 'listener', 'CLASS_9': 'Collection', 'CLASS_10': 'Class', 'CLASS_11': 'Status', 'VAR_6': 'listenerStatuses', 'FUNC_0': 'setQos', 'FUNC_1': 'setListener', 'VAR_7': 'Override', 'FUNC_2': 'addInitialStatuses', 'CLASS_12': 'DataAvailableStatusImpl', 'FUNC_3': 'getEnvironment', 'CLASS_13': 'SampleLostStatusImpl', 'CLASS_14': 'RequestedDeadlineMissedStatusImpl', 'CLASS_15': 'RequestedIncompatibleQosStatusImpl', 'CLASS_16': 'LivelinessChangedStatusImpl', 'CLASS_17': 'SubscriptionMatchedStatusImpl', 'CLASS_18': 'SampleRejectedStatusImpl', 'VAR_8': 'SampleRejectedStatus', 'CLASS_19': 'SampleRejectedStatus', 'VAR_9': 'Kind', 'VAR_10': 'NOT_REJECTED', 'FUNC_4': 'closeContainedEntities', 'FUNC_5': 'forEach', 'VAR_11': 'close', 'FUNC_6': 'close', 'FUNC_7': 'clear', 'VAR_12': 'SuppressWarnings', 'CLASS_20': 'X', 'FUNC_8': 'cast', 'CLASS_21': 'Selector', 'FUNC_9': 'select', 'CLASS_22': 'SelectorImpl', 'CLASS_23': 'DataState', 'VAR_13': 'condition', 'CLASS_24': 'ReadConditionImpl', 'CLASS_25': 'QueryCondition', 'FUNC_10': 'createQueryCondition', 'CLASS_26': 'String', 'VAR_14': 'queryExpression', 'VAR_15': 'queryParameters', 'FUNC_11': 'getParent', 'FUNC_12': 'createDataState', 'CLASS_27': 'QueryConditionImpl', 'FUNC_13': 'getStatus', 'CLASS_28': 'LivelinessChangedStatus', 'FUNC_14': 'getLivelinessChangedStatus', 'CLASS_29': 'RequestedDeadlineMissedStatus', 'FUNC_15': 'getRequestedDeadlineMissedStatus', 'CLASS_30': 'RequestedIncompatibleQosStatus', 'CLASS_31': 'SubscriptionMatchedStatus', 'FUNC_16': 'getSubscriptionMatchedStatus', 'CLASS_32': 'SampleLostStatus', 'VAR_16': 'maxWait', 'CLASS_33': 'TimeUnit', 'CLASS_34': 'TimeoutException', 'FUNC_17': 'getSPI', 'FUNC_18': 'newDuration', 'CLASS_35': 'Duration', 'FUNC_19': 'getMatchedPublications', 'CLASS_36': 'UnsupportedOperationException', 'CLASS_37': 'PublicationBuiltinTopicData', 'FUNC_20': 'getMatchedPublicationData', 'VAR_17': 'publicationHandle', 'CLASS_38': 'Sample', 'CLASS_39': 'Iterator', 'FUNC_21': 'read', 'VAR_18': 'read', 'VAR_19': 'maxSamples', 'FUNC_22': 'maxSamples', 'VAR_20': 'query', 'CLASS_40': 'SampleIteratorImpl', 'VAR_21': 'samples', 'VAR_22': 'selector', 'FUNC_23': 'take', 'VAR_23': 'take', 'FUNC_24': 'readNextSample', 'VAR_24': 'sample', 'FUNC_25': 'with', 'VAR_25': 'SampleState', 'VAR_26': 'NOT_READ', 'FUNC_26': 'withAnyViewState', 'FUNC_27': 'isEmpty', 'FUNC_28': 'takeNextSample', 'FUNC_29': 'getKeyValue', 'VAR_27': 'keyHolder', 'VAR_28': 'handle', 'CLASS_41': 'ModifiableInstanceHandle', 'FUNC_30': 'lookupInstance', 'CLASS_42': 'InstanceHandleImpl', 'FUNC_31': 'withEntity', 'FUNC_32': 'getInstanceHandle', 'FUNC_33': 'nilHandle', 'FUNC_34': 'getTopicDescription', 'FUNC_35': 'fetchProviderQos', 'CLASS_43': 'QosProvider', 'VAR_29': 'provider', 'FUNC_36': 'getDataReaderQos'} | java | OOP | 10.13% |
package com.github.solon_foot.view_log;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.Point;
import android.os.Build;
import android.os.Looper;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.github.solon_foot.TLog;
import com.github.solon_foot.TLog.PrintProxy;
import java.util.Calendar;
public class FloatView extends FrameLayout implements PrintProxy {
ImageView btnOk;
View secondView;
ListView listView;
ArrayAdapter<Model> adapter;
private static final int[] LOG_COLORS = {Color.WHITE,Color.WHITE,
0xFFbbbbbb,0xFF0070bb,0xFF48bb31,0xFFbbbb23,0xFFff5370,0xFF8f0005
};
WindowManager windowManager;
WindowManager.LayoutParams params;
Point screenSize = new Point();
final int viewWidth;
public FloatView(Context context) {
super(context);
viewWidth = (int) (getResources().getDisplayMetrics().density * 50);
init(context, viewWidth);
// setLayoutParams(new LayoutParams(width, width));
btnOk = new ImageView(context);
// btnOk.setBackgroundResource(R.drawable.icon_btn);
btnOk.setBackgroundResource(R.drawable.view_log_bg_log);
btnOk.setImageResource(R.drawable.view_log_icon_log);
btnOk.setPadding(viewWidth/5,viewWidth/5,viewWidth/5,viewWidth/5);
btnOk.setOnClickListener(v -> {
btnOk.setVisibility(GONE);
secondView.setVisibility(VISIBLE);
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.MATCH_PARENT;
windowManager.updateViewLayout(this, params);
});
LayoutParams params = new LayoutParams(viewWidth,viewWidth);
params.gravity = Gravity.CENTER;
addView(btnOk, params);
initSecondView(context);
}
private void copy(String data){
ClipboardManager clipboardManager = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clipData = ClipData.newPlainText("debug log",data);
clipboardManager.setPrimaryClip(clipData);
}
private void initSecondView(Context context) {
LayoutInflater inflater = LayoutInflater.from(context);
secondView = inflater.inflate(R.layout.view_log_layout_log, this, false);
listView = secondView.findViewById(R.id.list_view);
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
copy(adapter.getItem(position).msg);
Toast.makeText(getContext(),"Copied",Toast.LENGTH_SHORT).show();
return true;
}
});
adapter = new ArrayAdapter<Model>(context, 0){
int padding = (int) (getResources().getDisplayMetrics().density*4);
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView =null;
if (convertView==null){
textView = new TextView(parent.getContext());
textView.setPadding(padding,padding,padding,0);
textView.setTextSize(12);
}else {
textView = (TextView) convertView;
}
Model item = getItem(position);
textView.setText(item.toString());
textView.setTextColor(LOG_COLORS[item.priority]);
return textView;
}
};
listView.setAdapter(adapter);
secondView.findViewById(R.id.close).setOnClickListener(v->{
params.width = LayoutParams.WRAP_CONTENT;
params.height = LayoutParams.WRAP_CONTENT;
windowManager.updateViewLayout(this, params);
btnOk.setVisibility(VISIBLE);
secondView.setVisibility(GONE);
});
secondView.findViewById(R.id.clear).setOnClickListener(v->{
adapter.clear();
});
secondView.findViewById(R.id.copy).setOnClickListener(v->{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < adapter.getCount(); i++) {
Model item = adapter.getItem(i);
sb.append(item.toString).append('\n');
}
copy(sb.toString());
});
addView(secondView,0);
secondView.setVisibility(GONE);
}
private void init(Context context, int width) {
windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (windowManager == null) {
return;
}
params = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
params.type = WindowManager.LayoutParams.TYPE_PHONE;
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
params.type = WindowManager.LayoutParams.TYPE_TOAST;
} else {
params.type = WindowManager.LayoutParams.TYPE_PHONE;
}
windowManager.getDefaultDisplay().getSize(screenSize);
params.width = LayoutParams.WRAP_CONTENT;
params.height = LayoutParams.WRAP_CONTENT;
params.y = screenSize.y-width;
params.x = screenSize.x-width;
params.gravity = Gravity.TOP | Gravity.LEFT;
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
// | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
// | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
params.format = PixelFormat.TRANSLUCENT;
params.windowAnimations = 0;
windowManager.addView(this, params);
}
float lastX, lastY;
int tempX, tempY;
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() != MotionEvent.ACTION_MOVE) {
return super.onTouchEvent(event);
}
float x = event.getRawX();
float y = event.getRawY();
params.x = (int) (tempX + x - lastX);
params.y = (int) (tempY + y - lastY);
if (params.x < 0) {
params.x = 0;
}
if (params.y < 0) {
params.y = 0;
}
if (params.x + params.width > screenSize.x) {
params.x = screenSize.x - params.width;
}
if (params.y + params.height > screenSize.y) {
params.y = screenSize.y - params.height;
}
windowManager.updateViewLayout(this, params);
return super.onTouchEvent(event);
}
private static final int SNAP_VELOCITY = 600; // 最小滑动速度
private VelocityTracker mVelocityTracker; // 速度追踪器
private boolean mIsSwipe; // 是否滑动子View
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
windowManager.getDefaultDisplay().getSize(screenSize);
params = (WindowManager.LayoutParams) getLayoutParams();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
if (btnOk.getVisibility()!=VISIBLE) return super.onInterceptTouchEvent(e);
// if (params.alpha != 1) {
// params.alpha = 1;
// windowManager.updateViewLayout(this, params);
// }
// mHandler.removeMessages(-1);
// mHandler.sendEmptyMessageDelayed(-1, 5_000);
float x = e.getRawX();
float y = e.getRawY();
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(e);
switch (e.getAction()) {
case MotionEvent.ACTION_DOWN: // 因为没有拦截,所以不会被调用到
mIsSwipe = false;
lastX = x;
lastY = y;
tempX = params.x;
tempY = params.y;
break;
case MotionEvent.ACTION_MOVE:
if (mIsSwipe) {
break;
}
mVelocityTracker.computeCurrentVelocity(1000);
float xVelocity = mVelocityTracker.getXVelocity();
float yVelocity = mVelocityTracker.getYVelocity();
if (Math.abs(xVelocity) > SNAP_VELOCITY || Math.abs(yVelocity) > SNAP_VELOCITY || (e.getEventTime() - e.getDownTime()
> 500)) {
mIsSwipe = true;
return true;
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
mIsSwipe = false;
mVelocityTracker.clear();
break;
}
return mIsSwipe || super.onInterceptTouchEvent(e);
}
public void destory() {
windowManager.removeView(this);
}
@Override
public void println(int priority, String msg) {
appendString(new Model(priority,msg));
}
private void appendString(Model msg) {
if (Thread.currentThread() != Looper.getMainLooper().getThread()) {
post(() -> appendString(msg));
return;
}
msg.process();
adapter.add(msg);
}
final static class Model {
final int priority;
final String msg;
Thread thread;
public Model(int priority, String msg) {
this.priority = priority;
this.msg = msg;
this.thread = Thread.currentThread();
}
private String toString;
private static int fixLen = 30;
private void process() {
Calendar instance = Calendar.getInstance();
StringBuilder sb = new StringBuilder();
sb.append('[');
process(sb, instance.get(Calendar.HOUR_OF_DAY), 2);
sb.append(':');
process(sb, instance.get(Calendar.MINUTE), 2);
sb.append(':');
process(sb, instance.get(Calendar.SECOND), 2);
sb.append(':');
process(sb, instance.get(Calendar.MILLISECOND), 3);
sb.append(']');
sb.append(' ');
sb.append(thread.getId()).append("/").append(thread.getName());
if (sb.length()<fixLen){
for (int i = sb.length(); i < fixLen; i++) {
sb.append(' ');
}
} else {
sb.delete(fixLen,sb.length());
}
sb.append(' ');
sb.append(logLevel[priority]).append(':');
sb.append(msg);
toString = sb.toString();
}
static final char[] logLevel={' ',' ','V','D','I','W','E','A'};
private void process(StringBuilder sb, int t, int len) {
int tt = 1;
while (len > 1) {
tt *= 10;
len--;
}
while (t < tt) {
sb.append('0');
tt /= 10;
}
sb.append(t);
}
@Override
public String toString() {
return toString;
}
}
}
| package IMPORT_0.github.solon_foot.IMPORT_1;
import android.content.IMPORT_2;
import android.content.ClipboardManager;
import android.content.IMPORT_3;
import android.content.res.Configuration;
import android.graphics.Color;
import android.graphics.PixelFormat;
import android.graphics.IMPORT_4;
import android.os.Build;
import android.os.Looper;
import android.IMPORT_5.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.IMPORT_6;
import android.view.VelocityTracker;
import android.view.IMPORT_7;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.IMPORT_8;
import android.widget.IMPORT_9;
import android.widget.Filter;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import IMPORT_0.github.solon_foot.TLog;
import IMPORT_0.github.solon_foot.TLog.PrintProxy;
import java.IMPORT_5.IMPORT_10;
public class CLASS_0 extends FrameLayout implements PrintProxy {
ImageView btnOk;
IMPORT_7 VAR_0;
ListView VAR_1;
IMPORT_9<Model> adapter;
private static final int[] LOG_COLORS = {Color.WHITE,Color.WHITE,
0xFFbbbbbb,0xFF0070bb,0xFF48bb31,0xFFbbbb23,0xFFff5370,0xFF8f0005
};
WindowManager VAR_2;
WindowManager.LayoutParams VAR_3;
IMPORT_4 VAR_4 = new IMPORT_4();
final int viewWidth;
public CLASS_0(IMPORT_3 context) {
super(context);
viewWidth = (int) (FUNC_0().getDisplayMetrics().VAR_5 * 50);
init(context, viewWidth);
// setLayoutParams(new LayoutParams(width, width));
btnOk = new ImageView(context);
// btnOk.setBackgroundResource(R.drawable.icon_btn);
btnOk.setBackgroundResource(R.drawable.view_log_bg_log);
btnOk.FUNC_1(R.drawable.VAR_6);
btnOk.setPadding(viewWidth/5,viewWidth/5,viewWidth/5,viewWidth/5);
btnOk.FUNC_2(v -> {
btnOk.setVisibility(GONE);
VAR_0.setVisibility(VISIBLE);
VAR_3.width = LayoutParams.MATCH_PARENT;
VAR_3.VAR_7 = LayoutParams.MATCH_PARENT;
VAR_2.updateViewLayout(this, VAR_3);
});
LayoutParams VAR_3 = new LayoutParams(viewWidth,viewWidth);
VAR_3.gravity = Gravity.CENTER;
FUNC_3(btnOk, VAR_3);
initSecondView(context);
}
private void copy(String data){
ClipboardManager clipboardManager = (ClipboardManager) getContext().FUNC_4(IMPORT_3.CLIPBOARD_SERVICE);
IMPORT_2 VAR_8 = IMPORT_2.newPlainText("debug log",data);
clipboardManager.FUNC_5(VAR_8);
}
private void initSecondView(IMPORT_3 context) {
LayoutInflater VAR_9 = LayoutInflater.from(context);
VAR_0 = VAR_9.FUNC_6(R.VAR_10.view_log_layout_log, this, false);
VAR_1 = VAR_0.FUNC_7(R.id.list_view);
VAR_1.setOnItemLongClickListener(new IMPORT_8() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, IMPORT_7 view, int VAR_11, long id) {
copy(adapter.getItem(VAR_11).VAR_12);
Toast.makeText(getContext(),"Copied",Toast.VAR_13).show();
return true;
}
});
adapter = new IMPORT_9<Model>(context, 0){
int padding = (int) (FUNC_0().getDisplayMetrics().VAR_5*4);
@Override
public IMPORT_7 getView(int VAR_11, IMPORT_7 VAR_14, ViewGroup parent) {
TextView textView =null;
if (VAR_14==null){
textView = new TextView(parent.getContext());
textView.setPadding(padding,padding,padding,0);
textView.setTextSize(12);
}else {
textView = (TextView) VAR_14;
}
Model VAR_15 = getItem(VAR_11);
textView.setText(VAR_15.FUNC_8());
textView.setTextColor(LOG_COLORS[VAR_15.priority]);
return textView;
}
};
VAR_1.setAdapter(adapter);
VAR_0.FUNC_7(R.id.close).FUNC_2(v->{
VAR_3.width = LayoutParams.WRAP_CONTENT;
VAR_3.VAR_7 = LayoutParams.WRAP_CONTENT;
VAR_2.updateViewLayout(this, VAR_3);
btnOk.setVisibility(VISIBLE);
VAR_0.setVisibility(GONE);
});
VAR_0.FUNC_7(R.id.VAR_17).FUNC_2(v->{
adapter.FUNC_9();
});
VAR_0.FUNC_7(R.id.copy).FUNC_2(v->{
StringBuilder VAR_18 = new StringBuilder();
for (int i = 0; i < adapter.getCount(); i++) {
Model VAR_15 = adapter.getItem(i);
VAR_18.FUNC_10(VAR_15.VAR_16).FUNC_10('\n');
}
copy(VAR_18.FUNC_8());
});
FUNC_3(VAR_0,0);
VAR_0.setVisibility(GONE);
}
private void init(IMPORT_3 context, int width) {
VAR_2 = (WindowManager) context.FUNC_4(IMPORT_3.WINDOW_SERVICE);
if (VAR_2 == null) {
return;
}
VAR_3 = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= Build.VAR_19.O) {
//在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
VAR_3.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else if (Build.VERSION.SDK_INT >= Build.VAR_19.VAR_20) {
//在android7.1以上系统需要使用TYPE_PHONE类型 配合运行时权限
VAR_3.type = WindowManager.LayoutParams.TYPE_PHONE;
} else if (Build.VERSION.SDK_INT >= Build.VAR_19.VAR_21) {
VAR_3.type = WindowManager.LayoutParams.TYPE_TOAST;
} else {
VAR_3.type = WindowManager.LayoutParams.TYPE_PHONE;
}
VAR_2.getDefaultDisplay().FUNC_11(VAR_4);
VAR_3.width = LayoutParams.WRAP_CONTENT;
VAR_3.VAR_7 = LayoutParams.WRAP_CONTENT;
VAR_3.VAR_22 = VAR_4.VAR_22-width;
VAR_3.VAR_23 = VAR_4.VAR_23-width;
VAR_3.gravity = Gravity.VAR_24 | Gravity.VAR_25;
VAR_3.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
// | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
// | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
VAR_3.format = PixelFormat.VAR_26;
VAR_3.windowAnimations = 0;
VAR_2.FUNC_3(this, VAR_3);
}
float VAR_27, VAR_28;
int VAR_29, VAR_30;
@Override
public boolean FUNC_12(IMPORT_6 VAR_31) {
if (VAR_31.FUNC_13() != IMPORT_6.VAR_32) {
return super.FUNC_12(VAR_31);
}
float VAR_23 = VAR_31.FUNC_14();
float VAR_22 = VAR_31.getRawY();
VAR_3.VAR_23 = (int) (VAR_29 + VAR_23 - VAR_27);
VAR_3.VAR_22 = (int) (VAR_30 + VAR_22 - VAR_28);
if (VAR_3.VAR_23 < 0) {
VAR_3.VAR_23 = 0;
}
if (VAR_3.VAR_22 < 0) {
VAR_3.VAR_22 = 0;
}
if (VAR_3.VAR_23 + VAR_3.width > VAR_4.VAR_23) {
VAR_3.VAR_23 = VAR_4.VAR_23 - VAR_3.width;
}
if (VAR_3.VAR_22 + VAR_3.VAR_7 > VAR_4.VAR_22) {
VAR_3.VAR_22 = VAR_4.VAR_22 - VAR_3.VAR_7;
}
VAR_2.updateViewLayout(this, VAR_3);
return super.FUNC_12(VAR_31);
}
private static final int VAR_33 = 600; // 最小滑动速度
private VelocityTracker VAR_34; // 速度追踪器
private boolean VAR_35; // 是否滑动子View
@Override
protected void FUNC_15(Configuration newConfig) {
super.FUNC_15(newConfig);
VAR_2.getDefaultDisplay().FUNC_11(VAR_4);
VAR_3 = (WindowManager.LayoutParams) getLayoutParams();
}
@Override
public boolean onInterceptTouchEvent(IMPORT_6 e) {
if (btnOk.FUNC_16()!=VISIBLE) return super.onInterceptTouchEvent(e);
// if (params.alpha != 1) {
// params.alpha = 1;
// windowManager.updateViewLayout(this, params);
// }
// mHandler.removeMessages(-1);
// mHandler.sendEmptyMessageDelayed(-1, 5_000);
float VAR_23 = e.FUNC_14();
float VAR_22 = e.getRawY();
if (VAR_34 == null) {
VAR_34 = VelocityTracker.FUNC_17();
}
VAR_34.addMovement(e);
switch (e.FUNC_13()) {
case IMPORT_6.ACTION_DOWN: // 因为没有拦截,所以不会被调用到
VAR_35 = false;
VAR_27 = VAR_23;
VAR_28 = VAR_22;
VAR_29 = VAR_3.VAR_23;
VAR_30 = VAR_3.VAR_22;
break;
case IMPORT_6.VAR_32:
if (VAR_35) {
break;
}
VAR_34.FUNC_18(1000);
float xVelocity = VAR_34.getXVelocity();
float yVelocity = VAR_34.getYVelocity();
if (VAR_36.FUNC_19(xVelocity) > VAR_33 || VAR_36.FUNC_19(yVelocity) > VAR_33 || (e.getEventTime() - e.getDownTime()
> 500)) {
VAR_35 = true;
return true;
}
break;
case IMPORT_6.ACTION_CANCEL:
case IMPORT_6.ACTION_UP:
VAR_35 = false;
VAR_34.FUNC_9();
break;
}
return VAR_35 || super.onInterceptTouchEvent(e);
}
public void destory() {
VAR_2.removeView(this);
}
@Override
public void println(int priority, String VAR_12) {
appendString(new Model(priority,VAR_12));
}
private void appendString(Model VAR_12) {
if (Thread.FUNC_20() != Looper.FUNC_21().getThread()) {
post(() -> appendString(VAR_12));
return;
}
VAR_12.FUNC_22();
adapter.add(VAR_12);
}
final static class Model {
final int priority;
final String VAR_12;
Thread VAR_37;
public Model(int priority, String VAR_12) {
this.priority = priority;
this.VAR_12 = VAR_12;
this.VAR_37 = Thread.FUNC_20();
}
private String VAR_16;
private static int fixLen = 30;
private void FUNC_22() {
IMPORT_10 instance = IMPORT_10.getInstance();
StringBuilder VAR_18 = new StringBuilder();
VAR_18.FUNC_10('[');
FUNC_22(VAR_18, instance.get(IMPORT_10.VAR_38), 2);
VAR_18.FUNC_10(':');
FUNC_22(VAR_18, instance.get(IMPORT_10.VAR_39), 2);
VAR_18.FUNC_10(':');
FUNC_22(VAR_18, instance.get(IMPORT_10.SECOND), 2);
VAR_18.FUNC_10(':');
FUNC_22(VAR_18, instance.get(IMPORT_10.MILLISECOND), 3);
VAR_18.FUNC_10(']');
VAR_18.FUNC_10(' ');
VAR_18.FUNC_10(VAR_37.getId()).FUNC_10("/").FUNC_10(VAR_37.FUNC_23());
if (VAR_18.length()<fixLen){
for (int i = VAR_18.length(); i < fixLen; i++) {
VAR_18.FUNC_10(' ');
}
} else {
VAR_18.FUNC_24(fixLen,VAR_18.length());
}
VAR_18.FUNC_10(' ');
VAR_18.FUNC_10(logLevel[priority]).FUNC_10(':');
VAR_18.FUNC_10(VAR_12);
VAR_16 = VAR_18.FUNC_8();
}
static final char[] logLevel={' ',' ','V','D','I','W','E','A'};
private void FUNC_22(StringBuilder VAR_18, int t, int len) {
int VAR_40 = 1;
while (len > 1) {
VAR_40 *= 10;
len--;
}
while (t < VAR_40) {
VAR_18.FUNC_10('0');
VAR_40 /= 10;
}
VAR_18.FUNC_10(t);
}
@Override
public String FUNC_8() {
return VAR_16;
}
}
}
| 0.384073 | {'IMPORT_0': 'com', 'IMPORT_1': 'view_log', 'IMPORT_2': 'ClipData', 'IMPORT_3': 'Context', 'IMPORT_4': 'Point', 'IMPORT_5': 'util', 'IMPORT_6': 'MotionEvent', 'IMPORT_7': 'View', 'IMPORT_8': 'OnItemLongClickListener', 'IMPORT_9': 'ArrayAdapter', 'IMPORT_10': 'Calendar', 'CLASS_0': 'FloatView', 'VAR_0': 'secondView', 'VAR_1': 'listView', 'VAR_2': 'windowManager', 'VAR_3': 'params', 'VAR_4': 'screenSize', 'FUNC_0': 'getResources', 'VAR_5': 'density', 'FUNC_1': 'setImageResource', 'VAR_6': 'view_log_icon_log', 'FUNC_2': 'setOnClickListener', 'VAR_7': 'height', 'FUNC_3': 'addView', 'FUNC_4': 'getSystemService', 'VAR_8': 'clipData', 'FUNC_5': 'setPrimaryClip', 'VAR_9': 'inflater', 'FUNC_6': 'inflate', 'VAR_10': 'layout', 'FUNC_7': 'findViewById', 'VAR_11': 'position', 'VAR_12': 'msg', 'VAR_13': 'LENGTH_SHORT', 'VAR_14': 'convertView', 'VAR_15': 'item', 'FUNC_8': 'toString', 'VAR_16': 'toString', 'VAR_17': 'clear', 'FUNC_9': 'clear', 'VAR_18': 'sb', 'FUNC_10': 'append', 'VAR_19': 'VERSION_CODES', 'VAR_20': 'N', 'VAR_21': 'KITKAT', 'FUNC_11': 'getSize', 'VAR_22': 'y', 'VAR_23': 'x', 'VAR_24': 'TOP', 'VAR_25': 'LEFT', 'VAR_26': 'TRANSLUCENT', 'VAR_27': 'lastX', 'VAR_28': 'lastY', 'VAR_29': 'tempX', 'VAR_30': 'tempY', 'FUNC_12': 'onTouchEvent', 'VAR_31': 'event', 'FUNC_13': 'getAction', 'VAR_32': 'ACTION_MOVE', 'FUNC_14': 'getRawX', 'VAR_33': 'SNAP_VELOCITY', 'VAR_34': 'mVelocityTracker', 'VAR_35': 'mIsSwipe', 'FUNC_15': 'onConfigurationChanged', 'FUNC_16': 'getVisibility', 'FUNC_17': 'obtain', 'FUNC_18': 'computeCurrentVelocity', 'VAR_36': 'Math', 'FUNC_19': 'abs', 'FUNC_20': 'currentThread', 'FUNC_21': 'getMainLooper', 'FUNC_22': 'process', 'VAR_37': 'thread', 'VAR_38': 'HOUR_OF_DAY', 'VAR_39': 'MINUTE', 'FUNC_23': 'getName', 'FUNC_24': 'delete', 'VAR_40': 'tt'} | java | OOP | 12.83% |
/**
* Tests for GGFS per-block LR eviction policy.
*/
@SuppressWarnings({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
public class GridCacheGgfsPerBlockLruEvictionPolicySelfTest extends GridGgfsCommonAbstractTest {
/** Primary GGFS name. */
private static final String GGFS_PRIMARY = "ggfs-primary";
/** Primary GGFS name. */
private static final String GGFS_SECONDARY = "ggfs-secondary";
/** Secondary file system REST endpoint configuration map. */
private static final Map<String, String> SECONDARY_REST_CFG = new HashMap<String, String>() {{
put("type", "tcp");
put("port", "11500");
}};
/** File working in PRIMARY mode. */
public static final GridGgfsPath FILE = new GridGgfsPath("/file");
/** File working in DUAL mode. */
public static final GridGgfsPath FILE_RMT = new GridGgfsPath("/fileRemote");
/** Primary GGFS instances. */
private static GridGgfsImpl ggfsPrimary;
/** Secondary GGFS instance. */
private static GridGgfs secondaryFs;
/** Primary file system data cache. */
private static GridCacheAdapter<GridGgfsBlockKey, byte[]> dataCache;
/** Eviction policy */
private static GridCacheGgfsPerBlockLruEvictionPolicy evictPlc;
/**
* Start a grid with the primary file system.
*
* @throws Exception If failed.
*/
private void startPrimary() throws Exception {
GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration();
ggfsCfg.setDataCacheName("dataCache");
ggfsCfg.setMetaCacheName("metaCache");
ggfsCfg.setName(GGFS_PRIMARY);
ggfsCfg.setBlockSize(512);
ggfsCfg.setDefaultMode(PRIMARY);
ggfsCfg.setPrefetchBlocks(1);
ggfsCfg.setSequentialReadsBeforePrefetch(Integer.MAX_VALUE);
ggfsCfg.setSecondaryFileSystem(secondaryFs);
Map<String, GridGgfsMode> pathModes = new HashMap<>();
pathModes.put(FILE_RMT.toString(), DUAL_SYNC);
ggfsCfg.setPathModes(pathModes);
GridCacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setName("dataCache");
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY);
dataCacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
evictPlc = new GridCacheGgfsPerBlockLruEvictionPolicy();
dataCacheCfg.setEvictionPolicy(evictPlc);
dataCacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setQueryIndexEnabled(false);
GridCacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setName("metaCache");
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY);
metaCacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setQueryIndexEnabled(false);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
GridConfiguration cfg = new GridConfiguration();
cfg.setGridName("grid-primary");
GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();
discoSpi.setIpFinder(new GridTcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
cfg.setGgfsConfiguration(ggfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setRestEnabled(false);
Grid g = G.start(cfg);
ggfsPrimary = (GridGgfsImpl)g.ggfs(GGFS_PRIMARY);
dataCache = ggfsPrimary.context().kernalContext().cache().internalCache(
ggfsPrimary.context().configuration().getDataCacheName());
}
/**
* Start a grid with the secondary file system.
*
* @throws Exception If failed.
*/
private void startSecondary() throws Exception {
GridGgfsConfiguration ggfsCfg = new GridGgfsConfiguration();
ggfsCfg.setDataCacheName("dataCache");
ggfsCfg.setMetaCacheName("metaCache");
ggfsCfg.setName(GGFS_SECONDARY);
ggfsCfg.setBlockSize(512);
ggfsCfg.setDefaultMode(PRIMARY);
ggfsCfg.setIpcEndpointConfiguration(SECONDARY_REST_CFG);
GridCacheConfiguration dataCacheCfg = defaultCacheConfiguration();
dataCacheCfg.setName("dataCache");
dataCacheCfg.setCacheMode(PARTITIONED);
dataCacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY);
dataCacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.setBackups(0);
dataCacheCfg.setQueryIndexEnabled(false);
dataCacheCfg.setAtomicityMode(TRANSACTIONAL);
GridCacheConfiguration metaCacheCfg = defaultCacheConfiguration();
metaCacheCfg.setName("metaCache");
metaCacheCfg.setCacheMode(REPLICATED);
metaCacheCfg.setDistributionMode(GridCacheDistributionMode.PARTITIONED_ONLY);
metaCacheCfg.setWriteSynchronizationMode(GridCacheWriteSynchronizationMode.FULL_SYNC);
metaCacheCfg.setQueryIndexEnabled(false);
metaCacheCfg.setAtomicityMode(TRANSACTIONAL);
GridConfiguration cfg = new GridConfiguration();
cfg.setGridName("grid-secondary");
GridTcpDiscoverySpi discoSpi = new GridTcpDiscoverySpi();
discoSpi.setIpFinder(new GridTcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(discoSpi);
cfg.setCacheConfiguration(dataCacheCfg, metaCacheCfg);
cfg.setGgfsConfiguration(ggfsCfg);
cfg.setLocalHost("127.0.0.1");
cfg.setRestEnabled(false);
Grid g = G.start(cfg);
secondaryFs = g.ggfs(GGFS_SECONDARY);
}
/** {@inheritDoc} */
@Override protected void afterTest() throws Exception {
try {
// Cleanup.
ggfsPrimary.format().get();
while (!dataCache.isEmpty())
U.sleep(100);
checkEvictionPolicy(0, 0);
}
finally {
stopAllGrids(false);
}
}
/**
* Startup primary and secondary file systems.
*
* @throws Exception If failed.
*/
private void start() throws Exception {
startSecondary();
startPrimary();
evictPlc.setMaxBlocks(0);
evictPlc.setMaxSize(0);
evictPlc.setExcludePaths(null);
}
/**
* Test how evictions are handled for a file working in PRIMARY mode.
*
* @throws Exception If failed.
*/
public void testFilePrimary() throws Exception {
start();
// Create file in primary mode. It must not be propagated to eviction policy.
ggfsPrimary.create(FILE, true).close();
checkEvictionPolicy(0, 0);
int blockSize = ggfsPrimary.info(FILE).blockSize();
append(FILE, blockSize);
checkEvictionPolicy(0, 0);
read(FILE, 0, blockSize);
checkEvictionPolicy(0, 0);
}
/**
* Test how evictions are handled for a file working in PRIMARY mode.
*
* @throws Exception If failed.
*/
public void testFileDual() throws Exception {
start();
ggfsPrimary.create(FILE_RMT, true).close();
checkEvictionPolicy(0, 0);
int blockSize = ggfsPrimary.info(FILE_RMT).blockSize();
// File write.
append(FILE_RMT, blockSize);
checkEvictionPolicy(1, blockSize);
// One more write.
append(FILE_RMT, blockSize);
checkEvictionPolicy(2, blockSize * 2);
// Read.
read(FILE_RMT, 0, blockSize);
checkEvictionPolicy(2, blockSize * 2);
}
/**
* Ensure that a DUAL mode file is not propagated to eviction policy
*
* @throws Exception If failed.
*/
public void testFileDualExclusion() throws Exception {
start();
evictPlc.setExcludePaths(Collections.singleton(FILE_RMT.toString()));
// Create file in primary mode. It must not be propagated to eviction policy.
ggfsPrimary.create(FILE_RMT, true).close();
checkEvictionPolicy(0, 0);
int blockSize = ggfsPrimary.info(FILE_RMT).blockSize();
append(FILE_RMT, blockSize);
checkEvictionPolicy(0, 0);
read(FILE_RMT, 0, blockSize);
checkEvictionPolicy(0, 0);
}
/**
* Ensure that exception is thrown in case we are trying to rename file with one exclude setting to the file with
* another.
*
* @throws Exception If failed.
*/
public void testRenameDifferentExcludeSettings() throws Exception {
start();
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
ggfsPrimary.rename(FILE, FILE_RMT);
return null;
}
}, GridGgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " +
"(need to copy and remove)");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
ggfsPrimary.rename(FILE_RMT, FILE);
return null;
}
}, GridGgfsInvalidPathException.class, "Cannot move file to a path with different eviction exclude setting " +
"(need to copy and remove)");
}
/**
* Test eviction caused by too much blocks.
*
* @throws Exception If failed.
*/
public void testBlockCountEviction() throws Exception {
start();
int blockCnt = 3;
evictPlc.setMaxBlocks(blockCnt);
ggfsPrimary.create(FILE_RMT, true).close();
checkEvictionPolicy(0, 0);
int blockSize = ggfsPrimary.info(FILE_RMT).blockSize();
// Write blocks up to the limit.
append(FILE_RMT, blockSize * blockCnt);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Write one more block what should cause eviction.
append(FILE_RMT, blockSize);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Read the first block.
read(FILE_RMT, 0, blockSize);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
checkMetrics(1, 1);
}
/**
* Test eviction caused by too big data size.
*
* @throws Exception If failed.
*/
public void testDataSizeEviction() throws Exception {
start();
ggfsPrimary.create(FILE_RMT, true).close();
int blockCnt = 3;
int blockSize = ggfsPrimary.info(FILE_RMT).blockSize();
evictPlc.setMaxSize(blockSize * blockCnt);
// Write blocks up to the limit.
append(FILE_RMT, blockSize * blockCnt);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Reset metrics.
ggfsPrimary.resetMetrics();
// Read the first block what should cause reordering.
read(FILE_RMT, 0, blockSize);
checkMetrics(1, 0);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Write one more block what should cause eviction of the block 2.
append(FILE_RMT, blockSize);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Read the first block.
read(FILE_RMT, 0, blockSize);
checkMetrics(2, 0);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
// Read the second block (which was evicted).
read(FILE_RMT, blockSize, blockSize);
checkMetrics(3, 1);
checkEvictionPolicy(blockCnt, blockCnt * blockSize);
}
/**
* Read some data from the given file with the given offset.
*
* @param path File path.
* @param off Offset.
* @param len Length.
* @throws Exception If failed.
*/
private void read(GridGgfsPath path, int off, int len) throws Exception {
GridGgfsInputStream is = ggfsPrimary.open(path);
is.readFully(off, new byte[len]);
is.close();
}
/**
* Append some data to the given file.
*
* @param path File path.
* @param len Data length.
* @throws Exception If failed.
*/
private void append(GridGgfsPath path, int len) throws Exception {
GridGgfsOutputStream os = ggfsPrimary.append(path, false);
os.write(new byte[len]);
os.close();
}
/**
* Check metrics counters.
*
* @param blocksRead Expected blocks read.
* @param blocksReadRmt Expected blocks read remote.
* @throws Exception If failed.
*/
public void checkMetrics(final long blocksRead, final long blocksReadRmt) throws Exception {
assert GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
try {
GridGgfsMetrics metrics = ggfsPrimary.metrics();
return metrics.blocksReadTotal() == blocksRead && metrics.blocksReadRemote() == blocksReadRmt;
}
catch (GridException e) {
throw new RuntimeException(e);
}
}
}, 5000) : "Unexpected metrics [expectedBlocksReadTotal=" + blocksRead + ", actualBlocksReadTotal=" +
ggfsPrimary.metrics().blocksReadTotal() + ", expectedBlocksReadRemote=" + blocksReadRmt +
", actualBlocksReadRemote=" + ggfsPrimary.metrics().blocksReadRemote() + ']';
}
/**
* Check eviction policy state.
*
* @param curBlocks Current blocks.
* @param curBytes Current bytes.
*/
private void checkEvictionPolicy(final int curBlocks, final long curBytes) throws GridInterruptedException {
assert GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
return evictPlc.getCurrentBlocks() == curBlocks && evictPlc.getCurrentSize() == curBytes;
}
}, 5000) : "Unexpected counts [expectedBlocks=" + curBlocks + ", actualBlocks=" + evictPlc.getCurrentBlocks() +
", expectedBytes=" + curBytes + ", currentBytes=" + curBytes + ']';
}
} | /**
* Tests for GGFS per-block LR eviction policy.
*/
@VAR_0({"ConstantConditions", "ThrowableResultOfMethodCallIgnored"})
public class CLASS_0 extends GridGgfsCommonAbstractTest {
/** Primary GGFS name. */
private static final String VAR_1 = "ggfs-primary";
/** Primary GGFS name. */
private static final String GGFS_SECONDARY = "ggfs-secondary";
/** Secondary file system REST endpoint configuration map. */
private static final CLASS_1<String, String> VAR_2 = new HashMap<String, String>() {{
FUNC_0("type", "tcp");
FUNC_0("port", "11500");
}};
/** File working in PRIMARY mode. */
public static final CLASS_2 FILE = new CLASS_2("/file");
/** File working in DUAL mode. */
public static final CLASS_2 VAR_3 = new CLASS_2("/fileRemote");
/** Primary GGFS instances. */
private static CLASS_3 VAR_4;
/** Secondary GGFS instance. */
private static CLASS_4 VAR_5;
/** Primary file system data cache. */
private static GridCacheAdapter<CLASS_5, byte[]> VAR_6;
/** Eviction policy */
private static CLASS_6 VAR_7;
/**
* Start a grid with the primary file system.
*
* @throws Exception If failed.
*/
private void startPrimary() throws Exception {
CLASS_7 VAR_8 = new CLASS_7();
VAR_8.FUNC_1("dataCache");
VAR_8.FUNC_2("metaCache");
VAR_8.FUNC_3(VAR_1);
VAR_8.setBlockSize(512);
VAR_8.FUNC_4(VAR_9);
VAR_8.FUNC_5(1);
VAR_8.setSequentialReadsBeforePrefetch(VAR_10.VAR_11);
VAR_8.FUNC_6(VAR_5);
CLASS_1<String, CLASS_8> pathModes = new HashMap<>();
pathModes.FUNC_0(VAR_3.FUNC_7(), VAR_12);
VAR_8.FUNC_8(pathModes);
CLASS_9 dataCacheCfg = FUNC_9();
dataCacheCfg.FUNC_3("dataCache");
dataCacheCfg.FUNC_10(VAR_13);
dataCacheCfg.FUNC_11(VAR_14.VAR_15);
dataCacheCfg.FUNC_12(GridCacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAtomicityMode(VAR_16);
VAR_7 = new CLASS_6();
dataCacheCfg.FUNC_13(VAR_7);
dataCacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.FUNC_14(0);
dataCacheCfg.FUNC_15(false);
CLASS_9 VAR_17 = FUNC_9();
VAR_17.FUNC_3("metaCache");
VAR_17.FUNC_10(REPLICATED);
VAR_17.FUNC_11(VAR_14.VAR_15);
VAR_17.FUNC_12(GridCacheWriteSynchronizationMode.FULL_SYNC);
VAR_17.FUNC_15(false);
VAR_17.setAtomicityMode(VAR_16);
GridConfiguration VAR_18 = new GridConfiguration();
VAR_18.setGridName("grid-primary");
CLASS_10 discoSpi = new CLASS_10();
discoSpi.FUNC_16(new GridTcpDiscoveryVmIpFinder(true));
VAR_18.FUNC_17(discoSpi);
VAR_18.setCacheConfiguration(dataCacheCfg, VAR_17);
VAR_18.setGgfsConfiguration(VAR_8);
VAR_18.FUNC_18("127.0.0.1");
VAR_18.setRestEnabled(false);
CLASS_11 VAR_19 = VAR_20.FUNC_19(VAR_18);
VAR_4 = (CLASS_3)VAR_19.FUNC_20(VAR_1);
VAR_6 = VAR_4.context().kernalContext().FUNC_21().internalCache(
VAR_4.context().configuration().getDataCacheName());
}
/**
* Start a grid with the secondary file system.
*
* @throws Exception If failed.
*/
private void FUNC_22() throws Exception {
CLASS_7 VAR_8 = new CLASS_7();
VAR_8.FUNC_1("dataCache");
VAR_8.FUNC_2("metaCache");
VAR_8.FUNC_3(GGFS_SECONDARY);
VAR_8.setBlockSize(512);
VAR_8.FUNC_4(VAR_9);
VAR_8.FUNC_23(VAR_2);
CLASS_9 dataCacheCfg = FUNC_9();
dataCacheCfg.FUNC_3("dataCache");
dataCacheCfg.FUNC_10(VAR_13);
dataCacheCfg.FUNC_11(VAR_14.VAR_15);
dataCacheCfg.FUNC_12(GridCacheWriteSynchronizationMode.FULL_SYNC);
dataCacheCfg.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(128));
dataCacheCfg.FUNC_14(0);
dataCacheCfg.FUNC_15(false);
dataCacheCfg.setAtomicityMode(VAR_16);
CLASS_9 VAR_17 = FUNC_9();
VAR_17.FUNC_3("metaCache");
VAR_17.FUNC_10(REPLICATED);
VAR_17.FUNC_11(VAR_14.VAR_15);
VAR_17.FUNC_12(GridCacheWriteSynchronizationMode.FULL_SYNC);
VAR_17.FUNC_15(false);
VAR_17.setAtomicityMode(VAR_16);
GridConfiguration VAR_18 = new GridConfiguration();
VAR_18.setGridName("grid-secondary");
CLASS_10 discoSpi = new CLASS_10();
discoSpi.FUNC_16(new GridTcpDiscoveryVmIpFinder(true));
VAR_18.FUNC_17(discoSpi);
VAR_18.setCacheConfiguration(dataCacheCfg, VAR_17);
VAR_18.setGgfsConfiguration(VAR_8);
VAR_18.FUNC_18("127.0.0.1");
VAR_18.setRestEnabled(false);
CLASS_11 VAR_19 = VAR_20.FUNC_19(VAR_18);
VAR_5 = VAR_19.FUNC_20(GGFS_SECONDARY);
}
/** {@inheritDoc} */
@Override protected void FUNC_24() throws Exception {
try {
// Cleanup.
VAR_4.FUNC_25().FUNC_26();
while (!VAR_6.FUNC_27())
VAR_21.FUNC_28(100);
checkEvictionPolicy(0, 0);
}
finally {
stopAllGrids(false);
}
}
/**
* Startup primary and secondary file systems.
*
* @throws Exception If failed.
*/
private void FUNC_19() throws Exception {
FUNC_22();
startPrimary();
VAR_7.FUNC_29(0);
VAR_7.setMaxSize(0);
VAR_7.setExcludePaths(null);
}
/**
* Test how evictions are handled for a file working in PRIMARY mode.
*
* @throws Exception If failed.
*/
public void FUNC_30() throws Exception {
FUNC_19();
// Create file in primary mode. It must not be propagated to eviction policy.
VAR_4.FUNC_31(FILE, true).FUNC_32();
checkEvictionPolicy(0, 0);
int VAR_22 = VAR_4.FUNC_34(FILE).FUNC_33();
append(FILE, VAR_22);
checkEvictionPolicy(0, 0);
read(FILE, 0, VAR_22);
checkEvictionPolicy(0, 0);
}
/**
* Test how evictions are handled for a file working in PRIMARY mode.
*
* @throws Exception If failed.
*/
public void FUNC_35() throws Exception {
FUNC_19();
VAR_4.FUNC_31(VAR_3, true).FUNC_32();
checkEvictionPolicy(0, 0);
int VAR_22 = VAR_4.FUNC_34(VAR_3).FUNC_33();
// File write.
append(VAR_3, VAR_22);
checkEvictionPolicy(1, VAR_22);
// One more write.
append(VAR_3, VAR_22);
checkEvictionPolicy(2, VAR_22 * 2);
// Read.
read(VAR_3, 0, VAR_22);
checkEvictionPolicy(2, VAR_22 * 2);
}
/**
* Ensure that a DUAL mode file is not propagated to eviction policy
*
* @throws Exception If failed.
*/
public void FUNC_36() throws Exception {
FUNC_19();
VAR_7.setExcludePaths(VAR_23.FUNC_37(VAR_3.FUNC_7()));
// Create file in primary mode. It must not be propagated to eviction policy.
VAR_4.FUNC_31(VAR_3, true).FUNC_32();
checkEvictionPolicy(0, 0);
int VAR_22 = VAR_4.FUNC_34(VAR_3).FUNC_33();
append(VAR_3, VAR_22);
checkEvictionPolicy(0, 0);
read(VAR_3, 0, VAR_22);
checkEvictionPolicy(0, 0);
}
/**
* Ensure that exception is thrown in case we are trying to rename file with one exclude setting to the file with
* another.
*
* @throws Exception If failed.
*/
public void testRenameDifferentExcludeSettings() throws Exception {
FUNC_19();
VAR_24.FUNC_38(VAR_25, new Callable<CLASS_12>() {
@Override public CLASS_12 FUNC_39() throws Exception {
VAR_4.rename(FILE, VAR_3);
return null;
}
}, CLASS_13.class, "Cannot move file to a path with different eviction exclude setting " +
"(need to copy and remove)");
VAR_24.FUNC_38(VAR_25, new Callable<CLASS_12>() {
@Override public CLASS_12 FUNC_39() throws Exception {
VAR_4.rename(VAR_3, FILE);
return null;
}
}, CLASS_13.class, "Cannot move file to a path with different eviction exclude setting " +
"(need to copy and remove)");
}
/**
* Test eviction caused by too much blocks.
*
* @throws Exception If failed.
*/
public void testBlockCountEviction() throws Exception {
FUNC_19();
int VAR_26 = 3;
VAR_7.FUNC_29(VAR_26);
VAR_4.FUNC_31(VAR_3, true).FUNC_32();
checkEvictionPolicy(0, 0);
int VAR_22 = VAR_4.FUNC_34(VAR_3).FUNC_33();
// Write blocks up to the limit.
append(VAR_3, VAR_22 * VAR_26);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Write one more block what should cause eviction.
append(VAR_3, VAR_22);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Read the first block.
read(VAR_3, 0, VAR_22);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
checkMetrics(1, 1);
}
/**
* Test eviction caused by too big data size.
*
* @throws Exception If failed.
*/
public void FUNC_40() throws Exception {
FUNC_19();
VAR_4.FUNC_31(VAR_3, true).FUNC_32();
int VAR_26 = 3;
int VAR_22 = VAR_4.FUNC_34(VAR_3).FUNC_33();
VAR_7.setMaxSize(VAR_22 * VAR_26);
// Write blocks up to the limit.
append(VAR_3, VAR_22 * VAR_26);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Reset metrics.
VAR_4.FUNC_41();
// Read the first block what should cause reordering.
read(VAR_3, 0, VAR_22);
checkMetrics(1, 0);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Write one more block what should cause eviction of the block 2.
append(VAR_3, VAR_22);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Read the first block.
read(VAR_3, 0, VAR_22);
checkMetrics(2, 0);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
// Read the second block (which was evicted).
read(VAR_3, VAR_22, VAR_22);
checkMetrics(3, 1);
checkEvictionPolicy(VAR_26, VAR_26 * VAR_22);
}
/**
* Read some data from the given file with the given offset.
*
* @param path File path.
* @param off Offset.
* @param len Length.
* @throws Exception If failed.
*/
private void read(CLASS_2 VAR_27, int VAR_28, int VAR_29) throws Exception {
GridGgfsInputStream VAR_30 = VAR_4.FUNC_42(VAR_27);
VAR_30.FUNC_43(VAR_28, new byte[VAR_29]);
VAR_30.FUNC_32();
}
/**
* Append some data to the given file.
*
* @param path File path.
* @param len Data length.
* @throws Exception If failed.
*/
private void append(CLASS_2 VAR_27, int VAR_29) throws Exception {
CLASS_14 os = VAR_4.append(VAR_27, false);
os.write(new byte[VAR_29]);
os.FUNC_32();
}
/**
* Check metrics counters.
*
* @param blocksRead Expected blocks read.
* @param blocksReadRmt Expected blocks read remote.
* @throws Exception If failed.
*/
public void checkMetrics(final long VAR_31, final long VAR_32) throws Exception {
assert VAR_24.FUNC_44(new CLASS_15() {
@Override public boolean FUNC_45() {
try {
GridGgfsMetrics metrics = VAR_4.metrics();
return metrics.FUNC_46() == VAR_31 && metrics.blocksReadRemote() == VAR_32;
}
catch (GridException VAR_33) {
throw new RuntimeException(VAR_33);
}
}
}, 5000) : "Unexpected metrics [expectedBlocksReadTotal=" + VAR_31 + ", actualBlocksReadTotal=" +
VAR_4.metrics().FUNC_46() + ", expectedBlocksReadRemote=" + VAR_32 +
", actualBlocksReadRemote=" + VAR_4.metrics().blocksReadRemote() + ']';
}
/**
* Check eviction policy state.
*
* @param curBlocks Current blocks.
* @param curBytes Current bytes.
*/
private void checkEvictionPolicy(final int VAR_34, final long VAR_35) throws CLASS_16 {
assert VAR_24.FUNC_44(new CLASS_15() {
@Override public boolean FUNC_45() {
return VAR_7.FUNC_47() == VAR_34 && VAR_7.getCurrentSize() == VAR_35;
}
}, 5000) : "Unexpected counts [expectedBlocks=" + VAR_34 + ", actualBlocks=" + VAR_7.FUNC_47() +
", expectedBytes=" + VAR_35 + ", currentBytes=" + VAR_35 + ']';
}
} | 0.626814 | {'VAR_0': 'SuppressWarnings', 'CLASS_0': 'GridCacheGgfsPerBlockLruEvictionPolicySelfTest', 'VAR_1': 'GGFS_PRIMARY', 'CLASS_1': 'Map', 'VAR_2': 'SECONDARY_REST_CFG', 'FUNC_0': 'put', 'CLASS_2': 'GridGgfsPath', 'VAR_3': 'FILE_RMT', 'CLASS_3': 'GridGgfsImpl', 'VAR_4': 'ggfsPrimary', 'CLASS_4': 'GridGgfs', 'VAR_5': 'secondaryFs', 'CLASS_5': 'GridGgfsBlockKey', 'VAR_6': 'dataCache', 'CLASS_6': 'GridCacheGgfsPerBlockLruEvictionPolicy', 'VAR_7': 'evictPlc', 'CLASS_7': 'GridGgfsConfiguration', 'VAR_8': 'ggfsCfg', 'FUNC_1': 'setDataCacheName', 'FUNC_2': 'setMetaCacheName', 'FUNC_3': 'setName', 'FUNC_4': 'setDefaultMode', 'VAR_9': 'PRIMARY', 'FUNC_5': 'setPrefetchBlocks', 'VAR_10': 'Integer', 'VAR_11': 'MAX_VALUE', 'FUNC_6': 'setSecondaryFileSystem', 'CLASS_8': 'GridGgfsMode', 'FUNC_7': 'toString', 'VAR_12': 'DUAL_SYNC', 'FUNC_8': 'setPathModes', 'CLASS_9': 'GridCacheConfiguration', 'FUNC_9': 'defaultCacheConfiguration', 'FUNC_10': 'setCacheMode', 'VAR_13': 'PARTITIONED', 'FUNC_11': 'setDistributionMode', 'VAR_14': 'GridCacheDistributionMode', 'VAR_15': 'PARTITIONED_ONLY', 'FUNC_12': 'setWriteSynchronizationMode', 'VAR_16': 'TRANSACTIONAL', 'FUNC_13': 'setEvictionPolicy', 'FUNC_14': 'setBackups', 'FUNC_15': 'setQueryIndexEnabled', 'VAR_17': 'metaCacheCfg', 'VAR_18': 'cfg', 'CLASS_10': 'GridTcpDiscoverySpi', 'FUNC_16': 'setIpFinder', 'FUNC_17': 'setDiscoverySpi', 'FUNC_18': 'setLocalHost', 'CLASS_11': 'Grid', 'VAR_19': 'g', 'VAR_20': 'G', 'FUNC_19': 'start', 'FUNC_20': 'ggfs', 'FUNC_21': 'cache', 'FUNC_22': 'startSecondary', 'FUNC_23': 'setIpcEndpointConfiguration', 'FUNC_24': 'afterTest', 'FUNC_25': 'format', 'FUNC_26': 'get', 'FUNC_27': 'isEmpty', 'VAR_21': 'U', 'FUNC_28': 'sleep', 'FUNC_29': 'setMaxBlocks', 'FUNC_30': 'testFilePrimary', 'FUNC_31': 'create', 'FUNC_32': 'close', 'VAR_22': 'blockSize', 'FUNC_33': 'blockSize', 'FUNC_34': 'info', 'FUNC_35': 'testFileDual', 'FUNC_36': 'testFileDualExclusion', 'VAR_23': 'Collections', 'FUNC_37': 'singleton', 'VAR_24': 'GridTestUtils', 'FUNC_38': 'assertThrows', 'VAR_25': 'log', 'CLASS_12': 'Object', 'FUNC_39': 'call', 'CLASS_13': 'GridGgfsInvalidPathException', 'VAR_26': 'blockCnt', 'FUNC_40': 'testDataSizeEviction', 'FUNC_41': 'resetMetrics', 'VAR_27': 'path', 'VAR_28': 'off', 'VAR_29': 'len', 'VAR_30': 'is', 'FUNC_42': 'open', 'FUNC_43': 'readFully', 'CLASS_14': 'GridGgfsOutputStream', 'VAR_31': 'blocksRead', 'VAR_32': 'blocksReadRmt', 'FUNC_44': 'waitForCondition', 'CLASS_15': 'GridAbsPredicate', 'FUNC_45': 'apply', 'FUNC_46': 'blocksReadTotal', 'VAR_33': 'e', 'VAR_34': 'curBlocks', 'VAR_35': 'curBytes', 'CLASS_16': 'GridInterruptedException', 'FUNC_47': 'getCurrentBlocks'} | java | Procedural | 0.70% |
package com.luv2code.springdemo.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.luv2code.springdemo.dao.CustomerDAO;
import com.luv2code.springdemo.entity.Customer;
@Service
public class CustomerServiceImpl implements CustomerService {
//Need to inject customer dao
@Autowired
private CustomerDAO customerDAO;
@Override
@Transactional
public List<Customer> getCustomers() {
return customerDAO.getCustomers();
}
@Override
@Transactional
public void saveCustomer(Customer theCustomer) {
customerDAO.saveCustomer(theCustomer);
}
@Override
@Transactional
public Customer getCustomer(int theId) {
return customerDAO.getCustomer(theId);
}
@Override
@Transactional
public void deleteCustomer(int theId) {
customerDAO.deleteCustomer(theId);
}
@Override
@Transactional
public List<Customer> searchCustomers(String theSearchName) {
return customerDAO.searchCustomers(theSearchName);
}
@Override
@Transactional
public List<Customer> getCustomersByPage(int pageNumber) {
List<Customer> customers = customerDAO.getCustomersByPage(pageNumber);
return customers;
}
@Override
@Transactional
public long getCustomersCount() {
long count = customerDAO.getCustomersCount();
return count;
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.service;
import IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_10.IMPORT_11;
import IMPORT_6.IMPORT_7.IMPORT_12.IMPORT_13;
import IMPORT_6.IMPORT_7.transaction.IMPORT_10.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_15.IMPORT_16;
import IMPORT_0.IMPORT_1.IMPORT_2.entity.IMPORT_17;
@IMPORT_13
public class CLASS_0 implements CustomerService {
//Need to inject customer dao
@IMPORT_11
private IMPORT_16 VAR_0;
@VAR_1
@IMPORT_14
public IMPORT_5<IMPORT_17> FUNC_0() {
return VAR_0.FUNC_0();
}
@VAR_1
@IMPORT_14
public void FUNC_1(IMPORT_17 VAR_2) {
VAR_0.FUNC_1(VAR_2);
}
@VAR_1
@IMPORT_14
public IMPORT_17 getCustomer(int theId) {
return VAR_0.getCustomer(theId);
}
@VAR_1
@IMPORT_14
public void FUNC_2(int theId) {
VAR_0.FUNC_2(theId);
}
@VAR_1
@IMPORT_14
public IMPORT_5<IMPORT_17> FUNC_3(String VAR_3) {
return VAR_0.FUNC_3(VAR_3);
}
@VAR_1
@IMPORT_14
public IMPORT_5<IMPORT_17> FUNC_4(int VAR_4) {
IMPORT_5<IMPORT_17> VAR_5 = VAR_0.FUNC_4(VAR_4);
return VAR_5;
}
@VAR_1
@IMPORT_14
public long FUNC_5() {
long VAR_6 = VAR_0.FUNC_5();
return VAR_6;
}
}
| 0.855634 | {'IMPORT_0': 'com', 'IMPORT_1': 'luv2code', 'IMPORT_2': 'springdemo', 'IMPORT_3': 'java', 'IMPORT_4': 'util', 'IMPORT_5': 'List', 'IMPORT_6': 'org', 'IMPORT_7': 'springframework', 'IMPORT_8': 'beans', 'IMPORT_9': 'factory', 'IMPORT_10': 'annotation', 'IMPORT_11': 'Autowired', 'IMPORT_12': 'stereotype', 'IMPORT_13': 'Service', 'IMPORT_14': 'Transactional', 'IMPORT_15': 'dao', 'IMPORT_16': 'CustomerDAO', 'IMPORT_17': 'Customer', 'CLASS_0': 'CustomerServiceImpl', 'VAR_0': 'customerDAO', 'VAR_1': 'Override', 'FUNC_0': 'getCustomers', 'FUNC_1': 'saveCustomer', 'VAR_2': 'theCustomer', 'FUNC_2': 'deleteCustomer', 'FUNC_3': 'searchCustomers', 'VAR_3': 'theSearchName', 'FUNC_4': 'getCustomersByPage', 'VAR_4': 'pageNumber', 'VAR_5': 'customers', 'FUNC_5': 'getCustomersCount', 'VAR_6': 'count'} | java | OOP | 100.00% |
package org.bian.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.Valid;
/**
* BQPolicyTermsEvaluateOutputModelPolicyTermsInstanceRecord
*/
public class BQPolicyTermsEvaluateOutputModelPolicyTermsInstanceRecord {
private String applicableBankPolicyRuleInterpretation = null;
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Explanation or interpretation of the policy or rule as applied
* @return applicableBankPolicyRuleInterpretation
**/
public String getApplicableBankPolicyRuleInterpretation() {
return applicableBankPolicyRuleInterpretation;
}
public void setApplicableBankPolicyRuleInterpretation(String applicableBankPolicyRuleInterpretation) {
this.applicableBankPolicyRuleInterpretation = applicableBankPolicyRuleInterpretation;
}
}
| package org.bian.dto;
import com.IMPORT_0.jackson.annotation.IMPORT_1;
import com.IMPORT_0.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import IMPORT_2.validation.Valid;
/**
* BQPolicyTermsEvaluateOutputModelPolicyTermsInstanceRecord
*/
public class BQPolicyTermsEvaluateOutputModelPolicyTermsInstanceRecord {
private String VAR_0 = null;
/**
* `status: Not Mapped` core-data-type-reference: BIAN::DataTypesLibrary::CoreDataTypes::UNCEFACT::Text general-info: Explanation or interpretation of the policy or rule as applied
* @return applicableBankPolicyRuleInterpretation
**/
public String getApplicableBankPolicyRuleInterpretation() {
return VAR_0;
}
public void FUNC_0(String VAR_0) {
this.VAR_0 = VAR_0;
}
}
| 0.278982 | {'IMPORT_0': 'fasterxml', 'IMPORT_1': 'JsonProperty', 'IMPORT_2': 'javax', 'VAR_0': 'applicableBankPolicyRuleInterpretation', 'FUNC_0': 'setApplicableBankPolicyRuleInterpretation'} | java | OOP | 100.00% |
import java.util.Arrays;
import java.util.Scanner;
public class AmusingJoke141A {
public static void main (String[] args){
Scanner scanner = new Scanner(System.in);
String ans = "YES";
String input1 = scanner.nextLine() + scanner.nextLine();
String input2 = scanner.nextLine();
char[] in1 = new char[input1.length()];
char[] in2 = new char[input2.length()];
if(input1.length()!=input2.length()){
ans = "NO";
}
else{
for(int i=0; i<input1.length(); i++){
in1[i]=input1.charAt(i);
in2[i]=input2.charAt(i);
}
Arrays.sort(in1);
Arrays.sort(in2);
// System.out.println(Arrays.toString(in1));
// System.out.println(Arrays.toString(in2));
for(int i=0; i<input1.length();i++){
if(in1[i]!=in2[i]){
ans="NO";
break;
}
}
}
System.out.println(ans);
}
}
| import java.util.Arrays;
import java.util.Scanner;
public class AmusingJoke141A {
public static void FUNC_0 (CLASS_0[] args){
Scanner scanner = new Scanner(System.in);
CLASS_0 ans = "YES";
CLASS_0 input1 = scanner.nextLine() + scanner.nextLine();
CLASS_0 VAR_0 = scanner.nextLine();
char[] VAR_1 = new char[input1.FUNC_1()];
char[] VAR_2 = new char[VAR_0.FUNC_1()];
if(input1.FUNC_1()!=VAR_0.FUNC_1()){
ans = "NO";
}
else{
for(int VAR_3=0; VAR_3<input1.FUNC_1(); VAR_3++){
VAR_1[VAR_3]=input1.FUNC_2(VAR_3);
VAR_2[VAR_3]=VAR_0.FUNC_2(VAR_3);
}
Arrays.FUNC_3(VAR_1);
Arrays.FUNC_3(VAR_2);
// System.out.println(Arrays.toString(in1));
// System.out.println(Arrays.toString(in2));
for(int VAR_3=0; VAR_3<input1.FUNC_1();VAR_3++){
if(VAR_1[VAR_3]!=VAR_2[VAR_3]){
ans="NO";
break;
}
}
}
System.out.println(ans);
}
}
| 0.309006 | {'FUNC_0': 'main', 'CLASS_0': 'String', 'VAR_0': 'input2', 'VAR_1': 'in1', 'FUNC_1': 'length', 'VAR_2': 'in2', 'VAR_3': 'i', 'FUNC_2': 'charAt', 'FUNC_3': 'sort'} | java | OOP | 40.24% |
package imgui;
/**
* Helper class to get ABGR packed color used by Dear ImGui.
*/
public final class ImColor {
private ImColor() {
}
public static int intToColor(final int r, final int g, final int b, final int a) {
return a << 24 | b << 16 | g << 8 | r;
}
public static int intToColor(final int r, final int g, final int b) {
return intToColor(r, g, b, 255);
}
public static int floatToColor(final float r, final float g, final float b, final float a) {
return intToColor((int) (r * 255), (int) (g * 255), (int) (b * 255), (int) (a * 255));
}
public static int floatToColor(final float r, final float g, final float b) {
return floatToColor(r, g, b, 1f);
}
/**
* @param hex e.g. "#FFFFFF"
*/
public static int rgbToColor(final String hex) {
return intToColor(
Integer.parseInt(hex.substring(1, 3), 16),
Integer.parseInt(hex.substring(3, 5), 16),
Integer.parseInt(hex.substring(5, 7), 16)
);
}
/**
* @param hex e.g. "#FFFFFFFF"
*/
public static int rgbaToColor(final String hex) {
return intToColor(
Integer.parseInt(hex.substring(1, 3), 16),
Integer.parseInt(hex.substring(3, 5), 16),
Integer.parseInt(hex.substring(5, 7), 16),
Integer.parseInt(hex.substring(7, 9), 16)
);
}
public static int hslToColor(final int h, final int s, final int l) {
return hslToColor(h, s, l, 1);
}
public static int hslToColor(final int h, final int s, final int l, final float a) {
return hslToColor(h / 360f, s / 100f, l / 100f, a);
}
public static int hslToColor(final float h, final float s, final float l) {
return hslToColor(h, s, l, 1);
}
public static int hslToColor(final float h, final float s, final float l, final float a) {
final float q;
final float p;
final float r;
final float g;
final float b;
// Achromatic
if (s == 0) {
r = l;
g = l;
b = l;
} else {
q = l < 0.5 ? (l * (1 + s)) : (l + s - l * s);
p = 2 * l - q;
r = hue2rgb(p, q, h + 1.0f / 3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1.0f / 3);
}
return floatToColor(r, g, b, a);
}
private static float hue2rgb(final float p, final float q, final float hue) {
float h = hue;
if (h < 0) {
h += 1;
}
if (h > 1) {
h -= 1;
}
if (6 * h < 1) {
return p + ((q - p) * 6 * h);
}
if (2 * h < 1) {
return q;
}
if (3 * h < 2) {
return p + ((q - p) * 6 * ((2.0f / 3.0f) - h));
}
return p;
}
}
| package VAR_0;
/**
* Helper class to get ABGR packed color used by Dear ImGui.
*/
public final class CLASS_0 {
private CLASS_0() {
}
public static int FUNC_0(final int VAR_1, final int VAR_2, final int VAR_3, final int VAR_4) {
return VAR_4 << 24 | VAR_3 << 16 | VAR_2 << 8 | VAR_1;
}
public static int FUNC_0(final int VAR_1, final int VAR_2, final int VAR_3) {
return FUNC_0(VAR_1, VAR_2, VAR_3, 255);
}
public static int floatToColor(final float VAR_1, final float VAR_2, final float VAR_3, final float VAR_4) {
return FUNC_0((int) (VAR_1 * 255), (int) (VAR_2 * 255), (int) (VAR_3 * 255), (int) (VAR_4 * 255));
}
public static int floatToColor(final float VAR_1, final float VAR_2, final float VAR_3) {
return floatToColor(VAR_1, VAR_2, VAR_3, 1f);
}
/**
* @param hex e.g. "#FFFFFF"
*/
public static int FUNC_1(final CLASS_1 VAR_5) {
return FUNC_0(
VAR_6.FUNC_2(VAR_5.FUNC_3(1, 3), 16),
VAR_6.FUNC_2(VAR_5.FUNC_3(3, 5), 16),
VAR_6.FUNC_2(VAR_5.FUNC_3(5, 7), 16)
);
}
/**
* @param hex e.g. "#FFFFFFFF"
*/
public static int FUNC_4(final CLASS_1 VAR_5) {
return FUNC_0(
VAR_6.FUNC_2(VAR_5.FUNC_3(1, 3), 16),
VAR_6.FUNC_2(VAR_5.FUNC_3(3, 5), 16),
VAR_6.FUNC_2(VAR_5.FUNC_3(5, 7), 16),
VAR_6.FUNC_2(VAR_5.FUNC_3(7, 9), 16)
);
}
public static int FUNC_5(final int VAR_7, final int VAR_8, final int l) {
return FUNC_5(VAR_7, VAR_8, l, 1);
}
public static int FUNC_5(final int VAR_7, final int VAR_8, final int l, final float VAR_4) {
return FUNC_5(VAR_7 / 360f, VAR_8 / 100f, l / 100f, VAR_4);
}
public static int FUNC_5(final float VAR_7, final float VAR_8, final float l) {
return FUNC_5(VAR_7, VAR_8, l, 1);
}
public static int FUNC_5(final float VAR_7, final float VAR_8, final float l, final float VAR_4) {
final float q;
final float VAR_9;
final float VAR_1;
final float VAR_2;
final float VAR_3;
// Achromatic
if (VAR_8 == 0) {
VAR_1 = l;
VAR_2 = l;
VAR_3 = l;
} else {
q = l < 0.5 ? (l * (1 + VAR_8)) : (l + VAR_8 - l * VAR_8);
VAR_9 = 2 * l - q;
VAR_1 = FUNC_6(VAR_9, q, VAR_7 + 1.0f / 3);
VAR_2 = FUNC_6(VAR_9, q, VAR_7);
VAR_3 = FUNC_6(VAR_9, q, VAR_7 - 1.0f / 3);
}
return floatToColor(VAR_1, VAR_2, VAR_3, VAR_4);
}
private static float FUNC_6(final float VAR_9, final float q, final float VAR_10) {
float VAR_7 = VAR_10;
if (VAR_7 < 0) {
VAR_7 += 1;
}
if (VAR_7 > 1) {
VAR_7 -= 1;
}
if (6 * VAR_7 < 1) {
return VAR_9 + ((q - VAR_9) * 6 * VAR_7);
}
if (2 * VAR_7 < 1) {
return q;
}
if (3 * VAR_7 < 2) {
return VAR_9 + ((q - VAR_9) * 6 * ((2.0f / 3.0f) - VAR_7));
}
return VAR_9;
}
}
| 0.811149 | {'VAR_0': 'imgui', 'CLASS_0': 'ImColor', 'FUNC_0': 'intToColor', 'VAR_1': 'r', 'VAR_2': 'g', 'VAR_3': 'b', 'VAR_4': 'a', 'FUNC_1': 'rgbToColor', 'CLASS_1': 'String', 'VAR_5': 'hex', 'VAR_6': 'Integer', 'FUNC_2': 'parseInt', 'FUNC_3': 'substring', 'FUNC_4': 'rgbaToColor', 'FUNC_5': 'hslToColor', 'VAR_7': 'h', 'VAR_8': 's', 'VAR_9': 'p', 'FUNC_6': 'hue2rgb', 'VAR_10': 'hue'} | java | OOP | 19.24% |
package fi.maanmittauslaitos.pta.search.documentprocessor.query;
import org.w3c.dom.Node;
public class XmlQueryResultImpl implements QueryResult {
private Node node;
private XmlQueryResultImpl(Node node) {
this.node = node;
}
public static XmlQueryResultImpl create(Node node) {
return new XmlQueryResultImpl(node);
}
public Node getNode() {
return node;
}
@Override
public String getValue() {
return node.getNodeValue();
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9;
public class CLASS_0 implements CLASS_1 {
private IMPORT_9 VAR_0;
private CLASS_0(IMPORT_9 VAR_0) {
this.VAR_0 = VAR_0;
}
public static CLASS_0 FUNC_0(IMPORT_9 VAR_0) {
return new CLASS_0(VAR_0);
}
public IMPORT_9 FUNC_1() {
return VAR_0;
}
@VAR_1
public CLASS_2 FUNC_2() {
return VAR_0.FUNC_3();
}
}
| 0.976313 | {'IMPORT_0': 'fi', 'IMPORT_1': 'maanmittauslaitos', 'IMPORT_2': 'pta', 'IMPORT_3': 'search', 'IMPORT_4': 'documentprocessor', 'IMPORT_5': 'query', 'IMPORT_6': 'org', 'IMPORT_7': 'w3c', 'IMPORT_8': 'dom', 'IMPORT_9': 'Node', 'CLASS_0': 'XmlQueryResultImpl', 'CLASS_1': 'QueryResult', 'VAR_0': 'node', 'FUNC_0': 'create', 'FUNC_1': 'getNode', 'VAR_1': 'Override', 'CLASS_2': 'String', 'FUNC_2': 'getValue', 'FUNC_3': 'getNodeValue'} | java | OOP | 100.00% |
package com.cuppafame.gwtresponsive.client.application.home;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
public class HomeModule extends AbstractPresenterModule {
@Override
protected void configure() {
bindPresenter(HomePagePresenter.class, HomePagePresenter.MyView.class, HomePageView.class,
HomePagePresenter.MyProxy.class);
}
}
| package com.cuppafame.IMPORT_0.client.IMPORT_1.home;
import com.gwtplatform.IMPORT_2.client.IMPORT_3.AbstractPresenterModule;
public class HomeModule extends AbstractPresenterModule {
@VAR_0
protected void FUNC_0() {
bindPresenter(HomePagePresenter.class, HomePagePresenter.MyView.class, HomePageView.class,
HomePagePresenter.CLASS_0.class);
}
}
| 0.410482 | {'IMPORT_0': 'gwtresponsive', 'IMPORT_1': 'application', 'IMPORT_2': 'mvp', 'IMPORT_3': 'gin', 'VAR_0': 'Override', 'FUNC_0': 'configure', 'CLASS_0': 'MyProxy'} | java | OOP | 73.81% |
package com.wasu.upm.config;
import com.wasu.upm.config.zk.domain.DemoDomain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.Date;
public class App {
private static final Logger logger = LoggerFactory
.getLogger(App.class);
public static void main(String[] args) {
// StcServer.main(args);
//容器启动
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("/zk/applicationContext.xml");
final DemoDomain demoDomain = (DemoDomain) applicationContext.getBean("demoDomain");
Thread tt = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
Thread.sleep(2000);
// 测试 每隔一秒输出 类属性的value , 查看该属性是否被变动
logger.debug(demoDomain.getPublickey()+ " "+new Date());
} catch (InterruptedException e) {
logger.error("app ",e);
}
}
}
});
tt.start();
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5.DemoDomain;
import IMPORT_6.slf4j.IMPORT_7;
import IMPORT_6.slf4j.IMPORT_8;
import IMPORT_6.springframework.IMPORT_9.IMPORT_10.ClassPathXmlApplicationContext;
import IMPORT_11.util.IMPORT_12;
public class App {
private static final IMPORT_7 VAR_0 = IMPORT_8
.FUNC_0(App.class);
public static void FUNC_1(CLASS_0[] args) {
// StcServer.main(args);
//容器启动
ClassPathXmlApplicationContext VAR_1 = new ClassPathXmlApplicationContext("/zk/applicationContext.xml");
final DemoDomain VAR_2 = (DemoDomain) VAR_1.FUNC_2("demoDomain");
CLASS_1 VAR_4 = new CLASS_1(new CLASS_2() {
@VAR_5
public void FUNC_3() {
while (true) {
try {
VAR_3.FUNC_4(2000);
// 测试 每隔一秒输出 类属性的value , 查看该属性是否被变动
VAR_0.FUNC_5(VAR_2.FUNC_6()+ " "+new IMPORT_12());
} catch (CLASS_3 VAR_6) {
VAR_0.FUNC_7("app ",VAR_6);
}
}
}
});
VAR_4.FUNC_8();
}
}
| 0.826389 | {'IMPORT_0': 'com', 'IMPORT_1': 'wasu', 'IMPORT_2': 'upm', 'IMPORT_3': 'config', 'IMPORT_4': 'zk', 'IMPORT_5': 'domain', 'IMPORT_6': 'org', 'IMPORT_7': 'Logger', 'IMPORT_8': 'LoggerFactory', 'IMPORT_9': 'context', 'IMPORT_10': 'support', 'IMPORT_11': 'java', 'IMPORT_12': 'Date', 'VAR_0': 'logger', 'FUNC_0': 'getLogger', 'FUNC_1': 'main', 'CLASS_0': 'String', 'VAR_1': 'applicationContext', 'VAR_2': 'demoDomain', 'FUNC_2': 'getBean', 'CLASS_1': 'Thread', 'VAR_3': 'Thread', 'VAR_4': 'tt', 'CLASS_2': 'Runnable', 'VAR_5': 'Override', 'FUNC_3': 'run', 'FUNC_4': 'sleep', 'FUNC_5': 'debug', 'FUNC_6': 'getPublickey', 'CLASS_3': 'InterruptedException', 'VAR_6': 'e', 'FUNC_7': 'error', 'FUNC_8': 'start'} | java | OOP | 32.14% |
package com.intellij.tasks.youtrack;
import com.intellij.openapi.project.Project;
import com.intellij.tasks.TaskState;
import com.intellij.tasks.config.TaskRepositoryEditor;
import com.intellij.tasks.impl.BaseRepositoryType;
import com.intellij.util.Consumer;
import icons.TasksIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.EnumSet;
/**
* @author <NAME>
*/
public class YouTrackRepositoryType extends BaseRepositoryType<YouTrackRepository> {
@NotNull
public String getName() {
return "YouTrack";
}
@NotNull
public Icon getIcon() {
return TasksIcons.Youtrack;
}
@Nullable
@Override
public String getAdvertiser() {
return "<html>Not YouTrack customer yet? Get <a href='http://www.jetbrains.com/youtrack/download/get_youtrack.html?idea_integration'>YouTrack</a></html>";
}
@NotNull
public YouTrackRepository createRepository() {
return new YouTrackRepository(this);
}
@NotNull
@Override
public Class<YouTrackRepository> getRepositoryClass() {
return YouTrackRepository.class;
}
@Override
public EnumSet<TaskState> getPossibleTaskStates() {
return EnumSet.of(TaskState.IN_PROGRESS, TaskState.RESOLVED);
}
@NotNull
@Override
public TaskRepositoryEditor createEditor(YouTrackRepository repository, Project project, Consumer<YouTrackRepository> changeListener) {
return new YouTrackRepositoryEditor(project, repository, changeListener);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import IMPORT_0.IMPORT_1.IMPORT_4.IMPORT_5.IMPORT_6;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_7;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_8.IMPORT_9;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_10.IMPORT_11;
import IMPORT_0.IMPORT_1.IMPORT_12.IMPORT_13;
import IMPORT_14.IMPORT_15;
import IMPORT_16.IMPORT_17.IMPORT_18.IMPORT_19;
import IMPORT_16.IMPORT_17.IMPORT_18.IMPORT_20;
import IMPORT_21.IMPORT_22.*;
import IMPORT_23.IMPORT_12.EnumSet;
/**
* @author <NAME>
*/
public class CLASS_0 extends IMPORT_11<CLASS_1> {
@IMPORT_19
public CLASS_2 FUNC_0() {
return "YouTrack";
}
@IMPORT_19
public CLASS_3 FUNC_1() {
return IMPORT_15.VAR_0;
}
@IMPORT_20
@VAR_1
public CLASS_2 FUNC_2() {
return "<html>Not YouTrack customer yet? Get <a href='http://www.jetbrains.com/youtrack/download/get_youtrack.html?idea_integration'>YouTrack</a></html>";
}
@IMPORT_19
public CLASS_1 FUNC_3() {
return new CLASS_1(this);
}
@IMPORT_19
@VAR_1
public CLASS_4<CLASS_1> FUNC_4() {
return CLASS_1.class;
}
@VAR_1
public EnumSet<IMPORT_7> FUNC_5() {
return EnumSet.FUNC_6(IMPORT_7.IN_PROGRESS, IMPORT_7.VAR_2);
}
@IMPORT_19
@VAR_1
public IMPORT_9 FUNC_7(CLASS_1 VAR_3, IMPORT_6 IMPORT_5, IMPORT_13<CLASS_1> changeListener) {
return new CLASS_5(IMPORT_5, VAR_3, changeListener);
}
}
| 0.920182 | {'IMPORT_0': 'com', 'IMPORT_1': 'intellij', 'IMPORT_2': 'tasks', 'IMPORT_3': 'youtrack', 'IMPORT_4': 'openapi', 'IMPORT_5': 'project', 'IMPORT_6': 'Project', 'IMPORT_7': 'TaskState', 'IMPORT_8': 'config', 'IMPORT_9': 'TaskRepositoryEditor', 'IMPORT_10': 'impl', 'IMPORT_11': 'BaseRepositoryType', 'IMPORT_12': 'util', 'IMPORT_13': 'Consumer', 'IMPORT_14': 'icons', 'IMPORT_15': 'TasksIcons', 'IMPORT_16': 'org', 'IMPORT_17': 'jetbrains', 'IMPORT_18': 'annotations', 'IMPORT_19': 'NotNull', 'IMPORT_20': 'Nullable', 'IMPORT_21': 'javax', 'IMPORT_22': 'swing', 'IMPORT_23': 'java', 'CLASS_0': 'YouTrackRepositoryType', 'CLASS_1': 'YouTrackRepository', 'CLASS_2': 'String', 'FUNC_0': 'getName', 'CLASS_3': 'Icon', 'FUNC_1': 'getIcon', 'VAR_0': 'Youtrack', 'VAR_1': 'Override', 'FUNC_2': 'getAdvertiser', 'FUNC_3': 'createRepository', 'CLASS_4': 'Class', 'FUNC_4': 'getRepositoryClass', 'FUNC_5': 'getPossibleTaskStates', 'FUNC_6': 'of', 'VAR_2': 'RESOLVED', 'FUNC_7': 'createEditor', 'VAR_3': 'repository', 'CLASS_5': 'YouTrackRepositoryEditor'} | java | OOP | 100.00% |
/**
* Trigger a change to the sampling mode that should be used for live allocation tracking.
*/
public void requestLiveAllocationSamplingModeUpdate(@NotNull LiveAllocationSamplingMode mode) {
getStudioProfilers().getIdeServices().getPersistentProfilerPreferences().setInt(
LIVE_ALLOCATION_SAMPLING_PREF, mode.getValue(), DEFAULT_LIVE_ALLOCATION_SAMPLING_MODE.getValue()
);
try {
MemoryAllocSamplingData samplingRate = MemoryAllocSamplingData.newBuilder().setSamplingNumInterval(mode.getValue()).build();
if (getStudioProfilers().getIdeServices().getFeatureConfig().isUnifiedPipelineEnabled()) {
Transport.ExecuteResponse response = getStudioProfilers().getClient().getTransportClient().execute(
Transport.ExecuteRequest.newBuilder().setCommand(Commands.Command.newBuilder()
.setStreamId(mySessionData.getStreamId())
.setPid(mySessionData.getPid())
.setType(Commands.Command.CommandType.MEMORY_ALLOC_SAMPLING)
.setMemoryAllocSampling(samplingRate))
.build());
}
else {
SetAllocationSamplingRateResponse response =
getStudioProfilers().getClient().getMemoryClient().setAllocationSamplingRate(SetAllocationSamplingRateRequest.newBuilder()
.setSession(mySessionData)
.setSamplingRate(samplingRate)
.build());
}
}
catch (StatusRuntimeException e) {
getLogger().debug(e);
}
} | /**
* Trigger a change to the sampling mode that should be used for live allocation tracking.
*/
public void requestLiveAllocationSamplingModeUpdate(@NotNull LiveAllocationSamplingMode mode) {
FUNC_0().FUNC_1().FUNC_2().FUNC_3(
LIVE_ALLOCATION_SAMPLING_PREF, mode.FUNC_4(), DEFAULT_LIVE_ALLOCATION_SAMPLING_MODE.FUNC_4()
);
try {
MemoryAllocSamplingData samplingRate = MemoryAllocSamplingData.newBuilder().setSamplingNumInterval(mode.FUNC_4()).FUNC_5();
if (FUNC_0().FUNC_1().getFeatureConfig().isUnifiedPipelineEnabled()) {
CLASS_0.CLASS_1 response = FUNC_0().FUNC_6().getTransportClient().execute(
VAR_0.VAR_1.newBuilder().setCommand(VAR_2.Command.newBuilder()
.setStreamId(mySessionData.FUNC_7())
.FUNC_8(mySessionData.FUNC_9())
.FUNC_10(VAR_2.Command.CommandType.MEMORY_ALLOC_SAMPLING)
.FUNC_11(samplingRate))
.FUNC_5());
}
else {
CLASS_2 response =
FUNC_0().FUNC_6().getMemoryClient().FUNC_12(SetAllocationSamplingRateRequest.newBuilder()
.FUNC_13(mySessionData)
.FUNC_14(samplingRate)
.FUNC_5());
}
}
catch (CLASS_3 VAR_3) {
getLogger().FUNC_15(VAR_3);
}
} | 0.408 | {'FUNC_0': 'getStudioProfilers', 'FUNC_1': 'getIdeServices', 'FUNC_2': 'getPersistentProfilerPreferences', 'FUNC_3': 'setInt', 'FUNC_4': 'getValue', 'FUNC_5': 'build', 'CLASS_0': 'Transport', 'VAR_0': 'Transport', 'CLASS_1': 'ExecuteResponse', 'FUNC_6': 'getClient', 'VAR_1': 'ExecuteRequest', 'VAR_2': 'Commands', 'FUNC_7': 'getStreamId', 'FUNC_8': 'setPid', 'FUNC_9': 'getPid', 'FUNC_10': 'setType', 'FUNC_11': 'setMemoryAllocSampling', 'CLASS_2': 'SetAllocationSamplingRateResponse', 'FUNC_12': 'setAllocationSamplingRate', 'FUNC_13': 'setSession', 'FUNC_14': 'setSamplingRate', 'CLASS_3': 'StatusRuntimeException', 'VAR_3': 'e', 'FUNC_15': 'debug'} | java | Procedural | 21.20% |
package com.webapp.timeline.membership.service.interfaces;
import com.webapp.timeline.membership.domain.Users;
import com.webapp.timeline.membership.service.response.LoggedInfo;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface UserModifyService {
void modifyUser(Users user) throws RuntimeException;
LoggedInfo modifyImage(HttpServletRequest req, MultipartFile file)throws RuntimeException;
void modifyIdentify(HttpServletRequest request, HttpServletResponse response)throws RuntimeException;
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_6.IMPORT_7;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_8.IMPORT_9;
import IMPORT_10.IMPORT_11.IMPORT_12.IMPORT_13.IMPORT_14;
import IMPORT_15.IMPORT_16.IMPORT_17.IMPORT_18;
import IMPORT_15.IMPORT_16.IMPORT_17.IMPORT_19;
public interface CLASS_0 {
void FUNC_0(IMPORT_7 VAR_0) throws CLASS_1;
IMPORT_9 FUNC_1(IMPORT_18 VAR_1, IMPORT_14 VAR_2)throws CLASS_1;
void FUNC_2(IMPORT_18 VAR_3, IMPORT_19 IMPORT_8)throws CLASS_1;
}
| 0.949986 | {'IMPORT_0': 'com', 'IMPORT_1': 'webapp', 'IMPORT_2': 'timeline', 'IMPORT_3': 'membership', 'IMPORT_4': 'service', 'IMPORT_5': 'interfaces', 'IMPORT_6': 'domain', 'IMPORT_7': 'Users', 'IMPORT_8': 'response', 'IMPORT_9': 'LoggedInfo', 'IMPORT_10': 'org', 'IMPORT_11': 'springframework', 'IMPORT_12': 'web', 'IMPORT_13': 'multipart', 'IMPORT_14': 'MultipartFile', 'IMPORT_15': 'javax', 'IMPORT_16': 'servlet', 'IMPORT_17': 'http', 'IMPORT_18': 'HttpServletRequest', 'IMPORT_19': 'HttpServletResponse', 'CLASS_0': 'UserModifyService', 'FUNC_0': 'modifyUser', 'VAR_0': 'user', 'CLASS_1': 'RuntimeException', 'FUNC_1': 'modifyImage', 'VAR_1': 'req', 'VAR_2': 'file', 'FUNC_2': 'modifyIdentify', 'VAR_3': 'request'} | java | Texto | 59.15% |
package org.apache.maven.scm.provider.perforce.command.edit;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
import org.apache.maven.scm.ScmResult;
import org.apache.maven.scm.command.edit.AbstractEditCommand;
import org.apache.maven.scm.command.edit.EditScmResult;
import org.apache.maven.scm.provider.ScmProviderRepository;
import org.apache.maven.scm.provider.perforce.PerforceScmProvider;
import org.apache.maven.scm.provider.perforce.command.PerforceCommand;
import org.apache.maven.scm.provider.perforce.repository.PerforceScmProviderRepository;
import org.codehaus.plexus.util.cli.CommandLineException;
import org.codehaus.plexus.util.cli.CommandLineUtils;
import org.codehaus.plexus.util.cli.Commandline;
import java.io.File;
import java.io.IOException;
/**
* @author <NAME>
*
*/
public class PerforceEditCommand
extends AbstractEditCommand
implements PerforceCommand
{
/**
* {@inheritDoc}
*/
@Override
protected ScmResult executeEditCommand( ScmProviderRepository repo, ScmFileSet files )
throws ScmException
{
Commandline cl = createCommandLine( (PerforceScmProviderRepository) repo, files.getBasedir(), files );
PerforceEditConsumer consumer = new PerforceEditConsumer();
try
{
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( PerforceScmProvider.clean( "Executing " + cl.toString() ) );
}
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, err );
if ( exitCode != 0 )
{
String cmdLine = CommandLineUtils.toString( cl.getCommandline() );
StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
msg.append( '\n' );
msg.append( "Command line was:" + cmdLine );
throw new CommandLineException( msg.toString() );
}
}
catch ( CommandLineException e )
{
if ( getLogger().isErrorEnabled() )
{
getLogger().error( "CommandLineException " + e.getMessage(), e );
}
}
if ( consumer.isSuccess() )
{
return new EditScmResult( cl.toString(), consumer.getEdits() );
}
return new EditScmResult( cl.toString(), "Unable to edit file(s)", consumer.getErrorMessage(), false );
}
public static Commandline createCommandLine( PerforceScmProviderRepository repo, File workingDirectory,
ScmFileSet files )
throws ScmException
{
Commandline command = PerforceScmProvider.createP4Command( repo, workingDirectory );
command.createArg().setValue( "edit" );
try
{
String candir = workingDirectory.getCanonicalPath();
for ( File f : files.getFileList() )
{
File file = null;
if ( f.isAbsolute() )
{
file = new File( f.getPath() );
}
else
{
file = new File( workingDirectory, f.getPath() );
}
// I want to use relative paths to add files to make testing
// simpler.
// Otherwise the absolute path will be different on everyone's
// machine
// and testing will be a little more painful.
String canfile = file.getCanonicalPath();
if ( canfile.startsWith( candir ) )
{
canfile = canfile.substring( candir.length() + 1 );
}
command.createArg().setValue( canfile );
}
}
catch ( IOException e )
{
throw new ScmException( e.getMessage(), e );
}
return command;
}
}
| package IMPORT_0.IMPORT_1.maven.IMPORT_2.provider.perforce.command.IMPORT_3;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import IMPORT_0.IMPORT_1.maven.IMPORT_2.IMPORT_4;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.ScmFileSet;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.ScmResult;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.command.IMPORT_3.AbstractEditCommand;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.command.IMPORT_3.EditScmResult;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.provider.ScmProviderRepository;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.provider.perforce.PerforceScmProvider;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.provider.perforce.command.PerforceCommand;
import IMPORT_0.IMPORT_1.maven.IMPORT_2.provider.perforce.IMPORT_5.PerforceScmProviderRepository;
import IMPORT_0.codehaus.IMPORT_6.util.IMPORT_7.CommandLineException;
import IMPORT_0.codehaus.IMPORT_6.util.IMPORT_7.CommandLineUtils;
import IMPORT_0.codehaus.IMPORT_6.util.IMPORT_7.Commandline;
import java.io.IMPORT_8;
import java.io.IMPORT_9;
/**
* @author <NAME>
*
*/
public class PerforceEditCommand
extends AbstractEditCommand
implements PerforceCommand
{
/**
* {@inheritDoc}
*/
@VAR_0
protected ScmResult FUNC_0( ScmProviderRepository VAR_1, ScmFileSet files )
throws IMPORT_4
{
Commandline cl = createCommandLine( (PerforceScmProviderRepository) VAR_1, files.getBasedir(), files );
PerforceEditConsumer VAR_2 = new PerforceEditConsumer();
try
{
if ( FUNC_1().isDebugEnabled() )
{
FUNC_1().debug( PerforceScmProvider.clean( "Executing " + cl.FUNC_2() ) );
}
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
int exitCode = CommandLineUtils.executeCommandLine( cl, VAR_2, err );
if ( exitCode != 0 )
{
CLASS_0 cmdLine = CommandLineUtils.FUNC_2( cl.FUNC_3() );
StringBuilder msg = new StringBuilder( "Exit code: " + exitCode + " - " + err.getOutput() );
msg.append( '\n' );
msg.append( "Command line was:" + cmdLine );
throw new CommandLineException( msg.FUNC_2() );
}
}
catch ( CommandLineException VAR_3 )
{
if ( FUNC_1().FUNC_4() )
{
FUNC_1().error( "CommandLineException " + VAR_3.FUNC_5(), VAR_3 );
}
}
if ( VAR_2.isSuccess() )
{
return new EditScmResult( cl.FUNC_2(), VAR_2.FUNC_6() );
}
return new EditScmResult( cl.FUNC_2(), "Unable to edit file(s)", VAR_2.getErrorMessage(), false );
}
public static Commandline createCommandLine( PerforceScmProviderRepository VAR_1, IMPORT_8 workingDirectory,
ScmFileSet files )
throws IMPORT_4
{
Commandline command = PerforceScmProvider.FUNC_7( VAR_1, workingDirectory );
command.createArg().setValue( "edit" );
try
{
CLASS_0 candir = workingDirectory.FUNC_8();
for ( IMPORT_8 VAR_4 : files.FUNC_9() )
{
IMPORT_8 VAR_5 = null;
if ( VAR_4.isAbsolute() )
{
VAR_5 = new IMPORT_8( VAR_4.FUNC_10() );
}
else
{
VAR_5 = new IMPORT_8( workingDirectory, VAR_4.FUNC_10() );
}
// I want to use relative paths to add files to make testing
// simpler.
// Otherwise the absolute path will be different on everyone's
// machine
// and testing will be a little more painful.
CLASS_0 canfile = VAR_5.FUNC_8();
if ( canfile.startsWith( candir ) )
{
canfile = canfile.FUNC_11( candir.length() + 1 );
}
command.createArg().setValue( canfile );
}
}
catch ( IMPORT_9 VAR_3 )
{
throw new IMPORT_4( VAR_3.FUNC_5(), VAR_3 );
}
return command;
}
}
| 0.339684 | {'IMPORT_0': 'org', 'IMPORT_1': 'apache', 'IMPORT_2': 'scm', 'IMPORT_3': 'edit', 'IMPORT_4': 'ScmException', 'IMPORT_5': 'repository', 'IMPORT_6': 'plexus', 'IMPORT_7': 'cli', 'IMPORT_8': 'File', 'IMPORT_9': 'IOException', 'VAR_0': 'Override', 'FUNC_0': 'executeEditCommand', 'VAR_1': 'repo', 'VAR_2': 'consumer', 'FUNC_1': 'getLogger', 'FUNC_2': 'toString', 'CLASS_0': 'String', 'FUNC_3': 'getCommandline', 'VAR_3': 'e', 'FUNC_4': 'isErrorEnabled', 'FUNC_5': 'getMessage', 'FUNC_6': 'getEdits', 'FUNC_7': 'createP4Command', 'FUNC_8': 'getCanonicalPath', 'VAR_4': 'f', 'FUNC_9': 'getFileList', 'VAR_5': 'file', 'FUNC_10': 'getPath', 'FUNC_11': 'substring'} | java | Hibrido | 39.16% |
package com.bazaarvoice.emodb.web.migrator;
public interface MigratorRateLimiter {
int getMaxWritesPerSecond(String migrationId);
}
| package com.bazaarvoice.emodb.IMPORT_0.migrator;
public interface MigratorRateLimiter {
int getMaxWritesPerSecond(String migrationId);
}
| 0.182142 | {'IMPORT_0': 'web'} | java | Texto | 58.82% |
package com.example.greenflag.validator;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.util.Patterns;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.example.greenflag.R;
import com.example.greenflag.data.Load;
import com.example.greenflag.data.Read;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Email {
MathPassword mathPassword = new MathPassword();
Load load = new Load();
String password="";
public boolean check=false;
public boolean exist = false;
String regex = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,6})+$";
/*
public boolean testEmail(String email){
String regexEmail = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,6})+$";
return Pattern.compile(regexEmail).matcher(email).matches();
}
*/
public void checkEmail(EditText editText, ImageView imgCheckEmail, TextView warning, Read read) {
//UPDATE ROTATION
String email = editText.getText().toString();
if(Pattern.compile(regex).matcher(email).matches()){
imgCheckEmail.setImageResource(R.drawable.img_ok);
check=true;
read.enableEmail(true);
}
else {
imgCheckEmail.setImageResource(R.drawable.img_error);
warning.setText("Invalid email");
warning.setTextColor(Color.parseColor("#FF0000"));
read.enableEmail(false);
check=false;
}
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
String email = editable.toString();
if(Pattern.compile(regex).matcher(email).matches()){
imgCheckEmail.setImageResource(R.drawable.img_ok);
check=true;
read.enableEmail(true);
}
else {
imgCheckEmail.setImageResource(R.drawable.img_error);
warning.setText("Invalid email");
warning.setTextColor(Color.parseColor("#FF0000"));
read.enableEmail(false);
check=false;
}
}
});
}
public void checkMatch(EditText etPassword, EditText etMathPassword,TextView tvWarningMath,ImageView imgCheckMath, Read read,Password password) {
mathPassword.mathPassword(etMathPassword,etPassword,tvWarningMath,imgCheckMath,read);
}
public void checkEmailExist(EditText etEmail, SharedPreferences sharedPreferences, TextView tvWarningEmail,Read read,Password password) {
//UPDATE ROTATE
String email = etEmail.getText().toString();
if(Pattern.compile(regex).matcher(email).matches() && check){
//CHECKING EXITING PASSWORD
if(load.email(sharedPreferences,etEmail.getText().toString())){
tvWarningEmail.setText("Email exist");
tvWarningEmail.setTextColor(Color.parseColor("#086E00"));
exist = true;
read.enableWrite(false);
}else {
tvWarningEmail.setText("New User");
tvWarningEmail.setTextColor(Color.parseColor("#086E00"));
read.enableWrite(true);
}
}
//UPDATE EDIT TEXT
etEmail.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
String email = editable.toString();
if(Pattern.compile(regex).matcher(email).matches() && check){
//CHECKING EXITING PASSWORD
if(load.email(sharedPreferences,etEmail.getText().toString())){
tvWarningEmail.setText("Email exist");
tvWarningEmail.setTextColor(Color.parseColor("#086E00"));
exist = true;
read.enableWrite(false);
}else {
tvWarningEmail.setText("New User");
tvWarningEmail.setTextColor(Color.parseColor("#086E00"));
read.enableWrite(true);
}
}
}
});
}
//DETECT IF THE PASSWORD EXIST
public boolean match(String matchPassword) {
Log.d("READ_PASSWORD","Reading data"+matchPassword);
Log.d("READ_PASSWORD","The passord is"+load.password);
if (load.password.equals(matchPassword)){
password=<PASSWORD>;
return true;
// Log.d("READ_PASSWORD","<PASSWORD>!!");
}
else {
password = <PASSWORD>;
return false;
}
}
public void cleanPasswords(EditText etEmail, EditText etPassword, EditText etMathPassword) {
etEmail.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
etPassword.setText("");
etMathPassword.setText("");
}
});
}
//CLEAN EDIT TEXT
public void cleanData(EditText etEmail, EditText etPassword, EditText etMathPassword) {
etEmail.setText("");
etPassword.setText("");
etMathPassword.setText("");
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import IMPORT_4.IMPORT_5.IMPORT_6;
import IMPORT_4.IMPORT_7.IMPORT_8;
import IMPORT_4.text.Editable;
import IMPORT_4.text.TextWatcher;
import IMPORT_4.IMPORT_9.IMPORT_10;
import IMPORT_4.IMPORT_9.Patterns;
import IMPORT_4.IMPORT_11.Button;
import IMPORT_4.IMPORT_11.EditText;
import IMPORT_4.IMPORT_11.ImageView;
import IMPORT_4.IMPORT_11.TextView;
import androidx.IMPORT_12.IMPORT_5.IMPORT_13;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_15.Load;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_15.IMPORT_16;
import IMPORT_17.IMPORT_9.IMPORT_18.IMPORT_19;
import IMPORT_17.IMPORT_9.IMPORT_18.Pattern;
public class CLASS_0 {
CLASS_1 mathPassword = new CLASS_1();
Load VAR_0 = new Load();
CLASS_2 VAR_1="";
public boolean VAR_2=false;
public boolean VAR_3 = false;
CLASS_2 IMPORT_18 = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,6})+$";
/*
public boolean testEmail(String email){
String regexEmail = "^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,6})+$";
return Pattern.compile(regexEmail).matcher(email).matches();
}
*/
public void FUNC_0(EditText VAR_4, ImageView VAR_5, TextView warning, IMPORT_16 VAR_6) {
//UPDATE ROTATION
CLASS_2 VAR_7 = VAR_4.getText().toString();
if(Pattern.FUNC_2(IMPORT_18).FUNC_3(VAR_7).matches()){
VAR_5.FUNC_4(IMPORT_14.drawable.VAR_8);
VAR_2=true;
VAR_6.FUNC_5(true);
}
else {
VAR_5.FUNC_4(IMPORT_14.drawable.img_error);
warning.FUNC_6("Invalid email");
warning.setTextColor(IMPORT_8.FUNC_7("#FF0000"));
VAR_6.FUNC_5(false);
VAR_2=false;
}
VAR_4.addTextChangedListener(new TextWatcher() {
@VAR_9
public void beforeTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void onTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void FUNC_8(Editable VAR_13) {
CLASS_2 VAR_7 = VAR_13.toString();
if(Pattern.FUNC_2(IMPORT_18).FUNC_3(VAR_7).matches()){
VAR_5.FUNC_4(IMPORT_14.drawable.VAR_8);
VAR_2=true;
VAR_6.FUNC_5(true);
}
else {
VAR_5.FUNC_4(IMPORT_14.drawable.img_error);
warning.FUNC_6("Invalid email");
warning.setTextColor(IMPORT_8.FUNC_7("#FF0000"));
VAR_6.FUNC_5(false);
VAR_2=false;
}
}
});
}
public void FUNC_9(EditText VAR_14, EditText VAR_15,TextView tvWarningMath,ImageView imgCheckMath, IMPORT_16 VAR_6,CLASS_4 VAR_1) {
mathPassword.mathPassword(VAR_15,VAR_14,tvWarningMath,imgCheckMath,VAR_6);
}
public void FUNC_10(EditText VAR_16, IMPORT_6 VAR_17, TextView tvWarningEmail,IMPORT_16 VAR_6,CLASS_4 VAR_1) {
//UPDATE ROTATE
CLASS_2 VAR_7 = VAR_16.getText().toString();
if(Pattern.FUNC_2(IMPORT_18).FUNC_3(VAR_7).matches() && VAR_2){
//CHECKING EXITING PASSWORD
if(VAR_0.FUNC_1(VAR_17,VAR_16.getText().toString())){
tvWarningEmail.FUNC_6("Email exist");
tvWarningEmail.setTextColor(IMPORT_8.FUNC_7("#086E00"));
VAR_3 = true;
VAR_6.enableWrite(false);
}else {
tvWarningEmail.FUNC_6("New User");
tvWarningEmail.setTextColor(IMPORT_8.FUNC_7("#086E00"));
VAR_6.enableWrite(true);
}
}
//UPDATE EDIT TEXT
VAR_16.addTextChangedListener(new TextWatcher() {
@VAR_9
public void beforeTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void onTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void FUNC_8(Editable VAR_13) {
CLASS_2 VAR_7 = VAR_13.toString();
if(Pattern.FUNC_2(IMPORT_18).FUNC_3(VAR_7).matches() && VAR_2){
//CHECKING EXITING PASSWORD
if(VAR_0.FUNC_1(VAR_17,VAR_16.getText().toString())){
tvWarningEmail.FUNC_6("Email exist");
tvWarningEmail.setTextColor(IMPORT_8.FUNC_7("#086E00"));
VAR_3 = true;
VAR_6.enableWrite(false);
}else {
tvWarningEmail.FUNC_6("New User");
tvWarningEmail.setTextColor(IMPORT_8.FUNC_7("#086E00"));
VAR_6.enableWrite(true);
}
}
}
});
}
//DETECT IF THE PASSWORD EXIST
public boolean FUNC_11(CLASS_2 matchPassword) {
IMPORT_10.FUNC_12("READ_PASSWORD","Reading data"+matchPassword);
IMPORT_10.FUNC_12("READ_PASSWORD","The passord is"+VAR_0.VAR_1);
if (VAR_0.VAR_1.FUNC_13(matchPassword)){
CLASS_3=<CLASS_5>;
return true;
// Log.d("READ_PASSWORD","<PASSWORD>!!");
}
else {
CLASS_3 = <CLASS_5>;
return false;
}
}
public void cleanPasswords(EditText VAR_16, EditText VAR_14, EditText VAR_15) {
VAR_16.addTextChangedListener(new TextWatcher() {
@VAR_9
public void beforeTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void onTextChanged(CharSequence VAR_10, int VAR_11, int i1, int VAR_12) {
}
@VAR_9
public void FUNC_8(Editable VAR_13) {
VAR_14.FUNC_6("");
VAR_15.FUNC_6("");
}
});
}
//CLEAN EDIT TEXT
public void FUNC_14(EditText VAR_16, EditText VAR_14, EditText VAR_15) {
VAR_16.FUNC_6("");
VAR_14.FUNC_6("");
VAR_15.FUNC_6("");
}
}
| 0.664613 | {'IMPORT_0': 'com', 'IMPORT_1': 'example', 'IMPORT_2': 'greenflag', 'IMPORT_3': 'validator', 'IMPORT_4': 'android', 'IMPORT_5': 'content', 'IMPORT_6': 'SharedPreferences', 'IMPORT_7': 'graphics', 'IMPORT_8': 'Color', 'IMPORT_9': 'util', 'IMPORT_10': 'Log', 'IMPORT_11': 'widget', 'IMPORT_12': 'core', 'IMPORT_13': 'ContextCompat', 'IMPORT_14': 'R', 'IMPORT_15': 'data', 'IMPORT_16': 'Read', 'IMPORT_17': 'java', 'IMPORT_18': 'regex', 'IMPORT_19': 'Matcher', 'CLASS_0': 'Email', 'CLASS_1': 'MathPassword', 'VAR_0': 'load', 'CLASS_2': 'String', 'VAR_1': 'password', 'CLASS_3': 'password', 'VAR_2': 'check', 'VAR_3': 'exist', 'FUNC_0': 'checkEmail', 'VAR_4': 'editText', 'VAR_5': 'imgCheckEmail', 'VAR_6': 'read', 'VAR_7': 'email', 'FUNC_1': 'email', 'FUNC_2': 'compile', 'FUNC_3': 'matcher', 'FUNC_4': 'setImageResource', 'VAR_8': 'img_ok', 'FUNC_5': 'enableEmail', 'FUNC_6': 'setText', 'FUNC_7': 'parseColor', 'VAR_9': 'Override', 'VAR_10': 'charSequence', 'VAR_11': 'i', 'VAR_12': 'i2', 'FUNC_8': 'afterTextChanged', 'VAR_13': 'editable', 'FUNC_9': 'checkMatch', 'VAR_14': 'etPassword', 'VAR_15': 'etMathPassword', 'CLASS_4': 'Password', 'FUNC_10': 'checkEmailExist', 'VAR_16': 'etEmail', 'VAR_17': 'sharedPreferences', 'FUNC_11': 'match', 'FUNC_12': 'd', 'FUNC_13': 'equals', 'CLASS_5': 'PASSWORD', 'FUNC_14': 'cleanData'} | java | error | 0 |
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.ObjectInputStream;
import java.io.OptionalDataException;
import java.io.StreamCorruptedException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.LinkedList;
import net.runelite.mapping.Export;
import net.runelite.mapping.Implements;
import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
import net.runelite.rs.Reflection;
import net.runelite.rs.ScriptOpcodes;
@ObfuscatedName("ac")
@Implements("AbstractWorldMapData")
public abstract class AbstractWorldMapData {
@ObfuscatedName("n")
@ObfuscatedGetter(
intValue = 285974329
)
@Export("regionXLow")
int regionXLow;
@ObfuscatedName("v")
@ObfuscatedGetter(
intValue = 998722377
)
@Export("regionYLow")
int regionYLow;
@ObfuscatedName("d")
@ObfuscatedGetter(
intValue = -226026385
)
@Export("regionX")
int regionX;
@ObfuscatedName("c")
@ObfuscatedGetter(
intValue = 2108441199
)
@Export("regionY")
int regionY;
@ObfuscatedName("y")
@ObfuscatedGetter(
intValue = -351352557
)
@Export("minPlane")
int minPlane;
@ObfuscatedName("h")
@ObfuscatedGetter(
intValue = 754636665
)
@Export("planes")
int planes;
@ObfuscatedName("z")
@ObfuscatedGetter(
intValue = 1785019245
)
@Export("groupId")
int groupId;
@ObfuscatedName("e")
@ObfuscatedGetter(
intValue = -1849711777
)
@Export("fileId")
int fileId;
@ObfuscatedName("q")
@Export("floorUnderlayIds")
short[][][] floorUnderlayIds;
@ObfuscatedName("l")
@Export("floorOverlayIds")
short[][][] floorOverlayIds;
@ObfuscatedName("s")
byte[][][] field193;
@ObfuscatedName("b")
byte[][][] field204;
@ObfuscatedName("a")
@ObfuscatedSignature(
descriptor = "[[[[Lax;"
)
@Export("decorations")
WorldMapDecoration[][][][] decorations;
@ObfuscatedName("w")
boolean field203;
@ObfuscatedName("k")
boolean field207;
AbstractWorldMapData() {
this.groupId = -1; // L: 14
this.fileId = -1; // L: 15
new LinkedList();
this.field203 = false; // L: 26
this.field207 = false; // L: 27
} // L: 29
@ObfuscatedName("v")
@ObfuscatedSignature(
descriptor = "(Lkx;B)V",
garbageValue = "36"
)
@Export("readGeography")
abstract void readGeography(Buffer var1);
@ObfuscatedName("e")
@ObfuscatedSignature(
descriptor = "(I)Z",
garbageValue = "16711935"
)
@Export("isFullyLoaded")
boolean isFullyLoaded() {
return this.field203 && this.field207; // L: 32
}
@ObfuscatedName("q")
@ObfuscatedSignature(
descriptor = "(Lig;B)V",
garbageValue = "116"
)
@Export("loadGeography")
void loadGeography(AbstractArchive var1) {
if (!this.isFullyLoaded()) {
byte[] var2 = var1.takeFile(this.groupId, this.fileId);
if (var2 != null) {
this.readGeography(new Buffer(var2));
this.field203 = true;
this.field207 = true;
}
}
} // L: 43
@ObfuscatedName("l")
@ObfuscatedSignature(
descriptor = "(B)V",
garbageValue = "-59"
)
@Export("reset")
void reset() {
this.floorUnderlayIds = null;
this.floorOverlayIds = null;
this.field193 = null;
this.field204 = null;
this.decorations = null;
this.field203 = false; // L: 51
this.field207 = false;
}
@ObfuscatedName("s")
@ObfuscatedSignature(
descriptor = "(IILkx;I)V",
garbageValue = "-1493570847"
)
@Export("readTile")
void readTile(int var1, int var2, Buffer var3) {
int var4 = var3.readUnsignedByte(); // L: 56
if (var4 != 0) {
if ((var4 & 1) != 0) {
this.method327(var1, var2, var3, var4);
} else {
this.method328(var1, var2, var3, var4);
}
}
}
@ObfuscatedName("b")
@ObfuscatedSignature(
descriptor = "(IILkx;IB)V",
garbageValue = "20"
)
void method327(int var1, int var2, Buffer var3, int var4) {
boolean var5 = (var4 & 2) != 0;
if (var5) { // L: 70
this.floorOverlayIds[0][var1][var2] = (short)var3.readUnsignedByte();
}
this.floorUnderlayIds[0][var1][var2] = (short)var3.readUnsignedByte();
}
@ObfuscatedName("a")
@ObfuscatedSignature(
descriptor = "(IILkx;II)V",
garbageValue = "78729378"
)
void method328(int var1, int var2, Buffer var3, int var4) {
int var5 = ((var4 & 24) >> 3) + 1;
boolean var6 = (var4 & 2) != 0;
boolean var7 = (var4 & 4) != 0;
this.floorUnderlayIds[0][var1][var2] = (short)var3.readUnsignedByte(); // L: 80
int var8;
int var9;
int var11;
if (var6) {
var8 = var3.readUnsignedByte(); // L: 82
for (var9 = 0; var9 < var8; ++var9) {
int var14 = var3.readUnsignedByte();
if (var14 != 0) {
this.floorOverlayIds[var9][var1][var2] = (short)var14;
var11 = var3.readUnsignedByte();
this.field193[var9][var1][var2] = (byte)(var11 >> 2); // L: 88
this.field204[var9][var1][var2] = (byte)(var11 & 3); // L: 89
}
}
}
if (var7) {
for (var8 = 0; var8 < var5; ++var8) {
var9 = var3.readUnsignedByte(); // L: 95
if (var9 != 0) {
WorldMapDecoration[] var10 = this.decorations[var8][var1][var2] = new WorldMapDecoration[var9];
for (var11 = 0; var11 < var9; ++var11) {
int var12 = var3.method5833(); // L: 101
int var13 = var3.readUnsignedByte();
var10[var11] = new WorldMapDecoration(var12, var13 >> 2, var13 & 3);
}
}
}
}
} // L: 107
@ObfuscatedName("w")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "-75109979"
)
@Export("getRegionX")
int getRegionX() {
return this.regionX;
}
@ObfuscatedName("k")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "-2014407853"
)
@Export("getRegionY")
int getRegionY() {
return this.regionY; // L: 116
}
@ObfuscatedName("n")
@ObfuscatedSignature(
descriptor = "(ILjava/lang/String;Ljava/lang/String;I)V",
garbageValue = "1967773856"
)
@Export("addGameMessage")
static void addGameMessage(int var0, String var1, String var2) {
PlatformInfo.addChatMessage(var0, var1, var2, (String)null); // L: 19
} // L: 20
@ObfuscatedName("n")
@ObfuscatedSignature(
descriptor = "(I)I",
garbageValue = "1751033687"
)
public static int method342() {
return ViewportMouse.ViewportMouse_entityCount; // L: 44
}
@ObfuscatedName("d")
@ObfuscatedSignature(
descriptor = "(Lkd;I)V",
garbageValue = "352611015"
)
@Export("performReflectionCheck")
public static void performReflectionCheck(PacketBuffer var0) {
ReflectionCheck var1 = (ReflectionCheck)class105.reflectionChecks.last(); // L: 35
if (var1 != null) { // L: 36
int var2 = var0.offset; // L: 37
var0.writeInt(var1.id); // L: 38
for (int var3 = 0; var3 < var1.size; ++var3) { // L: 39
if (var1.creationErrors[var3] != 0) { // L: 40
var0.writeByte(var1.creationErrors[var3]); // L: 41
} else {
try {
int var4 = var1.operations[var3]; // L: 45
Field var5;
int var6;
if (var4 == 0) { // L: 46
var5 = var1.fields[var3]; // L: 47
var6 = Reflection.getInt(var5, (Object)null); // L: 48
var0.writeByte(0); // L: 49
var0.writeInt(var6); // L: 50
} else if (var4 == 1) { // L: 52
var5 = var1.fields[var3]; // L: 53
Reflection.setInt(var5, (Object)null, var1.intReplaceValues[var3]); // L: 54
var0.writeByte(0); // L: 55
} else if (var4 == 2) { // L: 57
var5 = var1.fields[var3]; // L: 58
var6 = var5.getModifiers(); // L: 59
var0.writeByte(0); // L: 60
var0.writeInt(var6); // L: 61
}
Method var25;
if (var4 != 3) { // L: 63
if (var4 == 4) { // L: 83
var25 = var1.methods[var3]; // L: 84
var6 = var25.getModifiers(); // L: 85
var0.writeByte(0); // L: 86
var0.writeInt(var6); // L: 87
}
} else {
var25 = var1.methods[var3]; // L: 64
byte[][] var10 = var1.arguments[var3]; // L: 65
Object[] var7 = new Object[var10.length]; // L: 66
for (int var8 = 0; var8 < var10.length; ++var8) { // L: 67
ObjectInputStream var9 = new ObjectInputStream(new ByteArrayInputStream(var10[var8])); // L: 68
var7[var8] = var9.readObject(); // L: 69
}
Object var11 = Reflection.invoke(var25, (Object)null, var7); // L: 71
if (var11 == null) { // L: 72
var0.writeByte(0);
} else if (var11 instanceof Number) { // L: 73
var0.writeByte(1); // L: 74
var0.writeLong(((Number)var11).longValue()); // L: 75
} else if (var11 instanceof String) { // L: 77
var0.writeByte(2); // L: 78
var0.writeStringCp1252NullTerminated((String)var11); // L: 79
} else {
var0.writeByte(4); // L: 81
}
}
} catch (ClassNotFoundException var13) { // L: 90
var0.writeByte(-10); // L: 91
} catch (InvalidClassException var14) { // L: 93
var0.writeByte(-11); // L: 94
} catch (StreamCorruptedException var15) { // L: 96
var0.writeByte(-12); // L: 97
} catch (OptionalDataException var16) { // L: 99
var0.writeByte(-13); // L: 100
} catch (IllegalAccessException var17) { // L: 102
var0.writeByte(-14); // L: 103
} catch (IllegalArgumentException var18) { // L: 105
var0.writeByte(-15); // L: 106
} catch (InvocationTargetException var19) { // L: 108
var0.writeByte(-16); // L: 109
} catch (SecurityException var20) { // L: 111
var0.writeByte(-17); // L: 112
} catch (IOException var21) { // L: 114
var0.writeByte(-18); // L: 115
} catch (NullPointerException var22) { // L: 117
var0.writeByte(-19); // L: 118
} catch (Exception var23) { // L: 120
var0.writeByte(-20); // L: 121
} catch (Throwable var24) { // L: 123
var0.writeByte(-21); // L: 124
}
}
}
var0.writeCrc(var2); // L: 127
var1.remove(); // L: 128
}
} // L: 129
@ObfuscatedName("e")
@ObfuscatedSignature(
descriptor = "(ILcl;ZI)I",
garbageValue = "1250443961"
)
static int method350(int var0, Script var1, boolean var2) {
boolean var3 = true; // L: 775
Widget var4;
if (var0 >= 2000) { // L: 777
var0 -= 1000; // L: 778
var4 = class237.getWidget(Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]); // L: 779
var3 = false; // L: 780
} else {
var4 = var2 ? class277.scriptDotWidget : Interpreter.scriptActiveWidget; // L: 782
}
int var11;
if (var0 == ScriptOpcodes.CC_SETOP) { // L: 783
var11 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] - 1; // L: 784
if (var11 >= 0 && var11 <= 9) { // L: 785
var4.setAction(var11, Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize]); // L: 789
return 1; // L: 790
} else {
--Interpreter.Interpreter_stringStackSize; // L: 786
return 1; // L: 787
}
} else {
int var6;
if (var0 == ScriptOpcodes.CC_SETDRAGGABLE) { // L: 792
Interpreter.Interpreter_intStackSize -= 2; // L: 793
var11 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]; // L: 794
var6 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]; // L: 795
var4.parent = ArchiveLoader.getWidgetChild(var11, var6); // L: 796
return 1; // L: 797
} else if (var0 == ScriptOpcodes.CC_SETDRAGGABLEBEHAVIOR) { // L: 799
var4.isScrollBar = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] == 1; // L: 800
return 1; // L: 801
} else if (var0 == ScriptOpcodes.CC_SETDRAGDEADZONE) { // L: 803
var4.dragZoneSize = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 804
return 1; // L: 805
} else if (var0 == ScriptOpcodes.CC_SETDRAGDEADTIME) { // L: 807
var4.dragThreshold = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 808
return 1; // L: 809
} else if (var0 == ScriptOpcodes.CC_SETOPBASE) { // L: 811
var4.dataText = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize]; // L: 812
return 1; // L: 813
} else if (var0 == ScriptOpcodes.CC_SETTARGETVERB) { // L: 815
var4.spellActionName = Interpreter.Interpreter_stringStack[--Interpreter.Interpreter_stringStackSize]; // L: 816
return 1; // L: 817
} else if (var0 == ScriptOpcodes.CC_CLEAROPS) { // L: 819
var4.actions = null; // L: 820
return 1; // L: 821
} else if (var0 == 1308) { // L: 823
var4.prioritizeMenuEntry = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] == 1; // L: 824
return 1; // L: 825
} else if (var0 == 1309) { // L: 827
--Interpreter.Interpreter_intStackSize; // L: 828
return 1; // L: 829
} else {
int var7;
byte[] var8;
if (var0 != ScriptOpcodes.CC_SETOPKEY) { // L: 831
byte var5;
if (var0 == ScriptOpcodes.CC_SETOPTKEY) { // L: 861
Interpreter.Interpreter_intStackSize -= 2; // L: 862
var5 = 10; // L: 863
var8 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]}; // L: 864
byte[] var9 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]}; // L: 865
TaskHandler.Widget_setKey(var4, var5, var8, var9); // L: 866
return 1; // L: 867
} else if (var0 == ScriptOpcodes.CC_SETOPKEYRATE) { // L: 869
Interpreter.Interpreter_intStackSize -= 3; // L: 870
var11 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize] - 1; // L: 871
var6 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]; // L: 872
var7 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 2]; // L: 873
if (var11 >= 0 && var11 <= 9) { // L: 874
WorldMapRegion.Widget_setKeyRate(var4, var11, var6, var7); // L: 877
return 1; // L: 878
} else {
throw new RuntimeException(); // L: 875
}
} else if (var0 == ScriptOpcodes.CC_SETOPTKEYRATE) { // L: 880
var5 = 10; // L: 881
var6 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 882
var7 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 883
WorldMapRegion.Widget_setKeyRate(var4, var5, var6, var7); // L: 884
return 1; // L: 885
} else if (var0 == ScriptOpcodes.CC_SETOPKEYIGNOREHELD) { // L: 887
--Interpreter.Interpreter_intStackSize; // L: 888
var11 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize] - 1; // L: 889
if (var11 >= 0 && var11 <= 9) { // L: 890
WorldMapIcon_0.Widget_setKeyIgnoreHeld(var4, var11); // L: 893
return 1; // L: 894
} else {
throw new RuntimeException(); // L: 891
}
} else if (var0 == ScriptOpcodes.CC_SETOPTKEYIGNOREHELD) { // L: 896
var5 = 10; // L: 897
WorldMapIcon_0.Widget_setKeyIgnoreHeld(var4, var5); // L: 898
return 1; // L: 899
} else {
return 2; // L: 901
}
} else {
byte[] var10 = null; // L: 832
var8 = null; // L: 833
if (var3) { // L: 834
Interpreter.Interpreter_intStackSize -= 10; // L: 835
for (var7 = 0; var7 < 10 && Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize] >= 0; var7 += 2) { // L: 837 838
}
if (var7 > 0) { // L: 840
var10 = new byte[var7 / 2]; // L: 841
var8 = new byte[var7 / 2]; // L: 842
for (var7 -= 2; var7 >= 0; var7 -= 2) { // L: 843
var10[var7 / 2] = (byte)Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize]; // L: 844
var8[var7 / 2] = (byte)Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize + 1]; // L: 845
}
}
} else {
Interpreter.Interpreter_intStackSize -= 2; // L: 850
var10 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]}; // L: 851
var8 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]}; // L: 852
}
var7 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] - 1; // L: 854
if (var7 >= 0 && var7 <= 9) { // L: 855
TaskHandler.Widget_setKey(var4, var7, var10, var8); // L: 858
return 1; // L: 859
} else {
throw new RuntimeException(); // L: 856
}
}
}
}
}
@ObfuscatedName("iu")
@ObfuscatedSignature(
descriptor = "(I)V",
garbageValue = "-1407692443"
)
static void method352() {
for (int var0 = 0; var0 < Client.menuOptionsCount; ++var0) { // L: 9015
if (AbstractWorldMapIcon.method685(Client.menuOpcodes[var0])) { // L: 9016
if (var0 < Client.menuOptionsCount - 1) { // L: 9017
for (int var1 = var0; var1 < Client.menuOptionsCount - 1; ++var1) { // L: 9018
Client.menuActions[var1] = Client.menuActions[var1 + 1]; // L: 9019
Client.menuTargets[var1] = Client.menuTargets[var1 + 1]; // L: 9020
Client.menuOpcodes[var1] = Client.menuOpcodes[var1 + 1]; // L: 9021
Client.menuIdentifiers[var1] = Client.menuIdentifiers[var1 + 1]; // L: 9022
Client.menuArguments1[var1] = Client.menuArguments1[var1 + 1]; // L: 9023
Client.menuArguments2[var1] = Client.menuArguments2[var1 + 1]; // L: 9024
Client.menuShiftClick[var1] = Client.menuShiftClick[var1 + 1]; // L: 9025
}
}
--var0; // L: 9028
--Client.menuOptionsCount; // L: 9029
}
}
class41.method650(); // L: 9032
} // L: 9033
}
| import IMPORT_0.IMPORT_1.IMPORT_2;
import IMPORT_0.IMPORT_1.IMPORT_3;
import IMPORT_0.IMPORT_1.IMPORT_4;
import IMPORT_0.IMPORT_1.IMPORT_5;
import IMPORT_0.IMPORT_1.OptionalDataException;
import IMPORT_0.IMPORT_1.IMPORT_6;
import IMPORT_0.IMPORT_7.IMPORT_8.IMPORT_9;
import IMPORT_0.IMPORT_7.IMPORT_8.InvocationTargetException;
import IMPORT_0.IMPORT_7.IMPORT_8.Method;
import IMPORT_0.util.IMPORT_10;
import net.runelite.IMPORT_11.Export;
import net.runelite.IMPORT_11.IMPORT_12;
import net.runelite.IMPORT_11.ObfuscatedGetter;
import net.runelite.IMPORT_11.ObfuscatedName;
import net.runelite.IMPORT_11.ObfuscatedSignature;
import net.runelite.rs.IMPORT_13;
import net.runelite.rs.IMPORT_14;
@ObfuscatedName("ac")
@IMPORT_12("AbstractWorldMapData")
public abstract class CLASS_0 {
@ObfuscatedName("n")
@ObfuscatedGetter(
intValue = 285974329
)
@Export("regionXLow")
int VAR_0;
@ObfuscatedName("v")
@ObfuscatedGetter(
intValue = 998722377
)
@Export("regionYLow")
int regionYLow;
@ObfuscatedName("d")
@ObfuscatedGetter(
intValue = -226026385
)
@Export("regionX")
int VAR_1;
@ObfuscatedName("c")
@ObfuscatedGetter(
intValue = 2108441199
)
@Export("regionY")
int VAR_2;
@ObfuscatedName("y")
@ObfuscatedGetter(
intValue = -351352557
)
@Export("minPlane")
int VAR_3;
@ObfuscatedName("h")
@ObfuscatedGetter(
intValue = 754636665
)
@Export("planes")
int planes;
@ObfuscatedName("z")
@ObfuscatedGetter(
intValue = 1785019245
)
@Export("groupId")
int groupId;
@ObfuscatedName("e")
@ObfuscatedGetter(
intValue = -1849711777
)
@Export("fileId")
int VAR_4;
@ObfuscatedName("q")
@Export("floorUnderlayIds")
short[][][] floorUnderlayIds;
@ObfuscatedName("l")
@Export("floorOverlayIds")
short[][][] floorOverlayIds;
@ObfuscatedName("s")
byte[][][] field193;
@ObfuscatedName("b")
byte[][][] field204;
@ObfuscatedName("a")
@ObfuscatedSignature(
descriptor = "[[[[Lax;"
)
@Export("decorations")
CLASS_1[][][][] VAR_5;
@ObfuscatedName("w")
boolean VAR_6;
@ObfuscatedName("k")
boolean VAR_7;
CLASS_0() {
this.groupId = -1; // L: 14
this.VAR_4 = -1; // L: 15
new IMPORT_10();
this.VAR_6 = false; // L: 26
this.VAR_7 = false; // L: 27
} // L: 29
@ObfuscatedName("v")
@ObfuscatedSignature(
descriptor = "(Lkx;B)V",
VAR_8 = "36"
)
@Export("readGeography")
abstract void readGeography(CLASS_2 VAR_9);
@ObfuscatedName("e")
@ObfuscatedSignature(
descriptor = "(I)Z",
VAR_8 = "16711935"
)
@Export("isFullyLoaded")
boolean FUNC_0() {
return this.VAR_6 && this.VAR_7; // L: 32
}
@ObfuscatedName("q")
@ObfuscatedSignature(
descriptor = "(Lig;B)V",
VAR_8 = "116"
)
@Export("loadGeography")
void FUNC_1(CLASS_3 VAR_9) {
if (!this.FUNC_0()) {
byte[] var2 = VAR_9.takeFile(this.groupId, this.VAR_4);
if (var2 != null) {
this.readGeography(new CLASS_2(var2));
this.VAR_6 = true;
this.VAR_7 = true;
}
}
} // L: 43
@ObfuscatedName("l")
@ObfuscatedSignature(
descriptor = "(B)V",
VAR_8 = "-59"
)
@Export("reset")
void FUNC_2() {
this.floorUnderlayIds = null;
this.floorOverlayIds = null;
this.field193 = null;
this.field204 = null;
this.VAR_5 = null;
this.VAR_6 = false; // L: 51
this.VAR_7 = false;
}
@ObfuscatedName("s")
@ObfuscatedSignature(
descriptor = "(IILkx;I)V",
VAR_8 = "-1493570847"
)
@Export("readTile")
void FUNC_3(int VAR_9, int var2, CLASS_2 VAR_10) {
int var4 = VAR_10.readUnsignedByte(); // L: 56
if (var4 != 0) {
if ((var4 & 1) != 0) {
this.method327(VAR_9, var2, VAR_10, var4);
} else {
this.method328(VAR_9, var2, VAR_10, var4);
}
}
}
@ObfuscatedName("b")
@ObfuscatedSignature(
descriptor = "(IILkx;IB)V",
VAR_8 = "20"
)
void method327(int VAR_9, int var2, CLASS_2 VAR_10, int var4) {
boolean VAR_11 = (var4 & 2) != 0;
if (VAR_11) { // L: 70
this.floorOverlayIds[0][VAR_9][var2] = (short)VAR_10.readUnsignedByte();
}
this.floorUnderlayIds[0][VAR_9][var2] = (short)VAR_10.readUnsignedByte();
}
@ObfuscatedName("a")
@ObfuscatedSignature(
descriptor = "(IILkx;II)V",
VAR_8 = "78729378"
)
void method328(int VAR_9, int var2, CLASS_2 VAR_10, int var4) {
int VAR_11 = ((var4 & 24) >> 3) + 1;
boolean var6 = (var4 & 2) != 0;
boolean var7 = (var4 & 4) != 0;
this.floorUnderlayIds[0][VAR_9][var2] = (short)VAR_10.readUnsignedByte(); // L: 80
int var8;
int var9;
int VAR_12;
if (var6) {
var8 = VAR_10.readUnsignedByte(); // L: 82
for (var9 = 0; var9 < var8; ++var9) {
int var14 = VAR_10.readUnsignedByte();
if (var14 != 0) {
this.floorOverlayIds[var9][VAR_9][var2] = (short)var14;
VAR_12 = VAR_10.readUnsignedByte();
this.field193[var9][VAR_9][var2] = (byte)(VAR_12 >> 2); // L: 88
this.field204[var9][VAR_9][var2] = (byte)(VAR_12 & 3); // L: 89
}
}
}
if (var7) {
for (var8 = 0; var8 < VAR_11; ++var8) {
var9 = VAR_10.readUnsignedByte(); // L: 95
if (var9 != 0) {
CLASS_1[] var10 = this.VAR_5[var8][VAR_9][var2] = new CLASS_1[var9];
for (VAR_12 = 0; VAR_12 < var9; ++VAR_12) {
int VAR_13 = VAR_10.method5833(); // L: 101
int var13 = VAR_10.readUnsignedByte();
var10[VAR_12] = new CLASS_1(VAR_13, var13 >> 2, var13 & 3);
}
}
}
}
} // L: 107
@ObfuscatedName("w")
@ObfuscatedSignature(
descriptor = "(I)I",
VAR_8 = "-75109979"
)
@Export("getRegionX")
int getRegionX() {
return this.VAR_1;
}
@ObfuscatedName("k")
@ObfuscatedSignature(
descriptor = "(I)I",
VAR_8 = "-2014407853"
)
@Export("getRegionY")
int FUNC_4() {
return this.VAR_2; // L: 116
}
@ObfuscatedName("n")
@ObfuscatedSignature(
descriptor = "(ILjava/lang/String;Ljava/lang/String;I)V",
VAR_8 = "1967773856"
)
@Export("addGameMessage")
static void addGameMessage(int var0, String VAR_9, String var2) {
VAR_14.addChatMessage(var0, VAR_9, var2, (String)null); // L: 19
} // L: 20
@ObfuscatedName("n")
@ObfuscatedSignature(
descriptor = "(I)I",
VAR_8 = "1751033687"
)
public static int FUNC_5() {
return VAR_15.VAR_16; // L: 44
}
@ObfuscatedName("d")
@ObfuscatedSignature(
descriptor = "(Lkd;I)V",
VAR_8 = "352611015"
)
@Export("performReflectionCheck")
public static void performReflectionCheck(CLASS_4 var0) {
CLASS_5 VAR_9 = (CLASS_5)class105.reflectionChecks.last(); // L: 35
if (VAR_9 != null) { // L: 36
int var2 = var0.offset; // L: 37
var0.writeInt(VAR_9.VAR_17); // L: 38
for (int VAR_10 = 0; VAR_10 < VAR_9.VAR_18; ++VAR_10) { // L: 39
if (VAR_9.creationErrors[VAR_10] != 0) { // L: 40
var0.writeByte(VAR_9.creationErrors[VAR_10]); // L: 41
} else {
try {
int var4 = VAR_9.VAR_19[VAR_10]; // L: 45
IMPORT_9 VAR_11;
int var6;
if (var4 == 0) { // L: 46
VAR_11 = VAR_9.fields[VAR_10]; // L: 47
var6 = IMPORT_13.FUNC_6(VAR_11, (CLASS_6)null); // L: 48
var0.writeByte(0); // L: 49
var0.writeInt(var6); // L: 50
} else if (var4 == 1) { // L: 52
VAR_11 = VAR_9.fields[VAR_10]; // L: 53
IMPORT_13.FUNC_7(VAR_11, (CLASS_6)null, VAR_9.VAR_20[VAR_10]); // L: 54
var0.writeByte(0); // L: 55
} else if (var4 == 2) { // L: 57
VAR_11 = VAR_9.fields[VAR_10]; // L: 58
var6 = VAR_11.FUNC_8(); // L: 59
var0.writeByte(0); // L: 60
var0.writeInt(var6); // L: 61
}
Method var25;
if (var4 != 3) { // L: 63
if (var4 == 4) { // L: 83
var25 = VAR_9.methods[VAR_10]; // L: 84
var6 = var25.FUNC_8(); // L: 85
var0.writeByte(0); // L: 86
var0.writeInt(var6); // L: 87
}
} else {
var25 = VAR_9.methods[VAR_10]; // L: 64
byte[][] var10 = VAR_9.VAR_21[VAR_10]; // L: 65
CLASS_6[] var7 = new CLASS_6[var10.VAR_22]; // L: 66
for (int var8 = 0; var8 < var10.VAR_22; ++var8) { // L: 67
IMPORT_5 var9 = new IMPORT_5(new IMPORT_2(var10[var8])); // L: 68
var7[var8] = var9.FUNC_9(); // L: 69
}
CLASS_6 VAR_12 = IMPORT_13.invoke(var25, (CLASS_6)null, var7); // L: 71
if (VAR_12 == null) { // L: 72
var0.writeByte(0);
} else if (VAR_12 instanceof Number) { // L: 73
var0.writeByte(1); // L: 74
var0.writeLong(((Number)VAR_12).FUNC_10()); // L: 75
} else if (VAR_12 instanceof String) { // L: 77
var0.writeByte(2); // L: 78
var0.writeStringCp1252NullTerminated((String)VAR_12); // L: 79
} else {
var0.writeByte(4); // L: 81
}
}
} catch (ClassNotFoundException var13) { // L: 90
var0.writeByte(-10); // L: 91
} catch (IMPORT_4 var14) { // L: 93
var0.writeByte(-11); // L: 94
} catch (IMPORT_6 VAR_23) { // L: 96
var0.writeByte(-12); // L: 97
} catch (OptionalDataException var16) { // L: 99
var0.writeByte(-13); // L: 100
} catch (IllegalAccessException var17) { // L: 102
var0.writeByte(-14); // L: 103
} catch (CLASS_7 var18) { // L: 105
var0.writeByte(-15); // L: 106
} catch (InvocationTargetException VAR_24) { // L: 108
var0.writeByte(-16); // L: 109
} catch (CLASS_8 VAR_25) { // L: 111
var0.writeByte(-17); // L: 112
} catch (IMPORT_3 var21) { // L: 114
var0.writeByte(-18); // L: 115
} catch (NullPointerException var22) { // L: 117
var0.writeByte(-19); // L: 118
} catch (CLASS_9 var23) { // L: 120
var0.writeByte(-20); // L: 121
} catch (CLASS_10 var24) { // L: 123
var0.writeByte(-21); // L: 124
}
}
}
var0.FUNC_11(var2); // L: 127
VAR_9.FUNC_12(); // L: 128
}
} // L: 129
@ObfuscatedName("e")
@ObfuscatedSignature(
descriptor = "(ILcl;ZI)I",
VAR_8 = "1250443961"
)
static int method350(int var0, CLASS_11 VAR_9, boolean var2) {
boolean VAR_10 = true; // L: 775
CLASS_12 var4;
if (var0 >= 2000) { // L: 777
var0 -= 1000; // L: 778
var4 = VAR_26.getWidget(Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]); // L: 779
VAR_10 = false; // L: 780
} else {
var4 = var2 ? VAR_27.scriptDotWidget : Interpreter.scriptActiveWidget; // L: 782
}
int VAR_12;
if (var0 == IMPORT_14.CC_SETOP) { // L: 783
VAR_12 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] - 1; // L: 784
if (VAR_12 >= 0 && VAR_12 <= 9) { // L: 785
var4.FUNC_13(VAR_12, Interpreter.VAR_28[--Interpreter.VAR_29]); // L: 789
return 1; // L: 790
} else {
--Interpreter.VAR_29; // L: 786
return 1; // L: 787
}
} else {
int var6;
if (var0 == IMPORT_14.VAR_30) { // L: 792
Interpreter.Interpreter_intStackSize -= 2; // L: 793
VAR_12 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]; // L: 794
var6 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]; // L: 795
var4.parent = VAR_31.getWidgetChild(VAR_12, var6); // L: 796
return 1; // L: 797
} else if (var0 == IMPORT_14.CC_SETDRAGGABLEBEHAVIOR) { // L: 799
var4.VAR_32 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] == 1; // L: 800
return 1; // L: 801
} else if (var0 == IMPORT_14.VAR_33) { // L: 803
var4.dragZoneSize = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 804
return 1; // L: 805
} else if (var0 == IMPORT_14.VAR_34) { // L: 807
var4.dragThreshold = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 808
return 1; // L: 809
} else if (var0 == IMPORT_14.VAR_35) { // L: 811
var4.dataText = Interpreter.VAR_28[--Interpreter.VAR_29]; // L: 812
return 1; // L: 813
} else if (var0 == IMPORT_14.CC_SETTARGETVERB) { // L: 815
var4.spellActionName = Interpreter.VAR_28[--Interpreter.VAR_29]; // L: 816
return 1; // L: 817
} else if (var0 == IMPORT_14.CC_CLEAROPS) { // L: 819
var4.VAR_36 = null; // L: 820
return 1; // L: 821
} else if (var0 == 1308) { // L: 823
var4.VAR_37 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] == 1; // L: 824
return 1; // L: 825
} else if (var0 == 1309) { // L: 827
--Interpreter.Interpreter_intStackSize; // L: 828
return 1; // L: 829
} else {
int var7;
byte[] var8;
if (var0 != IMPORT_14.VAR_38) { // L: 831
byte VAR_11;
if (var0 == IMPORT_14.VAR_39) { // L: 861
Interpreter.Interpreter_intStackSize -= 2; // L: 862
VAR_11 = 10; // L: 863
var8 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]}; // L: 864
byte[] var9 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]}; // L: 865
VAR_40.Widget_setKey(var4, VAR_11, var8, var9); // L: 866
return 1; // L: 867
} else if (var0 == IMPORT_14.CC_SETOPKEYRATE) { // L: 869
Interpreter.Interpreter_intStackSize -= 3; // L: 870
VAR_12 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize] - 1; // L: 871
var6 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]; // L: 872
var7 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 2]; // L: 873
if (VAR_12 >= 0 && VAR_12 <= 9) { // L: 874
VAR_41.FUNC_14(var4, VAR_12, var6, var7); // L: 877
return 1; // L: 878
} else {
throw new RuntimeException(); // L: 875
}
} else if (var0 == IMPORT_14.VAR_42) { // L: 880
VAR_11 = 10; // L: 881
var6 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 882
var7 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize]; // L: 883
VAR_41.FUNC_14(var4, VAR_11, var6, var7); // L: 884
return 1; // L: 885
} else if (var0 == IMPORT_14.VAR_43) { // L: 887
--Interpreter.Interpreter_intStackSize; // L: 888
VAR_12 = Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize] - 1; // L: 889
if (VAR_12 >= 0 && VAR_12 <= 9) { // L: 890
VAR_44.Widget_setKeyIgnoreHeld(var4, VAR_12); // L: 893
return 1; // L: 894
} else {
throw new RuntimeException(); // L: 891
}
} else if (var0 == IMPORT_14.VAR_45) { // L: 896
VAR_11 = 10; // L: 897
VAR_44.Widget_setKeyIgnoreHeld(var4, VAR_11); // L: 898
return 1; // L: 899
} else {
return 2; // L: 901
}
} else {
byte[] var10 = null; // L: 832
var8 = null; // L: 833
if (VAR_10) { // L: 834
Interpreter.Interpreter_intStackSize -= 10; // L: 835
for (var7 = 0; var7 < 10 && Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize] >= 0; var7 += 2) { // L: 837 838
}
if (var7 > 0) { // L: 840
var10 = new byte[var7 / 2]; // L: 841
var8 = new byte[var7 / 2]; // L: 842
for (var7 -= 2; var7 >= 0; var7 -= 2) { // L: 843
var10[var7 / 2] = (byte)Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize]; // L: 844
var8[var7 / 2] = (byte)Interpreter.Interpreter_intStack[var7 + Interpreter.Interpreter_intStackSize + 1]; // L: 845
}
}
} else {
Interpreter.Interpreter_intStackSize -= 2; // L: 850
var10 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize]}; // L: 851
var8 = new byte[]{(byte)Interpreter.Interpreter_intStack[Interpreter.Interpreter_intStackSize + 1]}; // L: 852
}
var7 = Interpreter.Interpreter_intStack[--Interpreter.Interpreter_intStackSize] - 1; // L: 854
if (var7 >= 0 && var7 <= 9) { // L: 855
VAR_40.Widget_setKey(var4, var7, var10, var8); // L: 858
return 1; // L: 859
} else {
throw new RuntimeException(); // L: 856
}
}
}
}
}
@ObfuscatedName("iu")
@ObfuscatedSignature(
descriptor = "(I)V",
VAR_8 = "-1407692443"
)
static void method352() {
for (int var0 = 0; var0 < Client.menuOptionsCount; ++var0) { // L: 9015
if (VAR_46.FUNC_15(Client.menuOpcodes[var0])) { // L: 9016
if (var0 < Client.menuOptionsCount - 1) { // L: 9017
for (int VAR_9 = var0; VAR_9 < Client.menuOptionsCount - 1; ++VAR_9) { // L: 9018
Client.VAR_47[VAR_9] = Client.VAR_47[VAR_9 + 1]; // L: 9019
Client.menuTargets[VAR_9] = Client.menuTargets[VAR_9 + 1]; // L: 9020
Client.menuOpcodes[VAR_9] = Client.menuOpcodes[VAR_9 + 1]; // L: 9021
Client.VAR_48[VAR_9] = Client.VAR_48[VAR_9 + 1]; // L: 9022
Client.menuArguments1[VAR_9] = Client.menuArguments1[VAR_9 + 1]; // L: 9023
Client.menuArguments2[VAR_9] = Client.menuArguments2[VAR_9 + 1]; // L: 9024
Client.menuShiftClick[VAR_9] = Client.menuShiftClick[VAR_9 + 1]; // L: 9025
}
}
--var0; // L: 9028
--Client.menuOptionsCount; // L: 9029
}
}
VAR_49.FUNC_16(); // L: 9032
} // L: 9033
}
| 0.500893 | {'IMPORT_0': 'java', 'IMPORT_1': 'io', 'IMPORT_2': 'ByteArrayInputStream', 'IMPORT_3': 'IOException', 'IMPORT_4': 'InvalidClassException', 'IMPORT_5': 'ObjectInputStream', 'IMPORT_6': 'StreamCorruptedException', 'IMPORT_7': 'lang', 'IMPORT_8': 'reflect', 'IMPORT_9': 'Field', 'IMPORT_10': 'LinkedList', 'IMPORT_11': 'mapping', 'IMPORT_12': 'Implements', 'IMPORT_13': 'Reflection', 'IMPORT_14': 'ScriptOpcodes', 'CLASS_0': 'AbstractWorldMapData', 'VAR_0': 'regionXLow', 'VAR_1': 'regionX', 'VAR_2': 'regionY', 'VAR_3': 'minPlane', 'VAR_4': 'fileId', 'CLASS_1': 'WorldMapDecoration', 'VAR_5': 'decorations', 'VAR_6': 'field203', 'VAR_7': 'field207', 'VAR_8': 'garbageValue', 'CLASS_2': 'Buffer', 'VAR_9': 'var1', 'FUNC_0': 'isFullyLoaded', 'FUNC_1': 'loadGeography', 'CLASS_3': 'AbstractArchive', 'FUNC_2': 'reset', 'FUNC_3': 'readTile', 'VAR_10': 'var3', 'VAR_11': 'var5', 'VAR_12': 'var11', 'VAR_13': 'var12', 'FUNC_4': 'getRegionY', 'VAR_14': 'PlatformInfo', 'FUNC_5': 'method342', 'VAR_15': 'ViewportMouse', 'VAR_16': 'ViewportMouse_entityCount', 'CLASS_4': 'PacketBuffer', 'CLASS_5': 'ReflectionCheck', 'VAR_17': 'id', 'VAR_18': 'size', 'VAR_19': 'operations', 'FUNC_6': 'getInt', 'CLASS_6': 'Object', 'FUNC_7': 'setInt', 'VAR_20': 'intReplaceValues', 'FUNC_8': 'getModifiers', 'VAR_21': 'arguments', 'VAR_22': 'length', 'FUNC_9': 'readObject', 'FUNC_10': 'longValue', 'VAR_23': 'var15', 'CLASS_7': 'IllegalArgumentException', 'VAR_24': 'var19', 'CLASS_8': 'SecurityException', 'VAR_25': 'var20', 'CLASS_9': 'Exception', 'CLASS_10': 'Throwable', 'FUNC_11': 'writeCrc', 'FUNC_12': 'remove', 'CLASS_11': 'Script', 'CLASS_12': 'Widget', 'VAR_26': 'class237', 'VAR_27': 'class277', 'FUNC_13': 'setAction', 'VAR_28': 'Interpreter_stringStack', 'VAR_29': 'Interpreter_stringStackSize', 'VAR_30': 'CC_SETDRAGGABLE', 'VAR_31': 'ArchiveLoader', 'VAR_32': 'isScrollBar', 'VAR_33': 'CC_SETDRAGDEADZONE', 'VAR_34': 'CC_SETDRAGDEADTIME', 'VAR_35': 'CC_SETOPBASE', 'VAR_36': 'actions', 'VAR_37': 'prioritizeMenuEntry', 'VAR_38': 'CC_SETOPKEY', 'VAR_39': 'CC_SETOPTKEY', 'VAR_40': 'TaskHandler', 'VAR_41': 'WorldMapRegion', 'FUNC_14': 'Widget_setKeyRate', 'VAR_42': 'CC_SETOPTKEYRATE', 'VAR_43': 'CC_SETOPKEYIGNOREHELD', 'VAR_44': 'WorldMapIcon_0', 'VAR_45': 'CC_SETOPTKEYIGNOREHELD', 'VAR_46': 'AbstractWorldMapIcon', 'FUNC_15': 'method685', 'VAR_47': 'menuActions', 'VAR_48': 'menuIdentifiers', 'VAR_49': 'class41', 'FUNC_16': 'method650'} | java | Hibrido | 15.00% |
package io.gridgo.redis.command;
import static io.gridgo.utils.ClasspathUtils.scanForAnnotatedTypes;
import java.util.HashMap;
import java.util.Map;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class RedisCommands {
/*
* STRING CMDS
*/
public static final String APPEND = "append";
public static final String BITCOUNT = "bitcount";
public static final String BITFIELD = "bitfield";
public static final String BITOP = "bitop";
public static final String BITPOS = "bitpos";
public static final String DECR = "decr";
public static final String DECRBY = "decrby";
public static final String GET = "get";
public static final String GETBIT = "getbit";
public static final String GETRANGE = "getrange";
public static final String GETSET = "getset";
public static final String INCR = "incr";
public static final String INCRBY = "incrby";
public static final String INCRBYFLOAT = "incrbyfloat";
public static final String MGET = "mget";
public static final String MSET = "mset";
public static final String MSETNX = "msetnx";
public static final String PSETEX = "psetex";
public static final String SET = "set";
public static final String SETBIT = "setbit";
public static final String SETEX = "setex";
public static final String SETNX = "setnx";
public static final String SETRANGE = "setrange";
public static final String STRLEN = "strlen";
/*
* HASH CMDS
*/
public static final String HDEL = "hdel";
public static final String HEXISTS = "hexists";
public static final String HGET = "hget";
public static final String HGETALL = "hgetall";
public static final String HINCRBY = "hincrby";
public static final String HINCRBYFLOAT = "hincrbyfloat";
public static final String HKEYS = "hkeys";
public static final String HLEN = "hlen";
public static final String HMGET = "hmget";
public static final String HMSET = "hmset";
public static final String HSET = "hset";
public static final String HSETNX = "hsetnx";
public static final String HSTRLEN = "hstrlen";
public static final String HVALS = "hvals";
public static final String HSCAN = "hscan";
/*
* LIST CMDS
*/
public static final String BLPOP = "blpop";
public static final String BRPOP = "brpop";
public static final String BRPOPLPUSH = "brpoplpush";
public static final String LINDEX = "lindex";
public static final String LINSERT = "linsert";
public static final String LLEN = "llen";
public static final String LPOP = "lpop";
public static final String LPUSH = "lpush";
public static final String LPUSHX = "lpushx";
public static final String LRANGE = "lrange";
public static final String LREM = "lrem";
public static final String LSET = "lset";
public static final String LTRIM = "ltrim";
public static final String RPOP = "rpop";
public static final String RPOPLPUSH = "rpoplpush";
public static final String RPUSH = "rpush";
public static final String RPUSHX = "rpushx";
/*
* SET CMDS
*/
public static final String SADD = "sadd";
public static final String SCARD = "scard";
public static final String SDIFF = "sdiff";
public static final String SDIFFSTORE = "sdiffstore";
public static final String SINTER = "sinter";
public static final String SINTERSTORE = "sinterstore";
public static final String SISMEMBER = "sismember";
public static final String SMEMBERS = "smembers";
public static final String SMOVE = "smove";
public static final String SPOP = "spop";
public static final String SRANDMEMBER = "srandmember";
public static final String SREM = "srem";
public static final String SUNION = "sunion";
public static final String SUNIONSTORE = "sunionstore";
public static final String SSCAN = "sscan";
/*
* SORTED SET CMDS
*/
public static final String BZPOPMIN = "bzpopmin";
public static final String BZPOPMAX = "bzpopmax";
public static final String ZADD = "zadd";
public static final String ZCARD = "zcard";
public static final String ZCOUNT = "zcount";
public static final String ZINCRBY = "zincrby";
public static final String ZINTERSTORE = "zinterstore";
public static final String ZLEXCOUNT = "zlexcount";
public static final String ZPOPMAX = "zpopmax";
public static final String ZPOPMIN = "zpopmin";
public static final String ZRANGE = "zrange";
public static final String ZRANGEBYLEX = "zrangebylex";
public static final String ZREVRANGEBYLEX = "zrevrangebylex";
public static final String ZRANGEBYSCORE = "zrangebyscore";
public static final String ZRANK = "zrank";
public static final String ZREM = "zrem";
public static final String ZREMRANGEBYLEX = "zremrangebylex";
public static final String ZREMRANGEBYRANK = "zremrangebyrank";
public static final String ZREMRANGEBYSCORE = "zremrangebyscore";
public static final String ZREVRANGE = "zrevrange";
public static final String ZREVRANGEBYSCORE = "zrevrangebyscore";
public static final String ZREVRANK = "zrevrank";
public static final String ZSCORE = "zscore";
public static final String ZUNIONSTORE = "zunionstore";
public static final String ZSCAN = "zscan";
/*
* SCRIPTING CMDS
*/
public static final String EVAL = "eval";
public static final String EVALSHA = "evalsha";
public static final String SCRIPT_EXISTS = "scriptexists";
public static final String SCRIPT_FLUSH = "scriptflush";
public static final String SCRIPT_KILL = "scriptkill";
public static final String SCRIPT_LOAD = "scriptload";
/*
* GEO CMDS
*/
public static final String GEOADD = "geoadd";
public static final String GEOHASH = "geohash";
public static final String GEOPOS = "geopos";
public static final String GEODIST = "geodist";
public static final String GEORADIUS = "georadius";
public static final String GEORADIUSBYMEMBER = "georadiusbymember";
/*
* HYPERLOGLOG CMDS
*/
public static final String PFADD = "pfadd";
public static final String PFCOUNT = "pfcount";
public static final String PFMERGE = "pfmerge";
/*
* KEY CMDS
*/
public static final String DEL = "del";
public static final String DUMP = "dump";
public static final String EXISTS = "exists";
public static final String EXPIRE = "expire";
public static final String EXPIREAT = "expireat";
public static final String KEYS = "keys";
public static final String MIGRATE = "migrate";
public static final String MOVE = "move";
public static final String OBJECT = "object";
public static final String PERSIST = "persist";
public static final String PEXPIRE = "pexpire";
public static final String PEXPIREAT = "pexpireat";
public static final String PTTL = "pttl";
public static final String RANDOMKEY = "randomkey";
public static final String RENAME = "rename";
public static final String RENAMENX = "renamenx";
public static final String RESTORE = "restore";
public static final String SORT = "sort";
public static final String TOUCH = "touch";
public static final String TTL = "ttl";
public static final String TYPE = "type";
public static final String UNLINK = "unlink";
public static final String SCAN = "scan";
/*
* CONNECTION
*/
public static final String AUTH = "auth";
public static final String ECHO = "echo";
public static final String PING = "ping";
public static final String QUIT = "quit";
public static final String SELECT = "select";
public static final String SWAPDB = "swapdb";
/*
* TRANSACTION CMDS
*/
public static final String DISCARD = "discard";
public static final String EXEC = "exec";
public static final String MULTI = "multi";
public static final String UNWATCH = "unwatch";
public static final String WATCH = "watch";
private static final Map<String, RedisCommandHandler> handlers = new HashMap<>();
static {
scanPackage(RedisCommands.class.getPackageName());
}
public static RedisCommandHandler getHandler(@NonNull String command) {
return handlers.get(command);
}
public static void scanPackage(String packageName) {
scanPackage(packageName, Thread.currentThread().getContextClassLoader());
}
private synchronized static void registerHandlerByAnnotation(Class<?> clazz, RedisCommand annotation) {
var cmd = annotation.value().toLowerCase().trim();
if (handlers.containsKey(cmd)) {
var existing = handlers.get(cmd).getClass().getName();
log.warn("Command '{}' has already registered with another handler: {}", cmd, existing);
return;
}
try {
handlers.put(cmd, (RedisCommandHandler) clazz.getConstructor().newInstance());
} catch (Exception e) {
throw new RuntimeException("Error while trying to create redis command handler", e);
}
}
public static void scanPackage(String packageName, ClassLoader classLoader) {
scanForAnnotatedTypes(packageName, RedisCommand.class, RedisCommands::registerHandlerByAnnotation, classLoader);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import static IMPORT_0.IMPORT_1.utils.ClasspathUtils.scanForAnnotatedTypes;
import IMPORT_4.IMPORT_5.IMPORT_6;
import IMPORT_4.IMPORT_5.Map;
import IMPORT_7.IMPORT_8;
import IMPORT_7.extern.IMPORT_9.Slf4j;
@Slf4j
public class RedisCommands {
/*
* STRING CMDS
*/
public static final CLASS_0 APPEND = "append";
public static final CLASS_0 VAR_0 = "bitcount";
public static final CLASS_0 BITFIELD = "bitfield";
public static final CLASS_0 BITOP = "bitop";
public static final CLASS_0 VAR_1 = "bitpos";
public static final CLASS_0 VAR_2 = "decr";
public static final CLASS_0 DECRBY = "decrby";
public static final CLASS_0 GET = "get";
public static final CLASS_0 VAR_3 = "getbit";
public static final CLASS_0 VAR_4 = "getrange";
public static final CLASS_0 VAR_5 = "getset";
public static final CLASS_0 INCR = "incr";
public static final CLASS_0 VAR_6 = "incrby";
public static final CLASS_0 INCRBYFLOAT = "incrbyfloat";
public static final CLASS_0 MGET = "mget";
public static final CLASS_0 MSET = "mset";
public static final CLASS_0 MSETNX = "msetnx";
public static final CLASS_0 PSETEX = "psetex";
public static final CLASS_0 VAR_7 = "set";
public static final CLASS_0 SETBIT = "setbit";
public static final CLASS_0 VAR_8 = "setex";
public static final CLASS_0 SETNX = "setnx";
public static final CLASS_0 SETRANGE = "setrange";
public static final CLASS_0 STRLEN = "strlen";
/*
* HASH CMDS
*/
public static final CLASS_0 HDEL = "hdel";
public static final CLASS_0 HEXISTS = "hexists";
public static final CLASS_0 HGET = "hget";
public static final CLASS_0 VAR_9 = "hgetall";
public static final CLASS_0 VAR_10 = "hincrby";
public static final CLASS_0 HINCRBYFLOAT = "hincrbyfloat";
public static final CLASS_0 VAR_11 = "hkeys";
public static final CLASS_0 VAR_12 = "hlen";
public static final CLASS_0 HMGET = "hmget";
public static final CLASS_0 VAR_13 = "hmset";
public static final CLASS_0 HSET = "hset";
public static final CLASS_0 HSETNX = "hsetnx";
public static final CLASS_0 HSTRLEN = "hstrlen";
public static final CLASS_0 HVALS = "hvals";
public static final CLASS_0 HSCAN = "hscan";
/*
* LIST CMDS
*/
public static final CLASS_0 VAR_14 = "blpop";
public static final CLASS_0 VAR_15 = "brpop";
public static final CLASS_0 VAR_16 = "brpoplpush";
public static final CLASS_0 VAR_17 = "lindex";
public static final CLASS_0 LINSERT = "linsert";
public static final CLASS_0 LLEN = "llen";
public static final CLASS_0 VAR_18 = "lpop";
public static final CLASS_0 VAR_19 = "lpush";
public static final CLASS_0 LPUSHX = "lpushx";
public static final CLASS_0 LRANGE = "lrange";
public static final CLASS_0 LREM = "lrem";
public static final CLASS_0 VAR_20 = "lset";
public static final CLASS_0 LTRIM = "ltrim";
public static final CLASS_0 VAR_21 = "rpop";
public static final CLASS_0 RPOPLPUSH = "rpoplpush";
public static final CLASS_0 RPUSH = "rpush";
public static final CLASS_0 RPUSHX = "rpushx";
/*
* SET CMDS
*/
public static final CLASS_0 SADD = "sadd";
public static final CLASS_0 VAR_22 = "scard";
public static final CLASS_0 VAR_23 = "sdiff";
public static final CLASS_0 SDIFFSTORE = "sdiffstore";
public static final CLASS_0 VAR_24 = "sinter";
public static final CLASS_0 VAR_25 = "sinterstore";
public static final CLASS_0 SISMEMBER = "sismember";
public static final CLASS_0 SMEMBERS = "smembers";
public static final CLASS_0 SMOVE = "smove";
public static final CLASS_0 VAR_26 = "spop";
public static final CLASS_0 VAR_27 = "srandmember";
public static final CLASS_0 SREM = "srem";
public static final CLASS_0 VAR_28 = "sunion";
public static final CLASS_0 SUNIONSTORE = "sunionstore";
public static final CLASS_0 VAR_29 = "sscan";
/*
* SORTED SET CMDS
*/
public static final CLASS_0 BZPOPMIN = "bzpopmin";
public static final CLASS_0 BZPOPMAX = "bzpopmax";
public static final CLASS_0 VAR_30 = "zadd";
public static final CLASS_0 VAR_31 = "zcard";
public static final CLASS_0 ZCOUNT = "zcount";
public static final CLASS_0 ZINCRBY = "zincrby";
public static final CLASS_0 ZINTERSTORE = "zinterstore";
public static final CLASS_0 VAR_32 = "zlexcount";
public static final CLASS_0 VAR_33 = "zpopmax";
public static final CLASS_0 ZPOPMIN = "zpopmin";
public static final CLASS_0 VAR_34 = "zrange";
public static final CLASS_0 ZRANGEBYLEX = "zrangebylex";
public static final CLASS_0 ZREVRANGEBYLEX = "zrevrangebylex";
public static final CLASS_0 ZRANGEBYSCORE = "zrangebyscore";
public static final CLASS_0 VAR_35 = "zrank";
public static final CLASS_0 VAR_36 = "zrem";
public static final CLASS_0 VAR_37 = "zremrangebylex";
public static final CLASS_0 ZREMRANGEBYRANK = "zremrangebyrank";
public static final CLASS_0 VAR_38 = "zremrangebyscore";
public static final CLASS_0 VAR_39 = "zrevrange";
public static final CLASS_0 VAR_40 = "zrevrangebyscore";
public static final CLASS_0 ZREVRANK = "zrevrank";
public static final CLASS_0 ZSCORE = "zscore";
public static final CLASS_0 VAR_41 = "zunionstore";
public static final CLASS_0 VAR_42 = "zscan";
/*
* SCRIPTING CMDS
*/
public static final CLASS_0 EVAL = "eval";
public static final CLASS_0 EVALSHA = "evalsha";
public static final CLASS_0 SCRIPT_EXISTS = "scriptexists";
public static final CLASS_0 SCRIPT_FLUSH = "scriptflush";
public static final CLASS_0 VAR_43 = "scriptkill";
public static final CLASS_0 SCRIPT_LOAD = "scriptload";
/*
* GEO CMDS
*/
public static final CLASS_0 VAR_44 = "geoadd";
public static final CLASS_0 VAR_45 = "geohash";
public static final CLASS_0 GEOPOS = "geopos";
public static final CLASS_0 VAR_46 = "geodist";
public static final CLASS_0 VAR_47 = "georadius";
public static final CLASS_0 VAR_48 = "georadiusbymember";
/*
* HYPERLOGLOG CMDS
*/
public static final CLASS_0 PFADD = "pfadd";
public static final CLASS_0 VAR_49 = "pfcount";
public static final CLASS_0 PFMERGE = "pfmerge";
/*
* KEY CMDS
*/
public static final CLASS_0 VAR_50 = "del";
public static final CLASS_0 VAR_51 = "dump";
public static final CLASS_0 VAR_52 = "exists";
public static final CLASS_0 VAR_53 = "expire";
public static final CLASS_0 EXPIREAT = "expireat";
public static final CLASS_0 KEYS = "keys";
public static final CLASS_0 MIGRATE = "migrate";
public static final CLASS_0 MOVE = "move";
public static final CLASS_0 OBJECT = "object";
public static final CLASS_0 PERSIST = "persist";
public static final CLASS_0 PEXPIRE = "pexpire";
public static final CLASS_0 PEXPIREAT = "pexpireat";
public static final CLASS_0 VAR_54 = "pttl";
public static final CLASS_0 RANDOMKEY = "randomkey";
public static final CLASS_0 RENAME = "rename";
public static final CLASS_0 VAR_55 = "renamenx";
public static final CLASS_0 VAR_56 = "restore";
public static final CLASS_0 VAR_57 = "sort";
public static final CLASS_0 VAR_58 = "touch";
public static final CLASS_0 TTL = "ttl";
public static final CLASS_0 TYPE = "type";
public static final CLASS_0 VAR_59 = "unlink";
public static final CLASS_0 VAR_60 = "scan";
/*
* CONNECTION
*/
public static final CLASS_0 AUTH = "auth";
public static final CLASS_0 VAR_61 = "echo";
public static final CLASS_0 VAR_62 = "ping";
public static final CLASS_0 VAR_63 = "quit";
public static final CLASS_0 VAR_64 = "select";
public static final CLASS_0 VAR_65 = "swapdb";
/*
* TRANSACTION CMDS
*/
public static final CLASS_0 DISCARD = "discard";
public static final CLASS_0 VAR_66 = "exec";
public static final CLASS_0 MULTI = "multi";
public static final CLASS_0 UNWATCH = "unwatch";
public static final CLASS_0 WATCH = "watch";
private static final Map<CLASS_0, RedisCommandHandler> handlers = new IMPORT_6<>();
static {
scanPackage(RedisCommands.class.getPackageName());
}
public static RedisCommandHandler FUNC_0(@IMPORT_8 CLASS_0 IMPORT_3) {
return handlers.get(IMPORT_3);
}
public static void scanPackage(CLASS_0 packageName) {
scanPackage(packageName, VAR_67.currentThread().FUNC_1());
}
private synchronized static void registerHandlerByAnnotation(CLASS_1<?> clazz, RedisCommand annotation) {
ID_0 VAR_68 = annotation.FUNC_2().toLowerCase().FUNC_3();
if (handlers.FUNC_4(VAR_68)) {
ID_0 VAR_69 = handlers.get(VAR_68).getClass().FUNC_5();
log.FUNC_6("Command '{}' has already registered with another handler: {}", VAR_68, VAR_69);
return;
}
try {
handlers.FUNC_7(VAR_68, (RedisCommandHandler) clazz.getConstructor().FUNC_8());
} catch (Exception e) {
throw new CLASS_2("Error while trying to create redis command handler", e);
}
}
public static void scanPackage(CLASS_0 packageName, CLASS_3 classLoader) {
scanForAnnotatedTypes(packageName, RedisCommand.class, RedisCommands::registerHandlerByAnnotation, classLoader);
}
}
| 0.434067 | {'IMPORT_0': 'io', 'IMPORT_1': 'gridgo', 'IMPORT_2': 'redis', 'IMPORT_3': 'command', 'IMPORT_4': 'java', 'IMPORT_5': 'util', 'IMPORT_6': 'HashMap', 'IMPORT_7': 'lombok', 'IMPORT_8': 'NonNull', 'IMPORT_9': 'slf4j', 'CLASS_0': 'String', 'VAR_0': 'BITCOUNT', 'VAR_1': 'BITPOS', 'VAR_2': 'DECR', 'VAR_3': 'GETBIT', 'VAR_4': 'GETRANGE', 'VAR_5': 'GETSET', 'VAR_6': 'INCRBY', 'VAR_7': 'SET', 'VAR_8': 'SETEX', 'VAR_9': 'HGETALL', 'VAR_10': 'HINCRBY', 'VAR_11': 'HKEYS', 'VAR_12': 'HLEN', 'VAR_13': 'HMSET', 'VAR_14': 'BLPOP', 'VAR_15': 'BRPOP', 'VAR_16': 'BRPOPLPUSH', 'VAR_17': 'LINDEX', 'VAR_18': 'LPOP', 'VAR_19': 'LPUSH', 'VAR_20': 'LSET', 'VAR_21': 'RPOP', 'VAR_22': 'SCARD', 'VAR_23': 'SDIFF', 'VAR_24': 'SINTER', 'VAR_25': 'SINTERSTORE', 'VAR_26': 'SPOP', 'VAR_27': 'SRANDMEMBER', 'VAR_28': 'SUNION', 'VAR_29': 'SSCAN', 'VAR_30': 'ZADD', 'VAR_31': 'ZCARD', 'VAR_32': 'ZLEXCOUNT', 'VAR_33': 'ZPOPMAX', 'VAR_34': 'ZRANGE', 'VAR_35': 'ZRANK', 'VAR_36': 'ZREM', 'VAR_37': 'ZREMRANGEBYLEX', 'VAR_38': 'ZREMRANGEBYSCORE', 'VAR_39': 'ZREVRANGE', 'VAR_40': 'ZREVRANGEBYSCORE', 'VAR_41': 'ZUNIONSTORE', 'VAR_42': 'ZSCAN', 'VAR_43': 'SCRIPT_KILL', 'VAR_44': 'GEOADD', 'VAR_45': 'GEOHASH', 'VAR_46': 'GEODIST', 'VAR_47': 'GEORADIUS', 'VAR_48': 'GEORADIUSBYMEMBER', 'VAR_49': 'PFCOUNT', 'VAR_50': 'DEL', 'VAR_51': 'DUMP', 'VAR_52': 'EXISTS', 'VAR_53': 'EXPIRE', 'VAR_54': 'PTTL', 'VAR_55': 'RENAMENX', 'VAR_56': 'RESTORE', 'VAR_57': 'SORT', 'VAR_58': 'TOUCH', 'VAR_59': 'UNLINK', 'VAR_60': 'SCAN', 'VAR_61': 'ECHO', 'VAR_62': 'PING', 'VAR_63': 'QUIT', 'VAR_64': 'SELECT', 'VAR_65': 'SWAPDB', 'VAR_66': 'EXEC', 'FUNC_0': 'getHandler', 'VAR_67': 'Thread', 'FUNC_1': 'getContextClassLoader', 'CLASS_1': 'Class', 'ID_0': 'var', 'VAR_68': 'cmd', 'FUNC_2': 'value', 'FUNC_3': 'trim', 'FUNC_4': 'containsKey', 'VAR_69': 'existing', 'FUNC_5': 'getName', 'FUNC_6': 'warn', 'FUNC_7': 'put', 'FUNC_8': 'newInstance', 'CLASS_2': 'RuntimeException', 'CLASS_3': 'ClassLoader'} | java | OOP | 84.07% |
/**
* Tear down JCR persistence runtime test environment.
*
* @throws Exception
*/
@After
public void tearDownPerTest() throws Exception
{
configured = false;
logger.info("JCR tear down test");
PersistenceManagerFactory.terminate();
rootContext.unbind(JCRPersistenceManager.WIDGET_REPOSITORY_JNDI_REPOSITORY_FULL_NAME);
logger.info("JCR test torn down");
} | /**
* Tear down JCR persistence runtime test environment.
*
* @throws Exception
*/
@VAR_0
public void FUNC_0() throws Exception
{
VAR_1 = false;
logger.FUNC_1("JCR tear down test");
PersistenceManagerFactory.terminate();
rootContext.unbind(JCRPersistenceManager.VAR_2);
logger.FUNC_1("JCR test torn down");
} | 0.498683 | {'VAR_0': 'After', 'FUNC_0': 'tearDownPerTest', 'VAR_1': 'configured', 'FUNC_1': 'info', 'VAR_2': 'WIDGET_REPOSITORY_JNDI_REPOSITORY_FULL_NAME'} | java | Procedural | 46.15% |
/***
* Interceptor to provide logging information of the restTemplate request and
* response
*
*/
public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
traceRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
traceResponse(response);
return response;
}
private void traceRequest(HttpRequest request, byte[] body) throws IOException {
System.out.println("===========================request begin================================================");
System.out.println("URI : " + request.getURI());
System.out.println("Method : " + request.getMethod());
System.out.println("Headers : " + request.getHeaders());
System.out.println("Request body: " + new String(body, "UTF-8"));
System.out.println("==========================request end===================================================");
}
private void traceResponse(ClientHttpResponse response) throws IOException {
HttpStatus statusCode = response.getStatusCode();
StringBuilder inputStringBuilder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.getBody(), "UTF-8"));
String line = bufferedReader.readLine();
while (line != null) {
inputStringBuilder.append(line);
inputStringBuilder.append('\n');
line = bufferedReader.readLine();
}
System.out.println("============================response begin==============================================");
System.out.println("Status code : " + statusCode);
System.out.println("Status text : " + response.getStatusText());
System.out.println("Headers : " + response.getHeaders());
System.out.println("Response body: " + inputStringBuilder.toString());
System.out.println("=======================response end=====================================================");
}
} | /***
* Interceptor to provide logging information of the restTemplate request and
* response
*
*/
public class LoggingRequestInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
traceRequest(request, body);
ClientHttpResponse response = execution.execute(request, body);
traceResponse(response);
return response;
}
private void traceRequest(HttpRequest request, byte[] body) throws IOException {
System.out.println("===========================request begin================================================");
System.out.println("URI : " + request.getURI());
System.out.println("Method : " + request.getMethod());
System.out.println("Headers : " + request.getHeaders());
System.out.println("Request body: " + new String(body, "UTF-8"));
System.out.println("==========================request end===================================================");
}
private void traceResponse(ClientHttpResponse response) throws IOException {
HttpStatus statusCode = response.getStatusCode();
StringBuilder inputStringBuilder = new StringBuilder();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(response.FUNC_0(), "UTF-8"));
String line = bufferedReader.readLine();
while (line != null) {
inputStringBuilder.append(line);
inputStringBuilder.append('\n');
line = bufferedReader.readLine();
}
System.out.println("============================response begin==============================================");
System.out.println("Status code : " + statusCode);
System.out.println("Status text : " + response.getStatusText());
System.out.println("Headers : " + response.getHeaders());
System.out.println("Response body: " + inputStringBuilder.toString());
System.out.println("=======================response end=====================================================");
}
} | 0.094679 | {'FUNC_0': 'getBody'} | java | OOP | 34.39% |
package org.framework.git.beer.controller;
import org.framework.git.beer.document.ShoppingDetail;
import org.framework.git.beer.service.GenericInterfaceService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Optional;
@RestController
@RequestMapping("/shoppingDetail")
public class ShoppingDetailController implements GenericInterfaceController<ShoppingDetail> {
private final GenericInterfaceService<ShoppingDetail> interfaceService;
public ShoppingDetailController(GenericInterfaceService<ShoppingDetail> interfaceService) {
this.interfaceService = interfaceService;
}
@GetMapping
public List<ShoppingDetail> findAll() {
return interfaceService.findAll();
}
@GetMapping("/{id}")
public Optional<ShoppingDetail> findById(@PathVariable String id) {
return interfaceService.findById(id);
}
@PostMapping
public ShoppingDetail save(ShoppingDetail shoppingDetail) {
return interfaceService.save(shoppingDetail);
}
@PutMapping("/{id}")
public ShoppingDetail update(ShoppingDetail shoppingDetail) {
return interfaceService.save(shoppingDetail);
}
@DeleteMapping("/{id}")
public void delete(@PathVariable String id) {
interfaceService.delete(id);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.controller;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_6.IMPORT_7;
import IMPORT_0.springframework.IMPORT_8.IMPORT_9.IMPORT_10.*;
import IMPORT_11.IMPORT_12.IMPORT_13;
import IMPORT_11.IMPORT_12.IMPORT_14;
@VAR_0
@VAR_1("/shoppingDetail")
public class CLASS_0 implements CLASS_1<IMPORT_5> {
private final IMPORT_7<IMPORT_5> VAR_2;
public CLASS_0(IMPORT_7<IMPORT_5> VAR_2) {
this.VAR_2 = VAR_2;
}
@VAR_3
public IMPORT_13<IMPORT_5> FUNC_0() {
return VAR_2.FUNC_0();
}
@VAR_3("/{id}")
public IMPORT_14<IMPORT_5> FUNC_1(@VAR_4 CLASS_2 VAR_5) {
return VAR_2.FUNC_1(VAR_5);
}
@VAR_6
public IMPORT_5 save(IMPORT_5 shoppingDetail) {
return VAR_2.save(shoppingDetail);
}
@VAR_7("/{id}")
public IMPORT_5 FUNC_2(IMPORT_5 shoppingDetail) {
return VAR_2.save(shoppingDetail);
}
@VAR_8("/{id}")
public void FUNC_3(@VAR_4 CLASS_2 VAR_5) {
VAR_2.FUNC_3(VAR_5);
}
}
| 0.880254 | {'IMPORT_0': 'org', 'IMPORT_1': 'framework', 'IMPORT_2': 'git', 'IMPORT_3': 'beer', 'IMPORT_4': 'document', 'IMPORT_5': 'ShoppingDetail', 'IMPORT_6': 'service', 'IMPORT_7': 'GenericInterfaceService', 'IMPORT_8': 'web', 'IMPORT_9': 'bind', 'IMPORT_10': 'annotation', 'IMPORT_11': 'java', 'IMPORT_12': 'util', 'IMPORT_13': 'List', 'IMPORT_14': 'Optional', 'VAR_0': 'RestController', 'VAR_1': 'RequestMapping', 'CLASS_0': 'ShoppingDetailController', 'CLASS_1': 'GenericInterfaceController', 'VAR_2': 'interfaceService', 'VAR_3': 'GetMapping', 'FUNC_0': 'findAll', 'FUNC_1': 'findById', 'VAR_4': 'PathVariable', 'CLASS_2': 'String', 'VAR_5': 'id', 'VAR_6': 'PostMapping', 'VAR_7': 'PutMapping', 'FUNC_2': 'update', 'VAR_8': 'DeleteMapping', 'FUNC_3': 'delete'} | java | Hibrido | 100.00% |
package soot.JastAddJ;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.File;import java.util.*;import beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;import java.io.FileNotFoundException;import java.util.Collection;import soot.*;import soot.util.*;import soot.jimple.*;import soot.coffi.ClassFile;import soot.coffi.method_info;import soot.coffi.CONSTANT_Utf8_info;import soot.tagkit.SourceFileTag;import soot.coffi.CoffiMethodSource;
public class CONSTANT_Utf8_Info extends CONSTANT_Info {
// Declared in BytecodeCONSTANT.jrag at line 223
public String string;
// Declared in BytecodeCONSTANT.jrag at line 225
public CONSTANT_Utf8_Info(BytecodeParser parser) {
super(parser);
string = p.readUTF();
}
// Declared in BytecodeCONSTANT.jrag at line 230
public String toString() {
return "Utf8Info: " + string;
}
// Declared in BytecodeCONSTANT.jrag at line 234
public Expr expr() {
return new StringLiteral(string);
}
// Declared in BytecodeCONSTANT.jrag at line 238
public String string() {
return string;
}
}
|
package soot.IMPORT_0;
import java.util.HashSet;import java.util.LinkedHashSet;import java.IMPORT_1.File;import java.util.*;import VAR_0.*;import java.util.ArrayList;import java.util.zip.*;import java.IMPORT_1.*;import java.IMPORT_1.IMPORT_2;import java.util.Collection;import soot.*;import soot.util.*;import soot.jimple.*;import soot.coffi.IMPORT_3;import soot.coffi.method_info;import soot.coffi.CONSTANT_Utf8_info;import soot.tagkit.SourceFileTag;import soot.coffi.CoffiMethodSource;
public class CLASS_0 extends CONSTANT_Info {
// Declared in BytecodeCONSTANT.jrag at line 223
public String string;
// Declared in BytecodeCONSTANT.jrag at line 225
public CLASS_0(BytecodeParser parser) {
super(parser);
string = p.FUNC_0();
}
// Declared in BytecodeCONSTANT.jrag at line 230
public String toString() {
return "Utf8Info: " + string;
}
// Declared in BytecodeCONSTANT.jrag at line 234
public Expr FUNC_1() {
return new CLASS_1(string);
}
// Declared in BytecodeCONSTANT.jrag at line 238
public String string() {
return string;
}
}
| 0.227182 | {'IMPORT_0': 'JastAddJ', 'IMPORT_1': 'io', 'VAR_0': 'beaver', 'IMPORT_2': 'FileNotFoundException', 'IMPORT_3': 'ClassFile', 'CLASS_0': 'CONSTANT_Utf8_Info', 'FUNC_0': 'readUTF', 'FUNC_1': 'expr', 'CLASS_1': 'StringLiteral'} | java | OOP | 100.00% |
/**
* Add Edit Activity Fragment
*
* <p>Add or edit customer details</p>
*
* @author Raptodimos Athanasios
*/
public class AddEditCustomerFragment extends Fragment implements AddEditCustomerContract.View {
private static final String TAG = "AddEditCustomerFragment";
private EditText mFirstNameEditText;
private EditText mLastNameEditText;
private EditText mProfessionEditText;
private EditText mCompanyNameEditText;
private EditText mPhoneNumberEditText;
private EditText mNotesEditText;
private OnAction mActionListener;
private AddEditCustomerContract.Presenter mPresenter;
public AddEditCustomerFragment() {
}
/**
* On Action Clicked Listener Interface
*/
public interface OnAction {
/**
* Close Listener Callback
*/
void onClose();
}
@Override
public void onAttach(Context context) {
Log.d(TAG, "onAttach: starts");
super.onAttach(context);
// Activities containing this fragment must implement it's callbacks
Activity activity = getActivity();
if(!(activity instanceof OnAction)) {
throw new ClassCastException(activity.getClass().getSimpleName() +
" must implement AddEditCustomerFragment.OnAction interface");
}
mActionListener = (OnAction) activity;
}
@Override
public void onDetach() {
Log.d(TAG, "onDetach: starts");
super.onDetach();
mActionListener = null;
mPresenter = null;
}
@Override
public void setPresenter(AddEditCustomerContract.Presenter presenter) {
mPresenter = presenter;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.d(TAG, "onCreateView: starts");
View view = inflater.inflate(R.layout.fragment_add_edit, container, false);
setupViews(view);
if(savedInstanceState != null) {
mPresenter = (AddEditCustomerContract.Presenter) savedInstanceState.
getSerializable(AddEditCustomerPresenter.class.getSimpleName());
}
if(mPresenter != null) {
mPresenter.bind(this);
mPresenter.initializeFields();
}
setHasOptionsMenu(true);
return view;
}
private void setupViews(View view) {
mFirstNameEditText = (EditText) view.findViewById(R.id.addedit_first_name);
mLastNameEditText = (EditText) view.findViewById(R.id.addedit_last_name);
mProfessionEditText = (EditText) view.findViewById(R.id.addedit_profession);
mCompanyNameEditText = (EditText) view.findViewById(R.id.addedit_company_name);
mPhoneNumberEditText = (EditText) view.findViewById(R.id.addedit_phone_number);
mNotesEditText = (EditText) view.findViewById(R.id.addedit_notes);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_add_edit, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.addedit_mnu_save:
mPresenter.save();
break;
case R.id.addedit_mnu_delete:
// Delete customer, requires confirmation
mPresenter.delete(true);
break;
}
return super.onOptionsItemSelected(item);
}
/**
* Delete Customer
*/
public void confirmedCustomerDeletion() {
// Delete customer, already confirmed
mPresenter.delete(false);
}
@Override
public void setFirstName(String firstName) {
mFirstNameEditText.setText(firstName);
}
@Override
public String getFirstName() {
return mFirstNameEditText.getText().toString();
}
@Override
public void setLastName(String lastName) {
mLastNameEditText.setText(lastName);
}
@Override
public String getLastName() {
return mLastNameEditText.getText().toString();
}
@Override
public void setProfession(String profession) {
mProfessionEditText.setText(profession);
}
@Override
public String getProfession() {
return mProfessionEditText.getText().toString();
}
@Override
public void setCompanyName(String companyName) {
mCompanyNameEditText.setText(companyName);
}
@Override
public String getCompanyName() {
return mCompanyNameEditText.getText().toString();
}
@Override
public void setPhoneNumber(String phoneNumber) {
mPhoneNumberEditText.setText(phoneNumber);
}
@Override
public String getPhoneNumber() {
return mPhoneNumberEditText.getText().toString();
}
@Override
public void setNotes(String notes) {
mNotesEditText.setText(notes);
}
@Override
public String getNotes() {
return mNotesEditText.getText().toString();
}
@Override
public void close() {
if(mActionListener != null) {
mActionListener.onClose();
}
}
public void closeView() {
mPresenter.closeView();
}
@Override
public void showDeleteConfirmation() {
DialogHelper.showConfirmDialog(getFragmentManager(),
AddEditCustomerActivity.DIALOG_ID_DELETE,
getString(R.string.dialog_delete_confirmation),
R.string.ok,
R.string.cancel);
}
@Override
public void showCancelEditConfirmation() {
DialogHelper.showConfirmDialog(getFragmentManager(),
AddEditCustomerActivity.DIALOG_ID_CANCEL_EDIT,
getString(R.string.cancelEditDiag_message),
R.string.cancelEditDiag_positive_caption,
R.string.cancelEditDiag_negative_caption);
}
private void showWarningDialog(int message) {
DialogHelper.showWarningDialog(getContext(), null, getString(message));
}
@Override
public void showEmptyFirstName() {
// Missing required fields, record cannot be saved
showWarningDialog(R.string.fill_required_fields_warning);
}
@Override
public void showSaveCompletedMessage() {
Toast.makeText(getContext(), R.string.save_completed_message, Toast.LENGTH_LONG).show();
}
@Override
public void showDeleteCompletedMessage() {
Toast.makeText(getContext(), R.string.record_deleted_message, Toast.LENGTH_LONG).show();
}
@Override
public void onSaveInstanceState(Bundle bundle) {
bundle.putSerializable(AddEditCustomerPresenter.class.getSimpleName(), mPresenter);
super.onSaveInstanceState(bundle);
}
@Override
public void onDestroy() {
// Dereference the view in the presenter to prevent memory leaks
mPresenter.unbind();
super.onDestroy();
}
} | /**
* Add Edit Activity Fragment
*
* <p>Add or edit customer details</p>
*
* @author Raptodimos Athanasios
*/
public class AddEditCustomerFragment extends Fragment implements CLASS_0.View {
private static final String TAG = "AddEditCustomerFragment";
private EditText mFirstNameEditText;
private EditText VAR_0;
private EditText mProfessionEditText;
private EditText mCompanyNameEditText;
private EditText VAR_1;
private EditText mNotesEditText;
private OnAction mActionListener;
private CLASS_0.CLASS_1 mPresenter;
public AddEditCustomerFragment() {
}
/**
* On Action Clicked Listener Interface
*/
public interface OnAction {
/**
* Close Listener Callback
*/
void onClose();
}
@Override
public void FUNC_0(Context VAR_2) {
Log.FUNC_1(TAG, "onAttach: starts");
super.FUNC_0(VAR_2);
// Activities containing this fragment must implement it's callbacks
Activity activity = getActivity();
if(!(activity instanceof OnAction)) {
throw new CLASS_2(activity.getClass().FUNC_2() +
" must implement AddEditCustomerFragment.OnAction interface");
}
mActionListener = (OnAction) activity;
}
@Override
public void FUNC_3() {
Log.FUNC_1(TAG, "onDetach: starts");
super.FUNC_3();
mActionListener = null;
mPresenter = null;
}
@Override
public void setPresenter(CLASS_0.CLASS_1 presenter) {
mPresenter = presenter;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Log.FUNC_1(TAG, "onCreateView: starts");
View view = inflater.inflate(VAR_3.VAR_4.VAR_5, container, false);
setupViews(view);
if(savedInstanceState != null) {
mPresenter = (CLASS_0.CLASS_1) savedInstanceState.
FUNC_4(AddEditCustomerPresenter.class.FUNC_2());
}
if(mPresenter != null) {
mPresenter.FUNC_5(this);
mPresenter.initializeFields();
}
FUNC_6(true);
return view;
}
private void setupViews(View view) {
mFirstNameEditText = (EditText) view.findViewById(VAR_3.id.addedit_first_name);
VAR_0 = (EditText) view.findViewById(VAR_3.id.addedit_last_name);
mProfessionEditText = (EditText) view.findViewById(VAR_3.id.VAR_6);
mCompanyNameEditText = (EditText) view.findViewById(VAR_3.id.addedit_company_name);
VAR_1 = (EditText) view.findViewById(VAR_3.id.addedit_phone_number);
mNotesEditText = (EditText) view.findViewById(VAR_3.id.addedit_notes);
}
@Override
public void onCreateOptionsMenu(CLASS_3 VAR_7, MenuInflater inflater) {
inflater.inflate(VAR_3.VAR_7.menu_add_edit, VAR_7);
super.onCreateOptionsMenu(VAR_7, inflater);
}
@Override
public boolean FUNC_7(MenuItem item) {
switch (item.getItemId()) {
case VAR_3.id.addedit_mnu_save:
mPresenter.save();
break;
case VAR_3.id.addedit_mnu_delete:
// Delete customer, requires confirmation
mPresenter.delete(true);
break;
}
return super.FUNC_7(item);
}
/**
* Delete Customer
*/
public void confirmedCustomerDeletion() {
// Delete customer, already confirmed
mPresenter.delete(false);
}
@Override
public void setFirstName(String firstName) {
mFirstNameEditText.setText(firstName);
}
@Override
public String getFirstName() {
return mFirstNameEditText.getText().toString();
}
@Override
public void setLastName(String lastName) {
VAR_0.setText(lastName);
}
@Override
public String FUNC_8() {
return VAR_0.getText().toString();
}
@Override
public void FUNC_9(String profession) {
mProfessionEditText.setText(profession);
}
@Override
public String getProfession() {
return mProfessionEditText.getText().toString();
}
@Override
public void FUNC_10(String VAR_8) {
mCompanyNameEditText.setText(VAR_8);
}
@Override
public String getCompanyName() {
return mCompanyNameEditText.getText().toString();
}
@Override
public void setPhoneNumber(String phoneNumber) {
VAR_1.setText(phoneNumber);
}
@Override
public String getPhoneNumber() {
return VAR_1.getText().toString();
}
@Override
public void setNotes(String notes) {
mNotesEditText.setText(notes);
}
@Override
public String FUNC_11() {
return mNotesEditText.getText().toString();
}
@Override
public void close() {
if(mActionListener != null) {
mActionListener.onClose();
}
}
public void FUNC_12() {
mPresenter.FUNC_12();
}
@Override
public void showDeleteConfirmation() {
DialogHelper.FUNC_13(FUNC_14(),
AddEditCustomerActivity.VAR_9,
FUNC_15(VAR_3.string.dialog_delete_confirmation),
VAR_3.string.ok,
VAR_3.string.VAR_10);
}
@Override
public void showCancelEditConfirmation() {
DialogHelper.FUNC_13(FUNC_14(),
AddEditCustomerActivity.VAR_11,
FUNC_15(VAR_3.string.VAR_12),
VAR_3.string.cancelEditDiag_positive_caption,
VAR_3.string.cancelEditDiag_negative_caption);
}
private void FUNC_16(int message) {
DialogHelper.FUNC_16(getContext(), null, FUNC_15(message));
}
@Override
public void showEmptyFirstName() {
// Missing required fields, record cannot be saved
FUNC_16(VAR_3.string.fill_required_fields_warning);
}
@Override
public void showSaveCompletedMessage() {
VAR_13.makeText(getContext(), VAR_3.string.VAR_14, VAR_13.LENGTH_LONG).show();
}
@Override
public void showDeleteCompletedMessage() {
VAR_13.makeText(getContext(), VAR_3.string.VAR_15, VAR_13.LENGTH_LONG).show();
}
@Override
public void onSaveInstanceState(Bundle bundle) {
bundle.putSerializable(AddEditCustomerPresenter.class.FUNC_2(), mPresenter);
super.onSaveInstanceState(bundle);
}
@Override
public void FUNC_17() {
// Dereference the view in the presenter to prevent memory leaks
mPresenter.unbind();
super.FUNC_17();
}
} | 0.317426 | {'CLASS_0': 'AddEditCustomerContract', 'VAR_0': 'mLastNameEditText', 'VAR_1': 'mPhoneNumberEditText', 'CLASS_1': 'Presenter', 'FUNC_0': 'onAttach', 'VAR_2': 'context', 'FUNC_1': 'd', 'CLASS_2': 'ClassCastException', 'FUNC_2': 'getSimpleName', 'FUNC_3': 'onDetach', 'VAR_3': 'R', 'VAR_4': 'layout', 'VAR_5': 'fragment_add_edit', 'FUNC_4': 'getSerializable', 'FUNC_5': 'bind', 'FUNC_6': 'setHasOptionsMenu', 'VAR_6': 'addedit_profession', 'CLASS_3': 'Menu', 'VAR_7': 'menu', 'FUNC_7': 'onOptionsItemSelected', 'FUNC_8': 'getLastName', 'FUNC_9': 'setProfession', 'FUNC_10': 'setCompanyName', 'VAR_8': 'companyName', 'FUNC_11': 'getNotes', 'FUNC_12': 'closeView', 'FUNC_13': 'showConfirmDialog', 'FUNC_14': 'getFragmentManager', 'VAR_9': 'DIALOG_ID_DELETE', 'FUNC_15': 'getString', 'VAR_10': 'cancel', 'VAR_11': 'DIALOG_ID_CANCEL_EDIT', 'VAR_12': 'cancelEditDiag_message', 'FUNC_16': 'showWarningDialog', 'VAR_13': 'Toast', 'VAR_14': 'save_completed_message', 'VAR_15': 'record_deleted_message', 'FUNC_17': 'onDestroy'} | java | OOP | 13.51% |
package com.kaizhuo.tiangong.boot.modules.admin.rest;
import com.kaizhuo.tiangong.boot.modules.admin.constants.Urls;
import com.kaizhuo.tiangong.boot.framework.controller.BaseController;
import com.kaizhuo.tiangong.boot.framework.vo.ResponseVo;
import com.kaizhuo.tiangong.boot.modules.admin.entity.ArticleCategory;
import com.kaizhuo.tiangong.boot.modules.admin.service.IArticleCategoryService;
import com.kaizhuo.tiangong.boot.modules.admin.vo.response.ArticleCateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(Urls.ROOT+"/articleCategory")
@Api(value = "文章分类相关", tags = "文章分类相关")
public class ArticleCategoryController extends BaseController<IArticleCategoryService, ArticleCategory> {
@RequestMapping(value = Urls.CATE_TREE_LIST, method = RequestMethod.GET)
@ApiOperation(value = "获取树状结构文章分类列表", notes = "获取树状结构文章分类列表")
public ResponseVo<List<ArticleCateVo>> getTreeCates(){
List<ArticleCateVo> treeCates = bizService.getTreeCates();
return new ResponseVo<>(treeCates);
}
}
| package com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.rest;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5.IMPORT_6;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_7.IMPORT_8.IMPORT_9;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_7.IMPORT_10.IMPORT_11;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_12.ArticleCategory;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_13.IMPORT_14;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_10.IMPORT_15.ArticleCateVo;
import IMPORT_16.IMPORT_17.IMPORT_18.Api;
import IMPORT_16.IMPORT_17.IMPORT_18.IMPORT_19;
import IMPORT_20.IMPORT_21.web.IMPORT_22.IMPORT_23.IMPORT_24;
import IMPORT_20.IMPORT_21.web.IMPORT_22.IMPORT_23.IMPORT_25;
import IMPORT_20.IMPORT_21.web.IMPORT_22.IMPORT_23.RestController;
import IMPORT_26.IMPORT_27.List;
@RestController
@IMPORT_24(IMPORT_6.VAR_0+"/articleCategory")
@Api(VAR_1 = "文章分类相关", tags = "文章分类VAR_2
public class ArticleCategoryController extends IMPORT_9<IMPORT_14, ArticleCategory> {
@IMPORT_24(VAR_1 = IMPORT_6.VAR_3, VAR_4 = IMPORT_25.VAR_5)
@IMPORT_19(VAR_1 = "获取树状结构文章分类列表", notes = "获取树状结构文章分类列表")
public IMPORT_11<List<ArticleCateVo>> FUNC_0(){
List<ArticleCateVo> VAR_6 = VAR_7.FUNC_0();
return new IMPORT_11<>(VAR_6);
}
}
| 0.781259 | {'IMPORT_0': 'kaizhuo', 'IMPORT_1': 'tiangong', 'IMPORT_2': 'boot', 'IMPORT_3': 'modules', 'IMPORT_4': 'admin', 'IMPORT_5': 'constants', 'IMPORT_6': 'Urls', 'IMPORT_7': 'framework', 'IMPORT_8': 'controller', 'IMPORT_9': 'BaseController', 'IMPORT_10': 'vo', 'IMPORT_11': 'ResponseVo', 'IMPORT_12': 'entity', 'IMPORT_13': 'service', 'IMPORT_14': 'IArticleCategoryService', 'IMPORT_15': 'response', 'IMPORT_16': 'io', 'IMPORT_17': 'swagger', 'IMPORT_18': 'annotations', 'IMPORT_19': 'ApiOperation', 'IMPORT_20': 'org', 'IMPORT_21': 'springframework', 'IMPORT_22': 'bind', 'IMPORT_23': 'annotation', 'IMPORT_24': 'RequestMapping', 'IMPORT_25': 'RequestMethod', 'IMPORT_26': 'java', 'IMPORT_27': 'util', 'VAR_0': 'ROOT', 'VAR_1': 'value', 'VAR_2': '相关")', 'VAR_3': 'CATE_TREE_LIST', 'VAR_4': 'method', 'VAR_5': 'GET', 'FUNC_0': 'getTreeCates', 'VAR_6': 'treeCates', 'VAR_7': 'bizService'} | java | Procedural | 91.45% |
package com.ababqq.buzzvil_test_android.entity;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ConfigResponse extends Response {
@SerializedName("firstAdRatio")
@Expose
public String firstAdRatio;
}
| package IMPORT_0.IMPORT_1.IMPORT_2.entity;
import IMPORT_0.IMPORT_3.gson.annotations.IMPORT_4;
import IMPORT_0.IMPORT_3.gson.annotations.SerializedName;
public class ConfigResponse extends CLASS_0 {
@SerializedName("firstAdRatio")
@IMPORT_4
public CLASS_1 firstAdRatio;
}
| 0.632576 | {'IMPORT_0': 'com', 'IMPORT_1': 'ababqq', 'IMPORT_2': 'buzzvil_test_android', 'IMPORT_3': 'google', 'IMPORT_4': 'Expose', 'CLASS_0': 'Response', 'CLASS_1': 'String'} | java | OOP | 100.00% |
/**
* Delete job custom job.
*
* @param id the id
* @return the custom job
* @throws IOException the io exception
*/
CustomJob deleteJob(String id) throws IOException {
CustomJob resultModel = new CustomJob();
resultModel.setResultStatus(RESULT_STATUS_SUCCESS);
CustomJob jobDetail = procGetJobDetail(Long.parseLong(id));
jobDetail.setCiServerUrl(procGetServiceInstances(jobDetail.getServiceInstancesId()).getCiServerUrl());
commonService.procGetCiServer(jobDetail.getCiServerUrl()).deleteJob(jobDetail.getJobGuid(), true);
jobBuiltFileService.deleteWorkspace(jobDetail);
restTemplateService.send(TARGET_COMMON_API, REQ_URL + "/" + id, HttpMethod.DELETE, null, String.class);
List jobHistoryList = restTemplateService.send(TARGET_COMMON_API, REQ_URL + "/" + id + "/histories", HttpMethod.GET, null, List.class);
int listSize = jobHistoryList.size();
if (listSize > 0) {
for (Object aJobHistoryList : jobHistoryList) {
Map<String, Object> map = (Map<String, Object>) aJobHistoryList;
int fileId = (int) map.get("fileId");
if (JOB_TYPE_BUILD.equals(jobDetail.getJobType()) && (fileId > 0)) {
FileInfo fileInfo = restTemplateService.send(TARGET_COMMON_API, REQ_FILE_URL + "/" + fileId, HttpMethod.GET, null, FileInfo.class);
restTemplateService.send(Constants.TARGET_BINARY_STORAGE_API, REQ_FILE_URL + "/fileDelete", HttpMethod.POST, fileInfo, String.class);
restTemplateService.send(TARGET_COMMON_API, REQ_FILE_URL + "/" + fileInfo.getId(), HttpMethod.DELETE, null, String.class);
}
}
}
restTemplateService.send(TARGET_COMMON_API, REQ_URL + "/" + id + REQ_HISTORY_URL, HttpMethod.DELETE, null, String.class);
procSetJobOrder(jobDetail, OperationType.DECREASE);
try {
if (JOB_TYPE_TEST.equals(jobDetail.getJobType())) {
inspectionProjectService.deleteProject(jobDetail);
}
} catch (Exception e) {
LOGGER.error("### ERROR :: INSPECTION PROJECT SERVICE :: DELETE PROJECT ###");
return resultModel;
}
return resultModel;
} | /**
* Delete job custom job.
*
* @param id the id
* @return the custom job
* @throws IOException the io exception
*/
CustomJob FUNC_0(String VAR_0) throws IOException {
CustomJob resultModel = new CustomJob();
resultModel.setResultStatus(RESULT_STATUS_SUCCESS);
CustomJob VAR_1 = FUNC_1(Long.parseLong(VAR_0));
VAR_1.setCiServerUrl(FUNC_2(VAR_1.getServiceInstancesId()).getCiServerUrl());
commonService.FUNC_3(VAR_1.getCiServerUrl()).FUNC_0(VAR_1.getJobGuid(), true);
jobBuiltFileService.deleteWorkspace(VAR_1);
restTemplateService.FUNC_4(TARGET_COMMON_API, REQ_URL + "/" + VAR_0, VAR_2.DELETE, null, String.class);
List jobHistoryList = restTemplateService.FUNC_4(TARGET_COMMON_API, REQ_URL + "/" + VAR_0 + "/histories", VAR_2.VAR_3, null, List.class);
int listSize = jobHistoryList.size();
if (listSize > 0) {
for (Object aJobHistoryList : jobHistoryList) {
Map<String, Object> map = (Map<String, Object>) aJobHistoryList;
int VAR_4 = (int) map.get("fileId");
if (JOB_TYPE_BUILD.FUNC_5(VAR_1.getJobType()) && (VAR_4 > 0)) {
FileInfo fileInfo = restTemplateService.FUNC_4(TARGET_COMMON_API, REQ_FILE_URL + "/" + VAR_4, VAR_2.VAR_3, null, FileInfo.class);
restTemplateService.FUNC_4(Constants.TARGET_BINARY_STORAGE_API, REQ_FILE_URL + "/fileDelete", VAR_2.POST, fileInfo, String.class);
restTemplateService.FUNC_4(TARGET_COMMON_API, REQ_FILE_URL + "/" + fileInfo.getId(), VAR_2.DELETE, null, String.class);
}
}
}
restTemplateService.FUNC_4(TARGET_COMMON_API, REQ_URL + "/" + VAR_0 + REQ_HISTORY_URL, VAR_2.DELETE, null, String.class);
FUNC_6(VAR_1, OperationType.DECREASE);
try {
if (JOB_TYPE_TEST.FUNC_5(VAR_1.getJobType())) {
inspectionProjectService.FUNC_7(VAR_1);
}
} catch (Exception e) {
VAR_5.FUNC_8("### ERROR :: INSPECTION PROJECT SERVICE :: DELETE PROJECT ###");
return resultModel;
}
return resultModel;
} | 0.280507 | {'FUNC_0': 'deleteJob', 'VAR_0': 'id', 'VAR_1': 'jobDetail', 'FUNC_1': 'procGetJobDetail', 'FUNC_2': 'procGetServiceInstances', 'FUNC_3': 'procGetCiServer', 'FUNC_4': 'send', 'VAR_2': 'HttpMethod', 'VAR_3': 'GET', 'VAR_4': 'fileId', 'FUNC_5': 'equals', 'FUNC_6': 'procSetJobOrder', 'FUNC_7': 'deleteProject', 'VAR_5': 'LOGGER', 'FUNC_8': 'error'} | java | Procedural | 10.00% |
/**
* The purpose of this class is to provide a concrete implementation of TileReader that reads in
* values from a data file and associates those values with Tile types to compile a list of all
* possible tiles for a given game type
* @author wyattfocht
*/
public class TileFactory implements TileReader {
private final String DATA_DIRECTORY = "./data/";
private String TILES = "TILES";
private final String PACKAGE = "ooga.model.tiles.";
private final int ITEMS_PER_LINE = 4;
private final int PROPERTY = 1;
private final int RAILROAD = 2;
private final int UTILITY = 3;
private final int CHANCE = 7;
private final int COMMUNITY = 8;
private final String[] DEFAULT_VALUES = {"Property", "WHITE", "-1", "1"};
private final String[] TILE_TYPES = {"GoTile", "Property", "Railroad", "UtilityTile", "TaxTile",
"JailTile", "GoToJailTile", "CardTile", "CardTile", "FreeParkingTile"};
private HashMap<String, List<Property>> propertyMap = new HashMap<>();
private String pathToTiles;
private List<Tile> allTiles;
private List<String> propertyNames;
private CSVFactory csvFactory;
private String gameType;
public TileFactory(String gameType) {
this.gameType = gameType;
this.pathToTiles = DATA_DIRECTORY + gameType.toLowerCase() + "/" + gameType + TILES;
csvFactory = new CSVFactory(this.pathToTiles);
propertyNames = new ArrayList<>();
readGameProperties();
initialize();
setMonopolyVals();
}
private void readGameProperties() {
allTiles = new ArrayList<>();
List<List<String>> allLinesOfCSV = csvFactory.getLinesOfCSV();
for (List<String> line : allLinesOfCSV) {
String[] arrayLine;
if (line.size() != ITEMS_PER_LINE) {
arrayLine = DEFAULT_VALUES;
} else {
arrayLine = line.toArray(new String[0]);
}
allTiles.add(handleLine(arrayLine));
}
}
private Tile handleLine(String[] nextLine) {
String name = nextLine[0];
propertyNames.add(name);
String color = nextLine[1];
int startingRent = Integer.parseInt(nextLine[2]);
int type = Integer.parseInt(nextLine[3]);
return createProperty(name, color, startingRent, type);
}
private Tile createProperty(String name, String color, int initialRent, int type) {
Tile t;
DeckOfCards chanceDeck = new DeckOfCards(0, gameType);
DeckOfCards communityDeck = new DeckOfCards(1, gameType);
try {
if (type == RAILROAD || type == UTILITY || type == PROPERTY) {
t = (Tile) Class.forName(PACKAGE + TILE_TYPES[type]).getDeclaredConstructors()[0]
.newInstance(name, color, initialRent);
if (type == PROPERTY) {
propertyMap.putIfAbsent(color, new ArrayList<>());
propertyMap.get(color).add((Property) t);
}
} else if (type == CHANCE) {
t = (Tile) Class.forName(PACKAGE + TILE_TYPES[type]).getDeclaredConstructors()[0]
.newInstance(name, color, chanceDeck);
} else if (type == COMMUNITY) {
t = (Tile) Class.forName(PACKAGE + TILE_TYPES[type]).getDeclaredConstructors()[0]
.newInstance(name, color, communityDeck);
} else {
t = (Tile) Class.forName(PACKAGE + TILE_TYPES[type]).getDeclaredConstructors()[0]
.newInstance(name, color);
}
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException | InvocationTargetException e) {
t = new Property(name, color, initialRent);
}
t.setGameType(gameType);
return t;
}
/**
* This method is a getter method for a list of Strings that represent the names of all the
* tiles within the game
* @return List that contains Strings that correspond to just the names of all the possible
* tiles for a given game type
*/
public List<String> getTileNames() {
if (propertyNames != null) {
return propertyNames;
} else {
return Collections.emptyList();
}
}
/**
* @see TileReader#getTiles()
*/
@Override
public List<Tile> getTiles() {
if (allTiles != null) {
return allTiles;
} else {
return Collections.emptyList();
}
}
private void setMonopolyVals () {
for (List<Property> propertyList : propertyMap.values()) {
for (Property p : propertyList) {
p.setForMonopoly(propertyList.size());
p.setGameType(gameType);
p.initialize();
}
}
}
private void initialize(){
for(Tile t : allTiles){
t.setGameType(gameType);
if(t instanceof Railroad) {
((Railroad)t).initialize();
}
}
}
} | /**
* The purpose of this class is to provide a concrete implementation of TileReader that reads in
* values from a data file and associates those values with Tile types to compile a list of all
* possible tiles for a given game type
* @author wyattfocht
*/
public class CLASS_0 implements CLASS_1 {
private final CLASS_2 VAR_0 = "./data/";
private CLASS_2 VAR_1 = "TILES";
private final CLASS_2 PACKAGE = "ooga.model.tiles.";
private final int VAR_2 = 4;
private final int VAR_3 = 1;
private final int VAR_4 = 2;
private final int VAR_5 = 3;
private final int CHANCE = 7;
private final int COMMUNITY = 8;
private final CLASS_2[] VAR_6 = {"Property", "WHITE", "-1", "1"};
private final CLASS_2[] VAR_7 = {"GoTile", "Property", "Railroad", "UtilityTile", "TaxTile",
"JailTile", "GoToJailTile", "CardTile", "CardTile", "FreeParkingTile"};
private HashMap<CLASS_2, CLASS_3<CLASS_4>> propertyMap = new HashMap<>();
private CLASS_2 pathToTiles;
private CLASS_3<CLASS_5> VAR_8;
private CLASS_3<CLASS_2> VAR_9;
private CLASS_6 VAR_10;
private CLASS_2 VAR_11;
public CLASS_0(CLASS_2 VAR_11) {
this.VAR_11 = VAR_11;
this.pathToTiles = VAR_0 + VAR_11.toLowerCase() + "/" + VAR_11 + VAR_1;
VAR_10 = new CLASS_6(this.pathToTiles);
VAR_9 = new CLASS_7<>();
readGameProperties();
FUNC_0();
FUNC_1();
}
private void readGameProperties() {
VAR_8 = new CLASS_7<>();
CLASS_3<CLASS_3<CLASS_2>> VAR_12 = VAR_10.FUNC_2();
for (CLASS_3<CLASS_2> VAR_13 : VAR_12) {
CLASS_2[] VAR_14;
if (VAR_13.FUNC_3() != VAR_2) {
VAR_14 = VAR_6;
} else {
VAR_14 = VAR_13.FUNC_4(new CLASS_2[0]);
}
VAR_8.FUNC_5(handleLine(VAR_14));
}
}
private CLASS_5 handleLine(CLASS_2[] nextLine) {
CLASS_2 name = nextLine[0];
VAR_9.FUNC_5(name);
CLASS_2 VAR_15 = nextLine[1];
int VAR_16 = VAR_17.parseInt(nextLine[2]);
int VAR_18 = VAR_17.parseInt(nextLine[3]);
return FUNC_6(name, VAR_15, VAR_16, VAR_18);
}
private CLASS_5 FUNC_6(CLASS_2 name, CLASS_2 VAR_15, int VAR_19, int VAR_18) {
CLASS_5 VAR_20;
CLASS_8 chanceDeck = new CLASS_8(0, VAR_11);
CLASS_8 VAR_21 = new CLASS_8(1, VAR_11);
try {
if (VAR_18 == VAR_4 || VAR_18 == VAR_5 || VAR_18 == VAR_3) {
VAR_20 = (CLASS_5) VAR_22.FUNC_7(PACKAGE + VAR_7[VAR_18]).getDeclaredConstructors()[0]
.FUNC_8(name, VAR_15, VAR_19);
if (VAR_18 == VAR_3) {
propertyMap.FUNC_9(VAR_15, new CLASS_7<>());
propertyMap.FUNC_10(VAR_15).FUNC_5((CLASS_4) VAR_20);
}
} else if (VAR_18 == CHANCE) {
VAR_20 = (CLASS_5) VAR_22.FUNC_7(PACKAGE + VAR_7[VAR_18]).getDeclaredConstructors()[0]
.FUNC_8(name, VAR_15, chanceDeck);
} else if (VAR_18 == COMMUNITY) {
VAR_20 = (CLASS_5) VAR_22.FUNC_7(PACKAGE + VAR_7[VAR_18]).getDeclaredConstructors()[0]
.FUNC_8(name, VAR_15, VAR_21);
} else {
VAR_20 = (CLASS_5) VAR_22.FUNC_7(PACKAGE + VAR_7[VAR_18]).getDeclaredConstructors()[0]
.FUNC_8(name, VAR_15);
}
} catch (CLASS_9 | CLASS_10 | CLASS_11 | InvocationTargetException e) {
VAR_20 = new CLASS_4(name, VAR_15, VAR_19);
}
VAR_20.FUNC_11(VAR_11);
return VAR_20;
}
/**
* This method is a getter method for a list of Strings that represent the names of all the
* tiles within the game
* @return List that contains Strings that correspond to just the names of all the possible
* tiles for a given game type
*/
public CLASS_3<CLASS_2> FUNC_12() {
if (VAR_9 != null) {
return VAR_9;
} else {
return Collections.FUNC_13();
}
}
/**
* @see TileReader#getTiles()
*/
@VAR_23
public CLASS_3<CLASS_5> getTiles() {
if (VAR_8 != null) {
return VAR_8;
} else {
return Collections.FUNC_13();
}
}
private void FUNC_1 () {
for (CLASS_3<CLASS_4> propertyList : propertyMap.values()) {
for (CLASS_4 p : propertyList) {
p.setForMonopoly(propertyList.FUNC_3());
p.FUNC_11(VAR_11);
p.FUNC_0();
}
}
}
private void FUNC_0(){
for(CLASS_5 VAR_20 : VAR_8){
VAR_20.FUNC_11(VAR_11);
if(VAR_20 instanceof CLASS_12) {
((CLASS_12)VAR_20).FUNC_0();
}
}
}
} | 0.720833 | {'CLASS_0': 'TileFactory', 'CLASS_1': 'TileReader', 'CLASS_2': 'String', 'VAR_0': 'DATA_DIRECTORY', 'VAR_1': 'TILES', 'VAR_2': 'ITEMS_PER_LINE', 'VAR_3': 'PROPERTY', 'VAR_4': 'RAILROAD', 'VAR_5': 'UTILITY', 'VAR_6': 'DEFAULT_VALUES', 'VAR_7': 'TILE_TYPES', 'CLASS_3': 'List', 'CLASS_4': 'Property', 'CLASS_5': 'Tile', 'VAR_8': 'allTiles', 'VAR_9': 'propertyNames', 'CLASS_6': 'CSVFactory', 'VAR_10': 'csvFactory', 'VAR_11': 'gameType', 'CLASS_7': 'ArrayList', 'FUNC_0': 'initialize', 'FUNC_1': 'setMonopolyVals', 'VAR_12': 'allLinesOfCSV', 'FUNC_2': 'getLinesOfCSV', 'VAR_13': 'line', 'VAR_14': 'arrayLine', 'FUNC_3': 'size', 'FUNC_4': 'toArray', 'FUNC_5': 'add', 'VAR_15': 'color', 'VAR_16': 'startingRent', 'VAR_17': 'Integer', 'VAR_18': 'type', 'FUNC_6': 'createProperty', 'VAR_19': 'initialRent', 'VAR_20': 't', 'CLASS_8': 'DeckOfCards', 'VAR_21': 'communityDeck', 'VAR_22': 'Class', 'FUNC_7': 'forName', 'FUNC_8': 'newInstance', 'FUNC_9': 'putIfAbsent', 'FUNC_10': 'get', 'CLASS_9': 'ClassNotFoundException', 'CLASS_10': 'IllegalAccessException', 'CLASS_11': 'InstantiationException', 'FUNC_11': 'setGameType', 'FUNC_12': 'getTileNames', 'FUNC_13': 'emptyList', 'VAR_23': 'Override', 'CLASS_12': 'Railroad'} | java | OOP | 30.75% |
/**
* Convert the passed references to a compressed (zip) byte array
* @param dto
* @return the compressed references
* @throws IOException
*/
@Deprecated
public static byte[] compressReferences(Map<String, Set<Reference>> dto) throws IOException{
if(dto == null) return null;
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedOutputStream buff = new BufferedOutputStream(out);
GZIPOutputStream zipper = new GZIPOutputStream(buff);
Writer zipWriter = new OutputStreamWriter(zipper, UTF8);
try{
XStream xstream = createXStream();
xstream.toXML(dto, zipWriter);
}finally{
IOUtils.closeQuietly(zipWriter);
}
return out.toByteArray();
} | /**
* Convert the passed references to a compressed (zip) byte array
* @param dto
* @return the compressed references
* @throws IOException
*/
@VAR_0
public static byte[] FUNC_0(CLASS_0<CLASS_1, CLASS_2<CLASS_3>> VAR_1) throws CLASS_4{
if(VAR_1 == null) return null;
CLASS_5 VAR_2 = new CLASS_5();
CLASS_6 VAR_3 = new CLASS_6(VAR_2);
CLASS_7 VAR_4 = new CLASS_7(VAR_3);
CLASS_8 VAR_5 = new CLASS_9(VAR_4, VAR_6);
try{
CLASS_10 VAR_7 = FUNC_1();
VAR_7.FUNC_2(VAR_1, VAR_5);
}finally{
VAR_8.FUNC_3(VAR_5);
}
return VAR_2.FUNC_4();
} | 0.838481 | {'VAR_0': 'Deprecated', 'FUNC_0': 'compressReferences', 'CLASS_0': 'Map', 'CLASS_1': 'String', 'CLASS_2': 'Set', 'CLASS_3': 'Reference', 'VAR_1': 'dto', 'CLASS_4': 'IOException', 'CLASS_5': 'ByteArrayOutputStream', 'VAR_2': 'out', 'CLASS_6': 'BufferedOutputStream', 'VAR_3': 'buff', 'CLASS_7': 'GZIPOutputStream', 'VAR_4': 'zipper', 'CLASS_8': 'Writer', 'VAR_5': 'zipWriter', 'CLASS_9': 'OutputStreamWriter', 'VAR_6': 'UTF8', 'CLASS_10': 'XStream', 'VAR_7': 'xstream', 'FUNC_1': 'createXStream', 'FUNC_2': 'toXML', 'VAR_8': 'IOUtils', 'FUNC_3': 'closeQuietly', 'FUNC_4': 'toByteArray'} | java | Procedural | 35.71% |
/*
* This file is generated by jOOQ.
*/
package com.oneops.crawler.jooq.cms.routines;
import com.oneops.crawler.jooq.cms.Kloopzcm;
import javax.annotation.Generated;
import org.jooq.Parameter;
import org.jooq.impl.AbstractRoutine;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.0"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DjUpdDeployment1 extends AbstractRoutine<java.lang.Void> {
private static final long serialVersionUID = 952408870;
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_deployment_id</code>.
*/
public static final Parameter<Long> P_DEPLOYMENT_ID = createParameter("p_deployment_id", org.jooq.impl.SQLDataType.BIGINT, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_state</code>.
*/
public static final Parameter<String> P_STATE = createParameter("p_state", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_updated_by</code>.
*/
public static final Parameter<String> P_UPDATED_BY = createParameter("p_updated_by", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_desc</code>.
*/
public static final Parameter<String> P_DESC = createParameter("p_desc", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_process_id</code>.
*/
public static final Parameter<String> P_PROCESS_ID = createParameter("p_process_id", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* Create a new routine call instance
*/
public DjUpdDeployment1() {
super("dj_upd_deployment", Kloopzcm.KLOOPZCM);
addInParameter(P_DEPLOYMENT_ID);
addInParameter(P_STATE);
addInParameter(P_UPDATED_BY);
addInParameter(P_DESC);
addInParameter(P_PROCESS_ID);
setOverloaded(true);
}
/**
* Set the <code>p_deployment_id</code> parameter IN value to the routine
*/
public void setPDeploymentId(Long value) {
setValue(P_DEPLOYMENT_ID, value);
}
/**
* Set the <code>p_state</code> parameter IN value to the routine
*/
public void setPState(String value) {
setValue(P_STATE, value);
}
/**
* Set the <code>p_updated_by</code> parameter IN value to the routine
*/
public void setPUpdatedBy(String value) {
setValue(P_UPDATED_BY, value);
}
/**
* Set the <code>p_desc</code> parameter IN value to the routine
*/
public void setPDesc(String value) {
setValue(P_DESC, value);
}
/**
* Set the <code>p_process_id</code> parameter IN value to the routine
*/
public void setPProcessId(String value) {
setValue(P_PROCESS_ID, value);
}
}
| /*
* This file is generated by jOOQ.
*/
package com.oneops.crawler.jooq.cms.routines;
import com.oneops.crawler.jooq.cms.Kloopzcm;
import javax.annotation.Generated;
import org.jooq.Parameter;
import org.jooq.impl.AbstractRoutine;
/**
* This class is generated by jOOQ.
*/
@Generated(
value = {
"http://www.jooq.org",
"jOOQ version:3.10.0"
},
comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class DjUpdDeployment1 extends AbstractRoutine<java.lang.Void> {
private static final long serialVersionUID = 952408870;
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_deployment_id</code>.
*/
public static final Parameter<Long> P_DEPLOYMENT_ID = createParameter("p_deployment_id", org.jooq.impl.SQLDataType.BIGINT, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_state</code>.
*/
public static final Parameter<String> P_STATE = createParameter("p_state", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_updated_by</code>.
*/
public static final Parameter<String> P_UPDATED_BY = createParameter("p_updated_by", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_desc</code>.
*/
public static final Parameter<String> P_DESC = createParameter("p_desc", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* The parameter <code>kloopzcm.dj_upd_deployment.p_process_id</code>.
*/
public static final Parameter<String> P_PROCESS_ID = createParameter("p_process_id", org.jooq.impl.SQLDataType.VARCHAR, false, false);
/**
* Create a new routine call instance
*/
public DjUpdDeployment1() {
super("dj_upd_deployment", Kloopzcm.KLOOPZCM);
addInParameter(P_DEPLOYMENT_ID);
addInParameter(P_STATE);
addInParameter(P_UPDATED_BY);
addInParameter(P_DESC);
addInParameter(P_PROCESS_ID);
setOverloaded(true);
}
/**
* Set the <code>p_deployment_id</code> parameter IN value to the routine
*/
public void setPDeploymentId(Long value) {
setValue(P_DEPLOYMENT_ID, value);
}
/**
* Set the <code>p_state</code> parameter IN value to the routine
*/
public void setPState(String value) {
setValue(P_STATE, value);
}
/**
* Set the <code>p_updated_by</code> parameter IN value to the routine
*/
public void setPUpdatedBy(String value) {
setValue(P_UPDATED_BY, value);
}
/**
* Set the <code>p_desc</code> parameter IN value to the routine
*/
public void setPDesc(String value) {
setValue(P_DESC, value);
}
/**
* Set the <code>p_process_id</code> parameter IN value to the routine
*/
public void setPProcessId(String value) {
setValue(P_PROCESS_ID, value);
}
}
| 0.008177 | {} | java | OOP | 12.39% |
/**
* Class for centering items after scroll event.<br />
* This class will listen to current scroll state and if item is not centered after scroll it will automatically scroll it to center.
*/
public class CenterScrollListener extends RecyclerView.OnScrollListener {
private boolean mAutoSet = true;
@Override
public void onScrollStateChanged(final RecyclerView recyclerView, final int newState) {
super.onScrollStateChanged(recyclerView, newState);
final RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (!(layoutManager instanceof CarouselLayoutManager)) {
mAutoSet = true;
return;
}
final CarouselLayoutManager lm = (CarouselLayoutManager) layoutManager;
if (!mAutoSet) {
if (RecyclerView.SCROLL_STATE_IDLE == newState) {
final int scrollNeeded = lm.getOffsetCenterView();
if (CarouselLayoutManager.HORIZONTAL == lm.getOrientation()) {
recyclerView.smoothScrollBy(scrollNeeded, 0);
} else {
recyclerView.smoothScrollBy(0, scrollNeeded);
}
mAutoSet = true;
}
}
if (RecyclerView.SCROLL_STATE_DRAGGING == newState || RecyclerView.SCROLL_STATE_SETTLING == newState) {
mAutoSet = false;
}
}
} | /**
* Class for centering items after scroll event.<br />
* This class will listen to current scroll state and if item is not centered after scroll it will automatically scroll it to center.
*/
public class CLASS_0 extends RecyclerView.CLASS_1 {
private boolean mAutoSet = true;
@VAR_0
public void FUNC_0(final RecyclerView VAR_1, final int VAR_2) {
super.FUNC_0(VAR_1, VAR_2);
final RecyclerView.CLASS_2 VAR_3 = VAR_1.getLayoutManager();
if (!(VAR_3 instanceof CarouselLayoutManager)) {
mAutoSet = true;
return;
}
final CarouselLayoutManager VAR_4 = (CarouselLayoutManager) VAR_3;
if (!mAutoSet) {
if (RecyclerView.VAR_5 == VAR_2) {
final int scrollNeeded = VAR_4.FUNC_1();
if (CarouselLayoutManager.VAR_6 == VAR_4.FUNC_2()) {
VAR_1.FUNC_3(scrollNeeded, 0);
} else {
VAR_1.FUNC_3(0, scrollNeeded);
}
mAutoSet = true;
}
}
if (RecyclerView.VAR_7 == VAR_2 || RecyclerView.VAR_8 == VAR_2) {
mAutoSet = false;
}
}
} | 0.655878 | {'CLASS_0': 'CenterScrollListener', 'CLASS_1': 'OnScrollListener', 'VAR_0': 'Override', 'FUNC_0': 'onScrollStateChanged', 'VAR_1': 'recyclerView', 'VAR_2': 'newState', 'CLASS_2': 'LayoutManager', 'VAR_3': 'layoutManager', 'VAR_4': 'lm', 'VAR_5': 'SCROLL_STATE_IDLE', 'FUNC_1': 'getOffsetCenterView', 'VAR_6': 'HORIZONTAL', 'FUNC_2': 'getOrientation', 'FUNC_3': 'smoothScrollBy', 'VAR_7': 'SCROLL_STATE_DRAGGING', 'VAR_8': 'SCROLL_STATE_SETTLING'} | java | OOP | 47.68% |
/**
* This method handles the messages that are received from the Log4J messages.
*
* @param sName DOCUMENTME
* @param edDetails The event details.
*/
public void handleMessage(String sName, EventDetails edDetails)
{
if (edDetails != null)
{
Log4JEventsPanel lepPanel = (Log4JEventsPanel) m_hmSubscribed.get(SUB_LOG4J_EVENTS);
if (lepPanel != null)
{
Log4JLogEvent lleEvent = new Log4JLogEvent(edDetails);
lepPanel.onReceive(lleEvent);
}
}
} | /**
* This method handles the messages that are received from the Log4J messages.
*
* @param sName DOCUMENTME
* @param edDetails The event details.
*/
public void FUNC_0(CLASS_0 VAR_0, EventDetails edDetails)
{
if (edDetails != null)
{
CLASS_1 lepPanel = (CLASS_1) VAR_1.FUNC_1(SUB_LOG4J_EVENTS);
if (lepPanel != null)
{
Log4JLogEvent VAR_2 = new Log4JLogEvent(edDetails);
lepPanel.FUNC_2(VAR_2);
}
}
} | 0.555272 | {'FUNC_0': 'handleMessage', 'CLASS_0': 'String', 'VAR_0': 'sName', 'CLASS_1': 'Log4JEventsPanel', 'VAR_1': 'm_hmSubscribed', 'FUNC_1': 'get', 'VAR_2': 'lleEvent', 'FUNC_2': 'onReceive'} | java | Procedural | 100.00% |
/*
* Part of Homeglue (c) 2018 <NAME> - https://github.com/4levity/homeglue
* Homeglue is free software. You can modify and/or distribute it under the terms
* of the Apache License Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
*/
package net.forlevity.homeglue.web;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;
/**
* Provides Jackson ObjectMapper to RESTeasy.
*/
@Provider
@Singleton
public class ObjectMapperProvider implements ContextResolver<ObjectMapper> {
private final ObjectMapper jackson;
@Inject
public ObjectMapperProvider(ObjectMapper jackson) {
this.jackson = jackson;
}
@Override
public ObjectMapper getContext(Class<?> type) {
return jackson;
}
}
| /*
* Part of Homeglue (c) 2018 <NAME> - https://github.com/4levity/homeglue
* Homeglue is free software. You can modify and/or distribute it under the terms
* of the Apache License Version 2.0: https://www.apache.org/licenses/LICENSE-2.0
*/
package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import IMPORT_4.IMPORT_5.IMPORT_6.IMPORT_7.IMPORT_8;
import IMPORT_4.IMPORT_9.IMPORT_10.IMPORT_11;
import IMPORT_4.IMPORT_9.IMPORT_10.IMPORT_12;
import javax.IMPORT_13.IMPORT_14.IMPORT_15.IMPORT_16;
import javax.IMPORT_13.IMPORT_14.IMPORT_15.IMPORT_17;
/**
* Provides Jackson ObjectMapper to RESTeasy.
*/
@IMPORT_17
@IMPORT_12
public class CLASS_0 implements IMPORT_16<IMPORT_8> {
private final IMPORT_8 IMPORT_6;
@IMPORT_11
public CLASS_0(IMPORT_8 IMPORT_6) {
this.IMPORT_6 = IMPORT_6;
}
@VAR_0
public IMPORT_8 FUNC_0(CLASS_1<?> VAR_1) {
return IMPORT_6;
}
}
| 0.919113 | {'IMPORT_0': 'net', 'IMPORT_1': 'forlevity', 'IMPORT_2': 'homeglue', 'IMPORT_3': 'web', 'IMPORT_4': 'com', 'IMPORT_5': 'fasterxml', 'IMPORT_6': 'jackson', 'IMPORT_7': 'databind', 'IMPORT_8': 'ObjectMapper', 'IMPORT_9': 'google', 'IMPORT_10': 'inject', 'IMPORT_11': 'Inject', 'IMPORT_12': 'Singleton', 'IMPORT_13': 'ws', 'IMPORT_14': 'rs', 'IMPORT_15': 'ext', 'IMPORT_16': 'ContextResolver', 'IMPORT_17': 'Provider', 'CLASS_0': 'ObjectMapperProvider', 'VAR_0': 'Override', 'FUNC_0': 'getContext', 'CLASS_1': 'Class', 'VAR_1': 'type'} | java | Hibrido | 100.00% |
package styx.data.db;
import java.util.Arrays;
import java.util.Objects;
public class Path implements Comparable<Path> {
private final int[] parts;
private Path(int[] parts) {
this.parts = Objects.requireNonNull(parts);
}
public static Path of(int... parts) {
return new Path(Arrays.copyOf(parts, parts.length));
}
public static Path decode(String string) {
int partCount = 0;
int[] parts = new int[string.length()];
for(int i = 0; i < string.length(); i++) {
int value = decode64(string.charAt(i));
if(value <= 36) {
parts[partCount++] = value;
} else {
int count = value - 36;
value = 0;
while(count-- > 0) {
value <<= 6;
value += decode64(string.charAt(++i));
}
parts[partCount++] = value;
}
}
return new Path(Arrays.copyOf(parts, partCount));
}
public String encode() {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < parts.length; i++) {
int value = parts[i];
if(value >= 0 && value <= 36) {
sb.append(encode64(value));
} else {
int count = 0;
int bits = value;
while(bits != 0) {
count++;
bits >>>= 6;
}
sb.append(encode64(36 + count));
int shift = (count-1) * 6;
while(shift >= 0) {
sb.append(encode64((value >>> shift) & 63));
shift -= 6;
};
}
}
return sb.toString();
}
static char encode64(int n) {
if(n < 0 || n >= 64) {
throw new IllegalArgumentException();
} else if(n < 10) {
return (char) ('0' + n);
} else if(n < 36) {
return (char) ('A' + n - 10);
} else if(n < 37) {
return '_';
} else if(n < 63) {
return (char) ('a' - 37 + n);
} else {
return '~';
}
}
static int decode64(char c) {
if(c >= '0' && c <= '9') {
return c - '0';
} else if(c >= 'A' && c <= 'Z') {
return c - 'A' + 10;
} else if(c == '_') {
return 36;
} else if(c >= 'a' && c <= 'z') {
return c - 'a' + 37;
} else if(c == '~') {
return 63;
} else {
throw new IllegalArgumentException();
}
}
@Override
public String toString() {
return Arrays.toString(parts);
}
@Override
public boolean equals(Object other) {
return other instanceof Path &&
Arrays.equals(parts, ((Path) other).parts);
}
@Override
public int hashCode() {
return Arrays.hashCode(parts);
}
@Override
public int compareTo(Path other) {
for(int i = 0; i < parts.length && i < other.parts.length; i++) {
if(parts[i] != other.parts[i]) {
return Integer.compare(parts[i], other.parts[i]);
}
}
return Integer.compare(parts.length, other.parts.length);
}
public int length() {
return parts.length;
}
public boolean startsWith(Path other) {
if(parts.length < other.parts.length) {
return false;
}
for(int i = 0; i < other.parts.length; i++) {
if(parts[i] != other.parts[i]) {
return false;
}
}
return true;
}
public int prefixLength(Path other) {
int i = 0;
while(i < parts.length && i < other.parts.length && parts[i] == other.parts[i]) {
i++;
}
return i;
}
public Path add(int part) {
int[] parts = Arrays.copyOf(this.parts, this.parts.length + 1);
parts[this.parts.length] = part;
return new Path(parts);
}
}
| package IMPORT_0.data.IMPORT_1;
import java.util.Arrays;
import java.util.Objects;
public class Path implements CLASS_0<Path> {
private final int[] VAR_0;
private Path(int[] VAR_0) {
this.VAR_0 = Objects.requireNonNull(VAR_0);
}
public static Path FUNC_0(int... VAR_0) {
return new Path(Arrays.copyOf(VAR_0, VAR_0.length));
}
public static Path FUNC_1(String string) {
int partCount = 0;
int[] VAR_0 = new int[string.length()];
for(int i = 0; i < string.length(); i++) {
int value = decode64(string.FUNC_2(i));
if(value <= 36) {
VAR_0[partCount++] = value;
} else {
int VAR_1 = value - 36;
value = 0;
while(VAR_1-- > 0) {
value <<= 6;
value += decode64(string.FUNC_2(++i));
}
VAR_0[partCount++] = value;
}
}
return new Path(Arrays.copyOf(VAR_0, partCount));
}
public String FUNC_3() {
StringBuilder VAR_2 = new StringBuilder();
for(int i = 0; i < VAR_0.length; i++) {
int value = VAR_0[i];
if(value >= 0 && value <= 36) {
VAR_2.FUNC_4(encode64(value));
} else {
int VAR_1 = 0;
int bits = value;
while(bits != 0) {
VAR_1++;
bits >>>= 6;
}
VAR_2.FUNC_4(encode64(36 + VAR_1));
int VAR_3 = (VAR_1-1) * 6;
while(VAR_3 >= 0) {
VAR_2.FUNC_4(encode64((value >>> VAR_3) & 63));
VAR_3 -= 6;
};
}
}
return VAR_2.FUNC_5();
}
static char encode64(int n) {
if(n < 0 || n >= 64) {
throw new IllegalArgumentException();
} else if(n < 10) {
return (char) ('0' + n);
} else if(n < 36) {
return (char) ('A' + n - 10);
} else if(n < 37) {
return '_';
} else if(n < 63) {
return (char) ('a' - 37 + n);
} else {
return '~';
}
}
static int decode64(char c) {
if(c >= '0' && c <= '9') {
return c - '0';
} else if(c >= 'A' && c <= 'Z') {
return c - 'A' + 10;
} else if(c == '_') {
return 36;
} else if(c >= 'a' && c <= 'z') {
return c - 'a' + 37;
} else if(c == '~') {
return 63;
} else {
throw new IllegalArgumentException();
}
}
@Override
public String FUNC_5() {
return Arrays.FUNC_5(VAR_0);
}
@Override
public boolean FUNC_6(Object VAR_4) {
return VAR_4 instanceof Path &&
Arrays.FUNC_6(VAR_0, ((Path) VAR_4).VAR_0);
}
@Override
public int FUNC_7() {
return Arrays.FUNC_7(VAR_0);
}
@Override
public int compareTo(Path VAR_4) {
for(int i = 0; i < VAR_0.length && i < VAR_4.VAR_0.length; i++) {
if(VAR_0[i] != VAR_4.VAR_0[i]) {
return VAR_5.FUNC_8(VAR_0[i], VAR_4.VAR_0[i]);
}
}
return VAR_5.FUNC_8(VAR_0.length, VAR_4.VAR_0.length);
}
public int length() {
return VAR_0.length;
}
public boolean FUNC_9(Path VAR_4) {
if(VAR_0.length < VAR_4.VAR_0.length) {
return false;
}
for(int i = 0; i < VAR_4.VAR_0.length; i++) {
if(VAR_0[i] != VAR_4.VAR_0[i]) {
return false;
}
}
return true;
}
public int prefixLength(Path VAR_4) {
int i = 0;
while(i < VAR_0.length && i < VAR_4.VAR_0.length && VAR_0[i] == VAR_4.VAR_0[i]) {
i++;
}
return i;
}
public Path FUNC_10(int part) {
int[] VAR_0 = Arrays.copyOf(this.VAR_0, this.VAR_0.length + 1);
VAR_0[this.VAR_0.length] = part;
return new Path(VAR_0);
}
}
| 0.407352 | {'IMPORT_0': 'styx', 'IMPORT_1': 'db', 'CLASS_0': 'Comparable', 'VAR_0': 'parts', 'FUNC_0': 'of', 'FUNC_1': 'decode', 'FUNC_2': 'charAt', 'VAR_1': 'count', 'FUNC_3': 'encode', 'VAR_2': 'sb', 'FUNC_4': 'append', 'VAR_3': 'shift', 'FUNC_5': 'toString', 'FUNC_6': 'equals', 'VAR_4': 'other', 'FUNC_7': 'hashCode', 'VAR_5': 'Integer', 'FUNC_8': 'compare', 'FUNC_9': 'startsWith', 'FUNC_10': 'add'} | java | OOP | 8.71% |
/*
* =============================================================================
*
* Copyright (c) 2010, The OP4J team (http://www.op4j.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package org.op4j.operators.impl.op.map;
import java.util.Comparator;
import java.util.Map;
import java.util.Map.Entry;
import org.op4j.functions.FnMap;
import org.op4j.functions.IFunction;
import org.op4j.operators.impl.AbstractOperator;
import org.op4j.operators.intf.map.ILevel0MapSelectedOperator;
import org.op4j.operators.qualities.UniqOpOperator;
import org.op4j.target.Target;
import org.op4j.target.Target.Normalisation;
import org.op4j.target.Target.Structure;
public final class Level0MapSelectedOperator<I,K,V> extends AbstractOperator implements UniqOpOperator<I,Map<K,V>>, ILevel0MapSelectedOperator<I,K,V> {
public Level0MapSelectedOperator(final Target target) {
super(target);
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> sortBy(final IFunction<? super Entry<K,V>,?> by) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().sortBy((IFunction)by)));
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> insertAll(final int position, final Map<K,V> map) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().insertAll(position, (Map)map)));
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> removeAllTrue(final IFunction<? super Entry<K,V>,Boolean> eval) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().removeAllTrue((IFunction)eval)));
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> removeAllFalse(final IFunction<? super Entry<K,V>,Boolean> eval) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().removeAllFalse((IFunction)eval)));
}
public Level0MapOperator<I,K,V> endIf() {
return new Level0MapOperator<I,K,V>(getTarget().endSelect());
}
public Level1MapSelectedEntriesOperator<I,K,V> forEachEntry() {
return new Level1MapSelectedEntriesOperator<I,K,V>(getTarget().iterate(Structure.MAP));
}
public Level0MapSelectedOperator<I,K,V> removeAllKeys(final K... keys) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().removeAllKeys(keys)));
}
public Level0MapSelectedOperator<I,K,V> removeAllKeysNot(final K... keys) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().removeAllKeysNot(keys)));
}
public Level0MapSelectedOperator<I,K,V> execAsMap(final IFunction<? super Map<K,V>,? extends Map<? extends K,? extends V>> function) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(function, Normalisation.MAP));
}
public Level0MapSelectedOperator<I,K,V> put(final K newKey, final V newValue) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().put(newKey, newValue)));
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> putAll(final Map<K,V> map) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().putAll((Map)map)));
}
public Level0MapSelectedOperator<I,K,V> insert(final int position, final K newKey, final V newValue) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().insert(position, newKey, newValue)));
}
public Level0MapSelectedOperator<I,K,V> sort() {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().sortByKey()));
}
@SuppressWarnings("unchecked")
public Level0MapSelectedOperator<I,K,V> sort(final Comparator<? super Entry<K,V>> comparator) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().execute(FnMap.ofObjectObject().sortEntries((Comparator)comparator)));
}
public Level0MapSelectedOperator<I,K,V> replaceWith(final Map<K,V> replacement) {
return new Level0MapSelectedOperator<I,K,V>(getTarget().replaceWith(replacement, Normalisation.MAP));
}
public Map<K,V> get() {
return endIf().get();
}
}
| /*
* =============================================================================
*
* Copyright (c) 2010, The OP4J team (http://www.op4j.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* =============================================================================
*/
package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_6.IMPORT_7.IMPORT_8;
import IMPORT_6.IMPORT_7.IMPORT_9;
import IMPORT_6.IMPORT_7.IMPORT_9.Entry;
import IMPORT_0.IMPORT_1.IMPORT_10.FnMap;
import IMPORT_0.IMPORT_1.IMPORT_10.IFunction;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_11;
import IMPORT_0.IMPORT_1.IMPORT_2.intf.IMPORT_5.IMPORT_12;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_13.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_15.IMPORT_16;
import IMPORT_0.IMPORT_1.IMPORT_15.IMPORT_16.IMPORT_17;
import IMPORT_0.IMPORT_1.IMPORT_15.IMPORT_16.IMPORT_18;
public final class CLASS_0<CLASS_1,CLASS_2,CLASS_3> extends IMPORT_11 implements IMPORT_14<CLASS_1,IMPORT_9<CLASS_2,CLASS_3>>, IMPORT_12<CLASS_1,CLASS_2,CLASS_3> {
public CLASS_0(final IMPORT_16 IMPORT_15) {
super(IMPORT_15);
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> sortBy(final IFunction<? super Entry<CLASS_2,CLASS_3>,?> VAR_1) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().sortBy((IFunction)VAR_1)));
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_3(final int VAR_2, final IMPORT_9<CLASS_2,CLASS_3> IMPORT_5) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_3(VAR_2, (IMPORT_9)IMPORT_5)));
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_4(final IFunction<? super Entry<CLASS_2,CLASS_3>,CLASS_4> VAR_3) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_4((IFunction)VAR_3)));
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> removeAllFalse(final IFunction<? super Entry<CLASS_2,CLASS_3>,CLASS_4> VAR_3) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().removeAllFalse((IFunction)VAR_3)));
}
public CLASS_5<CLASS_1,CLASS_2,CLASS_3> FUNC_5() {
return new CLASS_5<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_6());
}
public CLASS_6<CLASS_1,CLASS_2,CLASS_3> FUNC_7() {
return new CLASS_6<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_8(IMPORT_18.MAP));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_9(final CLASS_2... VAR_4) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_9(VAR_4)));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_10(final CLASS_2... VAR_4) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_10(VAR_4)));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> execAsMap(final IFunction<? super IMPORT_9<CLASS_2,CLASS_3>,? extends IMPORT_9<? extends CLASS_2,? extends CLASS_3>> function) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(function, IMPORT_17.MAP));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_11(final CLASS_2 VAR_5, final CLASS_3 VAR_6) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_11(VAR_5, VAR_6)));
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_12(final IMPORT_9<CLASS_2,CLASS_3> IMPORT_5) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_12((IMPORT_9)IMPORT_5)));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> insert(final int VAR_2, final CLASS_2 VAR_5, final CLASS_3 VAR_6) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().insert(VAR_2, VAR_5, VAR_6)));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_13() {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_14()));
}
@VAR_0("unchecked")
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_13(final IMPORT_8<? super Entry<CLASS_2,CLASS_3>> VAR_7) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_1(FnMap.FUNC_2().FUNC_15((IMPORT_8)VAR_7)));
}
public CLASS_0<CLASS_1,CLASS_2,CLASS_3> FUNC_16(final IMPORT_9<CLASS_2,CLASS_3> replacement) {
return new CLASS_0<CLASS_1,CLASS_2,CLASS_3>(FUNC_0().FUNC_16(replacement, IMPORT_17.MAP));
}
public IMPORT_9<CLASS_2,CLASS_3> FUNC_17() {
return FUNC_5().FUNC_17();
}
}
| 0.850169 | {'IMPORT_0': 'org', 'IMPORT_1': 'op4j', 'IMPORT_2': 'operators', 'IMPORT_3': 'impl', 'IMPORT_4': 'op', 'IMPORT_5': 'map', 'IMPORT_6': 'java', 'IMPORT_7': 'util', 'IMPORT_8': 'Comparator', 'IMPORT_9': 'Map', 'IMPORT_10': 'functions', 'IMPORT_11': 'AbstractOperator', 'IMPORT_12': 'ILevel0MapSelectedOperator', 'IMPORT_13': 'qualities', 'IMPORT_14': 'UniqOpOperator', 'IMPORT_15': 'target', 'IMPORT_16': 'Target', 'IMPORT_17': 'Normalisation', 'IMPORT_18': 'Structure', 'CLASS_0': 'Level0MapSelectedOperator', 'CLASS_1': 'I', 'CLASS_2': 'K', 'CLASS_3': 'V', 'VAR_0': 'SuppressWarnings', 'VAR_1': 'by', 'FUNC_0': 'getTarget', 'FUNC_1': 'execute', 'FUNC_2': 'ofObjectObject', 'FUNC_3': 'insertAll', 'VAR_2': 'position', 'FUNC_4': 'removeAllTrue', 'CLASS_4': 'Boolean', 'VAR_3': 'eval', 'CLASS_5': 'Level0MapOperator', 'FUNC_5': 'endIf', 'FUNC_6': 'endSelect', 'CLASS_6': 'Level1MapSelectedEntriesOperator', 'FUNC_7': 'forEachEntry', 'FUNC_8': 'iterate', 'FUNC_9': 'removeAllKeys', 'VAR_4': 'keys', 'FUNC_10': 'removeAllKeysNot', 'FUNC_11': 'put', 'VAR_5': 'newKey', 'VAR_6': 'newValue', 'FUNC_12': 'putAll', 'FUNC_13': 'sort', 'FUNC_14': 'sortByKey', 'VAR_7': 'comparator', 'FUNC_15': 'sortEntries', 'FUNC_16': 'replaceWith', 'FUNC_17': 'get'} | java | Hibrido | 28.08% |
package querqy.rewrite.commonrules;
import querqy.infologging.InfoLoggingContext;
import querqy.model.AbstractNodeVisitor;
import querqy.model.BooleanQuery;
import querqy.model.DisjunctionMaxQuery;
import querqy.model.ExpandedQuery;
import querqy.model.InputSequenceElement;
import querqy.model.MatchAllQuery;
import querqy.model.Node;
import querqy.model.QuerqyQuery;
import querqy.model.Query;
import querqy.model.Term;
import querqy.rewrite.ContextAwareQueryRewriter;
import querqy.rewrite.SearchEngineRequestAdapter;
import querqy.rewrite.commonrules.model.Action;
import querqy.rewrite.commonrules.model.InputBoundary;
import querqy.rewrite.commonrules.model.InputBoundary.Type;
import querqy.rewrite.commonrules.model.Instructions;
import querqy.rewrite.commonrules.model.PositionSequence;
import querqy.rewrite.commonrules.model.RulesCollection;
import querqy.rewrite.commonrules.select.SelectionStrategy;
import querqy.rewrite.commonrules.select.TopRewritingActionCollector;
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author rene
*
*/
public class CommonRulesRewriter extends AbstractNodeVisitor<Node> implements ContextAwareQueryRewriter {
static final InputBoundary LEFT_BOUNDARY = new InputBoundary(Type.LEFT);
static final InputBoundary RIGHT_BOUNDARY = new InputBoundary(Type.RIGHT);
public static final String APPLIED_RULES = "APPLIED_RULES";
protected final RulesCollection rules;
protected final LinkedList<PositionSequence<Term>> sequencesStack;
protected ExpandedQuery expandedQuery;
protected SearchEngineRequestAdapter searchEngineRequestAdapter;
protected SelectionStrategy selectionStrategy;
public CommonRulesRewriter(final RulesCollection rules, final SelectionStrategy selectionStrategy) {
this.rules = rules;
sequencesStack = new LinkedList<>();
this.selectionStrategy = selectionStrategy;
}
@Override
public ExpandedQuery rewrite(final ExpandedQuery query) {
throw new UnsupportedOperationException("This rewriter needs a query context");
}
@Override
public ExpandedQuery rewrite(final ExpandedQuery query,
final SearchEngineRequestAdapter searchEngineRequestAdapter) {
final QuerqyQuery<?> userQuery = query.getUserQuery();
if (userQuery instanceof Query) {
this.expandedQuery = query;
this.searchEngineRequestAdapter = searchEngineRequestAdapter;
sequencesStack.add(new PositionSequence<>());
super.visit((BooleanQuery) query.getUserQuery());
applySequence(sequencesStack.removeLast(), true);
if (((Query) userQuery).isEmpty()
&& (query.getBoostUpQueries() != null || query.getFilterQueries() != null)) {
query.setUserQuery(new MatchAllQuery(true));
}
}
return query;
}
@Override
public Node visit(final BooleanQuery booleanQuery) {
sequencesStack.add(new PositionSequence<>());
super.visit(booleanQuery);
applySequence(sequencesStack.removeLast(), false);
return null;
}
protected void applySequence(final PositionSequence<Term> sequence, boolean addBoundaries) {
final PositionSequence<InputSequenceElement> sequenceForLookUp = addBoundaries
? addBoundaries(sequence) : termSequenceToInputSequence(sequence);
final boolean isDebug = Boolean.TRUE.equals(searchEngineRequestAdapter.getContext()
.get(CONTEXT_KEY_DEBUG_ENABLED));
List<String> actionsDebugInfo = (List<String>) searchEngineRequestAdapter.getContext()
.get(CONTEXT_KEY_DEBUG_DATA);
// prepare debug info context object if requested
if (isDebug && actionsDebugInfo == null) {
actionsDebugInfo = new LinkedList<>();
searchEngineRequestAdapter.getContext().put(CONTEXT_KEY_DEBUG_DATA, actionsDebugInfo);
}
final TopRewritingActionCollector collector = selectionStrategy.createTopRewritingActionCollector();
rules.collectRewriteActions(sequenceForLookUp, collector);
final List<Action> actions = collector.evaluateBooleanInput().createActions();
final InfoLoggingContext infoLoggingContext = searchEngineRequestAdapter.getInfoLoggingContext().orElse(null);
final boolean infoLoggingEnabled = infoLoggingContext != null && infoLoggingContext.isEnabledForRewriter();
final Set<String> appliedRules = infoLoggingEnabled ? new HashSet<>() : null;
for (final Action action : actions) {
if (isDebug) {
actionsDebugInfo.add(action.toString());
}
final Instructions instructions = action.getInstructions();
instructions.forEach(instruction ->
instruction.apply(sequence, action.getTermMatches(),
action.getStartPosition(),
action.getEndPosition(), expandedQuery, searchEngineRequestAdapter)
);
if (infoLoggingEnabled) {
instructions.getProperty(Instructions.StandardPropertyNames.LOG_MESSAGE)
.map(String::valueOf).ifPresent(appliedRules::add);
}
}
if (infoLoggingEnabled && !appliedRules.isEmpty()) {
final Map<String, Set<String>> message = new IdentityHashMap<>(1);
message.put(APPLIED_RULES, appliedRules);
infoLoggingContext.log(message);
}
}
protected PositionSequence<InputSequenceElement> termSequenceToInputSequence(
final PositionSequence<Term> sequence) {
final PositionSequence<InputSequenceElement> result = new PositionSequence<>();
sequence.forEach(termList -> result.add(Collections.unmodifiableList(termList)));
return result;
}
protected PositionSequence<InputSequenceElement> addBoundaries(final PositionSequence<Term> sequence) {
PositionSequence<InputSequenceElement> result = new PositionSequence<>();
result.nextPosition();
result.addElement(LEFT_BOUNDARY);
for (List<Term> termList : sequence) {
result.add(Collections.unmodifiableList(termList));
}
result.nextPosition();
result.addElement(RIGHT_BOUNDARY);
return result;
}
@Override
public Node visit(final DisjunctionMaxQuery disjunctionMaxQuery) {
sequencesStack.getLast().nextPosition();
return super.visit(disjunctionMaxQuery);
}
@Override
public Node visit(final Term term) {
sequencesStack.getLast().addElement(term);
return super.visit(term);
}
}
| package querqy.rewrite.IMPORT_0;
import querqy.infologging.InfoLoggingContext;
import querqy.model.IMPORT_1;
import querqy.model.BooleanQuery;
import querqy.model.DisjunctionMaxQuery;
import querqy.model.IMPORT_2;
import querqy.model.InputSequenceElement;
import querqy.model.MatchAllQuery;
import querqy.model.Node;
import querqy.model.IMPORT_3;
import querqy.model.Query;
import querqy.model.Term;
import querqy.rewrite.ContextAwareQueryRewriter;
import querqy.rewrite.SearchEngineRequestAdapter;
import querqy.rewrite.IMPORT_0.model.Action;
import querqy.rewrite.IMPORT_0.model.IMPORT_4;
import querqy.rewrite.IMPORT_0.model.IMPORT_4.Type;
import querqy.rewrite.IMPORT_0.model.IMPORT_5;
import querqy.rewrite.IMPORT_0.model.PositionSequence;
import querqy.rewrite.IMPORT_0.model.RulesCollection;
import querqy.rewrite.IMPORT_0.select.SelectionStrategy;
import querqy.rewrite.IMPORT_0.select.TopRewritingActionCollector;
import java.util.Collections;
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.IMPORT_6;
import java.util.Set;
/**
* @author rene
*
*/
public class CommonRulesRewriter extends IMPORT_1<Node> implements ContextAwareQueryRewriter {
static final IMPORT_4 LEFT_BOUNDARY = new IMPORT_4(Type.LEFT);
static final IMPORT_4 RIGHT_BOUNDARY = new IMPORT_4(Type.RIGHT);
public static final String APPLIED_RULES = "APPLIED_RULES";
protected final RulesCollection rules;
protected final LinkedList<PositionSequence<Term>> VAR_0;
protected IMPORT_2 expandedQuery;
protected SearchEngineRequestAdapter searchEngineRequestAdapter;
protected SelectionStrategy selectionStrategy;
public CommonRulesRewriter(final RulesCollection rules, final SelectionStrategy selectionStrategy) {
this.rules = rules;
VAR_0 = new LinkedList<>();
this.selectionStrategy = selectionStrategy;
}
@Override
public IMPORT_2 rewrite(final IMPORT_2 query) {
throw new CLASS_0("This rewriter needs a query context");
}
@Override
public IMPORT_2 rewrite(final IMPORT_2 query,
final SearchEngineRequestAdapter searchEngineRequestAdapter) {
final IMPORT_3<?> userQuery = query.getUserQuery();
if (userQuery instanceof Query) {
this.expandedQuery = query;
this.searchEngineRequestAdapter = searchEngineRequestAdapter;
VAR_0.add(new PositionSequence<>());
super.visit((BooleanQuery) query.getUserQuery());
applySequence(VAR_0.removeLast(), true);
if (((Query) userQuery).isEmpty()
&& (query.getBoostUpQueries() != null || query.getFilterQueries() != null)) {
query.FUNC_0(new MatchAllQuery(true));
}
}
return query;
}
@Override
public Node visit(final BooleanQuery VAR_1) {
VAR_0.add(new PositionSequence<>());
super.visit(VAR_1);
applySequence(VAR_0.removeLast(), false);
return null;
}
protected void applySequence(final PositionSequence<Term> sequence, boolean addBoundaries) {
final PositionSequence<InputSequenceElement> sequenceForLookUp = addBoundaries
? addBoundaries(sequence) : termSequenceToInputSequence(sequence);
final boolean isDebug = Boolean.TRUE.FUNC_1(searchEngineRequestAdapter.getContext()
.FUNC_2(CONTEXT_KEY_DEBUG_ENABLED));
List<String> actionsDebugInfo = (List<String>) searchEngineRequestAdapter.getContext()
.FUNC_2(CONTEXT_KEY_DEBUG_DATA);
// prepare debug info context object if requested
if (isDebug && actionsDebugInfo == null) {
actionsDebugInfo = new LinkedList<>();
searchEngineRequestAdapter.getContext().put(CONTEXT_KEY_DEBUG_DATA, actionsDebugInfo);
}
final TopRewritingActionCollector VAR_2 = selectionStrategy.createTopRewritingActionCollector();
rules.FUNC_3(sequenceForLookUp, VAR_2);
final List<Action> VAR_3 = VAR_2.evaluateBooleanInput().FUNC_4();
final InfoLoggingContext infoLoggingContext = searchEngineRequestAdapter.getInfoLoggingContext().orElse(null);
final boolean VAR_4 = infoLoggingContext != null && infoLoggingContext.isEnabledForRewriter();
final Set<String> appliedRules = VAR_4 ? new HashSet<>() : null;
for (final Action action : VAR_3) {
if (isDebug) {
actionsDebugInfo.add(action.FUNC_5());
}
final IMPORT_5 instructions = action.FUNC_6();
instructions.forEach(VAR_5 ->
VAR_5.FUNC_7(sequence, action.getTermMatches(),
action.getStartPosition(),
action.getEndPosition(), expandedQuery, searchEngineRequestAdapter)
);
if (VAR_4) {
instructions.FUNC_8(IMPORT_5.StandardPropertyNames.VAR_6)
.map(String::valueOf).FUNC_9(appliedRules::add);
}
}
if (VAR_4 && !appliedRules.isEmpty()) {
final IMPORT_6<String, Set<String>> message = new IdentityHashMap<>(1);
message.put(APPLIED_RULES, appliedRules);
infoLoggingContext.FUNC_10(message);
}
}
protected PositionSequence<InputSequenceElement> termSequenceToInputSequence(
final PositionSequence<Term> sequence) {
final PositionSequence<InputSequenceElement> result = new PositionSequence<>();
sequence.forEach(VAR_7 -> result.add(Collections.unmodifiableList(VAR_7)));
return result;
}
protected PositionSequence<InputSequenceElement> addBoundaries(final PositionSequence<Term> sequence) {
PositionSequence<InputSequenceElement> result = new PositionSequence<>();
result.nextPosition();
result.addElement(LEFT_BOUNDARY);
for (List<Term> VAR_7 : sequence) {
result.add(Collections.unmodifiableList(VAR_7));
}
result.nextPosition();
result.addElement(RIGHT_BOUNDARY);
return result;
}
@Override
public Node visit(final DisjunctionMaxQuery disjunctionMaxQuery) {
VAR_0.FUNC_11().nextPosition();
return super.visit(disjunctionMaxQuery);
}
@Override
public Node visit(final Term term) {
VAR_0.FUNC_11().addElement(term);
return super.visit(term);
}
}
| 0.201346 | {'IMPORT_0': 'commonrules', 'IMPORT_1': 'AbstractNodeVisitor', 'IMPORT_2': 'ExpandedQuery', 'IMPORT_3': 'QuerqyQuery', 'IMPORT_4': 'InputBoundary', 'IMPORT_5': 'Instructions', 'IMPORT_6': 'Map', 'VAR_0': 'sequencesStack', 'CLASS_0': 'UnsupportedOperationException', 'FUNC_0': 'setUserQuery', 'VAR_1': 'booleanQuery', 'FUNC_1': 'equals', 'FUNC_2': 'get', 'VAR_2': 'collector', 'FUNC_3': 'collectRewriteActions', 'VAR_3': 'actions', 'FUNC_4': 'createActions', 'VAR_4': 'infoLoggingEnabled', 'FUNC_5': 'toString', 'FUNC_6': 'getInstructions', 'VAR_5': 'instruction', 'FUNC_7': 'apply', 'FUNC_8': 'getProperty', 'VAR_6': 'LOG_MESSAGE', 'FUNC_9': 'ifPresent', 'FUNC_10': 'log', 'VAR_7': 'termList', 'FUNC_11': 'getLast'} | java | OOP | 35.42% |
package com.mauersu.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.mauersu.util.Constant;
@Controller
public class IndexController implements Constant{
@RequestMapping(value="/index", method=RequestMethod.GET)
public Object index(HttpServletRequest request, HttpServletResponse response) {
return "redirect:/redis";
}
@RequestMapping(value="/", method=RequestMethod.GET)
public Object home(HttpServletRequest request, HttpServletResponse response) {
return "redirect:/redis";
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2;
import IMPORT_3.IMPORT_4.IMPORT_5.HttpServletRequest;
import IMPORT_3.IMPORT_4.IMPORT_5.IMPORT_6;
import IMPORT_7.IMPORT_8.IMPORT_9.Controller;
import IMPORT_7.IMPORT_8.IMPORT_10.IMPORT_11.IMPORT_12.IMPORT_13;
import IMPORT_7.IMPORT_8.IMPORT_10.IMPORT_11.IMPORT_12.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_15.IMPORT_16;
@Controller
public class CLASS_0 implements IMPORT_16{
@IMPORT_13(VAR_0="/index", VAR_1=IMPORT_14.VAR_2)
public CLASS_1 index(HttpServletRequest VAR_3, IMPORT_6 VAR_4) {
return "redirect:/redis";
}
@IMPORT_13(VAR_0="/", VAR_1=IMPORT_14.VAR_2)
public CLASS_1 FUNC_0(HttpServletRequest VAR_3, IMPORT_6 VAR_4) {
return "redirect:/redis";
}
}
| 0.870564 | {'IMPORT_0': 'com', 'IMPORT_1': 'mauersu', 'IMPORT_2': 'controller', 'IMPORT_3': 'javax', 'IMPORT_4': 'servlet', 'IMPORT_5': 'http', 'IMPORT_6': 'HttpServletResponse', 'IMPORT_7': 'org', 'IMPORT_8': 'springframework', 'IMPORT_9': 'stereotype', 'IMPORT_10': 'web', 'IMPORT_11': 'bind', 'IMPORT_12': 'annotation', 'IMPORT_13': 'RequestMapping', 'IMPORT_14': 'RequestMethod', 'IMPORT_15': 'util', 'IMPORT_16': 'Constant', 'CLASS_0': 'IndexController', 'VAR_0': 'value', 'VAR_1': 'method', 'VAR_2': 'GET', 'CLASS_1': 'Object', 'VAR_3': 'request', 'VAR_4': 'response', 'FUNC_0': 'home'} | java | OOP | 100.00% |
package org.yuan.mapper;
import org.apache.ibatis.annotations.Param;
import org.yuan.my.mapper.MyMapper;
import org.yuan.pojo.Category;
import org.yuan.pojo.vo.CategoryVO;
import java.util.List;
import java.util.Map;
public interface CategoryMapperCustom {
List<CategoryVO> getSubCatList(Integer rootCatId);
List getSixNewItemLazy(@Param("paramMap") Map<String ,Object> map);
} | package org.IMPORT_0.mapper;
import org.apache.IMPORT_1.IMPORT_2.Param;
import org.IMPORT_0.my.mapper.IMPORT_3;
import org.IMPORT_0.pojo.Category;
import org.IMPORT_0.pojo.vo.CategoryVO;
import IMPORT_4.util.List;
import IMPORT_4.util.IMPORT_5;
public interface CategoryMapperCustom {
List<CategoryVO> FUNC_0(CLASS_0 rootCatId);
List FUNC_1(@Param("paramMap") IMPORT_5<CLASS_1 ,Object> map);
} | 0.50658 | {'IMPORT_0': 'yuan', 'IMPORT_1': 'ibatis', 'IMPORT_2': 'annotations', 'IMPORT_3': 'MyMapper', 'IMPORT_4': 'java', 'IMPORT_5': 'Map', 'FUNC_0': 'getSubCatList', 'CLASS_0': 'Integer', 'FUNC_1': 'getSixNewItemLazy', 'CLASS_1': 'String'} | java | Texto | 67.24% |
package JavaSyntaxExercises;
import java.util.Scanner;
public class VowelOrDigit {
public static void main(String[] args) {
Scanner scanner=new Scanner(System.in);
char[] vowels = {'a', 'e', 'o', 'u', 'y', 'i'};
char inputChar=scanner.next().charAt(0);
boolean isVowel=false;
for(int i=0; i<vowels.length;i++){
if(inputChar == vowels[i]){
isVowel=true;
}
}
boolean isDigit=true;
if(isVowel){
System.out.println("vowel");
}else if(inputChar>=48 && inputChar<=57){
System.out.println("digit");
}else {
System.out.println("other");
}
}
}
| package VAR_0;
import IMPORT_0.IMPORT_1.IMPORT_2;
public class CLASS_0 {
public static void main(CLASS_1[] args) {
IMPORT_2 scanner=new IMPORT_2(VAR_1.VAR_2);
char[] vowels = {'a', 'e', 'o', 'u', 'y', 'i'};
char VAR_3=scanner.FUNC_0().charAt(0);
boolean isVowel=false;
for(int VAR_4=0; VAR_4<vowels.VAR_5;VAR_4++){
if(VAR_3 == vowels[VAR_4]){
isVowel=true;
}
}
boolean VAR_6=true;
if(isVowel){
VAR_1.out.FUNC_1("vowel");
}else if(VAR_3>=48 && VAR_3<=57){
VAR_1.out.FUNC_1("digit");
}else {
VAR_1.out.FUNC_1("other");
}
}
}
| 0.690586 | {'VAR_0': 'JavaSyntaxExercises', 'IMPORT_0': 'java', 'IMPORT_1': 'util', 'IMPORT_2': 'Scanner', 'CLASS_0': 'VowelOrDigit', 'CLASS_1': 'String', 'VAR_1': 'System', 'VAR_2': 'in', 'VAR_3': 'inputChar', 'FUNC_0': 'next', 'VAR_4': 'i', 'VAR_5': 'length', 'VAR_6': 'isDigit', 'FUNC_1': 'println'} | java | OOP | 100.00% |
package p009co.apptailor.googlesignin;
import android.accounts.Account;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.AsyncTask;
import android.util.Log;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.BaseActivityEventListener;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.UiThreadUtil;
import com.facebook.react.bridge.WritableMap;
import com.google.android.gms.auth.GoogleAuthException;
import com.google.android.gms.auth.GoogleAuthUtil;
import com.google.android.gms.auth.UserRecoverableAuthException;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInStatusCodes;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule */
public class RNGoogleSigninModule extends ReactContextBaseJavaModule {
public static final String ERROR_USER_RECOVERABLE_AUTH = "ERROR_USER_RECOVERABLE_AUTH";
public static final String MODULE_NAME = "RNGoogleSignin";
public static final String PLAY_SERVICES_NOT_AVAILABLE = "PLAY_SERVICES_NOT_AVAILABLE";
public static final int RC_SIGN_IN = 9001;
public static final int REQUEST_CODE_RECOVER_AUTH = 53294;
private static final String SHOULD_RECOVER = "SHOULD_RECOVER";
/* access modifiers changed from: private */
public GoogleSignInClient _apiClient;
/* access modifiers changed from: private */
public PendingAuthRecovery pendingAuthRecovery;
/* access modifiers changed from: private */
public PromiseWrapper promiseWrapper = new PromiseWrapper();
public String getName() {
return MODULE_NAME;
}
public PromiseWrapper getPromiseWrapper() {
return this.promiseWrapper;
}
public RNGoogleSigninModule(ReactApplicationContext reactApplicationContext) {
super(reactApplicationContext);
reactApplicationContext.addActivityEventListener(new RNGoogleSigninActivityEventListener());
}
public Map<String, Object> getConstants() {
HashMap hashMap = new HashMap();
hashMap.put("BUTTON_SIZE_ICON", 2);
hashMap.put("BUTTON_SIZE_STANDARD", 0);
hashMap.put("BUTTON_SIZE_WIDE", 1);
hashMap.put("BUTTON_COLOR_AUTO", 2);
hashMap.put("BUTTON_COLOR_LIGHT", 1);
hashMap.put("BUTTON_COLOR_DARK", 0);
hashMap.put("SIGN_IN_CANCELLED", String.valueOf(GoogleSignInStatusCodes.SIGN_IN_CANCELLED));
hashMap.put("SIGN_IN_REQUIRED", String.valueOf(4));
hashMap.put("IN_PROGRESS", PromiseWrapper.ASYNC_OP_IN_PROGRESS);
hashMap.put(PLAY_SERVICES_NOT_AVAILABLE, PLAY_SERVICES_NOT_AVAILABLE);
return hashMap;
}
@ReactMethod
public void playServicesAvailable(boolean z, Promise promise) {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
Log.w(MODULE_NAME, "could not determine playServicesAvailable, activity is null");
promise.reject(MODULE_NAME, "activity is null");
return;
}
GoogleApiAvailability instance = GoogleApiAvailability.getInstance();
int isGooglePlayServicesAvailable = instance.isGooglePlayServicesAvailable(currentActivity);
if (isGooglePlayServicesAvailable != 0) {
if (z && instance.isUserResolvableError(isGooglePlayServicesAvailable)) {
instance.getErrorDialog(currentActivity, isGooglePlayServicesAvailable, 2404).show();
}
promise.reject(PLAY_SERVICES_NOT_AVAILABLE, "Play services not available");
return;
}
promise.resolve(true);
}
@ReactMethod
public void configure(ReadableMap readableMap, Promise promise) {
this._apiClient = GoogleSignIn.getClient((Context) getReactApplicationContext(), C0621Utils.getSignInOptions(C0621Utils.createScopesArray(readableMap.hasKey("scopes") ? readableMap.getArray("scopes") : Arguments.createArray()), readableMap.hasKey("webClientId") ? readableMap.getString("webClientId") : null, readableMap.hasKey("offlineAccess") && readableMap.getBoolean("offlineAccess"), readableMap.hasKey("forceCodeForRefreshToken") && readableMap.getBoolean("forceCodeForRefreshToken"), readableMap.hasKey("accountName") ? readableMap.getString("accountName") : null, readableMap.hasKey("hostedDomain") ? readableMap.getString("hostedDomain") : null));
promise.resolve((Object) null);
}
@ReactMethod
public void signInSilently(Promise promise) {
if (this._apiClient == null) {
rejectWithNullClientError(promise);
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "signInSilently");
UiThreadUtil.runOnUiThread(new Runnable() {
public void run() {
Task<GoogleSignInAccount> silentSignIn = RNGoogleSigninModule.this._apiClient.silentSignIn();
if (silentSignIn.isSuccessful()) {
RNGoogleSigninModule.this.handleSignInTaskResult(silentSignIn);
} else {
silentSignIn.addOnCompleteListener(new OnCompleteListener() {
public void onComplete(Task task) {
RNGoogleSigninModule.this.handleSignInTaskResult(task);
}
});
}
}
});
}
/* access modifiers changed from: private */
public void handleSignInTaskResult(Task<GoogleSignInAccount> task) {
try {
GoogleSignInAccount result = task.getResult(ApiException.class);
if (result == null) {
this.promiseWrapper.reject(MODULE_NAME, "GoogleSignInAccount instance was null");
return;
}
this.promiseWrapper.resolve(C0621Utils.getUserProperties(result));
} catch (ApiException e) {
int statusCode = e.getStatusCode();
this.promiseWrapper.reject(String.valueOf(statusCode), GoogleSignInStatusCodes.getStatusCodeString(statusCode));
}
}
@ReactMethod
public void signIn(Promise promise) {
if (this._apiClient == null) {
rejectWithNullClientError(promise);
return;
}
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
promise.reject(MODULE_NAME, "activity is null");
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "signIn");
UiThreadUtil.runOnUiThread(new Runnable() {
public void run() {
currentActivity.startActivityForResult(RNGoogleSigninModule.this._apiClient.getSignInIntent(), RNGoogleSigninModule.RC_SIGN_IN);
}
});
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$RNGoogleSigninActivityEventListener */
private class RNGoogleSigninActivityEventListener extends BaseActivityEventListener {
private RNGoogleSigninActivityEventListener() {
}
public void onActivityResult(Activity activity, int i, int i2, Intent intent) {
if (i == 9001) {
RNGoogleSigninModule.this.handleSignInTaskResult(GoogleSignIn.getSignedInAccountFromIntent(intent));
} else if (i != 53294) {
} else {
if (i2 == -1) {
RNGoogleSigninModule.this.rerunFailedAuthTokenTask();
} else {
RNGoogleSigninModule.this.promiseWrapper.reject(RNGoogleSigninModule.MODULE_NAME, "Failed authentication recovery attempt, probably user-rejected.");
}
}
}
}
/* access modifiers changed from: private */
public void rerunFailedAuthTokenTask() {
WritableMap userProperties = this.pendingAuthRecovery.getUserProperties();
if (userProperties != null) {
new AccessTokenRetrievalTask(this).execute(new WritableMap[]{userProperties, null});
return;
}
this.promiseWrapper.reject(MODULE_NAME, "rerunFailedAuthTokenTask: recovery failed");
}
@ReactMethod
public void signOut(final Promise promise) {
GoogleSignInClient googleSignInClient = this._apiClient;
if (googleSignInClient == null) {
rejectWithNullClientError(promise);
} else {
googleSignInClient.signOut().addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(Task<Void> task) {
RNGoogleSigninModule.this.handleSignOutOrRevokeAccessTask(task, promise);
}
});
}
}
/* access modifiers changed from: private */
public void handleSignOutOrRevokeAccessTask(Task<Void> task, Promise promise) {
if (task.isSuccessful()) {
promise.resolve((Object) null);
return;
}
int exceptionCode = C0621Utils.getExceptionCode(task);
promise.reject(String.valueOf(exceptionCode), GoogleSignInStatusCodes.getStatusCodeString(exceptionCode));
}
@ReactMethod
public void revokeAccess(final Promise promise) {
GoogleSignInClient googleSignInClient = this._apiClient;
if (googleSignInClient == null) {
rejectWithNullClientError(promise);
} else {
googleSignInClient.revokeAccess().addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(Task<Void> task) {
RNGoogleSigninModule.this.handleSignOutOrRevokeAccessTask(task, promise);
}
});
}
}
@ReactMethod
public void isSignedIn(Promise promise) {
promise.resolve(Boolean.valueOf(GoogleSignIn.getLastSignedInAccount(getReactApplicationContext()) != null));
}
@ReactMethod
public void getCurrentUser(Promise promise) {
WritableMap writableMap;
GoogleSignInAccount lastSignedInAccount = GoogleSignIn.getLastSignedInAccount(getReactApplicationContext());
if (lastSignedInAccount == null) {
writableMap = null;
} else {
writableMap = C0621Utils.getUserProperties(lastSignedInAccount);
}
promise.resolve(writableMap);
}
@ReactMethod
public void clearCachedAccessToken(String str, Promise promise) {
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "clearCachedAccessToken");
new TokenClearingTask(this).execute(new String[]{str});
}
@ReactMethod
public void getTokens(Promise promise) {
GoogleSignInAccount lastSignedInAccount = GoogleSignIn.getLastSignedInAccount(getReactApplicationContext());
if (lastSignedInAccount == null) {
promise.reject(MODULE_NAME, "getTokens requires a user to be signed in");
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "getTokens");
startTokenRetrievalTaskWithRecovery(lastSignedInAccount);
}
private void startTokenRetrievalTaskWithRecovery(GoogleSignInAccount googleSignInAccount) {
WritableMap userProperties = C0621Utils.getUserProperties(googleSignInAccount);
WritableMap createMap = Arguments.createMap();
createMap.putBoolean(SHOULD_RECOVER, true);
new AccessTokenRetrievalTask(this).execute(new WritableMap[]{userProperties, createMap});
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$AccessTokenRetrievalTask */
private static class AccessTokenRetrievalTask extends AsyncTask<WritableMap, Void, Void> {
private WeakReference<RNGoogleSigninModule> weakModuleRef;
AccessTokenRetrievalTask(RNGoogleSigninModule rNGoogleSigninModule) {
this.weakModuleRef = new WeakReference<>(rNGoogleSigninModule);
}
/* access modifiers changed from: protected */
public Void doInBackground(WritableMap... writableMapArr) {
WritableMap writableMap = writableMapArr[0];
RNGoogleSigninModule rNGoogleSigninModule = (RNGoogleSigninModule) this.weakModuleRef.get();
if (rNGoogleSigninModule == null) {
return null;
}
try {
insertAccessTokenIntoUserProperties(rNGoogleSigninModule, writableMap);
rNGoogleSigninModule.getPromiseWrapper().resolve(writableMap);
} catch (Exception e) {
handleException(rNGoogleSigninModule, e, writableMap, writableMapArr.length >= 2 ? writableMapArr[1] : null);
}
return null;
}
private void insertAccessTokenIntoUserProperties(RNGoogleSigninModule rNGoogleSigninModule, WritableMap writableMap) throws IOException, GoogleAuthException {
writableMap.putString("accessToken", GoogleAuthUtil.getToken((Context) rNGoogleSigninModule.getReactApplicationContext(), new Account(writableMap.getMap("user").getString("email"), "com.google"), C0621Utils.scopesToString(writableMap.getArray("scopes"))));
}
private void handleException(RNGoogleSigninModule rNGoogleSigninModule, Exception exc, WritableMap writableMap, WritableMap writableMap2) {
if (exc instanceof UserRecoverableAuthException) {
if (writableMap2 != null && writableMap2.hasKey(RNGoogleSigninModule.SHOULD_RECOVER) && writableMap2.getBoolean(RNGoogleSigninModule.SHOULD_RECOVER)) {
attemptRecovery(rNGoogleSigninModule, exc, writableMap);
} else {
rNGoogleSigninModule.promiseWrapper.reject(RNGoogleSigninModule.ERROR_USER_RECOVERABLE_AUTH, (Throwable) exc);
}
} else {
rNGoogleSigninModule.promiseWrapper.reject(RNGoogleSigninModule.MODULE_NAME, (Throwable) exc);
}
}
private void attemptRecovery(RNGoogleSigninModule rNGoogleSigninModule, Exception exc, WritableMap writableMap) {
Activity access$700 = rNGoogleSigninModule.getCurrentActivity();
if (access$700 == null) {
PendingAuthRecovery unused = rNGoogleSigninModule.pendingAuthRecovery = null;
PromiseWrapper access$400 = rNGoogleSigninModule.promiseWrapper;
access$400.reject(RNGoogleSigninModule.MODULE_NAME, "Cannot attempt recovery auth because app is not in foreground. " + exc.getLocalizedMessage());
return;
}
PendingAuthRecovery unused2 = rNGoogleSigninModule.pendingAuthRecovery = new PendingAuthRecovery(writableMap);
access$700.startActivityForResult(((UserRecoverableAuthException) exc).getIntent(), RNGoogleSigninModule.REQUEST_CODE_RECOVER_AUTH);
}
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$TokenClearingTask */
private static class TokenClearingTask extends AsyncTask<String, Void, Void> {
private WeakReference<RNGoogleSigninModule> weakModuleRef;
TokenClearingTask(RNGoogleSigninModule rNGoogleSigninModule) {
this.weakModuleRef = new WeakReference<>(rNGoogleSigninModule);
}
/* access modifiers changed from: protected */
public Void doInBackground(String... strArr) {
RNGoogleSigninModule rNGoogleSigninModule = (RNGoogleSigninModule) this.weakModuleRef.get();
if (rNGoogleSigninModule == null) {
return null;
}
try {
GoogleAuthUtil.clearToken(rNGoogleSigninModule.getReactApplicationContext(), strArr[0]);
rNGoogleSigninModule.getPromiseWrapper().resolve((Object) null);
} catch (Exception e) {
rNGoogleSigninModule.promiseWrapper.reject(RNGoogleSigninModule.MODULE_NAME, (Throwable) e);
}
return null;
}
}
private void rejectWithNullClientError(Promise promise) {
promise.reject(MODULE_NAME, "apiClient is null - call configure first");
}
}
| package IMPORT_0.apptailor.IMPORT_1;
import android.accounts.IMPORT_2;
import android.app.Activity;
import android.content.IMPORT_3;
import android.content.Intent;
import android.os.AsyncTask;
import android.IMPORT_4.IMPORT_5;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.Arguments;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_10;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.Promise;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.ReactApplicationContext;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.ReactContextBaseJavaModule;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.ReactMethod;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_11;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_12;
import IMPORT_6.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_13;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.GoogleAuthException;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.GoogleAuthUtil;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.UserRecoverableAuthException;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.api.signin.IMPORT_16;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.api.signin.GoogleSignInAccount;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.api.signin.IMPORT_17;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_15.api.signin.GoogleSignInStatusCodes;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_18.GoogleApiAvailability;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_18.api.ApiException;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_19.OnCompleteListener;
import IMPORT_6.IMPORT_14.android.gms.IMPORT_19.Task;
import IMPORT_20.io.IOException;
import IMPORT_20.IMPORT_21.IMPORT_22.WeakReference;
import IMPORT_20.IMPORT_4.HashMap;
import IMPORT_20.IMPORT_4.Map;
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule */
public class CLASS_0 extends ReactContextBaseJavaModule {
public static final String ERROR_USER_RECOVERABLE_AUTH = "ERROR_USER_RECOVERABLE_AUTH";
public static final String VAR_1 = "RNGoogleSignin";
public static final String VAR_2 = "PLAY_SERVICES_NOT_AVAILABLE";
public static final int VAR_3 = 9001;
public static final int VAR_4 = 53294;
private static final String VAR_5 = "SHOULD_RECOVER";
/* access modifiers changed from: private */
public IMPORT_17 _apiClient;
/* access modifiers changed from: private */
public CLASS_1 VAR_6;
/* access modifiers changed from: private */
public PromiseWrapper promiseWrapper = new PromiseWrapper();
public String FUNC_0() {
return VAR_1;
}
public PromiseWrapper getPromiseWrapper() {
return this.promiseWrapper;
}
public CLASS_0(ReactApplicationContext VAR_7) {
super(VAR_7);
VAR_7.FUNC_1(new RNGoogleSigninActivityEventListener());
}
public Map<String, Object> getConstants() {
HashMap hashMap = new HashMap();
hashMap.put("BUTTON_SIZE_ICON", 2);
hashMap.put("BUTTON_SIZE_STANDARD", 0);
hashMap.put("BUTTON_SIZE_WIDE", 1);
hashMap.put("BUTTON_COLOR_AUTO", 2);
hashMap.put("BUTTON_COLOR_LIGHT", 1);
hashMap.put("BUTTON_COLOR_DARK", 0);
hashMap.put("SIGN_IN_CANCELLED", String.valueOf(GoogleSignInStatusCodes.SIGN_IN_CANCELLED));
hashMap.put("SIGN_IN_REQUIRED", String.valueOf(4));
hashMap.put("IN_PROGRESS", PromiseWrapper.VAR_8);
hashMap.put(VAR_2, VAR_2);
return hashMap;
}
@ReactMethod
public void playServicesAvailable(boolean VAR_9, Promise promise) {
Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
IMPORT_5.w(VAR_1, "could not determine playServicesAvailable, activity is null");
promise.reject(VAR_1, "activity is null");
return;
}
GoogleApiAvailability VAR_10 = GoogleApiAvailability.getInstance();
int isGooglePlayServicesAvailable = VAR_10.isGooglePlayServicesAvailable(currentActivity);
if (isGooglePlayServicesAvailable != 0) {
if (VAR_9 && VAR_10.FUNC_2(isGooglePlayServicesAvailable)) {
VAR_10.FUNC_3(currentActivity, isGooglePlayServicesAvailable, 2404).FUNC_4();
}
promise.reject(VAR_2, "Play services not available");
return;
}
promise.resolve(true);
}
@ReactMethod
public void FUNC_5(IMPORT_11 readableMap, Promise promise) {
this._apiClient = IMPORT_16.FUNC_6((IMPORT_3) getReactApplicationContext(), C0621Utils.getSignInOptions(C0621Utils.FUNC_7(readableMap.FUNC_8("scopes") ? readableMap.getArray("scopes") : Arguments.createArray()), readableMap.FUNC_8("webClientId") ? readableMap.getString("webClientId") : null, readableMap.FUNC_8("offlineAccess") && readableMap.getBoolean("offlineAccess"), readableMap.FUNC_8("forceCodeForRefreshToken") && readableMap.getBoolean("forceCodeForRefreshToken"), readableMap.FUNC_8("accountName") ? readableMap.getString("accountName") : null, readableMap.FUNC_8("hostedDomain") ? readableMap.getString("hostedDomain") : null));
promise.resolve((Object) null);
}
@ReactMethod
public void FUNC_9(Promise promise) {
if (this._apiClient == null) {
rejectWithNullClientError(promise);
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "signInSilently");
IMPORT_12.FUNC_10(new Runnable() {
public void run() {
Task<GoogleSignInAccount> VAR_11 = VAR_0.this._apiClient.FUNC_11();
if (VAR_11.isSuccessful()) {
VAR_0.this.handleSignInTaskResult(VAR_11);
} else {
VAR_11.addOnCompleteListener(new OnCompleteListener() {
public void onComplete(Task VAR_12) {
VAR_0.this.handleSignInTaskResult(VAR_12);
}
});
}
}
});
}
/* access modifiers changed from: private */
public void handleSignInTaskResult(Task<GoogleSignInAccount> VAR_12) {
try {
GoogleSignInAccount result = VAR_12.getResult(ApiException.class);
if (result == null) {
this.promiseWrapper.reject(VAR_1, "GoogleSignInAccount instance was null");
return;
}
this.promiseWrapper.resolve(C0621Utils.FUNC_12(result));
} catch (ApiException VAR_13) {
int statusCode = VAR_13.getStatusCode();
this.promiseWrapper.reject(String.valueOf(statusCode), GoogleSignInStatusCodes.getStatusCodeString(statusCode));
}
}
@ReactMethod
public void signIn(Promise promise) {
if (this._apiClient == null) {
rejectWithNullClientError(promise);
return;
}
final Activity currentActivity = getCurrentActivity();
if (currentActivity == null) {
promise.reject(VAR_1, "activity is null");
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "signIn");
IMPORT_12.FUNC_10(new Runnable() {
public void run() {
currentActivity.FUNC_13(VAR_0.this._apiClient.FUNC_14(), VAR_0.VAR_3);
}
});
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$RNGoogleSigninActivityEventListener */
private class RNGoogleSigninActivityEventListener extends IMPORT_10 {
private RNGoogleSigninActivityEventListener() {
}
public void FUNC_15(Activity activity, int VAR_14, int VAR_15, Intent intent) {
if (VAR_14 == 9001) {
VAR_0.this.handleSignInTaskResult(IMPORT_16.getSignedInAccountFromIntent(intent));
} else if (VAR_14 != 53294) {
} else {
if (VAR_15 == -1) {
VAR_0.this.rerunFailedAuthTokenTask();
} else {
VAR_0.this.promiseWrapper.reject(VAR_0.VAR_1, "Failed authentication recovery attempt, probably user-rejected.");
}
}
}
}
/* access modifiers changed from: private */
public void rerunFailedAuthTokenTask() {
IMPORT_13 userProperties = this.VAR_6.FUNC_12();
if (userProperties != null) {
new CLASS_2(this).execute(new IMPORT_13[]{userProperties, null});
return;
}
this.promiseWrapper.reject(VAR_1, "rerunFailedAuthTokenTask: recovery failed");
}
@ReactMethod
public void FUNC_16(final Promise promise) {
IMPORT_17 VAR_16 = this._apiClient;
if (VAR_16 == null) {
rejectWithNullClientError(promise);
} else {
VAR_16.FUNC_16().addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(Task<Void> VAR_12) {
VAR_0.this.handleSignOutOrRevokeAccessTask(VAR_12, promise);
}
});
}
}
/* access modifiers changed from: private */
public void handleSignOutOrRevokeAccessTask(Task<Void> VAR_12, Promise promise) {
if (VAR_12.isSuccessful()) {
promise.resolve((Object) null);
return;
}
int VAR_17 = C0621Utils.FUNC_17(VAR_12);
promise.reject(String.valueOf(VAR_17), GoogleSignInStatusCodes.getStatusCodeString(VAR_17));
}
@ReactMethod
public void revokeAccess(final Promise promise) {
IMPORT_17 VAR_16 = this._apiClient;
if (VAR_16 == null) {
rejectWithNullClientError(promise);
} else {
VAR_16.revokeAccess().addOnCompleteListener(new OnCompleteListener<Void>() {
public void onComplete(Task<Void> VAR_12) {
VAR_0.this.handleSignOutOrRevokeAccessTask(VAR_12, promise);
}
});
}
}
@ReactMethod
public void FUNC_18(Promise promise) {
promise.resolve(VAR_18.valueOf(IMPORT_16.FUNC_19(getReactApplicationContext()) != null));
}
@ReactMethod
public void getCurrentUser(Promise promise) {
IMPORT_13 writableMap;
GoogleSignInAccount lastSignedInAccount = IMPORT_16.FUNC_19(getReactApplicationContext());
if (lastSignedInAccount == null) {
writableMap = null;
} else {
writableMap = C0621Utils.FUNC_12(lastSignedInAccount);
}
promise.resolve(writableMap);
}
@ReactMethod
public void FUNC_20(String str, Promise promise) {
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "clearCachedAccessToken");
new CLASS_3(this).execute(new String[]{str});
}
@ReactMethod
public void getTokens(Promise promise) {
GoogleSignInAccount lastSignedInAccount = IMPORT_16.FUNC_19(getReactApplicationContext());
if (lastSignedInAccount == null) {
promise.reject(VAR_1, "getTokens requires a user to be signed in");
return;
}
this.promiseWrapper.setPromiseWithInProgressCheck(promise, "getTokens");
startTokenRetrievalTaskWithRecovery(lastSignedInAccount);
}
private void startTokenRetrievalTaskWithRecovery(GoogleSignInAccount VAR_19) {
IMPORT_13 userProperties = C0621Utils.FUNC_12(VAR_19);
IMPORT_13 VAR_20 = Arguments.FUNC_21();
VAR_20.FUNC_22(VAR_5, true);
new CLASS_2(this).execute(new IMPORT_13[]{userProperties, VAR_20});
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$AccessTokenRetrievalTask */
private static class CLASS_2 extends AsyncTask<IMPORT_13, Void, Void> {
private WeakReference<CLASS_0> VAR_21;
CLASS_2(CLASS_0 rNGoogleSigninModule) {
this.VAR_21 = new WeakReference<>(rNGoogleSigninModule);
}
/* access modifiers changed from: protected */
public Void FUNC_23(IMPORT_13... VAR_22) {
IMPORT_13 writableMap = VAR_22[0];
CLASS_0 rNGoogleSigninModule = (CLASS_0) this.VAR_21.get();
if (rNGoogleSigninModule == null) {
return null;
}
try {
insertAccessTokenIntoUserProperties(rNGoogleSigninModule, writableMap);
rNGoogleSigninModule.getPromiseWrapper().resolve(writableMap);
} catch (Exception VAR_13) {
handleException(rNGoogleSigninModule, VAR_13, writableMap, VAR_22.VAR_23 >= 2 ? VAR_22[1] : null);
}
return null;
}
private void insertAccessTokenIntoUserProperties(CLASS_0 rNGoogleSigninModule, IMPORT_13 writableMap) throws IOException, GoogleAuthException {
writableMap.FUNC_24("accessToken", GoogleAuthUtil.getToken((IMPORT_3) rNGoogleSigninModule.getReactApplicationContext(), new IMPORT_2(writableMap.FUNC_25("user").getString("email"), "com.google"), C0621Utils.FUNC_26(writableMap.getArray("scopes"))));
}
private void handleException(CLASS_0 rNGoogleSigninModule, Exception exc, IMPORT_13 writableMap, IMPORT_13 writableMap2) {
if (exc instanceof UserRecoverableAuthException) {
if (writableMap2 != null && writableMap2.FUNC_8(VAR_0.VAR_5) && writableMap2.getBoolean(VAR_0.VAR_5)) {
FUNC_27(rNGoogleSigninModule, exc, writableMap);
} else {
rNGoogleSigninModule.promiseWrapper.reject(VAR_0.ERROR_USER_RECOVERABLE_AUTH, (Throwable) exc);
}
} else {
rNGoogleSigninModule.promiseWrapper.reject(VAR_0.VAR_1, (Throwable) exc);
}
}
private void FUNC_27(CLASS_0 rNGoogleSigninModule, Exception exc, IMPORT_13 writableMap) {
Activity access$700 = rNGoogleSigninModule.getCurrentActivity();
if (access$700 == null) {
CLASS_1 unused = rNGoogleSigninModule.VAR_6 = null;
PromiseWrapper VAR_24 = rNGoogleSigninModule.promiseWrapper;
VAR_24.reject(VAR_0.VAR_1, "Cannot attempt recovery auth because app is not in foreground. " + exc.FUNC_28());
return;
}
CLASS_1 VAR_25 = rNGoogleSigninModule.VAR_6 = new CLASS_1(writableMap);
access$700.FUNC_13(((UserRecoverableAuthException) exc).getIntent(), VAR_0.VAR_4);
}
}
/* renamed from: co.apptailor.googlesignin.RNGoogleSigninModule$TokenClearingTask */
private static class CLASS_3 extends AsyncTask<String, Void, Void> {
private WeakReference<CLASS_0> VAR_21;
CLASS_3(CLASS_0 rNGoogleSigninModule) {
this.VAR_21 = new WeakReference<>(rNGoogleSigninModule);
}
/* access modifiers changed from: protected */
public Void FUNC_23(String... VAR_26) {
CLASS_0 rNGoogleSigninModule = (CLASS_0) this.VAR_21.get();
if (rNGoogleSigninModule == null) {
return null;
}
try {
GoogleAuthUtil.FUNC_29(rNGoogleSigninModule.getReactApplicationContext(), VAR_26[0]);
rNGoogleSigninModule.getPromiseWrapper().resolve((Object) null);
} catch (Exception VAR_13) {
rNGoogleSigninModule.promiseWrapper.reject(VAR_0.VAR_1, (Throwable) VAR_13);
}
return null;
}
}
private void rejectWithNullClientError(Promise promise) {
promise.reject(VAR_1, "apiClient is null - call configure first");
}
}
| 0.38863 | {'IMPORT_0': 'p009co', 'IMPORT_1': 'googlesignin', 'IMPORT_2': 'Account', 'IMPORT_3': 'Context', 'IMPORT_4': 'util', 'IMPORT_5': 'Log', 'IMPORT_6': 'com', 'IMPORT_7': 'facebook', 'IMPORT_8': 'react', 'IMPORT_9': 'bridge', 'IMPORT_10': 'BaseActivityEventListener', 'IMPORT_11': 'ReadableMap', 'IMPORT_12': 'UiThreadUtil', 'IMPORT_13': 'WritableMap', 'IMPORT_14': 'google', 'IMPORT_15': 'auth', 'IMPORT_16': 'GoogleSignIn', 'IMPORT_17': 'GoogleSignInClient', 'IMPORT_18': 'common', 'IMPORT_19': 'tasks', 'IMPORT_20': 'java', 'IMPORT_21': 'lang', 'IMPORT_22': 'ref', 'CLASS_0': 'RNGoogleSigninModule', 'VAR_0': 'RNGoogleSigninModule', 'VAR_1': 'MODULE_NAME', 'VAR_2': 'PLAY_SERVICES_NOT_AVAILABLE', 'VAR_3': 'RC_SIGN_IN', 'VAR_4': 'REQUEST_CODE_RECOVER_AUTH', 'VAR_5': 'SHOULD_RECOVER', 'CLASS_1': 'PendingAuthRecovery', 'VAR_6': 'pendingAuthRecovery', 'FUNC_0': 'getName', 'VAR_7': 'reactApplicationContext', 'FUNC_1': 'addActivityEventListener', 'VAR_8': 'ASYNC_OP_IN_PROGRESS', 'VAR_9': 'z', 'VAR_10': 'instance', 'FUNC_2': 'isUserResolvableError', 'FUNC_3': 'getErrorDialog', 'FUNC_4': 'show', 'FUNC_5': 'configure', 'FUNC_6': 'getClient', 'FUNC_7': 'createScopesArray', 'FUNC_8': 'hasKey', 'FUNC_9': 'signInSilently', 'FUNC_10': 'runOnUiThread', 'VAR_11': 'silentSignIn', 'FUNC_11': 'silentSignIn', 'VAR_12': 'task', 'FUNC_12': 'getUserProperties', 'VAR_13': 'e', 'FUNC_13': 'startActivityForResult', 'FUNC_14': 'getSignInIntent', 'FUNC_15': 'onActivityResult', 'VAR_14': 'i', 'VAR_15': 'i2', 'CLASS_2': 'AccessTokenRetrievalTask', 'FUNC_16': 'signOut', 'VAR_16': 'googleSignInClient', 'VAR_17': 'exceptionCode', 'FUNC_17': 'getExceptionCode', 'FUNC_18': 'isSignedIn', 'VAR_18': 'Boolean', 'FUNC_19': 'getLastSignedInAccount', 'FUNC_20': 'clearCachedAccessToken', 'CLASS_3': 'TokenClearingTask', 'VAR_19': 'googleSignInAccount', 'VAR_20': 'createMap', 'FUNC_21': 'createMap', 'FUNC_22': 'putBoolean', 'VAR_21': 'weakModuleRef', 'FUNC_23': 'doInBackground', 'VAR_22': 'writableMapArr', 'VAR_23': 'length', 'FUNC_24': 'putString', 'FUNC_25': 'getMap', 'FUNC_26': 'scopesToString', 'FUNC_27': 'attemptRecovery', 'VAR_24': 'access$400', 'FUNC_28': 'getLocalizedMessage', 'VAR_25': 'unused2', 'VAR_26': 'strArr', 'FUNC_29': 'clearToken'} | java | OOP | 16.95% |
/**
* Builder pattern for Compression Settings. See CompressionSettings for details on values.
*/
public class CompressionSettingsBuilder {
private double samplingRatio;
private boolean allowSharedDictionary = false;
private String transposeInput;
private int seed = -1;
private boolean lossy = false;
private EnumSet<CompressionType> validCompressions;
private boolean sortValuesByLength = true;
private int maxColGroupCoCode = 10000;
private double coCodePercentage = 0.01;
private int minimumSampleSize = 3000;
private int maxSampleSize = 1000000;
private EstimationType estimationType = EstimationType.HassAndStokes;
private PartitionerType columnPartitioner;
private CostType costType;
private double minimumCompressionRatio = 1.0;
private boolean isInSparkInstruction = false;
private SORT_TYPE sdcSortType = SORT_TYPE.MATERIALIZE;
public CompressionSettingsBuilder() {
DMLConfig conf = ConfigurationManager.getDMLConfig();
this.lossy = conf.getBooleanValue(DMLConfig.COMPRESSED_LOSSY);
this.validCompressions = EnumSet.of(CompressionType.UNCOMPRESSED, CompressionType.CONST);
String[] validCompressionsString = conf.getTextValue(DMLConfig.COMPRESSED_VALID_COMPRESSIONS).split(",");
for(String comp : validCompressionsString)
validCompressions.add(CompressionType.valueOf(comp));
samplingRatio = conf.getDoubleValue(DMLConfig.COMPRESSED_SAMPLING_RATIO);
columnPartitioner = PartitionerType.valueOf(conf.getTextValue(DMLConfig.COMPRESSED_COCODE));
costType = CostType.valueOf(conf.getTextValue(DMLConfig.COMPRESSED_COST_MODEL));
transposeInput = conf.getTextValue(DMLConfig.COMPRESSED_TRANSPOSE);
}
/**
* Copy the settings from another CompressionSettings Builder, modifies this, not that.
*
* @param that The other CompressionSettingsBuilder to copy settings from.
* @return The modified CompressionSettings in the same object.
*/
public CompressionSettingsBuilder copySettings(CompressionSettings that) {
this.samplingRatio = that.samplingRatio;
this.allowSharedDictionary = that.allowSharedDictionary;
this.transposeInput = that.transposeInput;
this.seed = that.seed;
this.lossy = that.lossy;
this.validCompressions = EnumSet.copyOf(that.validCompressions);
this.sortValuesByLength = that.sortTuplesByFrequency;
this.columnPartitioner = that.columnPartitioner;
this.maxColGroupCoCode = that.maxColGroupCoCode;
this.coCodePercentage = that.coCodePercentage;
this.minimumSampleSize = that.minimumSampleSize;
return this;
}
/**
* Set the Compression to use Lossy compression.
*
* @param lossy A boolean specifying if the compression should be lossy
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setLossy(boolean lossy) {
this.lossy = lossy;
return this;
}
/**
* Set the sampling ratio in percent to sample the input matrix. Input value should be in range 0.0 - 1.0
*
* @param samplingRatio The ratio to sample from the input
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setSamplingRatio(double samplingRatio) {
this.samplingRatio = samplingRatio;
return this;
}
/**
* Set the sortValuesByLength flag. This sorts the dictionaries containing the data based on their occurences in the
* ColGroup. Improving cache efficiency especially for diverse column groups.
*
* @param sortValuesByLength A boolean specifying if the values should be sorted
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setSortValuesByLength(boolean sortValuesByLength) {
this.sortValuesByLength = sortValuesByLength;
return this;
}
/**
* Allow the Dictionaries to be shared between different column groups.
*
* @param allowSharedDictionary A boolean specifying if the dictionary can be shared between column groups.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setAllowSharedDictionary(boolean allowSharedDictionary) {
this.allowSharedDictionary = allowSharedDictionary;
return this;
}
/**
* Specify if the input matrix should be transposed before compression. This improves cache efficiency while
* compression the input matrix
*
* @param transposeInput string specifying if the input should be transposed before compression, should be one of
* "auto", "true" or "false"
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setTransposeInput(String transposeInput) {
switch(transposeInput) {
case "auto":
case "true":
case "false":
this.transposeInput = transposeInput;
break;
default:
throw new DMLCompressionException("Invalid transpose technique");
}
return this;
}
/**
* Set the seed for the compression operation.
*
* @param seed The seed used in sampling the matrix and general operations in the compression.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setSeed(int seed) {
this.seed = seed;
return this;
}
/**
* Set the valid compression strategies used for the compression.
*
* @param validCompressions An EnumSet of CompressionTypes to use in the compression
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setValidCompressions(EnumSet<CompressionType> validCompressions) {
// should always contain Uncompressed as an option.
if(!validCompressions.contains(CompressionType.UNCOMPRESSED))
validCompressions.add(CompressionType.UNCOMPRESSED);
if(!validCompressions.contains(CompressionType.CONST))
validCompressions.add(CompressionType.CONST);
this.validCompressions = validCompressions;
return this;
}
/**
* Add a single valid compression type to the EnumSet of valid compressions.
*
* @param cp The compression type to add to the valid ones.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder addValidCompression(CompressionType cp) {
this.validCompressions.add(cp);
return this;
}
/**
* Clear all the compression types allowed in the compression. This will only allow the Uncompressed ColGroup type.
* Since this is required for operation of the compression
*
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder clearValidCompression() {
this.validCompressions = EnumSet.of(CompressionType.UNCOMPRESSED);
return this;
}
/**
* Set the type of CoCoding Partitioner type to use for combining columns together.
*
* @param columnPartitioner The Strategy to select from PartitionerType
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setColumnPartitioner(PartitionerType columnPartitioner) {
this.columnPartitioner = columnPartitioner;
return this;
}
/**
* Set the maximum number of columns to CoCode together in the CoCoding strategy. Compression time increase with
* higher numbers.
*
* @param maxColGroupCoCode The max selected.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setMaxColGroupCoCode(int maxColGroupCoCode) {
this.maxColGroupCoCode = maxColGroupCoCode;
return this;
}
/**
* Set the coCode percentage, the effect is different based on the coCoding strategy, but the general effect is that
* higher values results in more coCoding while lower values result in less.
*
* Note that with high coCoding the compression ratio would possibly be lower.
*
* @param coCodePercentage The percentage to set.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setCoCodePercentage(double coCodePercentage) {
this.coCodePercentage = coCodePercentage;
return this;
}
/**
* Set the minimum sample size to extract from a given matrix, this overrules the sample percentage if the sample
* percentage extracted is lower than this minimum bound.
*
* @param minimumSampleSize The minimum sample size to extract
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setMinimumSampleSize(int minimumSampleSize) {
this.minimumSampleSize = minimumSampleSize;
return this;
}
/**
* Set the maximum sample size to extract from a given matrix, this overrules the sample percentage if the sample
* percentage extracted is higher than this maximum bound.
*
* @param maxSampleSize The maximum sample size to extract
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setMaxSampleSize(int maxSampleSize) {
this.maxSampleSize = maxSampleSize;
return this;
}
/**
* Set the estimation type used for the sampled estimates.
*
* @param estimationType the estimation type in used.
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setEstimationType(EstimationType estimationType) {
this.estimationType = estimationType;
return this;
}
/**
* Set the cost type used for estimating the cost of column groups default is memory based.
*
* @param costType The Cost type wanted
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setCostType(CostType costType) {
this.costType = costType;
return this;
}
/**
* Set the minimum compression ratio to be achieved by the compression.
*
* @param ratio The ratio to achieve while compressing
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setMinimumCompressionRatio(double ratio) {
this.minimumCompressionRatio = ratio;
return this;
}
/**
* Inform the compression that it is executed in a spark instruction.
*
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setIsInSparkInstruction() {
this.isInSparkInstruction = true;
return this;
}
/**
* Set the sort type to use.
*
* @param sdcSortType The sort type for the construction of SDC groups
* @return The CompressionSettingsBuilder
*/
public CompressionSettingsBuilder setSDCSortType(SORT_TYPE sdcSortType) {
this.sdcSortType = sdcSortType;
return this;
}
/**
* Create the CompressionSettings object to use in the compression.
*
* @return The CompressionSettings
*/
public CompressionSettings create() {
return new CompressionSettings(samplingRatio, allowSharedDictionary, transposeInput, seed, lossy,
validCompressions, sortValuesByLength, columnPartitioner, maxColGroupCoCode, coCodePercentage,
minimumSampleSize, maxSampleSize, estimationType, costType, minimumCompressionRatio, isInSparkInstruction,
sdcSortType);
}
} | /**
* Builder pattern for Compression Settings. See CompressionSettings for details on values.
*/
public class CLASS_0 {
private double VAR_0;
private boolean allowSharedDictionary = false;
private CLASS_1 transposeInput;
private int VAR_1 = -1;
private boolean lossy = false;
private CLASS_2<CompressionType> VAR_3;
private boolean sortValuesByLength = true;
private int VAR_4 = 10000;
private double VAR_5 = 0.01;
private int VAR_6 = 3000;
private int VAR_7 = 1000000;
private CLASS_3 estimationType = VAR_8.VAR_9;
private PartitionerType VAR_10;
private CostType VAR_11;
private double minimumCompressionRatio = 1.0;
private boolean isInSparkInstruction = false;
private SORT_TYPE sdcSortType = SORT_TYPE.MATERIALIZE;
public CLASS_0() {
DMLConfig VAR_12 = VAR_13.getDMLConfig();
this.lossy = VAR_12.getBooleanValue(DMLConfig.VAR_14);
this.VAR_3 = VAR_2.of(CompressionType.UNCOMPRESSED, CompressionType.CONST);
CLASS_1[] VAR_15 = VAR_12.FUNC_0(DMLConfig.COMPRESSED_VALID_COMPRESSIONS).FUNC_1(",");
for(CLASS_1 comp : VAR_15)
VAR_3.add(CompressionType.FUNC_2(comp));
VAR_0 = VAR_12.FUNC_3(DMLConfig.VAR_16);
VAR_10 = PartitionerType.FUNC_2(VAR_12.FUNC_0(DMLConfig.COMPRESSED_COCODE));
VAR_11 = CostType.FUNC_2(VAR_12.FUNC_0(DMLConfig.COMPRESSED_COST_MODEL));
transposeInput = VAR_12.FUNC_0(DMLConfig.VAR_17);
}
/**
* Copy the settings from another CompressionSettings Builder, modifies this, not that.
*
* @param that The other CompressionSettingsBuilder to copy settings from.
* @return The modified CompressionSettings in the same object.
*/
public CLASS_0 FUNC_4(CompressionSettings that) {
this.VAR_0 = that.VAR_0;
this.allowSharedDictionary = that.allowSharedDictionary;
this.transposeInput = that.transposeInput;
this.VAR_1 = that.VAR_1;
this.lossy = that.lossy;
this.VAR_3 = VAR_2.copyOf(that.VAR_3);
this.sortValuesByLength = that.sortTuplesByFrequency;
this.VAR_10 = that.VAR_10;
this.VAR_4 = that.VAR_4;
this.VAR_5 = that.VAR_5;
this.VAR_6 = that.VAR_6;
return this;
}
/**
* Set the Compression to use Lossy compression.
*
* @param lossy A boolean specifying if the compression should be lossy
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setLossy(boolean lossy) {
this.lossy = lossy;
return this;
}
/**
* Set the sampling ratio in percent to sample the input matrix. Input value should be in range 0.0 - 1.0
*
* @param samplingRatio The ratio to sample from the input
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setSamplingRatio(double VAR_0) {
this.VAR_0 = VAR_0;
return this;
}
/**
* Set the sortValuesByLength flag. This sorts the dictionaries containing the data based on their occurences in the
* ColGroup. Improving cache efficiency especially for diverse column groups.
*
* @param sortValuesByLength A boolean specifying if the values should be sorted
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setSortValuesByLength(boolean sortValuesByLength) {
this.sortValuesByLength = sortValuesByLength;
return this;
}
/**
* Allow the Dictionaries to be shared between different column groups.
*
* @param allowSharedDictionary A boolean specifying if the dictionary can be shared between column groups.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setAllowSharedDictionary(boolean allowSharedDictionary) {
this.allowSharedDictionary = allowSharedDictionary;
return this;
}
/**
* Specify if the input matrix should be transposed before compression. This improves cache efficiency while
* compression the input matrix
*
* @param transposeInput string specifying if the input should be transposed before compression, should be one of
* "auto", "true" or "false"
* @return The CompressionSettingsBuilder
*/
public CLASS_0 FUNC_5(CLASS_1 transposeInput) {
switch(transposeInput) {
case "auto":
case "true":
case "false":
this.transposeInput = transposeInput;
break;
default:
throw new CLASS_4("Invalid transpose technique");
}
return this;
}
/**
* Set the seed for the compression operation.
*
* @param seed The seed used in sampling the matrix and general operations in the compression.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setSeed(int VAR_1) {
this.VAR_1 = VAR_1;
return this;
}
/**
* Set the valid compression strategies used for the compression.
*
* @param validCompressions An EnumSet of CompressionTypes to use in the compression
* @return The CompressionSettingsBuilder
*/
public CLASS_0 FUNC_6(CLASS_2<CompressionType> VAR_3) {
// should always contain Uncompressed as an option.
if(!VAR_3.contains(CompressionType.UNCOMPRESSED))
VAR_3.add(CompressionType.UNCOMPRESSED);
if(!VAR_3.contains(CompressionType.CONST))
VAR_3.add(CompressionType.CONST);
this.VAR_3 = VAR_3;
return this;
}
/**
* Add a single valid compression type to the EnumSet of valid compressions.
*
* @param cp The compression type to add to the valid ones.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 addValidCompression(CompressionType VAR_18) {
this.VAR_3.add(VAR_18);
return this;
}
/**
* Clear all the compression types allowed in the compression. This will only allow the Uncompressed ColGroup type.
* Since this is required for operation of the compression
*
* @return The CompressionSettingsBuilder
*/
public CLASS_0 clearValidCompression() {
this.VAR_3 = VAR_2.of(CompressionType.UNCOMPRESSED);
return this;
}
/**
* Set the type of CoCoding Partitioner type to use for combining columns together.
*
* @param columnPartitioner The Strategy to select from PartitionerType
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setColumnPartitioner(PartitionerType VAR_10) {
this.VAR_10 = VAR_10;
return this;
}
/**
* Set the maximum number of columns to CoCode together in the CoCoding strategy. Compression time increase with
* higher numbers.
*
* @param maxColGroupCoCode The max selected.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setMaxColGroupCoCode(int VAR_4) {
this.VAR_4 = VAR_4;
return this;
}
/**
* Set the coCode percentage, the effect is different based on the coCoding strategy, but the general effect is that
* higher values results in more coCoding while lower values result in less.
*
* Note that with high coCoding the compression ratio would possibly be lower.
*
* @param coCodePercentage The percentage to set.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setCoCodePercentage(double VAR_5) {
this.VAR_5 = VAR_5;
return this;
}
/**
* Set the minimum sample size to extract from a given matrix, this overrules the sample percentage if the sample
* percentage extracted is lower than this minimum bound.
*
* @param minimumSampleSize The minimum sample size to extract
* @return The CompressionSettingsBuilder
*/
public CLASS_0 FUNC_7(int VAR_6) {
this.VAR_6 = VAR_6;
return this;
}
/**
* Set the maximum sample size to extract from a given matrix, this overrules the sample percentage if the sample
* percentage extracted is higher than this maximum bound.
*
* @param maxSampleSize The maximum sample size to extract
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setMaxSampleSize(int VAR_7) {
this.VAR_7 = VAR_7;
return this;
}
/**
* Set the estimation type used for the sampled estimates.
*
* @param estimationType the estimation type in used.
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setEstimationType(CLASS_3 estimationType) {
this.estimationType = estimationType;
return this;
}
/**
* Set the cost type used for estimating the cost of column groups default is memory based.
*
* @param costType The Cost type wanted
* @return The CompressionSettingsBuilder
*/
public CLASS_0 FUNC_8(CostType VAR_11) {
this.VAR_11 = VAR_11;
return this;
}
/**
* Set the minimum compression ratio to be achieved by the compression.
*
* @param ratio The ratio to achieve while compressing
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setMinimumCompressionRatio(double ratio) {
this.minimumCompressionRatio = ratio;
return this;
}
/**
* Inform the compression that it is executed in a spark instruction.
*
* @return The CompressionSettingsBuilder
*/
public CLASS_0 FUNC_9() {
this.isInSparkInstruction = true;
return this;
}
/**
* Set the sort type to use.
*
* @param sdcSortType The sort type for the construction of SDC groups
* @return The CompressionSettingsBuilder
*/
public CLASS_0 setSDCSortType(SORT_TYPE sdcSortType) {
this.sdcSortType = sdcSortType;
return this;
}
/**
* Create the CompressionSettings object to use in the compression.
*
* @return The CompressionSettings
*/
public CompressionSettings create() {
return new CompressionSettings(VAR_0, allowSharedDictionary, transposeInput, VAR_1, lossy,
VAR_3, sortValuesByLength, VAR_10, VAR_4, VAR_5,
VAR_6, VAR_7, estimationType, VAR_11, minimumCompressionRatio, isInSparkInstruction,
sdcSortType);
}
} | 0.298603 | {'CLASS_0': 'CompressionSettingsBuilder', 'VAR_0': 'samplingRatio', 'CLASS_1': 'String', 'VAR_1': 'seed', 'CLASS_2': 'EnumSet', 'VAR_2': 'EnumSet', 'VAR_3': 'validCompressions', 'VAR_4': 'maxColGroupCoCode', 'VAR_5': 'coCodePercentage', 'VAR_6': 'minimumSampleSize', 'VAR_7': 'maxSampleSize', 'CLASS_3': 'EstimationType', 'VAR_8': 'EstimationType', 'VAR_9': 'HassAndStokes', 'VAR_10': 'columnPartitioner', 'VAR_11': 'costType', 'VAR_12': 'conf', 'VAR_13': 'ConfigurationManager', 'VAR_14': 'COMPRESSED_LOSSY', 'VAR_15': 'validCompressionsString', 'FUNC_0': 'getTextValue', 'FUNC_1': 'split', 'FUNC_2': 'valueOf', 'FUNC_3': 'getDoubleValue', 'VAR_16': 'COMPRESSED_SAMPLING_RATIO', 'VAR_17': 'COMPRESSED_TRANSPOSE', 'FUNC_4': 'copySettings', 'FUNC_5': 'setTransposeInput', 'CLASS_4': 'DMLCompressionException', 'FUNC_6': 'setValidCompressions', 'VAR_18': 'cp', 'FUNC_7': 'setMinimumSampleSize', 'FUNC_8': 'setCostType', 'FUNC_9': 'setIsInSparkInstruction'} | java | OOP | 10.97% |
/** Generated Model for C_Location
* @author iDempiere (generated)
* @version Release 5.1 - $Id$ */
public class X_C_Location extends PO implements I_Persistent
{
/**
*
*/
private static final long serialVersionUID = 20171031L;
/** Standard Constructor */
public X_C_Location (Properties ctx, int C_Location_ID, String trxName)
{
super (ctx, C_Location_ID, trxName);
/** if (C_Location_ID == 0)
{
setC_Country_ID (0);
setC_Location_ID (0);
} */
}
/** Load Constructor */
public X_C_Location (Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** AccessLevel
* @return 7 - System - Client - Org
*/
protected int get_AccessLevel()
{
return I_C_Location.accessLevel.intValue();
}
/** Load Meta Data */
protected POInfo initPO (Properties ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, I_C_Location.Table_ID, get_TrxName());
return poi;
}
public String toString()
{
StringBuffer sb = new StringBuffer ("X_C_Location[")
.append(get_ID()).append("]");
return sb.toString();
}
/** Set Address 1.
@param Address1
Address line 1 for this location
*/
public void setAddress1 (String Address1)
{
set_Value (I_C_Location.COLUMNNAME_Address1, Address1);
}
/** Get Address 1.
@return Address line 1 for this location
*/
public String getAddress1 ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Address1);
}
/** Set Address 2.
@param Address2
Address line 2 for this location
*/
public void setAddress2 (String Address2)
{
set_Value (I_C_Location.COLUMNNAME_Address2, Address2);
}
/** Get Address 2.
@return Address line 2 for this location
*/
public String getAddress2 ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Address2);
}
/** Set Address 3.
@param Address3
Address Line 3 for the location
*/
public void setAddress3 (String Address3)
{
set_Value (I_C_Location.COLUMNNAME_Address3, Address3);
}
/** Get Address 3.
@return Address Line 3 for the location
*/
public String getAddress3 ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Address3);
}
/** Set Address 4.
@param Address4
Address Line 4 for the location
*/
public void setAddress4 (String Address4)
{
set_Value (I_C_Location.COLUMNNAME_Address4, Address4);
}
/** Get Address 4.
@return Address Line 4 for the location
*/
public String getAddress4 ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Address4);
}
/** Set Address 5.
@param Address5
Address Line 5 for the location
*/
public void setAddress5 (String Address5)
{
set_Value (I_C_Location.COLUMNNAME_Address5, Address5);
}
/** Get Address 5.
@return Address Line 5 for the location
*/
public String getAddress5 ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Address5);
}
public org.compiere.model.I_C_AddressValidation getC_AddressValidation() throws RuntimeException
{
return (org.compiere.model.I_C_AddressValidation)MTable.get(getCtx(), org.compiere.model.I_C_AddressValidation.Table_Name)
.getPO(getC_AddressValidation_ID(), get_TrxName()); }
/** Set Address Validation.
@param C_AddressValidation_ID Address Validation */
public void setC_AddressValidation_ID (int C_AddressValidation_ID)
{
if (C_AddressValidation_ID < 1)
set_ValueNoCheck (I_C_Location.COLUMNNAME_C_AddressValidation_ID, null);
else
set_ValueNoCheck (I_C_Location.COLUMNNAME_C_AddressValidation_ID, Integer.valueOf(C_AddressValidation_ID));
}
/** Get Address Validation.
@return Address Validation */
public int getC_AddressValidation_ID ()
{
Integer ii = (Integer)get_Value(I_C_Location.COLUMNNAME_C_AddressValidation_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_City getC_City() throws RuntimeException
{
return (org.compiere.model.I_C_City)MTable.get(getCtx(), org.compiere.model.I_C_City.Table_Name)
.getPO(getC_City_ID(), get_TrxName()); }
/** Set City.
@param C_City_ID
City
*/
public void setC_City_ID (int C_City_ID)
{
if (C_City_ID < 1)
set_Value (I_C_Location.COLUMNNAME_C_City_ID, null);
else
set_Value (I_C_Location.COLUMNNAME_C_City_ID, Integer.valueOf(C_City_ID));
}
/** Get City.
@return City
*/
public int getC_City_ID ()
{
Integer ii = (Integer)get_Value(I_C_Location.COLUMNNAME_C_City_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Country getC_Country() throws RuntimeException
{
return (org.compiere.model.I_C_Country)MTable.get(getCtx(), org.compiere.model.I_C_Country.Table_Name)
.getPO(getC_Country_ID(), get_TrxName()); }
/** Set Country.
@param C_Country_ID
Country
*/
public void setC_Country_ID (int C_Country_ID)
{
if (C_Country_ID < 1)
set_Value (I_C_Location.COLUMNNAME_C_Country_ID, null);
else
set_Value (I_C_Location.COLUMNNAME_C_Country_ID, Integer.valueOf(C_Country_ID));
}
/** Get Country.
@return Country
*/
public int getC_Country_ID ()
{
Integer ii = (Integer)get_Value(I_C_Location.COLUMNNAME_C_Country_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set City.
@param City
Identifies a City
*/
public void setCity (String City)
{
set_Value (I_C_Location.COLUMNNAME_City, City);
}
/** Get City.
@return Identifies a City
*/
public String getCity ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_City);
}
/** Get Record ID/I_C_Location.COLUMNNAME
@return ID/I_C_Location.COLUMNNAME pair
*/
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getCity());
}
/** Set Address.
@param C_Location_ID
Location or Address
*/
public void setC_Location_ID (int C_Location_ID)
{
if (C_Location_ID < 1)
set_ValueNoCheck (I_C_Location.COLUMNNAME_C_Location_ID, null);
else
set_ValueNoCheck (I_C_Location.COLUMNNAME_C_Location_ID, Integer.valueOf(C_Location_ID));
}
/** Get Address.
@return Location or Address
*/
public int getC_Location_ID ()
{
Integer ii = (Integer)get_Value(I_C_Location.COLUMNNAME_C_Location_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set C_Location_UU.
@param C_Location_UU C_Location_UU */
public void setC_Location_UU (String C_Location_UU)
{
set_Value (I_C_Location.COLUMNNAME_C_Location_UU, C_Location_UU);
}
/** Get C_Location_UU.
@return C_Location_UU */
public String getC_Location_UU ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_C_Location_UU);
}
/** Set Comments.
@param Comments
Comments or additional information
*/
public void setComments (String Comments)
{
set_Value (I_C_Location.COLUMNNAME_Comments, Comments);
}
/** Get Comments.
@return Comments or additional information
*/
public String getComments ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Comments);
}
public org.compiere.model.I_C_Region getC_Region() throws RuntimeException
{
return (org.compiere.model.I_C_Region)MTable.get(getCtx(), org.compiere.model.I_C_Region.Table_Name)
.getPO(getC_Region_ID(), get_TrxName()); }
/** Set Region.
@param C_Region_ID
Identifies a geographical Region
*/
public void setC_Region_ID (int C_Region_ID)
{
if (C_Region_ID < 1)
set_Value (I_C_Location.COLUMNNAME_C_Region_ID, null);
else
set_Value (I_C_Location.COLUMNNAME_C_Region_ID, Integer.valueOf(C_Region_ID));
}
/** Get Region.
@return Identifies a geographical Region
*/
public int getC_Region_ID ()
{
Integer ii = (Integer)get_Value(I_C_Location.COLUMNNAME_C_Region_ID);
if (ii == null)
return 0;
return ii.intValue();
}
/** Set Valid.
@param IsValid
Element is valid
*/
public void setIsValid (boolean IsValid)
{
set_ValueNoCheck (I_C_Location.COLUMNNAME_IsValid, Boolean.valueOf(IsValid));
}
/** Get Valid.
@return Element is valid
*/
public boolean isValid ()
{
Object oo = get_Value(I_C_Location.COLUMNNAME_IsValid);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set ZIP.
@param Postal
Postal code
*/
public void setPostal (String Postal)
{
set_Value (I_C_Location.COLUMNNAME_Postal, Postal);
}
/** Get ZIP.
@return Postal code
*/
public String getPostal ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Postal);
}
/** Set Additional Zip.
@param Postal_Add
Additional ZIP or Postal code
*/
public void setPostal_Add (String Postal_Add)
{
set_Value (I_C_Location.COLUMNNAME_Postal_Add, Postal_Add);
}
/** Get Additional Zip.
@return Additional ZIP or Postal code
*/
public String getPostal_Add ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Postal_Add);
}
/** Set Region.
@param RegionName
Name of the Region
*/
public void setRegionName (String RegionName)
{
set_Value (I_C_Location.COLUMNNAME_RegionName, RegionName);
}
/** Get Region.
@return Name of the Region
*/
public String getRegionName ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_RegionName);
}
/** Set Result.
@param Result
Result of the action taken
*/
public void setResult (String Result)
{
set_ValueNoCheck (I_C_Location.COLUMNNAME_Result, Result);
}
/** Get Result.
@return Result of the action taken
*/
public String getResult ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_Result);
}
/** Set Validate Address.
@param ValidateAddress Validate Address */
public void setValidateAddress (String ValidateAddress)
{
set_Value (I_C_Location.COLUMNNAME_ValidateAddress, ValidateAddress);
}
/** Get Validate Address.
@return Validate Address */
public String getValidateAddress ()
{
return (String)get_Value(I_C_Location.COLUMNNAME_ValidateAddress);
}
} | /** Generated Model for C_Location
* @author iDempiere (generated)
* @version Release 5.1 - $Id$ */
public class CLASS_0 extends CLASS_1 implements CLASS_2
{
/**
*
*/
private static final long VAR_0 = 20171031L;
/** Standard Constructor */
public CLASS_0 (CLASS_3 ctx, int C_Location_ID, String VAR_1)
{
super (ctx, C_Location_ID, VAR_1);
/** if (C_Location_ID == 0)
{
setC_Country_ID (0);
setC_Location_ID (0);
} */
}
/** Load Constructor */
public CLASS_0 (CLASS_3 ctx, CLASS_4 VAR_2, String VAR_1)
{
super (ctx, VAR_2, VAR_1);
}
/** AccessLevel
* @return 7 - System - Client - Org
*/
protected int get_AccessLevel()
{
return I_C_Location.VAR_3.FUNC_0();
}
/** Load Meta Data */
protected POInfo initPO (CLASS_3 ctx)
{
POInfo poi = POInfo.FUNC_1 (ctx, I_C_Location.VAR_4, FUNC_2());
return poi;
}
public String FUNC_3()
{
CLASS_5 VAR_5 = new CLASS_5 ("X_C_Location[")
.FUNC_4(get_ID()).FUNC_4("]");
return VAR_5.FUNC_3();
}
/** Set Address 1.
@param Address1
Address line 1 for this location
*/
public void FUNC_5 (String VAR_6)
{
set_Value (I_C_Location.VAR_7, VAR_6);
}
/** Get Address 1.
@return Address line 1 for this location
*/
public String FUNC_6 ()
{
return (String)FUNC_7(I_C_Location.VAR_7);
}
/** Set Address 2.
@param Address2
Address line 2 for this location
*/
public void FUNC_8 (String VAR_8)
{
set_Value (I_C_Location.COLUMNNAME_Address2, VAR_8);
}
/** Get Address 2.
@return Address line 2 for this location
*/
public String FUNC_9 ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_Address2);
}
/** Set Address 3.
@param Address3
Address Line 3 for the location
*/
public void FUNC_10 (String Address3)
{
set_Value (I_C_Location.COLUMNNAME_Address3, Address3);
}
/** Get Address 3.
@return Address Line 3 for the location
*/
public String FUNC_11 ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_Address3);
}
/** Set Address 4.
@param Address4
Address Line 4 for the location
*/
public void FUNC_12 (String VAR_9)
{
set_Value (I_C_Location.COLUMNNAME_Address4, VAR_9);
}
/** Get Address 4.
@return Address Line 4 for the location
*/
public String FUNC_13 ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_Address4);
}
/** Set Address 5.
@param Address5
Address Line 5 for the location
*/
public void FUNC_14 (String Address5)
{
set_Value (I_C_Location.VAR_10, Address5);
}
/** Get Address 5.
@return Address Line 5 for the location
*/
public String getAddress5 ()
{
return (String)FUNC_7(I_C_Location.VAR_10);
}
public CLASS_6.CLASS_7.CLASS_8.I_C_AddressValidation FUNC_15() throws RuntimeException
{
return (CLASS_6.CLASS_7.CLASS_8.I_C_AddressValidation)VAR_14.get(getCtx(), VAR_11.VAR_12.VAR_13.I_C_AddressValidation.VAR_15)
.FUNC_16(getC_AddressValidation_ID(), FUNC_2()); }
/** Set Address Validation.
@param C_AddressValidation_ID Address Validation */
public void FUNC_17 (int VAR_16)
{
if (VAR_16 < 1)
set_ValueNoCheck (I_C_Location.VAR_17, null);
else
set_ValueNoCheck (I_C_Location.VAR_17, Integer.FUNC_18(VAR_16));
}
/** Get Address Validation.
@return Address Validation */
public int getC_AddressValidation_ID ()
{
Integer ii = (Integer)FUNC_7(I_C_Location.VAR_17);
if (ii == null)
return 0;
return ii.FUNC_0();
}
public CLASS_6.CLASS_7.CLASS_8.CLASS_9 getC_City() throws RuntimeException
{
return (CLASS_6.CLASS_7.CLASS_8.CLASS_9)VAR_14.get(getCtx(), VAR_11.VAR_12.VAR_13.VAR_18.VAR_15)
.FUNC_16(FUNC_19(), FUNC_2()); }
/** Set City.
@param C_City_ID
City
*/
public void FUNC_20 (int C_City_ID)
{
if (C_City_ID < 1)
set_Value (I_C_Location.VAR_19, null);
else
set_Value (I_C_Location.VAR_19, Integer.FUNC_18(C_City_ID));
}
/** Get City.
@return City
*/
public int FUNC_19 ()
{
Integer ii = (Integer)FUNC_7(I_C_Location.VAR_19);
if (ii == null)
return 0;
return ii.FUNC_0();
}
public CLASS_6.CLASS_7.CLASS_8.CLASS_10 FUNC_21() throws RuntimeException
{
return (CLASS_6.CLASS_7.CLASS_8.CLASS_10)VAR_14.get(getCtx(), VAR_11.VAR_12.VAR_13.VAR_20.VAR_15)
.FUNC_16(FUNC_22(), FUNC_2()); }
/** Set Country.
@param C_Country_ID
Country
*/
public void FUNC_23 (int C_Country_ID)
{
if (C_Country_ID < 1)
set_Value (I_C_Location.VAR_21, null);
else
set_Value (I_C_Location.VAR_21, Integer.FUNC_18(C_Country_ID));
}
/** Get Country.
@return Country
*/
public int FUNC_22 ()
{
Integer ii = (Integer)FUNC_7(I_C_Location.VAR_21);
if (ii == null)
return 0;
return ii.FUNC_0();
}
/** Set City.
@param City
Identifies a City
*/
public void setCity (String VAR_22)
{
set_Value (I_C_Location.VAR_23, VAR_22);
}
/** Get City.
@return Identifies a City
*/
public String FUNC_24 ()
{
return (String)FUNC_7(I_C_Location.VAR_23);
}
/** Get Record ID/I_C_Location.COLUMNNAME
@return ID/I_C_Location.COLUMNNAME pair
*/
public KeyNamePair FUNC_25()
{
return new KeyNamePair(get_ID(), FUNC_24());
}
/** Set Address.
@param C_Location_ID
Location or Address
*/
public void FUNC_26 (int C_Location_ID)
{
if (C_Location_ID < 1)
set_ValueNoCheck (I_C_Location.VAR_24, null);
else
set_ValueNoCheck (I_C_Location.VAR_24, Integer.FUNC_18(C_Location_ID));
}
/** Get Address.
@return Location or Address
*/
public int getC_Location_ID ()
{
Integer ii = (Integer)FUNC_7(I_C_Location.VAR_24);
if (ii == null)
return 0;
return ii.FUNC_0();
}
/** Set C_Location_UU.
@param C_Location_UU C_Location_UU */
public void FUNC_27 (String C_Location_UU)
{
set_Value (I_C_Location.VAR_25, C_Location_UU);
}
/** Get C_Location_UU.
@return C_Location_UU */
public String FUNC_28 ()
{
return (String)FUNC_7(I_C_Location.VAR_25);
}
/** Set Comments.
@param Comments
Comments or additional information
*/
public void FUNC_29 (String VAR_26)
{
set_Value (I_C_Location.COLUMNNAME_Comments, VAR_26);
}
/** Get Comments.
@return Comments or additional information
*/
public String FUNC_30 ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_Comments);
}
public CLASS_6.CLASS_7.CLASS_8.I_C_Region FUNC_31() throws RuntimeException
{
return (CLASS_6.CLASS_7.CLASS_8.I_C_Region)VAR_14.get(getCtx(), VAR_11.VAR_12.VAR_13.I_C_Region.VAR_15)
.FUNC_16(FUNC_32(), FUNC_2()); }
/** Set Region.
@param C_Region_ID
Identifies a geographical Region
*/
public void FUNC_33 (int C_Region_ID)
{
if (C_Region_ID < 1)
set_Value (I_C_Location.VAR_27, null);
else
set_Value (I_C_Location.VAR_27, Integer.FUNC_18(C_Region_ID));
}
/** Get Region.
@return Identifies a geographical Region
*/
public int FUNC_32 ()
{
Integer ii = (Integer)FUNC_7(I_C_Location.VAR_27);
if (ii == null)
return 0;
return ii.FUNC_0();
}
/** Set Valid.
@param IsValid
Element is valid
*/
public void FUNC_34 (boolean VAR_28)
{
set_ValueNoCheck (I_C_Location.COLUMNNAME_IsValid, VAR_29.FUNC_18(VAR_28));
}
/** Get Valid.
@return Element is valid
*/
public boolean FUNC_35 ()
{
CLASS_12 oo = FUNC_7(I_C_Location.COLUMNNAME_IsValid);
if (oo != null)
{
if (oo instanceof CLASS_11)
return ((CLASS_11)oo).FUNC_36();
return "Y".FUNC_37(oo);
}
return false;
}
/** Set ZIP.
@param Postal
Postal code
*/
public void FUNC_38 (String Postal)
{
set_Value (I_C_Location.COLUMNNAME_Postal, Postal);
}
/** Get ZIP.
@return Postal code
*/
public String getPostal ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_Postal);
}
/** Set Additional Zip.
@param Postal_Add
Additional ZIP or Postal code
*/
public void FUNC_39 (String Postal_Add)
{
set_Value (I_C_Location.VAR_30, Postal_Add);
}
/** Get Additional Zip.
@return Additional ZIP or Postal code
*/
public String FUNC_40 ()
{
return (String)FUNC_7(I_C_Location.VAR_30);
}
/** Set Region.
@param RegionName
Name of the Region
*/
public void setRegionName (String VAR_31)
{
set_Value (I_C_Location.VAR_32, VAR_31);
}
/** Get Region.
@return Name of the Region
*/
public String FUNC_41 ()
{
return (String)FUNC_7(I_C_Location.VAR_32);
}
/** Set Result.
@param Result
Result of the action taken
*/
public void setResult (String VAR_33)
{
set_ValueNoCheck (I_C_Location.VAR_34, VAR_33);
}
/** Get Result.
@return Result of the action taken
*/
public String FUNC_42 ()
{
return (String)FUNC_7(I_C_Location.VAR_34);
}
/** Set Validate Address.
@param ValidateAddress Validate Address */
public void FUNC_43 (String VAR_35)
{
set_Value (I_C_Location.COLUMNNAME_ValidateAddress, VAR_35);
}
/** Get Validate Address.
@return Validate Address */
public String FUNC_44 ()
{
return (String)FUNC_7(I_C_Location.COLUMNNAME_ValidateAddress);
}
} | 0.646377 | {'CLASS_0': 'X_C_Location', 'CLASS_1': 'PO', 'CLASS_2': 'I_Persistent', 'VAR_0': 'serialVersionUID', 'CLASS_3': 'Properties', 'VAR_1': 'trxName', 'CLASS_4': 'ResultSet', 'VAR_2': 'rs', 'VAR_3': 'accessLevel', 'FUNC_0': 'intValue', 'FUNC_1': 'getPOInfo', 'VAR_4': 'Table_ID', 'FUNC_2': 'get_TrxName', 'FUNC_3': 'toString', 'CLASS_5': 'StringBuffer', 'VAR_5': 'sb', 'FUNC_4': 'append', 'FUNC_5': 'setAddress1', 'VAR_6': 'Address1', 'VAR_7': 'COLUMNNAME_Address1', 'FUNC_6': 'getAddress1', 'FUNC_7': 'get_Value', 'FUNC_8': 'setAddress2', 'VAR_8': 'Address2', 'FUNC_9': 'getAddress2', 'FUNC_10': 'setAddress3', 'FUNC_11': 'getAddress3', 'FUNC_12': 'setAddress4', 'VAR_9': 'Address4', 'FUNC_13': 'getAddress4', 'FUNC_14': 'setAddress5', 'VAR_10': 'COLUMNNAME_Address5', 'CLASS_6': 'org', 'VAR_11': 'org', 'CLASS_7': 'compiere', 'VAR_12': 'compiere', 'CLASS_8': 'model', 'VAR_13': 'model', 'FUNC_15': 'getC_AddressValidation', 'VAR_14': 'MTable', 'VAR_15': 'Table_Name', 'FUNC_16': 'getPO', 'FUNC_17': 'setC_AddressValidation_ID', 'VAR_16': 'C_AddressValidation_ID', 'VAR_17': 'COLUMNNAME_C_AddressValidation_ID', 'FUNC_18': 'valueOf', 'CLASS_9': 'I_C_City', 'VAR_18': 'I_C_City', 'FUNC_19': 'getC_City_ID', 'FUNC_20': 'setC_City_ID', 'VAR_19': 'COLUMNNAME_C_City_ID', 'CLASS_10': 'I_C_Country', 'VAR_20': 'I_C_Country', 'FUNC_21': 'getC_Country', 'FUNC_22': 'getC_Country_ID', 'FUNC_23': 'setC_Country_ID', 'VAR_21': 'COLUMNNAME_C_Country_ID', 'VAR_22': 'City', 'VAR_23': 'COLUMNNAME_City', 'FUNC_24': 'getCity', 'FUNC_25': 'getKeyNamePair', 'FUNC_26': 'setC_Location_ID', 'VAR_24': 'COLUMNNAME_C_Location_ID', 'FUNC_27': 'setC_Location_UU', 'VAR_25': 'COLUMNNAME_C_Location_UU', 'FUNC_28': 'getC_Location_UU', 'FUNC_29': 'setComments', 'VAR_26': 'Comments', 'FUNC_30': 'getComments', 'FUNC_31': 'getC_Region', 'FUNC_32': 'getC_Region_ID', 'FUNC_33': 'setC_Region_ID', 'VAR_27': 'COLUMNNAME_C_Region_ID', 'FUNC_34': 'setIsValid', 'VAR_28': 'IsValid', 'VAR_29': 'Boolean', 'CLASS_11': 'Boolean', 'FUNC_35': 'isValid', 'CLASS_12': 'Object', 'FUNC_36': 'booleanValue', 'FUNC_37': 'equals', 'FUNC_38': 'setPostal', 'FUNC_39': 'setPostal_Add', 'VAR_30': 'COLUMNNAME_Postal_Add', 'FUNC_40': 'getPostal_Add', 'VAR_31': 'RegionName', 'VAR_32': 'COLUMNNAME_RegionName', 'FUNC_41': 'getRegionName', 'VAR_33': 'Result', 'VAR_34': 'COLUMNNAME_Result', 'FUNC_42': 'getResult', 'FUNC_43': 'setValidateAddress', 'VAR_35': 'ValidateAddress', 'FUNC_44': 'getValidateAddress'} | java | Hibrido | 8.58% |
package Threads;
public class ThreadAnn {
public static void main(String[] args) throws InterruptedException {
Thread t1 = new Thread(() -> {
while (!Thread.interrupted()) {
System.out.println("this is t1");
}
});
Thread t2 = new Thread(() -> {
while (!Thread.interrupted()) {
System.out.println("this is t2");
}
});
t1.start();
t2.start();
Thread.sleep(5000);
t1.interrupt();
t2.interrupt();
}
}
| package Threads;
public class ThreadAnn {
public static void main(String[] args) throws InterruptedException {
Thread VAR_0 = new Thread(() -> {
while (!Thread.interrupted()) {
System.out.FUNC_0("this is t1");
}
});
Thread t2 = new Thread(() -> {
while (!Thread.interrupted()) {
System.out.FUNC_0("this is t2");
}
});
VAR_0.start();
t2.start();
Thread.FUNC_1(5000);
VAR_0.interrupt();
t2.interrupt();
}
}
| 0.036426 | {'VAR_0': 't1', 'FUNC_0': 'println', 'FUNC_1': 'sleep'} | java | OOP | 26.44% |
package com.roadrunner.panoengine.panorama;
public interface PanoramaHotspotTouchListener {
public void onTouch(PanoramaHotspot hotspot);
}
| package IMPORT_0.roadrunner.IMPORT_1.IMPORT_2;
public interface CLASS_0 {
public void FUNC_0(PanoramaHotspot VAR_0);
}
| 0.834836 | {'IMPORT_0': 'com', 'IMPORT_1': 'panoengine', 'IMPORT_2': 'panorama', 'CLASS_0': 'PanoramaHotspotTouchListener', 'FUNC_0': 'onTouch', 'VAR_0': 'hotspot'} | java | Texto | 52.94% |
// Concise names welcome.
public class KeyTransformingLoadingCache<A, B, V> extends AbstractLoadingCache<A, V> {
private final LoadingCache<B, V> delegate;
private final Function<A, B> keyTransformer;
public KeyTransformingLoadingCache(LoadingCache<B, V> delegate, Function<A, B> keyTransformer) {
this.delegate = delegate;
this.keyTransformer = keyTransformer;
}
public static <A, B, V> KeyTransformingLoadingCache<A, B, V> from(LoadingCache<B, V> delegate, Function<A, B> keyTransformer) {
return new KeyTransformingLoadingCache<A, B, V>(delegate, keyTransformer);
}
protected Function<A, B> keyTransformer() {
return keyTransformer;
}
protected LoadingCache<B, V> delegate() {
return delegate;
}
@Override
public V getIfPresent(Object key) {
try {
@SuppressWarnings("unchecked")
A cast = (A) key;
return delegate().getIfPresent(keyTransformer().apply(cast));
} catch (ClassCastException e) {
return null;
}
}
@Override
public V get(A key, Callable<? extends V> valueLoader) throws ExecutionException {
return delegate().get(keyTransformer().apply(key), valueLoader);
}
/**
* Undefined because we can't prohibit a surjective {@link #keyTransformer()}.
* @throws UnsupportedOperationException
*/
@Override
public ImmutableMap<A, V> getAllPresent(Iterable<?> keys) {
throw new UnsupportedOperationException("getAllPresent in "+getClass().getName() + " undefined");
}
@Override
public void put(A key, V value) {
delegate().put(keyTransformer().apply(key), value);
}
@Override
public void invalidate(Object key) {
try {
@SuppressWarnings("unchecked")
A cast = (A) key;
delegate().invalidate(keyTransformer().apply(cast));
} catch (ClassCastException e) {
// Ignore
}
}
@Override
public void invalidateAll() {
delegate().invalidateAll();
}
@Override
public long size() {
return delegate().size();
}
@Override
public CacheStats stats() {
return delegate().stats();
}
@Override
public V get(A key) throws ExecutionException {
return delegate().get(keyTransformer().apply(key));
}
@Override
public void refresh(A key) {
delegate().refresh(keyTransformer().apply(key));
}
/**
* Undefined because input values are not tracked.
* @throws UnsupportedOperationException
*/
@Override
public ConcurrentMap<A, V> asMap() {
throw new UnsupportedOperationException("asMap in " + getClass().getName() + " undefined");
}
@Override
public void cleanUp() {
delegate().cleanUp();
}
// Users can avoid middle type parameter.
public static class KeyTransformingSameTypeLoadingCache<A, V> extends KeyTransformingLoadingCache<A, A, V> {
public KeyTransformingSameTypeLoadingCache(LoadingCache<A, V> delegate, Function<A, A> keyTransformer) {
super(delegate, keyTransformer);
}
// IDE note: This was named `from` to be consistent with KeyTransformingLoadingCache but Intellij 13
// claims a name clash with the superclass `from`:
// java: name clash: <A,V>from(LoadingCache<A,V>, Function<A,A>) in KeyTransformingSameTypeLoadingCache
// and <A,B,V>from(LoadingCache<B,V>, Function<A,B>) in KeyTransformingLoadingCache have the same erasure,
// yet neither hides the other
public static <A, V> KeyTransformingSameTypeLoadingCache<A, V> with(LoadingCache<A, V> delegate, Function<A, A> keyTransformer) {
return new KeyTransformingSameTypeLoadingCache<A, V>(delegate, keyTransformer);
}
}
} | // Concise names welcome.
public class CLASS_0<CLASS_1, CLASS_2, CLASS_3> extends CLASS_4<CLASS_1, CLASS_3> {
private final CLASS_5<CLASS_2, CLASS_3> VAR_0;
private final CLASS_6<CLASS_1, CLASS_2> VAR_1;
public CLASS_0(CLASS_5<CLASS_2, CLASS_3> VAR_0, CLASS_6<CLASS_1, CLASS_2> VAR_1) {
this.VAR_0 = VAR_0;
this.VAR_1 = VAR_1;
}
public static <CLASS_1, CLASS_2, CLASS_3> CLASS_0<CLASS_1, CLASS_2, CLASS_3> FUNC_2(CLASS_5<CLASS_2, CLASS_3> VAR_0, CLASS_6<CLASS_1, CLASS_2> VAR_1) {
return new CLASS_0<CLASS_1, CLASS_2, CLASS_3>(VAR_0, VAR_1);
}
protected CLASS_6<CLASS_1, CLASS_2> FUNC_1() {
return VAR_1;
}
protected CLASS_5<CLASS_2, CLASS_3> FUNC_0() {
return VAR_0;
}
@VAR_2
public CLASS_3 FUNC_3(CLASS_7 VAR_3) {
try {
@VAR_4("unchecked")
CLASS_1 VAR_5 = (CLASS_1) VAR_3;
return FUNC_0().FUNC_3(FUNC_1().FUNC_4(VAR_5));
} catch (CLASS_8 VAR_6) {
return null;
}
}
@VAR_2
public CLASS_3 FUNC_5(CLASS_1 VAR_3, CLASS_9<? extends CLASS_3> VAR_7) throws CLASS_10 {
return FUNC_0().FUNC_5(FUNC_1().FUNC_4(VAR_3), VAR_7);
}
/**
* Undefined because we can't prohibit a surjective {@link #keyTransformer()}.
* @throws UnsupportedOperationException
*/
@VAR_2
public CLASS_11<CLASS_1, CLASS_3> FUNC_6(CLASS_12<?> VAR_8) {
throw new CLASS_13("getAllPresent in "+FUNC_7().FUNC_8() + " undefined");
}
@VAR_2
public void FUNC_9(CLASS_1 VAR_3, CLASS_3 VAR_9) {
FUNC_0().FUNC_9(FUNC_1().FUNC_4(VAR_3), VAR_9);
}
@VAR_2
public void FUNC_10(CLASS_7 VAR_3) {
try {
@VAR_4("unchecked")
CLASS_1 VAR_5 = (CLASS_1) VAR_3;
FUNC_0().FUNC_10(FUNC_1().FUNC_4(VAR_5));
} catch (CLASS_8 VAR_6) {
// Ignore
}
}
@VAR_2
public void FUNC_11() {
FUNC_0().FUNC_11();
}
@VAR_2
public long FUNC_12() {
return FUNC_0().FUNC_12();
}
@VAR_2
public CLASS_14 FUNC_13() {
return FUNC_0().FUNC_13();
}
@VAR_2
public CLASS_3 FUNC_5(CLASS_1 VAR_3) throws CLASS_10 {
return FUNC_0().FUNC_5(FUNC_1().FUNC_4(VAR_3));
}
@VAR_2
public void FUNC_14(CLASS_1 VAR_3) {
FUNC_0().FUNC_14(FUNC_1().FUNC_4(VAR_3));
}
/**
* Undefined because input values are not tracked.
* @throws UnsupportedOperationException
*/
@VAR_2
public CLASS_15<CLASS_1, CLASS_3> FUNC_15() {
throw new CLASS_13("asMap in " + FUNC_7().FUNC_8() + " undefined");
}
@VAR_2
public void FUNC_16() {
FUNC_0().FUNC_16();
}
// Users can avoid middle type parameter.
public static class CLASS_16<CLASS_1, CLASS_3> extends CLASS_0<CLASS_1, CLASS_1, CLASS_3> {
public CLASS_16(CLASS_5<CLASS_1, CLASS_3> VAR_0, CLASS_6<CLASS_1, CLASS_1> VAR_1) {
super(VAR_0, VAR_1);
}
// IDE note: This was named `from` to be consistent with KeyTransformingLoadingCache but Intellij 13
// claims a name clash with the superclass `from`:
// java: name clash: <A,V>from(LoadingCache<A,V>, Function<A,A>) in KeyTransformingSameTypeLoadingCache
// and <A,B,V>from(LoadingCache<B,V>, Function<A,B>) in KeyTransformingLoadingCache have the same erasure,
// yet neither hides the other
public static <CLASS_1, CLASS_3> CLASS_16<CLASS_1, CLASS_3> FUNC_17(CLASS_5<CLASS_1, CLASS_3> VAR_0, CLASS_6<CLASS_1, CLASS_1> VAR_1) {
return new CLASS_16<CLASS_1, CLASS_3>(VAR_0, VAR_1);
}
}
} | 0.993933 | {'CLASS_0': 'KeyTransformingLoadingCache', 'CLASS_1': 'A', 'CLASS_2': 'B', 'CLASS_3': 'V', 'CLASS_4': 'AbstractLoadingCache', 'CLASS_5': 'LoadingCache', 'VAR_0': 'delegate', 'FUNC_0': 'delegate', 'CLASS_6': 'Function', 'VAR_1': 'keyTransformer', 'FUNC_1': 'keyTransformer', 'FUNC_2': 'from', 'VAR_2': 'Override', 'FUNC_3': 'getIfPresent', 'CLASS_7': 'Object', 'VAR_3': 'key', 'VAR_4': 'SuppressWarnings', 'VAR_5': 'cast', 'FUNC_4': 'apply', 'CLASS_8': 'ClassCastException', 'VAR_6': 'e', 'FUNC_5': 'get', 'CLASS_9': 'Callable', 'VAR_7': 'valueLoader', 'CLASS_10': 'ExecutionException', 'CLASS_11': 'ImmutableMap', 'FUNC_6': 'getAllPresent', 'CLASS_12': 'Iterable', 'VAR_8': 'keys', 'CLASS_13': 'UnsupportedOperationException', 'FUNC_7': 'getClass', 'FUNC_8': 'getName', 'FUNC_9': 'put', 'VAR_9': 'value', 'FUNC_10': 'invalidate', 'FUNC_11': 'invalidateAll', 'FUNC_12': 'size', 'CLASS_14': 'CacheStats', 'FUNC_13': 'stats', 'FUNC_14': 'refresh', 'CLASS_15': 'ConcurrentMap', 'FUNC_15': 'asMap', 'FUNC_16': 'cleanUp', 'CLASS_16': 'KeyTransformingSameTypeLoadingCache', 'FUNC_17': 'with'} | java | OOP | 23.27% |
/**
* King represents the King chess piece.
* @author Quang Vu
*
*/
public class King extends ChessPieces{
private String ID;
public King(int row, int col){
super(row,col);
this.ID = "King";
}
@Override
public ArrayList<ArrayList<ArrayList<ChessPieces>>> neighbor(int row, int col, ArrayList<ArrayList<ChessPieces>> board) {
ArrayList<ArrayList<ArrayList<ChessPieces>>> neighbor = new ArrayList<ArrayList<ArrayList<ChessPieces>>>();
//1.Eat another piece right diagonal.
// Checking: - The position is available on the board
// - The position has been occupied by another chess pieces.
if((row-1) >= 0 && (col + 1) < board.get(row - 1).size()){
if(!board.get(row - 1).get(col + 1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row - 1).set(col + 1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 2.Eat another piece left diagonal.
// Checking: - The position is available on the board
// - The position has been occupied by another chess pieces.
if((row -1) >= 0 && (col - 1) >= 0){
if(!board.get(row - 1).get(col - 1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row - 1).set(col - 1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 3.Eat another piece upward.
// Checking: - The position is available on the board.
// - The position has been occupied by another chess pieces.
if((row -1) >= 0){
if(!board.get(row -1).get(col).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row-1).set(col, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 4.Eat another piece on the left side.
// Same check as above.
if((col - 1) >= 0){
if(!board.get(row).get(col - 1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row).set(col-1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 5.Eat another piece on the right side.
// Same check as above.
if((col + 1) < board.get(row).size()){
if(!board.get(row).get(col+1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row).set(col+1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 6.Eat another piece downward
if((row + 1) < board.size()){
if(!board.get(row+1).get(col).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row + 1).set(col, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 7.eat another piece South East
if((row + 1) < board.size() && (col + 1) < board.get(row + 1).size()){
if(!board.get(row+1).get(col+1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row + 1).set(col + 1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
// 8.eat another piece South West
if((row+ 1)< board.size() && (col - 1) >= 0){
if(!board.get(row + 1).get(col-1).getID().equals("Dot")){
ArrayList<ArrayList<ChessPieces>> deepCopy = new ArrayList<ArrayList<ChessPieces>>();
for(ArrayList<ChessPieces> lists : board){
ArrayList<ChessPieces> objectCopy = new ArrayList<ChessPieces>();
objectCopy.addAll(lists);
deepCopy.add(objectCopy);
}
deepCopy.get(row + 1).set(col - 1, this);
deepCopy.get(row).set(col, new Dot(row, col));
neighbor.add(deepCopy);
}
}
return neighbor;
}
public String getID() {
return ID;
}
@Override
public int getRow() {
return row;
}
@Override
public int getCol() {
return col;
}
} | /**
* King represents the King chess piece.
* @author Quang Vu
*
*/
public class King extends ChessPieces{
private String ID;
public King(int row, int col){
super(row,col);
this.ID = "King";
}
@VAR_0
public CLASS_0<CLASS_0<CLASS_0<ChessPieces>>> FUNC_0(int row, int col, CLASS_0<CLASS_0<ChessPieces>> board) {
CLASS_0<CLASS_0<CLASS_0<ChessPieces>>> VAR_1 = new CLASS_0<CLASS_0<CLASS_0<ChessPieces>>>();
//1.Eat another piece right diagonal.
// Checking: - The position is available on the board
// - The position has been occupied by another chess pieces.
if((row-1) >= 0 && (col + 1) < board.get(row - 1).size()){
if(!board.get(row - 1).get(col + 1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row - 1).set(col + 1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 2.Eat another piece left diagonal.
// Checking: - The position is available on the board
// - The position has been occupied by another chess pieces.
if((row -1) >= 0 && (col - 1) >= 0){
if(!board.get(row - 1).get(col - 1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row - 1).set(col - 1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 3.Eat another piece upward.
// Checking: - The position is available on the board.
// - The position has been occupied by another chess pieces.
if((row -1) >= 0){
if(!board.get(row -1).get(col).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row-1).set(col, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 4.Eat another piece on the left side.
// Same check as above.
if((col - 1) >= 0){
if(!board.get(row).get(col - 1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row).set(col-1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 5.Eat another piece on the right side.
// Same check as above.
if((col + 1) < board.get(row).size()){
if(!board.get(row).get(col+1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row).set(col+1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 6.Eat another piece downward
if((row + 1) < board.size()){
if(!board.get(row+1).get(col).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row + 1).set(col, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 7.eat another piece South East
if((row + 1) < board.size() && (col + 1) < board.get(row + 1).size()){
if(!board.get(row+1).get(col+1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row + 1).set(col + 1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
// 8.eat another piece South West
if((row+ 1)< board.size() && (col - 1) >= 0){
if(!board.get(row + 1).get(col-1).FUNC_1().FUNC_2("Dot")){
CLASS_0<CLASS_0<ChessPieces>> deepCopy = new CLASS_0<CLASS_0<ChessPieces>>();
for(CLASS_0<ChessPieces> VAR_2 : board){
CLASS_0<ChessPieces> VAR_3 = new CLASS_0<ChessPieces>();
VAR_3.FUNC_3(VAR_2);
deepCopy.add(VAR_3);
}
deepCopy.get(row + 1).set(col - 1, this);
deepCopy.get(row).set(col, new CLASS_1(row, col));
VAR_1.add(deepCopy);
}
}
return VAR_1;
}
public String FUNC_1() {
return ID;
}
@VAR_0
public int FUNC_4() {
return row;
}
@VAR_0
public int FUNC_5() {
return col;
}
} | 0.459965 | {'VAR_0': 'Override', 'CLASS_0': 'ArrayList', 'FUNC_0': 'neighbor', 'VAR_1': 'neighbor', 'FUNC_1': 'getID', 'FUNC_2': 'equals', 'VAR_2': 'lists', 'VAR_3': 'objectCopy', 'FUNC_3': 'addAll', 'CLASS_1': 'Dot', 'FUNC_4': 'getRow', 'FUNC_5': 'getCol'} | java | OOP | 8.94% |
/**
* Create a <code>SOAPElement</code> object initialized with the
* given <code>Name</code> object.
*
* @param name a <code>Name</code> object with the XML name for
* the new element
* @return the new <code>SOAPElement</code> object that was
* created
* @throws javax.xml.soap.SOAPException if there is an error in creating the
* <code>SOAPElement</code> object
*/
public SOAPElement createElement(Name name) throws SOAPException {
String localName = name.getLocalName();
String prefix = name.getPrefix();
String uri = name.getURI();
OMElement omElement = DOOMAbstractFactory.getOMFactory().createOMElement(localName, uri, prefix);
return new SOAPElementImpl((ElementImpl) omElement);
} | /**
* Create a <code>SOAPElement</code> object initialized with the
* given <code>Name</code> object.
*
* @param name a <code>Name</code> object with the XML name for
* the new element
* @return the new <code>SOAPElement</code> object that was
* created
* @throws javax.xml.soap.SOAPException if there is an error in creating the
* <code>SOAPElement</code> object
*/
public CLASS_0 createElement(CLASS_1 VAR_0) throws CLASS_2 {
CLASS_3 VAR_1 = VAR_0.FUNC_0();
CLASS_3 prefix = VAR_0.FUNC_1();
CLASS_3 VAR_2 = VAR_0.FUNC_2();
CLASS_4 omElement = DOOMAbstractFactory.FUNC_3().FUNC_4(VAR_1, VAR_2, prefix);
return new CLASS_5((CLASS_6) omElement);
} | 0.848124 | {'CLASS_0': 'SOAPElement', 'CLASS_1': 'Name', 'VAR_0': 'name', 'CLASS_2': 'SOAPException', 'CLASS_3': 'String', 'VAR_1': 'localName', 'FUNC_0': 'getLocalName', 'FUNC_1': 'getPrefix', 'VAR_2': 'uri', 'FUNC_2': 'getURI', 'CLASS_4': 'OMElement', 'FUNC_3': 'getOMFactory', 'FUNC_4': 'createOMElement', 'CLASS_5': 'SOAPElementImpl', 'CLASS_6': 'ElementImpl'} | java | Procedural | 62.26% |
/**
* @author Stu B. <www.texpedient.com>
*/
public class BridgeTriggers implements UtilClass {
@UISalient(MenuName = "<toplevel>|External Tools|Startup Twinkle main")//
public static void startTwinkle() throws Throwable {
Class.forName("twinkle.Twinkle").getMethod("main", String[].class).invoke(null, (Object) new String[0]);
}
@UISalient(MenuName = "<toplevel>|External Tools|Startup Swoop main")//
public static void startSwoop() throws Throwable {
Class.forName("org.mindswap.swoop.Swoop").getMethod("main", String[].class).invoke(null, (Object) new String[0]);
}
@UISalient(MenuName = "External Tools|Run Twinkle On Model %t", IsNotSideEffectSafe = true)//
public static void startTwinkle(Model m) throws Throwable {
Class.forName("twinkle.Twinkle").getMethod("mainWithModel", Model.class).invoke(null, m);
}
@UISalient(MenuName = "%m%p")//
public static List<Model> getModelsFoundIn(Repo repo) {
return getModelsFoundIn(repo.getMainQueryDataset());
}
@UISalient(MenuName = "%m%p")//
public static List<Model> getModelsFoundIn(Dataset mainQueryDataset) {
ArrayList<Model> models = new ArrayList<Model>();
for (String s : ReflectUtils.toList(mainQueryDataset.listNames())) {
models.add(mainQueryDataset.getNamedModel(s));
}
return models;
}
public static class MountSubmenuFromTriplesTrigger<BT extends Box<TriggerImpl<BT>>> extends TriggerImpl<BT> implements TriggerForClass {
// as opposed to system gnerated triggers
@Override public boolean isFavorited() {
return true;
}
/**
* return @true if the trigger can be invoked for a visual that changes no state
*/
@Override public boolean isSideEffectSafe() {
return false;
}
@UISalient(MenuName = "triplesURLParam")
public static Class<URL> boxTargetClass = URL.class;
@Override public boolean appliesTarget(Class cls, Object anyObject) {
return ReflectUtils.convertsTo(anyObject, cls, boxTargetClass);
}
@Override public Trigger createTrigger(String menuFmt, DisplayContext ctx, Object poj) {
try {
return new MountSubmenuFromTriplesTrigger(Utility.recast(poj, boxTargetClass));
} catch (NoSuchConversionException e) {
throw Debuggable.reThrowable(e);
}
}
String triplesURL;
public MountSubmenuFromTriplesTrigger(URL triplesURLParam) {
triplesURL = triplesURLParam.toExternalForm();
}
public MountSubmenuFromTriplesTrigger(String triplesURLParam) {
triplesURL = triplesURLParam;
}
@Override public void fire(BT targetBox) {
logInfo(toString() + ".fire()");
BoxContext bc = targetBox.getBoxContext();
JenaFileManagerUtils.ensureClassLoaderRegisteredWithDefaultJenaFM(DemoResources.class.getClassLoader());
logInfo("Loading triples from URL: " + triplesURL);
try {
Set<Object> loadedStuff = AssemblerUtils.buildAllObjectsInRdfFile(triplesURL);
logInfo("Loaded " + loadedStuff.size() + " objects");
for (Object o : loadedStuff) {
if (o instanceof MutableBox) {
MutableBox loadedMutableBox = (MutableBox) o;
bc.contextualizeAndAttachChildBox(targetBox, loadedMutableBox);
logInfo("Loaded mutable box: " + loadedMutableBox);
} else {
logInfo("Loaded object which is not a mutable box: " + o);
}
}
} catch (Exception e) {
}
}
@Override public Object getIdentityObject() {
return (getClass() + ":" + triplesURL).intern();
}
}
} | /**
* @author Stu B. <www.texpedient.com>
*/
public class BridgeTriggers implements UtilClass {
@UISalient(MenuName = "<toplevel>|External Tools|Startup Twinkle main")//
public static void startTwinkle() throws Throwable {
Class.forName("twinkle.Twinkle").getMethod("main", String[].class).invoke(null, (Object) new String[0]);
}
@UISalient(MenuName = "<toplevel>|External Tools|Startup Swoop main")//
public static void startSwoop() throws Throwable {
Class.forName("org.mindswap.swoop.Swoop").getMethod("main", String[].class).invoke(null, (Object) new String[0]);
}
@UISalient(MenuName = "External Tools|Run Twinkle On Model %t", IsNotSideEffectSafe = true)//
public static void startTwinkle(Model m) throws Throwable {
Class.forName("twinkle.Twinkle").getMethod("mainWithModel", Model.class).invoke(null, m);
}
@UISalient(MenuName = "%m%p")//
public static List<Model> getModelsFoundIn(Repo repo) {
return getModelsFoundIn(repo.getMainQueryDataset());
}
@UISalient(MenuName = "%m%p")//
public static List<Model> getModelsFoundIn(Dataset mainQueryDataset) {
ArrayList<Model> VAR_0 = new ArrayList<Model>();
for (String s : ReflectUtils.toList(mainQueryDataset.listNames())) {
VAR_0.add(mainQueryDataset.getNamedModel(s));
}
return VAR_0;
}
public static class MountSubmenuFromTriplesTrigger<BT extends Box<TriggerImpl<BT>>> extends TriggerImpl<BT> implements TriggerForClass {
// as opposed to system gnerated triggers
@Override public boolean isFavorited() {
return true;
}
/**
* return @true if the trigger can be invoked for a visual that changes no state
*/
@Override public boolean isSideEffectSafe() {
return false;
}
@UISalient(MenuName = "triplesURLParam")
public static Class<URL> boxTargetClass = URL.class;
@Override public boolean appliesTarget(Class cls, Object anyObject) {
return ReflectUtils.convertsTo(anyObject, cls, boxTargetClass);
}
@Override public Trigger createTrigger(String VAR_1, DisplayContext ctx, Object poj) {
try {
return new MountSubmenuFromTriplesTrigger(Utility.recast(poj, boxTargetClass));
} catch (NoSuchConversionException e) {
throw Debuggable.reThrowable(e);
}
}
String triplesURL;
public MountSubmenuFromTriplesTrigger(URL triplesURLParam) {
triplesURL = triplesURLParam.toExternalForm();
}
public MountSubmenuFromTriplesTrigger(String triplesURLParam) {
triplesURL = triplesURLParam;
}
@Override public void fire(BT targetBox) {
logInfo(toString() + ".fire()");
BoxContext bc = targetBox.getBoxContext();
JenaFileManagerUtils.ensureClassLoaderRegisteredWithDefaultJenaFM(DemoResources.class.getClassLoader());
logInfo("Loading triples from URL: " + triplesURL);
try {
Set<Object> loadedStuff = AssemblerUtils.buildAllObjectsInRdfFile(triplesURL);
logInfo("Loaded " + loadedStuff.size() + " objects");
for (Object o : loadedStuff) {
if (o instanceof MutableBox) {
MutableBox loadedMutableBox = (MutableBox) o;
bc.contextualizeAndAttachChildBox(targetBox, loadedMutableBox);
logInfo("Loaded mutable box: " + loadedMutableBox);
} else {
logInfo("Loaded object which is not a mutable box: " + o);
}
}
} catch (Exception e) {
}
}
@Override public Object getIdentityObject() {
return (getClass() + ":" + triplesURL).intern();
}
}
} | 0.018949 | {'VAR_0': 'models', 'VAR_1': 'menuFmt'} | java | OOP | 7.30% |
/*
* TickHistory
* TickHistory provides dynamic access to historical tick data for a specific security for specific dates or date range.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.factset.sdk.FactSetTickHistory.auth;
public enum OAuthFlow {
accessCode, implicit, password, application
}
| /*
* TickHistory
* TickHistory provides dynamic access to historical tick data for a specific security for specific dates or date range.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package IMPORT_0.factset.IMPORT_1.IMPORT_2.IMPORT_3;
public enum OAuthFlow {
accessCode, VAR_0, VAR_1, VAR_2
}
| 0.572737 | {'IMPORT_0': 'com', 'IMPORT_1': 'sdk', 'IMPORT_2': 'FactSetTickHistory', 'IMPORT_3': 'auth', 'VAR_0': 'implicit', 'VAR_1': 'password', 'VAR_2': 'application'} | java | OOP | 100.00% |
package bio.terra.app.controller;
import bio.terra.model.ErrorModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.util.List;
import static java.util.stream.Collectors.toList;
@ControllerAdvice
public class ApiValidationExceptionHandler extends ResponseEntityExceptionHandler {
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException ex,
HttpHeaders headers,
HttpStatus status,
WebRequest request
) {
BindingResult bindingResult = ex.getBindingResult();
List<String> errorDetails = bindingResult
.getFieldErrors()
.stream()
.map(this::formatFieldError)
.collect(toList());
ErrorModel errorModel = new ErrorModel()
.message("Validation errors - see error details")
.errorDetail(errorDetails);
return new ResponseEntity<>(errorModel, HttpStatus.BAD_REQUEST);
}
private String formatFieldError(FieldError error) {
StringBuilder builder = new StringBuilder()
.append(String.format("%s: '%s'", error.getField(), error.getCode()));
String defaultMessage = error.getDefaultMessage();
if (StringUtils.isNotEmpty(defaultMessage)) {
builder.append(String.format(" (%s)", defaultMessage));
}
return builder.toString();
}
}
| package bio.terra.app.IMPORT_0;
import bio.terra.IMPORT_1.IMPORT_2;
import org.IMPORT_3.IMPORT_4.lang3.IMPORT_5;
import org.springframework.IMPORT_6.HttpHeaders;
import org.springframework.IMPORT_6.IMPORT_7;
import org.springframework.IMPORT_6.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.IMPORT_8.bind.MethodArgumentNotValidException;
import org.springframework.IMPORT_8.bind.annotation.ControllerAdvice;
import org.springframework.IMPORT_8.context.request.WebRequest;
import org.springframework.IMPORT_8.servlet.mvc.IMPORT_9.annotation.IMPORT_10;
import IMPORT_11.util.List;
import static IMPORT_11.util.IMPORT_12.Collectors.IMPORT_13;
@ControllerAdvice
public class CLASS_0 extends IMPORT_10 {
@VAR_0
protected ResponseEntity<Object> handleMethodArgumentNotValid(
MethodArgumentNotValidException ex,
HttpHeaders headers,
IMPORT_7 VAR_1,
WebRequest request
) {
BindingResult VAR_2 = ex.getBindingResult();
List<CLASS_1> VAR_4 = VAR_2
.getFieldErrors()
.IMPORT_12()
.map(this::VAR_5)
.collect(IMPORT_13());
IMPORT_2 errorModel = new IMPORT_2()
.message("Validation errors - see error details")
.FUNC_1(VAR_4);
return new ResponseEntity<>(errorModel, IMPORT_7.BAD_REQUEST);
}
private CLASS_1 FUNC_0(FieldError VAR_6) {
CLASS_2 builder = new CLASS_2()
.append(VAR_3.format("%s: '%s'", VAR_6.FUNC_2(), VAR_6.FUNC_3()));
CLASS_1 VAR_7 = VAR_6.getDefaultMessage();
if (IMPORT_5.isNotEmpty(VAR_7)) {
builder.append(VAR_3.format(" (%s)", VAR_7));
}
return builder.toString();
}
}
| 0.425213 | {'IMPORT_0': 'controller', 'IMPORT_1': 'model', 'IMPORT_2': 'ErrorModel', 'IMPORT_3': 'apache', 'IMPORT_4': 'commons', 'IMPORT_5': 'StringUtils', 'IMPORT_6': 'http', 'IMPORT_7': 'HttpStatus', 'IMPORT_8': 'web', 'IMPORT_9': 'method', 'IMPORT_10': 'ResponseEntityExceptionHandler', 'IMPORT_11': 'java', 'IMPORT_12': 'stream', 'IMPORT_13': 'toList', 'CLASS_0': 'ApiValidationExceptionHandler', 'VAR_0': 'Override', 'VAR_1': 'status', 'VAR_2': 'bindingResult', 'CLASS_1': 'String', 'VAR_3': 'String', 'VAR_4': 'errorDetails', 'VAR_5': 'formatFieldError', 'FUNC_0': 'formatFieldError', 'FUNC_1': 'errorDetail', 'VAR_6': 'error', 'CLASS_2': 'StringBuilder', 'FUNC_2': 'getField', 'FUNC_3': 'getCode', 'VAR_7': 'defaultMessage'} | java | OOP | 60.28% |
/*******************************************************************************
* Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation
*
******************************************************************************/
package org.eclipse.persistence.jpa.jpql.parser;
import org.eclipse.persistence.jpa.jpql.EclipseLinkVersion;
import org.eclipse.persistence.jpa.jpql.JPAVersion;
/**
* <p>This {@link JPQLGrammar} provides support for parsing JPQL queries defined in <a
* href="http://jcp.org/en/jsr/detail?id=317">JSR-338 - Java Persistence 2.1</a> and the additional
* support provided by EclipseLink 2.6.</p>
*
* The BNFs of the additional support are the following:
* <pre><code> ...</code></pre>
*
* <p>Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.</p>
*
* @version 2.6
* @since 2.6
* @author <NAME>
*/
@SuppressWarnings("nls")
public final class EclipseLinkJPQLGrammar2_6 extends AbstractJPQLGrammar {
/**
* The singleton instance of this {@link EclipseLinkJPQLGrammar2_6}.
*/
private static final JPQLGrammar INSTANCE = new EclipseLinkJPQLGrammar2_6();
/**
* The EclipseLink version, which is 2.6.
*/
public static final EclipseLinkVersion VERSION = EclipseLinkVersion.VERSION_2_6;
/**
* Creates a new <code>EclipseLinkJPQLGrammar2_6</code>.
*/
public EclipseLinkJPQLGrammar2_6() {
super();
}
/**
* Creates a new <code>EclipseLinkJPQLGrammar2_6</code>.
*
* @param jpqlGrammar The {@link JPQLGrammar} to extend with the content of this one without
* instantiating the base {@link JPQLGrammar}
*/
public EclipseLinkJPQLGrammar2_6(AbstractJPQLGrammar jpqlGrammar) {
super(jpqlGrammar);
}
/**
* Extends the given {@link JPQLGrammar} with the information of this one without instantiating
* the base {@link JPQLGrammar}.
*
* @param jpqlGrammar The {@link JPQLGrammar} to extend with the content of this one without
* instantiating the base {@link JPQLGrammar}
*/
public static void extend(AbstractJPQLGrammar jpqlGrammar) {
new EclipseLinkJPQLGrammar2_6(jpqlGrammar);
}
/**
* Returns the singleton instance of this class.
*
* @return The singleton instance of {@link EclipseLinkJPQLGrammar2_6}
*/
public static JPQLGrammar instance() {
return INSTANCE;
}
/**
* {@inheritDoc}
*/
@Override
protected JPQLGrammar buildBaseGrammar() {
return new EclipseLinkJPQLGrammar2_5();
}
/**
* {@inheritDoc}
*/
@Override
public JPAVersion getJPAVersion() {
return JPAVersion.VERSION_2_1;
}
/**
* {@inheritDoc}
*/
@Override
public String getProvider() {
return DefaultEclipseLinkJPQLGrammar.PROVIDER_NAME;
}
/**
* {@inheritDoc}
*/
@Override
public String getProviderVersion() {
return VERSION.getVersion();
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeBNFs() {
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeExpressionFactories() {
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeIdentifiers() {
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "EclipseLink 2.6";
}
}
| /*******************************************************************************
* Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* Contributors:
* Oracle - initial API and implementation
*
******************************************************************************/
package org.eclipse.persistence.jpa.jpql.parser;
import org.eclipse.persistence.jpa.jpql.EclipseLinkVersion;
import org.eclipse.persistence.jpa.jpql.JPAVersion;
/**
* <p>This {@link JPQLGrammar} provides support for parsing JPQL queries defined in <a
* href="http://jcp.org/en/jsr/detail?id=317">JSR-338 - Java Persistence 2.1</a> and the additional
* support provided by EclipseLink 2.6.</p>
*
* The BNFs of the additional support are the following:
* <pre><code> ...</code></pre>
*
* <p>Provisional API: This interface is part of an interim API that is still under development and
* expected to change significantly before reaching stability. It is available at this early stage
* to solicit feedback from pioneering adopters on the understanding that any code that uses this
* API will almost certainly be broken (repeatedly) as the API evolves.</p>
*
* @version 2.6
* @since 2.6
* @author <NAME>
*/
@SuppressWarnings("nls")
public final class EclipseLinkJPQLGrammar2_6 extends CLASS_0 {
/**
* The singleton instance of this {@link EclipseLinkJPQLGrammar2_6}.
*/
private static final JPQLGrammar VAR_0 = new EclipseLinkJPQLGrammar2_6();
/**
* The EclipseLink version, which is 2.6.
*/
public static final EclipseLinkVersion VERSION = EclipseLinkVersion.VAR_1;
/**
* Creates a new <code>EclipseLinkJPQLGrammar2_6</code>.
*/
public EclipseLinkJPQLGrammar2_6() {
super();
}
/**
* Creates a new <code>EclipseLinkJPQLGrammar2_6</code>.
*
* @param jpqlGrammar The {@link JPQLGrammar} to extend with the content of this one without
* instantiating the base {@link JPQLGrammar}
*/
public EclipseLinkJPQLGrammar2_6(CLASS_0 VAR_2) {
super(VAR_2);
}
/**
* Extends the given {@link JPQLGrammar} with the information of this one without instantiating
* the base {@link JPQLGrammar}.
*
* @param jpqlGrammar The {@link JPQLGrammar} to extend with the content of this one without
* instantiating the base {@link JPQLGrammar}
*/
public static void extend(CLASS_0 VAR_2) {
new EclipseLinkJPQLGrammar2_6(VAR_2);
}
/**
* Returns the singleton instance of this class.
*
* @return The singleton instance of {@link EclipseLinkJPQLGrammar2_6}
*/
public static JPQLGrammar instance() {
return VAR_0;
}
/**
* {@inheritDoc}
*/
@Override
protected JPQLGrammar FUNC_0() {
return new CLASS_1();
}
/**
* {@inheritDoc}
*/
@Override
public JPAVersion FUNC_1() {
return JPAVersion.VERSION_2_1;
}
/**
* {@inheritDoc}
*/
@Override
public String getProvider() {
return DefaultEclipseLinkJPQLGrammar.PROVIDER_NAME;
}
/**
* {@inheritDoc}
*/
@Override
public String getProviderVersion() {
return VERSION.getVersion();
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeBNFs() {
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeExpressionFactories() {
}
/**
* {@inheritDoc}
*/
@Override
protected void initializeIdentifiers() {
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "EclipseLink 2.6";
}
}
| 0.225889 | {'CLASS_0': 'AbstractJPQLGrammar', 'VAR_0': 'INSTANCE', 'VAR_1': 'VERSION_2_6', 'VAR_2': 'jpqlGrammar', 'FUNC_0': 'buildBaseGrammar', 'CLASS_1': 'EclipseLinkJPQLGrammar2_5', 'FUNC_1': 'getJPAVersion'} | java | Procedural | 20.61% |
import org.junit.*;
import java.util.*;
import play.test.*;
import models.*;
import helpers.*;
import javax.*;
import play.*;
import play.db.jpa.*;
import play.mvc.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import com.google.gson.*;
import java.io.*;
import play.libs.*;
import javax.xml.parsers.*;
import flexjson.*;
import flexjson.transformer.*;
public class GEOQIntegrationTests extends UnitTest {
@Test
public void testProjectReadFromGEOQ() {
JsonElement s = GEOQIntegration.getGeoQProjects();
Logger.info(s.toString());
assertTrue(s.isJsonArray());
}
@Test
public void testRegionToWKTPolygon() {
Event e = Event.find("byName", "Tornadoes in Kansas City, MO").first();
String poly = GEOQIntegration.regionToWKTPolygon(e.region);
assertEquals(poly, "POLYGON ((-94.789288 39.043900 , -94.426740 39.048166 , -94.330609 38.911520 , -94.459698 38.661032 , -94.995282 38.563382 , -95.146344 38.701769 , -95.052960 39.005493 ))");
}
@Test
public void putGeoQProject() {
Event e = Event.find("byName", "Tornadoes in Kansas City, MO").first();
GEOQIntegration.putGeoQProject(e);
}
@Test
public void testBufferCreation() {
RFI r = RFI.findById(2L);
GEOQIntegration.putGeoQJob(r);
}
}
| import org.IMPORT_0.*;
import IMPORT_1.IMPORT_2.*;
import IMPORT_3.test.*;
import VAR_0.*;
import VAR_1.*;
import javax.*;
import IMPORT_3.*;
import IMPORT_3.IMPORT_4.jpa.*;
import IMPORT_3.IMPORT_5.*;
import org.w3c.IMPORT_6.*;
import org.IMPORT_7.IMPORT_8.*;
import IMPORT_9.google.IMPORT_10.*;
import IMPORT_1.IMPORT_11.*;
import IMPORT_3.IMPORT_12.*;
import javax.IMPORT_7.IMPORT_13.*;
import flexjson.*;
import flexjson.transformer.*;
public class CLASS_0 extends CLASS_1 {
@VAR_2
public void FUNC_0() {
JsonElement s = GEOQIntegration.getGeoQProjects();
VAR_3.FUNC_1(s.FUNC_2());
FUNC_3(s.FUNC_4());
}
@VAR_2
public void FUNC_5() {
Event e = Event.FUNC_6("byName", "Tornadoes in Kansas City, MO").first();
CLASS_2 VAR_4 = GEOQIntegration.regionToWKTPolygon(e.VAR_5);
FUNC_7(VAR_4, "POLYGON ((-94.789288 39.043900 , -94.426740 39.048166 , -94.330609 38.911520 , -94.459698 38.661032 , -94.995282 38.563382 , -95.146344 38.701769 , -95.052960 39.005493 ))");
}
@VAR_2
public void FUNC_8() {
Event e = Event.FUNC_6("byName", "Tornadoes in Kansas City, MO").first();
GEOQIntegration.FUNC_8(e);
}
@VAR_2
public void FUNC_9() {
RFI r = RFI.FUNC_10(2L);
GEOQIntegration.FUNC_11(r);
}
}
| 0.633861 | {'IMPORT_0': 'junit', 'IMPORT_1': 'java', 'IMPORT_2': 'util', 'IMPORT_3': 'play', 'VAR_0': 'models', 'VAR_1': 'helpers', 'IMPORT_4': 'db', 'IMPORT_5': 'mvc', 'IMPORT_6': 'dom', 'IMPORT_7': 'xml', 'IMPORT_8': 'sax', 'IMPORT_9': 'com', 'IMPORT_10': 'gson', 'IMPORT_11': 'io', 'IMPORT_12': 'libs', 'IMPORT_13': 'parsers', 'CLASS_0': 'GEOQIntegrationTests', 'CLASS_1': 'UnitTest', 'VAR_2': 'Test', 'FUNC_0': 'testProjectReadFromGEOQ', 'VAR_3': 'Logger', 'FUNC_1': 'info', 'FUNC_2': 'toString', 'FUNC_3': 'assertTrue', 'FUNC_4': 'isJsonArray', 'FUNC_5': 'testRegionToWKTPolygon', 'FUNC_6': 'find', 'CLASS_2': 'String', 'VAR_4': 'poly', 'VAR_5': 'region', 'FUNC_7': 'assertEquals', 'FUNC_8': 'putGeoQProject', 'FUNC_9': 'testBufferCreation', 'FUNC_10': 'findById', 'FUNC_11': 'putGeoQJob'} | java | OOP | 48.10% |
/**
* Invoked when the scheduler re-registers with a newly elected Mesos master.
* This is only called when the scheduler has previously been registered.
* MasterInfo containing the updated information about the elected master
* is provided as an argument.
*
* @param driver The driver that was re-registered.
* @param masterInfo The updated information about the elected master.
*
* @see SchedulerDriver
* @see MasterInfo
*/
@Override
public void reregistered(
SchedulerDriver driver,
Protos.MasterInfo masterInfo) {
LOG.info(String.format(
"Reregistered with Mesos master [%s:%d]",
masterInfo.getHostname(),
masterInfo.getPort()
));
} | /**
* Invoked when the scheduler re-registers with a newly elected Mesos master.
* This is only called when the scheduler has previously been registered.
* MasterInfo containing the updated information about the elected master
* is provided as an argument.
*
* @param driver The driver that was re-registered.
* @param masterInfo The updated information about the elected master.
*
* @see SchedulerDriver
* @see MasterInfo
*/
@VAR_0
public void FUNC_0(
SchedulerDriver driver,
CLASS_0.CLASS_1 VAR_1) {
LOG.FUNC_1(VAR_2.FUNC_2(
"Reregistered with Mesos master [%s:%d]",
VAR_1.FUNC_3(),
VAR_1.getPort()
));
} | 0.58691 | {'VAR_0': 'Override', 'FUNC_0': 'reregistered', 'CLASS_0': 'Protos', 'CLASS_1': 'MasterInfo', 'VAR_1': 'masterInfo', 'FUNC_1': 'info', 'VAR_2': 'String', 'FUNC_2': 'format', 'FUNC_3': 'getHostname'} | java | Procedural | 87.36% |
import javax.swing.JOptionPane;
public class Main {
private static String temp = "";
public static void main(String[] args) {
temp = JOptionPane.showInputDialog(null, "Velocidad", "Datos", JOptionPane.QUESTION_MESSAGE);
double velocidad = Double.parseDouble(temp);
temp = JOptionPane.showInputDialog(null, "Angulo", "Datos", JOptionPane.QUESTION_MESSAGE);
double angulo = Double.parseDouble(temp);
Calculos calculos = new Calculos();
calculos.Operaciones(angulo, velocidad);
}
}
|
import IMPORT_0.IMPORT_1.IMPORT_2;
public class CLASS_0 {
private static CLASS_1 temp = "";
public static void FUNC_0(CLASS_1[] args) {
temp = IMPORT_2.FUNC_1(null, "Velocidad", "Datos", IMPORT_2.VAR_0);
double VAR_1 = Double.parseDouble(temp);
temp = IMPORT_2.FUNC_1(null, "Angulo", "Datos", IMPORT_2.VAR_0);
double VAR_2 = Double.parseDouble(temp);
CLASS_2 VAR_3 = new CLASS_2();
VAR_3.Operaciones(VAR_2, VAR_1);
}
}
| 0.821853 | {'IMPORT_0': 'javax', 'IMPORT_1': 'swing', 'IMPORT_2': 'JOptionPane', 'CLASS_0': 'Main', 'CLASS_1': 'String', 'FUNC_0': 'main', 'FUNC_1': 'showInputDialog', 'VAR_0': 'QUESTION_MESSAGE', 'VAR_1': 'velocidad', 'VAR_2': 'angulo', 'CLASS_2': 'Calculos', 'VAR_3': 'calculos'} | java | OOP | 100.00% |
package com.lanking.uxb.service.thirdparty.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import com.lanking.uxb.service.session.api.SessionService;
import com.lanking.uxb.service.thirdparty.weixin.WXMethodHandlerInterceptor;
import com.lanking.uxb.service.thirdparty.weixin.client.WXClient;
import com.lanking.uxb.service.user.api.AccountService;
import com.lanking.uxb.service.user.api.CredentialService;
@Configuration
public class ThirdpartyConfig extends WebMvcConfigurerAdapter {
@Autowired
private WXClient wxclient;
@Autowired
private CredentialService credentialService;
@Autowired
@Qualifier("accountService")
private AccountService accountService;
@Autowired
private SessionService sessionService;
@Bean("WXMethodHandlerInterceptor")
@Qualifier(value = "WXMethodHandlerInterceptor")
WXMethodHandlerInterceptor handlerInterceptorAdapter() {
WXMethodHandlerInterceptor handlerInterceptorAdapter = new WXMethodHandlerInterceptor();
handlerInterceptorAdapter.setAccountService(accountService);
handlerInterceptorAdapter.setCredentialService(credentialService);
handlerInterceptorAdapter.setSessionService(sessionService);
handlerInterceptorAdapter.setWxclient(wxclient);
return handlerInterceptorAdapter;
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(handlerInterceptorAdapter());
super.addInterceptors(registry);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.thirdparty.config;
import IMPORT_4.IMPORT_5.IMPORT_6.IMPORT_7.annotation.Autowired;
import IMPORT_4.IMPORT_5.IMPORT_6.IMPORT_7.annotation.IMPORT_8;
import IMPORT_4.IMPORT_5.context.annotation.IMPORT_9;
import IMPORT_4.IMPORT_5.context.annotation.Configuration;
import IMPORT_4.IMPORT_5.IMPORT_10.IMPORT_11.config.annotation.InterceptorRegistry;
import IMPORT_4.IMPORT_5.IMPORT_10.IMPORT_11.config.annotation.WebMvcConfigurerAdapter;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_12.api.SessionService;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.thirdparty.IMPORT_13.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.thirdparty.IMPORT_13.IMPORT_15.WXClient;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_16.api.AccountService;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_16.api.CredentialService;
@Configuration
public class ThirdpartyConfig extends WebMvcConfigurerAdapter {
@Autowired
private WXClient VAR_0;
@Autowired
private CredentialService VAR_1;
@Autowired
@IMPORT_8("accountService")
private AccountService VAR_2;
@Autowired
private SessionService VAR_3;
@IMPORT_9("WXMethodHandlerInterceptor")
@IMPORT_8(VAR_4 = "WXMethodHandlerInterceptor")
IMPORT_14 FUNC_0() {
IMPORT_14 VAR_5 = new IMPORT_14();
VAR_5.setAccountService(VAR_2);
VAR_5.setCredentialService(VAR_1);
VAR_5.setSessionService(VAR_3);
VAR_5.FUNC_1(VAR_0);
return VAR_5;
}
@VAR_6
public void FUNC_2(InterceptorRegistry VAR_7) {
VAR_7.FUNC_3(FUNC_0());
super.FUNC_2(VAR_7);
}
}
| 0.709367 | {'IMPORT_0': 'com', 'IMPORT_1': 'lanking', 'IMPORT_2': 'uxb', 'IMPORT_3': 'service', 'IMPORT_4': 'org', 'IMPORT_5': 'springframework', 'IMPORT_6': 'beans', 'IMPORT_7': 'factory', 'IMPORT_8': 'Qualifier', 'IMPORT_9': 'Bean', 'IMPORT_10': 'web', 'IMPORT_11': 'servlet', 'IMPORT_12': 'session', 'IMPORT_13': 'weixin', 'IMPORT_14': 'WXMethodHandlerInterceptor', 'IMPORT_15': 'client', 'IMPORT_16': 'user', 'VAR_0': 'wxclient', 'VAR_1': 'credentialService', 'VAR_2': 'accountService', 'VAR_3': 'sessionService', 'VAR_4': 'value', 'FUNC_0': 'handlerInterceptorAdapter', 'VAR_5': 'handlerInterceptorAdapter', 'FUNC_1': 'setWxclient', 'VAR_6': 'Override', 'FUNC_2': 'addInterceptors', 'VAR_7': 'registry', 'FUNC_3': 'addInterceptor'} | java | OOP | 95.00% |
/**
* TemplateUri evaluates a template expression and returns the result
*/
public class TemplateUri extends Uri {
private final UriTemplate uri;
public TemplateUri(String uri) {
this.uri = UriTemplate.fromTemplate(uri);
}
public TemplateUri set(String variableName, Object value) {
uri.set(variableName, value);
return this;
}
@Override
public String toString() {
return uri.expand();
}
} | /**
* TemplateUri evaluates a template expression and returns the result
*/
public class TemplateUri extends Uri {
private final UriTemplate uri;
public TemplateUri(String uri) {
this.uri = UriTemplate.fromTemplate(uri);
}
public TemplateUri set(String variableName, Object value) {
uri.set(variableName, value);
return this;
}
@Override
public String toString() {
return uri.expand();
}
} | 0.053281 | {} | java | OOP | 100.00% |
package alien4cloud.rest.orchestrator.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
@Getter
@Setter
@ApiModel("Request to update a location resource template property.")
public class UpdateLocationResourceTemplatePropertyRequest {
@NotBlank
@ApiModelProperty(value = "Name of the property to update.")
private String propertyName;
@ApiModelProperty(value = "Value of the property to update, the type must be equal to the type of the property that will be updated.")
private Object propertyValue;
}
| package alien4cloud.rest.orchestrator.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.NotBlank;
@Getter
@Setter
@ApiModel("Request to update a location resource template property.")
public class UpdateLocationResourceTemplatePropertyRequest {
@NotBlank
@ApiModelProperty(VAR_0 = "Name of the property to update.")
private CLASS_0 VAR_1;
@ApiModelProperty(VAR_0 = "Value of the property to update, the type must be equal to the type of the property that will be updated.")
private Object propertyValue;
}
| 0.140914 | {'VAR_0': 'value', 'CLASS_0': 'String', 'VAR_1': 'propertyName'} | java | Hibrido | 100.00% |
package com.jipthechip.fermentationmod.Particles;
import net.fabricmc.fabric.api.particle.v1.FabricParticleTypes;
import net.minecraft.client.particle.ParticleTextureSheet;
import net.minecraft.client.particle.SpriteBillboardParticle;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.particle.DefaultParticleType;
public class TestParticle extends SpriteBillboardParticle {
//DefaultParticleType testParticleType = FabricParticleTypes//.complex();
protected TestParticle(ClientWorld clientWorld, double d, double e, double f) {
super(clientWorld, d, e, f);
}
protected TestParticle(ClientWorld clientWorld, double d, double e, double f, double g, double h, double i) {
super(clientWorld, d, e, f, g, h, i);
}
@Override
public ParticleTextureSheet getType() {
return ParticleTextureSheet.PARTICLE_SHEET_OPAQUE;
}
}
| package IMPORT_0.IMPORT_1.fermentationmod.IMPORT_2;
import IMPORT_3.IMPORT_4.IMPORT_5.api.IMPORT_6.v1.IMPORT_7;
import IMPORT_3.minecraft.client.IMPORT_6.IMPORT_8;
import IMPORT_3.minecraft.client.IMPORT_6.IMPORT_9;
import IMPORT_3.minecraft.client.IMPORT_10.IMPORT_11;
import IMPORT_3.minecraft.IMPORT_6.DefaultParticleType;
public class CLASS_0 extends IMPORT_9 {
//DefaultParticleType testParticleType = FabricParticleTypes//.complex();
protected CLASS_0(IMPORT_11 VAR_0, double VAR_1, double e, double VAR_2) {
super(VAR_0, VAR_1, e, VAR_2);
}
protected CLASS_0(IMPORT_11 VAR_0, double VAR_1, double e, double VAR_2, double VAR_3, double h, double VAR_4) {
super(VAR_0, VAR_1, e, VAR_2, VAR_3, h, VAR_4);
}
@Override
public IMPORT_8 FUNC_0() {
return IMPORT_8.VAR_5;
}
}
| 0.734846 | {'IMPORT_0': 'com', 'IMPORT_1': 'jipthechip', 'IMPORT_2': 'Particles', 'IMPORT_3': 'net', 'IMPORT_4': 'fabricmc', 'IMPORT_5': 'fabric', 'IMPORT_6': 'particle', 'IMPORT_7': 'FabricParticleTypes', 'IMPORT_8': 'ParticleTextureSheet', 'IMPORT_9': 'SpriteBillboardParticle', 'IMPORT_10': 'world', 'IMPORT_11': 'ClientWorld', 'CLASS_0': 'TestParticle', 'VAR_0': 'clientWorld', 'VAR_1': 'd', 'VAR_2': 'f', 'VAR_3': 'g', 'VAR_4': 'i', 'FUNC_0': 'getType', 'VAR_5': 'PARTICLE_SHEET_OPAQUE'} | java | OOP | 100.00% |
/**
*
* @author Xavier Sumba <[email protected]>
*/
public class ScholarImageUriAttrMapper extends CssUriAttrWhitelistQueryParamsMapper {
public ScholarImageUriAttrMapper(String cssSelector, String attr, String... queryParamWhitelist) {
super(cssSelector, attr, queryParamWhitelist);
}
@Override
public List<Value> map(String resourceUri, Element element, ValueFactory factory) {
final String uri = rewriteUrl(element.absUrl(attr));
if (uri.contains("avatar_scholar")) {
return Collections.emptyList();
}
try {
return Collections.singletonList((Value) factory.createURI(uri));
} catch (IllegalArgumentException e) {
return Collections.emptyList();
}
}
} | /**
*
* @author Xavier Sumba <[email protected]>
*/
public class ScholarImageUriAttrMapper extends CssUriAttrWhitelistQueryParamsMapper {
public ScholarImageUriAttrMapper(CLASS_0 VAR_0, CLASS_0 attr, CLASS_0... VAR_1) {
super(VAR_0, attr, VAR_1);
}
@Override
public List<CLASS_1> map(CLASS_0 VAR_2, Element element, ValueFactory factory) {
final CLASS_0 VAR_3 = FUNC_0(element.absUrl(attr));
if (VAR_3.contains("avatar_scholar")) {
return VAR_4.emptyList();
}
try {
return VAR_4.FUNC_1((CLASS_1) factory.FUNC_2(VAR_3));
} catch (IllegalArgumentException e) {
return VAR_4.emptyList();
}
}
} | 0.354381 | {'CLASS_0': 'String', 'VAR_0': 'cssSelector', 'VAR_1': 'queryParamWhitelist', 'CLASS_1': 'Value', 'VAR_2': 'resourceUri', 'VAR_3': 'uri', 'FUNC_0': 'rewriteUrl', 'VAR_4': 'Collections', 'FUNC_1': 'singletonList', 'FUNC_2': 'createURI'} | java | OOP | 53.00% |
package org.opsli.modulars.tools.api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.opsli.common.annotation.ApiRestController;
import org.opsli.common.annotation.ApiVersion;
import org.springframework.web.bind.annotation.GetMapping;
/**
* API 版本控制测试
*
* @author 周鹏程
* @date 2021年10月27日12:50:00
*/
@Api(tags = "API-测试版本控制")
@ApiRestController("/{ver}/tools/api")
public class ApiController {
@ApiOperation(value = "测试正常接口", notes = "测试正常接口")
@GetMapping("/test")
public String test() {
return "test 1";
}
@ApiOperation(value = ">= V1 && <= V4", notes = ">= V1 && <= V4")
@GetMapping("/fun")
public String fun1() {
return "fun 1";
}
@ApiOperation(value = ">= V5 && <= V8", notes = ">= V5 && <= V8")
@ApiVersion(5)
@GetMapping("/fun")
public String fun2() {
return "fun 2";
}
@ApiOperation(value = ">= V9", notes = ">= V9")
@ApiVersion(9)
@GetMapping("/fun")
public String fun3() {
return "fun 5";
}
} | package org.IMPORT_0.modulars.tools.api;
import io.swagger.IMPORT_1.Api;
import io.swagger.IMPORT_1.ApiOperation;
import org.IMPORT_0.common.annotation.ApiRestController;
import org.IMPORT_0.common.annotation.ApiVersion;
import org.IMPORT_2.IMPORT_3.IMPORT_4.annotation.GetMapping;
/**
* API 版本控制测试
*
* @author 周鹏程
* @date 2021年10月27日12:50:00
*/
@Api(tags = "API-测试版本控制")
@ApiRestController("/{ver}/tools/api")
public class ApiController {
@ApiOperation(value = "测试正常接口", notes = "测试正VAR_0
@GetMapping("/test")
public String FUNC_0() {
return "test 1";
}
@ApiOperation(value = ">= V1 && <= V4", VAR_1 = ">= V1 && <= V4")
@GetMapping("/fun")
public String fun1() {
return "fun 1";
}
@ApiOperation(value = ">= V5 && <= V8", VAR_1 = ">= V5 && <= V8")
@ApiVersion(5)
@GetMapping("/fun")
public String FUNC_1() {
return "fun 2";
}
@ApiOperation(value = ">= V9", VAR_1 = ">= V9")
@ApiVersion(9)
@GetMapping("/fun")
public String FUNC_2() {
return "fun 5";
}
} | 0.270615 | {'IMPORT_0': 'opsli', 'IMPORT_1': 'annotations', 'IMPORT_2': 'springframework', 'IMPORT_3': 'web', 'IMPORT_4': 'bind', 'VAR_0': '常接口")', 'FUNC_0': 'test', 'VAR_1': 'notes', 'FUNC_1': 'fun2', 'FUNC_2': 'fun3'} | java | Procedural | 36.75% |
import java.util.*;
public class Solution {
static int[][] dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int r = sc.nextInt(), c = sc.nextInt(); sc.nextLine();
String[] board = new String[r];
for (int a = 0; a < r; ++a) {
board[a] = sc.nextLine();
}
boolean[][] vis = new boolean[r][c];
for (int a = 0; a < r; ++a) {
for (int b = 0; b < c; ++b) {
if (vis[a][b]){ continue; }
if (dfs(board[a].charAt(b), a, b, a, b, board, vis)){
System.out.println("Yes");
return;
}
}
}
System.out.println("No");
}
static boolean dfs(char col, int pr, int pc, int nr, int nc, String[] board, boolean[][] vis) {
if (board[nr].charAt(nc) != col){
return false;
}
if (vis[nr][nc]) {
return true;
}
vis[nr][nc] = true;
for (int[] dir : dirs) {
int nnr = nr + dir[0], nnc = nc + dir[1];
if (nnr == pr && nnc == pc) { continue; }
if (isInside(nnr, nnc, board) && dfs(col, nr, nc, nnr, nnc, board, vis)) {
return true;
}
}
return false;
}
static boolean isInside(int r, int c, String[] board) {
return r >= 0 && r < board.length && c >= 0 && c < board[0].length();
}
} | import java.util.*;
public class Solution {
static int[][] VAR_0 = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
public static void main(CLASS_0[] args) {
Scanner sc = new Scanner(System.in);
int r = sc.nextInt(), c = sc.nextInt(); sc.nextLine();
CLASS_0[] board = new CLASS_0[r];
for (int a = 0; a < r; ++a) {
board[a] = sc.nextLine();
}
boolean[][] VAR_1 = new boolean[r][c];
for (int a = 0; a < r; ++a) {
for (int b = 0; b < c; ++b) {
if (VAR_1[a][b]){ continue; }
if (dfs(board[a].charAt(b), a, b, a, b, board, VAR_1)){
System.out.println("Yes");
return;
}
}
}
System.out.println("No");
}
static boolean dfs(char col, int pr, int pc, int nr, int nc, CLASS_0[] board, boolean[][] VAR_1) {
if (board[nr].charAt(nc) != col){
return false;
}
if (VAR_1[nr][nc]) {
return true;
}
VAR_1[nr][nc] = true;
for (int[] dir : VAR_0) {
int nnr = nr + dir[0], nnc = nc + dir[1];
if (nnr == pr && nnc == pc) { continue; }
if (FUNC_0(nnr, nnc, board) && dfs(col, nr, nc, nnr, nnc, board, VAR_1)) {
return true;
}
}
return false;
}
static boolean FUNC_0(int r, int c, CLASS_0[] board) {
return r >= 0 && r < board.VAR_2 && c >= 0 && c < board[0].FUNC_1();
}
} | 0.19202 | {'VAR_0': 'dirs', 'CLASS_0': 'String', 'VAR_1': 'vis', 'FUNC_0': 'isInside', 'VAR_2': 'length', 'FUNC_1': 'length'} | java | OOP | 4.55% |
package com.ushaqi.zhuishushenqi.ui;
import com.ushaqi.zhuishushenqi.a.e;
import com.ushaqi.zhuishushenqi.api.ApiService;
import com.ushaqi.zhuishushenqi.api.b;
import com.ushaqi.zhuishushenqi.model.RecommendUgcRoot;
public final class RelateUgcFragment$GetUgcsTask extends e<String, Void, RecommendUgcRoot>
{
private String b = "共%1$d本书 | %2$d人收藏";
public RelateUgcFragment$GetUgcsTask(RelateUgcFragment paramRelateUgcFragment)
{
}
private static RecommendUgcRoot a(String[] paramArrayOfString)
{
try
{
b.a();
RecommendUgcRoot localRecommendUgcRoot = b.b().i(paramArrayOfString[0], 3);
return localRecommendUgcRoot;
}
catch (Exception localException)
{
localException.printStackTrace();
}
return null;
}
}
/* Location: E:\Progs\Dev\Android\Decompile\apktool\zssq\zssq-dex2jar.jar
* Qualified Name: com.ushaqi.zhuishushenqi.ui.RelateUgcFragment.GetUgcsTask
* JD-Core Version: 0.6.0
*/ | package IMPORT_0.IMPORT_1.zhuishushenqi.ui;
import IMPORT_0.IMPORT_1.zhuishushenqi.a.IMPORT_2;
import IMPORT_0.IMPORT_1.zhuishushenqi.IMPORT_3.IMPORT_4;
import IMPORT_0.IMPORT_1.zhuishushenqi.IMPORT_3.b;
import IMPORT_0.IMPORT_1.zhuishushenqi.IMPORT_5.IMPORT_6;
public final class RelateUgcFragment$GetUgcsTask extends IMPORT_2<CLASS_0, CLASS_1, IMPORT_6>
{
private CLASS_0 b = "共%1$d本书 | %2$d人收藏";
public RelateUgcFragment$GetUgcsTask(CLASS_2 VAR_0)
{
}
private static IMPORT_6 a(CLASS_0[] VAR_1)
{
try
{
b.a();
IMPORT_6 VAR_2 = b.b().FUNC_0(VAR_1[0], 3);
return VAR_2;
}
catch (CLASS_3 localException)
{
localException.FUNC_1();
}
return null;
}
}
/* Location: E:\Progs\Dev\Android\Decompile\apktool\zssq\zssq-dex2jar.jar
* Qualified Name: com.ushaqi.zhuishushenqi.ui.RelateUgcFragment.GetUgcsTask
* JD-Core Version: 0.6.0
*/ | 0.495217 | {'IMPORT_0': 'com', 'IMPORT_1': 'ushaqi', 'IMPORT_2': 'e', 'IMPORT_3': 'api', 'IMPORT_4': 'ApiService', 'IMPORT_5': 'model', 'IMPORT_6': 'RecommendUgcRoot', 'CLASS_0': 'String', 'CLASS_1': 'Void', 'CLASS_2': 'RelateUgcFragment', 'VAR_0': 'paramRelateUgcFragment', 'VAR_1': 'paramArrayOfString', 'VAR_2': 'localRecommendUgcRoot', 'FUNC_0': 'i', 'CLASS_3': 'Exception', 'FUNC_1': 'printStackTrace'} | java | OOP | 100.00% |
package com.book.thread.visit;
/**
* 《Java多线程编程核心技术》第1章 Java多线程技能
* 2.2.1 synchronized方法的弊端
* Page: 72
* 当两个并发线程访问同一个对象Object中的Synchronized(this)同步代码块时,
* 一段时间内只能有一个线程被执行。另一个线程必须等待当前线程执行完这个代码块
* 以后才能执行该代码块。
* Author: wedo
* Time: 2018-07-26 05:50:20
*/
public class ThreadSynchronizedMethodDefect {
protected static long beginTime1;
protected static long endTime1;
protected static long beginTime2;
public static long endTime2;
private String getData1;
private String getData2;
public synchronized void doLongTimeTask(){
try{
System.out.println("Begin Task");
Thread.sleep(3000 );
getData1 = "长时间处理任务后从远程返回的值 1 ThreadName= " + Thread.currentThread().getName();
getData2 = "长时间处理任务后从远程返回的值 2 ThreadName= " + Thread.currentThread().getName();
System.out.println(getData1);
System.out.println(getData2);
System.out.println("End Task");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws InterruptedException {
ThreadSynchronizedMethodDefect task = new ThreadSynchronizedMethodDefect();
Thread t1 = new Thread() {
@Override
public void run() {
super.run();
beginTime1 = System.currentTimeMillis();
task.doLongTimeTask();
endTime1 = System.currentTimeMillis();
}
};
t1.start();
Thread t2 = new Thread() {
@Override
public void run() {
super.run();
beginTime2 = System.currentTimeMillis();
task.doLongTimeTask();
endTime2 = System.currentTimeMillis();
}
};
t2.start();
Thread.sleep(10000);
long beginTime = beginTime1 > beginTime2 ? beginTime1 : beginTime2;
long endTime = endTime1 > endTime2 ? endTime1 : endTime2;
System.out.println("耗时: " + ((endTime - beginTime) / 1000));
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
/**
* 《Java多线程编程核心技术》第1章 Java多线程技能
* 2.2.1 synchronized方法的弊端
* Page: 72
* 当两个并发线程访问同一个对象Object中的Synchronized(this)同步代码块时,
* 一段时间内只能有一个线程被执行。另一个线程必须等待当前线程执行完这个代码块
* 以后才能执行该代码块。
* Author: wedo
* Time: 2018-07-26 05:50:20
*/
public class CLASS_0 {
protected static long beginTime1;
protected static long VAR_0;
protected static long VAR_1;
public static long VAR_2;
private CLASS_1 getData1;
private CLASS_1 getData2;
public synchronized void FUNC_0(){
try{
System.VAR_3.FUNC_1("Begin Task");
Thread.sleep(3000 );
getData1 = "长时间处理任务后从远程返回的值 1 ThreadName= " + Thread.currentThread().getName();
getData2 = "长时间处理任务后从远程返回的值 2 ThreadName= " + Thread.currentThread().getName();
System.VAR_3.FUNC_1(getData1);
System.VAR_3.FUNC_1(getData2);
System.VAR_3.FUNC_1("End Task");
} catch (InterruptedException VAR_4) {
VAR_4.FUNC_2();
}
}
public static void main(CLASS_1[] args) throws InterruptedException {
CLASS_0 VAR_5 = new CLASS_0();
Thread VAR_6 = new Thread() {
@VAR_7
public void FUNC_3() {
super.FUNC_3();
beginTime1 = System.FUNC_4();
VAR_5.FUNC_0();
VAR_0 = System.FUNC_4();
}
};
VAR_6.start();
Thread VAR_8 = new Thread() {
@VAR_7
public void FUNC_3() {
super.FUNC_3();
VAR_1 = System.FUNC_4();
VAR_5.FUNC_0();
VAR_2 = System.FUNC_4();
}
};
VAR_8.start();
Thread.sleep(10000);
long VAR_9 = beginTime1 > VAR_1 ? beginTime1 : VAR_1;
long endTime = VAR_0 > VAR_2 ? VAR_0 : VAR_2;
System.VAR_3.FUNC_1("耗时: " + ((endTimVAR_10inTVAR_1100));
}
}
| 0.675569 | {'IMPORT_0': 'com', 'IMPORT_1': 'book', 'IMPORT_2': 'thread', 'IMPORT_3': 'visit', 'CLASS_0': 'ThreadSynchronizedMethodDefect', 'VAR_0': 'endTime1', 'VAR_1': 'beginTime2', 'VAR_2': 'endTime2', 'CLASS_1': 'String', 'FUNC_0': 'doLongTimeTask', 'VAR_3': 'out', 'FUNC_1': 'println', 'VAR_4': 'e', 'FUNC_2': 'printStackTrace', 'VAR_5': 'task', 'VAR_6': 't1', 'VAR_7': 'Override', 'FUNC_3': 'run', 'FUNC_4': 'currentTimeMillis', 'VAR_8': 't2', 'VAR_9': 'beginTime', 'VAR_10': 'e - beg', 'VAR_11': 'ime) / 10'} | java | Hibrido | 100.00% |
/**
* List objects (files in bucket)
* NOTE: An S3ObjectSummary object stores file size, file owner (no need database for this), ...
* @param bucketName Name of bucket
* @return List of
*/
public static List<S3ObjectSummary> listObjects(String bucketName) {
if (s3client.doesBucketExistV2(bucketName)) {
ObjectListing objectListing = s3client.listObjects(bucketName);
return objectListing.getObjectSummaries();
}
System.out.println("[x] Bucket does not exist... Please try again");
return null;
} | /**
* List objects (files in bucket)
* NOTE: An S3ObjectSummary object stores file size, file owner (no need database for this), ...
* @param bucketName Name of bucket
* @return List of
*/
public static CLASS_0<S3ObjectSummary> listObjects(CLASS_1 bucketName) {
if (VAR_0.FUNC_0(bucketName)) {
ObjectListing VAR_1 = VAR_0.listObjects(bucketName);
return VAR_1.FUNC_1();
}
System.VAR_2.println("[x] Bucket does not exist... Please try again");
return null;
} | 0.327848 | {'CLASS_0': 'List', 'CLASS_1': 'String', 'VAR_0': 's3client', 'FUNC_0': 'doesBucketExistV2', 'VAR_1': 'objectListing', 'FUNC_1': 'getObjectSummaries', 'VAR_2': 'out'} | java | Procedural | 64.79% |
/**
* A KB corresponding to a Wikipedia instance, which is concretely stored as a set of LMDB databases.
*
* -> should be renamed LowerKBEnvironment
*
*/
public abstract class KBEnvironment implements Closeable {
private static final Logger LOGGER = LoggerFactory.getLogger(KBEnvironment.class);
// this is the singleton FST configuration for all serialization operations with the KB
protected static FSTConfiguration singletonConf = FSTConfiguration.createDefaultConfiguration();
//protected static FSTConfiguration singletonConf = FSTConfiguration.createUnsafeBinaryConfiguration();
public static FSTConfiguration getFSTConfigurationInstance() {
return singletonConf;
}
/**
* Serialization in the KBEnvironment with FST
*/
public static byte[] serialize(Object obj) {
byte data[] = getFSTConfigurationInstance().asByteArray(obj);
return data;
}
/**
* Deserialization in the KBEnvironment with FST. The returned Object needs to be casted
* in the expected actual object.
*/
public static Object deserialize(byte[] data) {
return getFSTConfigurationInstance().asObject(data);
}
// NERD configuration for the KB instance
protected NerdConfig conf = null;
// database registry for the environment
protected Map<DatabaseType, KBDatabase> databasesByType = null;
/**
* Constructor
*/
public KBEnvironment(NerdConfig conf) {
this.conf = conf;
// register classes to be serialized
singletonConf.registerClass(DbPage.class, DbIntList.class, DbTranslations.class, Property.class, Statement.class);
//initDatabases();
}
/**
* Returns the configuration of this environment
*/
public NerdConfig getConfiguration() {
return conf;
}
protected abstract void initDatabases();
protected KBDatabase getDatabase(DatabaseType dbType) {
return databasesByType.get(dbType);
}
public void close() {
for (KBDatabase db:this.databasesByType.values()) {
db.close();
}
}
public abstract Long retrieveStatistic(StatisticName sn);
public abstract void buildEnvironment(NerdConfig conf, boolean overwrite) throws Exception;
protected static File getDataFile(File dataDirectory, String fileName) {
File file = new File(dataDirectory + File.separator + fileName);
if (!file.canRead()) {
LOGGER.info(file + " is not readable");
return null;
} else
return file;
}
/**
* Statistics available about a wikipedia dump
*/
public enum StatisticName {
/**
* number of articles (not disambiguations or redirects)
*/
articleCount,
/**
* number of categories
*/
categoryCount,
/**
* number of disambiguation pages
*/
disambiguationCount,
/**
* number of redirects
*/
redirectCount,
/**
* date and time this dump was last edited, use new Date(long)
*/
lastEdit,
/**
* maximum path length between articles and the root category
*/
maxCategoryDepth,
/**
* id of root category
*/
rootCategoryId
}
} | /**
* A KB corresponding to a Wikipedia instance, which is concretely stored as a set of LMDB databases.
*
* -> should be renamed LowerKBEnvironment
*
*/
public abstract class CLASS_0 implements CLASS_1 {
private static final CLASS_2 VAR_0 = VAR_1.FUNC_0(CLASS_0.class);
// this is the singleton FST configuration for all serialization operations with the KB
protected static CLASS_3 VAR_3 = VAR_2.FUNC_1();
//protected static FSTConfiguration singletonConf = FSTConfiguration.createUnsafeBinaryConfiguration();
public static CLASS_3 FUNC_2() {
return VAR_3;
}
/**
* Serialization in the KBEnvironment with FST
*/
public static byte[] FUNC_3(CLASS_4 VAR_4) {
byte VAR_5[] = FUNC_2().FUNC_4(VAR_4);
return VAR_5;
}
/**
* Deserialization in the KBEnvironment with FST. The returned Object needs to be casted
* in the expected actual object.
*/
public static CLASS_4 FUNC_5(byte[] VAR_5) {
return FUNC_2().FUNC_6(VAR_5);
}
// NERD configuration for the KB instance
protected CLASS_5 VAR_6 = null;
// database registry for the environment
protected CLASS_6<CLASS_7, CLASS_8> databasesByType = null;
/**
* Constructor
*/
public CLASS_0(CLASS_5 VAR_6) {
this.VAR_6 = VAR_6;
// register classes to be serialized
VAR_3.FUNC_7(CLASS_9.class, CLASS_10.class, CLASS_11.class, CLASS_12.class, CLASS_13.class);
//initDatabases();
}
/**
* Returns the configuration of this environment
*/
public CLASS_5 FUNC_8() {
return VAR_6;
}
protected abstract void FUNC_9();
protected CLASS_8 FUNC_10(CLASS_7 VAR_7) {
return databasesByType.get(VAR_7);
}
public void FUNC_11() {
for (CLASS_8 VAR_8:this.databasesByType.FUNC_12()) {
VAR_8.FUNC_11();
}
}
public abstract Long FUNC_13(CLASS_14 sn);
public abstract void FUNC_14(CLASS_5 VAR_6, boolean VAR_9) throws CLASS_15;
protected static CLASS_16 FUNC_15(CLASS_16 VAR_11, CLASS_17 VAR_12) {
CLASS_16 VAR_13 = new CLASS_16(VAR_11 + VAR_10.VAR_14 + VAR_12);
if (!VAR_13.FUNC_16()) {
VAR_0.FUNC_17(VAR_13 + " is not readable");
return null;
} else
return VAR_13;
}
/**
* Statistics available about a wikipedia dump
*/
public enum CLASS_14 {
/**
* number of articles (not disambiguations or redirects)
*/
articleCount,
/**
* number of categories
*/
categoryCount,
/**
* number of disambiguation pages
*/
VAR_15,
/**
* number of redirects
*/
VAR_16,
/**
* date and time this dump was last edited, use new Date(long)
*/
VAR_17,
/**
* maximum path length between articles and the root category
*/
VAR_18,
/**
* id of root category
*/
VAR_19
}
} | 0.905841 | {'CLASS_0': 'KBEnvironment', 'CLASS_1': 'Closeable', 'CLASS_2': 'Logger', 'VAR_0': 'LOGGER', 'VAR_1': 'LoggerFactory', 'FUNC_0': 'getLogger', 'CLASS_3': 'FSTConfiguration', 'VAR_2': 'FSTConfiguration', 'VAR_3': 'singletonConf', 'FUNC_1': 'createDefaultConfiguration', 'FUNC_2': 'getFSTConfigurationInstance', 'FUNC_3': 'serialize', 'CLASS_4': 'Object', 'VAR_4': 'obj', 'VAR_5': 'data', 'FUNC_4': 'asByteArray', 'FUNC_5': 'deserialize', 'FUNC_6': 'asObject', 'CLASS_5': 'NerdConfig', 'VAR_6': 'conf', 'CLASS_6': 'Map', 'CLASS_7': 'DatabaseType', 'CLASS_8': 'KBDatabase', 'FUNC_7': 'registerClass', 'CLASS_9': 'DbPage', 'CLASS_10': 'DbIntList', 'CLASS_11': 'DbTranslations', 'CLASS_12': 'Property', 'CLASS_13': 'Statement', 'FUNC_8': 'getConfiguration', 'FUNC_9': 'initDatabases', 'FUNC_10': 'getDatabase', 'VAR_7': 'dbType', 'FUNC_11': 'close', 'VAR_8': 'db', 'FUNC_12': 'values', 'FUNC_13': 'retrieveStatistic', 'CLASS_14': 'StatisticName', 'FUNC_14': 'buildEnvironment', 'VAR_9': 'overwrite', 'CLASS_15': 'Exception', 'CLASS_16': 'File', 'VAR_10': 'File', 'FUNC_15': 'getDataFile', 'VAR_11': 'dataDirectory', 'CLASS_17': 'String', 'VAR_12': 'fileName', 'VAR_13': 'file', 'VAR_14': 'separator', 'FUNC_16': 'canRead', 'FUNC_17': 'info', 'VAR_15': 'disambiguationCount', 'VAR_16': 'redirectCount', 'VAR_17': 'lastEdit', 'VAR_18': 'maxCategoryDepth', 'VAR_19': 'rootCategoryId'} | java | OOP | 9.97% |
package com.clickhouse.jdbc.internal;
import java.math.BigDecimal;
import java.sql.Array;
import java.sql.Date;
import java.sql.ParameterMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.TimeZone;
import com.clickhouse.client.ClickHouseChecker;
import com.clickhouse.client.ClickHouseConfig;
import com.clickhouse.client.ClickHouseParameterizedQuery;
import com.clickhouse.client.ClickHouseRequest;
import com.clickhouse.client.ClickHouseResponse;
import com.clickhouse.client.ClickHouseUtils;
import com.clickhouse.client.ClickHouseValue;
import com.clickhouse.client.ClickHouseValues;
import com.clickhouse.client.data.ClickHouseDateTimeValue;
import com.clickhouse.client.data.ClickHouseDateValue;
import com.clickhouse.client.data.ClickHouseStringValue;
import com.clickhouse.client.logging.Logger;
import com.clickhouse.client.logging.LoggerFactory;
import com.clickhouse.jdbc.ClickHousePreparedStatement;
import com.clickhouse.jdbc.JdbcParameterizedQuery;
import com.clickhouse.jdbc.JdbcTypeMapping;
import com.clickhouse.jdbc.SqlExceptionUtils;
import com.clickhouse.jdbc.parser.ClickHouseSqlStatement;
public class SqlBasedPreparedStatement extends AbstractPreparedStatement implements ClickHousePreparedStatement {
private static final Logger log = LoggerFactory.getLogger(SqlBasedPreparedStatement.class);
private final Calendar defaultCalendar;
private final TimeZone preferredTimeZone;
private final ZoneId timeZoneForDate;
private final ZoneId timeZoneForTs;
private final ClickHouseSqlStatement parsedStmt;
private final String insertValuesQuery;
private final ClickHouseParameterizedQuery preparedQuery;
private final ClickHouseValue[] templates;
private final String[] values;
private final List<String[]> batch;
private final StringBuilder builder;
private int counter;
protected SqlBasedPreparedStatement(ClickHouseConnectionImpl connection, ClickHouseRequest<?> request,
ClickHouseSqlStatement parsedStmt, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
super(connection, request, resultSetType, resultSetConcurrency, resultSetHoldability);
ClickHouseConfig config = getConfig();
defaultCalendar = connection.getDefaultCalendar();
preferredTimeZone = config.getUseTimeZone();
timeZoneForTs = preferredTimeZone.toZoneId();
timeZoneForDate = config.isUseServerTimeZoneForDates() ? timeZoneForTs : null;
this.parsedStmt = parsedStmt;
String valuesExpr = null;
ClickHouseParameterizedQuery parsedValuesExpr = null;
String prefix = null;
if (parsedStmt.hasValues()) { // consolidate multiple inserts into one
valuesExpr = parsedStmt.getContentBetweenKeywords(ClickHouseSqlStatement.KEYWORD_VALUES_START,
ClickHouseSqlStatement.KEYWORD_VALUES_END);
if (ClickHouseChecker.isNullOrBlank(valuesExpr)) {
log.warn(
"Please consider to use one and only one values expression, for example: use 'values(?)' instead of 'values(?),(?)'.");
} else {
valuesExpr += ")";
prefix = parsedStmt.getSQL().substring(0,
parsedStmt.getPositions().get(ClickHouseSqlStatement.KEYWORD_VALUES_START));
if (connection.getJdbcConfig().useNamedParameter()) {
parsedValuesExpr = ClickHouseParameterizedQuery.of(config, valuesExpr);
} else {
parsedValuesExpr = JdbcParameterizedQuery.of(config, valuesExpr);
}
}
}
preparedQuery = parsedValuesExpr == null ? request.getPreparedQuery() : parsedValuesExpr;
templates = preparedQuery.getParameterTemplates();
values = new String[templates.length];
batch = new LinkedList<>();
builder = new StringBuilder();
if ((insertValuesQuery = prefix) != null) {
builder.append(insertValuesQuery);
}
counter = 0;
}
protected void ensureParams() throws SQLException {
List<String> columns = new ArrayList<>();
for (int i = 0, len = values.length; i < len; i++) {
if (values[i] == null) {
columns.add(String.valueOf(i + 1));
}
}
if (!columns.isEmpty()) {
throw SqlExceptionUtils.clientError(ClickHouseUtils.format("Missing parameter(s): %s", columns));
}
}
@Override
protected long[] executeAny(boolean asBatch) throws SQLException {
ensureOpen();
boolean continueOnError = false;
if (asBatch) {
if (counter < 1) {
throw SqlExceptionUtils.emptyBatchError();
}
continueOnError = getConnection().getJdbcConfig().isContinueBatchOnError();
} else {
if (counter != 0) {
throw SqlExceptionUtils.undeterminedExecutionError();
}
addBatch();
}
long[] results = new long[counter];
ClickHouseResponse r = null;
if (builder.length() > 0) { // insert ... values
long rows = 0L;
try {
r = executeStatement(builder.toString(), null, null, null);
updateResult(parsedStmt, r);
if (asBatch && getResultSet() != null) {
throw SqlExceptionUtils.queryInBatchError(results);
}
rows = r.getSummary().getWrittenRows();
// no effective rows for update and delete, and the number for insertion is not
// accurate as well
// if (rows > 0L && rows != counter) {
// log.warn("Expect %d rows being inserted but only got %d", counter, rows);
// }
// FIXME needs to enhance http client before getting back to this
Arrays.fill(results, 1);
} catch (Exception e) {
// just a wild guess...
if (rows < 1) {
results[0] = EXECUTE_FAILED;
} else {
if (rows >= counter) {
rows = counter;
}
for (int i = 0, len = (int) rows - 1; i < len; i++) {
results[i] = 1;
}
results[(int) rows] = EXECUTE_FAILED;
}
if (!continueOnError) {
throw SqlExceptionUtils.batchUpdateError(e, results);
}
log.error("Failed to execute batch insertion of %d records", counter, e);
} finally {
if (asBatch && r != null) {
r.close();
}
clearBatch();
}
} else {
int index = 0;
try {
for (String[] params : batch) {
builder.setLength(0);
preparedQuery.apply(builder, params);
try {
r = executeStatement(builder.toString(), null, null, null);
updateResult(parsedStmt, r);
if (asBatch && getResultSet() != null) {
throw SqlExceptionUtils.queryInBatchError(results);
}
int count = getUpdateCount();
results[index] = count > 0 ? count : 0;
} catch (Exception e) {
results[index] = EXECUTE_FAILED;
if (!continueOnError) {
throw SqlExceptionUtils.batchUpdateError(e, results);
}
log.error("Failed to execute batch insert at %d of %d", index + 1, counter, e);
} finally {
index++;
if (asBatch && r != null) {
r.close();
}
}
}
} finally {
clearBatch();
}
}
return results;
}
protected int toArrayIndex(int parameterIndex) throws SQLException {
if (parameterIndex < 1 || parameterIndex > templates.length) {
throw SqlExceptionUtils.clientError(ClickHouseUtils
.format("Parameter index must between 1 and %d but we got %d", templates.length, parameterIndex));
}
return parameterIndex - 1;
}
@Override
public ResultSet executeQuery() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Query failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
ResultSet rs = getResultSet();
return rs == null ? newEmptyResultSet() : rs;
}
@Override
public long executeLargeUpdate() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Update failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
return getLargeUpdateCount();
}
@Override
public void setByte(int parameterIndex, byte x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setShort(int parameterIndex, short x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setInt(int parameterIndex, int x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setLong(int parameterIndex, long x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setFloat(int parameterIndex, float x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setDouble(int parameterIndex, double x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = String.valueOf(x);
}
}
@Override
public void setString(int parameterIndex, String x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
values[idx] = ClickHouseValues.convertToQuotedString(x);
}
}
@Override
public void setBytes(int parameterIndex, byte[] x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value == null) {
templates[idx] = value = ClickHouseStringValue.ofNull();
}
values[idx] = value.update(x).toSqlExpression();
}
@Override
public void clearParameters() throws SQLException {
ensureOpen();
for (int i = 0, len = values.length; i < len; i++) {
values[i] = null;
}
}
@Override
public void setObject(int parameterIndex, Object x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.update(x);
values[idx] = value.toSqlExpression();
} else {
if (x instanceof ClickHouseValue) {
value = (ClickHouseValue) x;
templates[idx] = value;
values[idx] = value.toSqlExpression();
} else {
values[idx] = ClickHouseValues.convertToSqlExpression(x);
}
}
}
@Override
public boolean execute() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Execution failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
return getResultSet() != null;
}
@Override
public void addBatch() throws SQLException {
ensureOpen();
if (builder.length() > 0) {
int index = 1;
for (String v : values) {
if (v == null) {
throw SqlExceptionUtils
.clientError(ClickHouseUtils.format("Missing value for parameter #%d", index));
}
index++;
}
preparedQuery.apply(builder, values);
} else {
int len = values.length;
String[] newValues = new String[len];
for (int i = 0; i < len; i++) {
String v = values[i];
if (v == null) {
throw SqlExceptionUtils
.clientError(ClickHouseUtils.format("Missing value for parameter #%d", i + 1));
} else {
newValues[i] = v;
}
}
batch.add(newValues);
}
counter++;
clearParameters();
}
@Override
public void clearBatch() throws SQLException {
ensureOpen();
this.batch.clear();
this.builder.setLength(0);
if (insertValuesQuery != null) {
this.builder.append(insertValuesQuery);
}
this.counter = 0;
}
@Override
public void setArray(int parameterIndex, Array x) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
Object array = x != null ? x.getArray() : x;
values[idx] = array != null ? ClickHouseValues.convertToSqlExpression(array)
: ClickHouseValues.EMPTY_ARRAY_EXPR;
}
@Override
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
if (x == null) {
values[idx] = ClickHouseValues.NULL_EXPR;
return;
}
LocalDate d;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId tz = cal.getTimeZone().toZoneId();
if (timeZoneForDate == null || tz.equals(timeZoneForDate)) {
d = x.toLocalDate();
} else {
Calendar c = (Calendar) cal.clone();
c.setTime(x);
d = c.toInstant().atZone(tz).withZoneSameInstant(timeZoneForDate).toLocalDate();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateValue.ofNull();
}
values[idx] = value.update(d).toSqlExpression();
}
@Override
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
if (x == null) {
values[idx] = ClickHouseValues.NULL_EXPR;
return;
}
LocalTime t;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId tz = cal.getTimeZone().toZoneId();
if (tz.equals(timeZoneForTs)) {
t = x.toLocalTime();
} else {
Calendar c = (Calendar) cal.clone();
c.setTime(x);
t = c.toInstant().atZone(tz).withZoneSameInstant(timeZoneForTs).toLocalTime();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateValue.ofNull();
}
values[idx] = value.update(t).toSqlExpression();
}
@Override
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
if (x == null) {
values[idx] = ClickHouseValues.NULL_EXPR;
return;
}
LocalDateTime dt;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId tz = cal.getTimeZone().toZoneId();
if (tz.equals(timeZoneForTs)) {
dt = x.toLocalDateTime();
} else {
Calendar c = (Calendar) cal.clone();
c.setTime(x);
dt = c.toInstant().atZone(tz).withZoneSameInstant(timeZoneForTs).toLocalDateTime();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateTimeValue.ofNull(dt.getNano() > 0 ? 9 : 0, preferredTimeZone);
}
values[idx] = value.update(dt).toSqlExpression();
}
@Override
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.resetToNullOrEmpty();
values[idx] = value.toSqlExpression();
} else {
values[idx] = ClickHouseValues.NULL_EXPR;
}
}
@Override
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException {
ensureOpen();
int idx = toArrayIndex(parameterIndex);
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseValues.newValue(getConfig(), JdbcTypeMapping.fromJdbcType(targetSqlType, scaleOrLength));
templates[idx] = value;
}
value.update(x);
values[idx] = value.toSqlExpression();
}
}
| package com.IMPORT_0.jdbc.IMPORT_1;
import java.math.BigDecimal;
import java.IMPORT_2.IMPORT_3;
import java.IMPORT_2.IMPORT_4;
import java.IMPORT_2.ParameterMetaData;
import java.IMPORT_2.IMPORT_5;
import java.IMPORT_2.SQLException;
import java.IMPORT_2.Time;
import java.IMPORT_2.Timestamp;
import java.time.IMPORT_6;
import java.time.IMPORT_7;
import java.time.LocalTime;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.IMPORT_8;
import com.IMPORT_0.IMPORT_9.ClickHouseChecker;
import com.IMPORT_0.IMPORT_9.ClickHouseConfig;
import com.IMPORT_0.IMPORT_9.ClickHouseParameterizedQuery;
import com.IMPORT_0.IMPORT_9.ClickHouseRequest;
import com.IMPORT_0.IMPORT_9.ClickHouseResponse;
import com.IMPORT_0.IMPORT_9.ClickHouseUtils;
import com.IMPORT_0.IMPORT_9.ClickHouseValue;
import com.IMPORT_0.IMPORT_9.ClickHouseValues;
import com.IMPORT_0.IMPORT_9.data.ClickHouseDateTimeValue;
import com.IMPORT_0.IMPORT_9.data.ClickHouseDateValue;
import com.IMPORT_0.IMPORT_9.data.ClickHouseStringValue;
import com.IMPORT_0.IMPORT_9.logging.IMPORT_10;
import com.IMPORT_0.IMPORT_9.logging.LoggerFactory;
import com.IMPORT_0.jdbc.ClickHousePreparedStatement;
import com.IMPORT_0.jdbc.JdbcParameterizedQuery;
import com.IMPORT_0.jdbc.JdbcTypeMapping;
import com.IMPORT_0.jdbc.SqlExceptionUtils;
import com.IMPORT_0.jdbc.IMPORT_11.IMPORT_12;
public class SqlBasedPreparedStatement extends AbstractPreparedStatement implements ClickHousePreparedStatement {
private static final IMPORT_10 log = LoggerFactory.getLogger(SqlBasedPreparedStatement.class);
private final Calendar defaultCalendar;
private final IMPORT_8 preferredTimeZone;
private final ZoneId VAR_0;
private final ZoneId timeZoneForTs;
private final IMPORT_12 parsedStmt;
private final CLASS_0 VAR_2;
private final ClickHouseParameterizedQuery preparedQuery;
private final ClickHouseValue[] templates;
private final CLASS_0[] VAR_3;
private final List<CLASS_0[]> VAR_4;
private final StringBuilder builder;
private int counter;
protected SqlBasedPreparedStatement(CLASS_1 connection, ClickHouseRequest<?> request,
IMPORT_12 parsedStmt, int VAR_5, int resultSetConcurrency, int resultSetHoldability)
throws SQLException {
super(connection, request, VAR_5, resultSetConcurrency, resultSetHoldability);
ClickHouseConfig config = getConfig();
defaultCalendar = connection.FUNC_0();
preferredTimeZone = config.getUseTimeZone();
timeZoneForTs = preferredTimeZone.FUNC_1();
VAR_0 = config.FUNC_2() ? timeZoneForTs : null;
this.parsedStmt = parsedStmt;
CLASS_0 VAR_6 = null;
ClickHouseParameterizedQuery VAR_7 = null;
CLASS_0 VAR_8 = null;
if (parsedStmt.hasValues()) { // consolidate multiple inserts into one
VAR_6 = parsedStmt.getContentBetweenKeywords(IMPORT_12.VAR_9,
IMPORT_12.KEYWORD_VALUES_END);
if (ClickHouseChecker.isNullOrBlank(VAR_6)) {
log.warn(
"Please consider to use one and only one values expression, for example: use 'values(?)' instead of 'values(?),(?)'.");
} else {
VAR_6 += ")";
VAR_8 = parsedStmt.getSQL().substring(0,
parsedStmt.getPositions().FUNC_3(IMPORT_12.VAR_9));
if (connection.getJdbcConfig().useNamedParameter()) {
VAR_7 = ClickHouseParameterizedQuery.of(config, VAR_6);
} else {
VAR_7 = JdbcParameterizedQuery.of(config, VAR_6);
}
}
}
preparedQuery = VAR_7 == null ? request.getPreparedQuery() : VAR_7;
templates = preparedQuery.getParameterTemplates();
VAR_3 = new CLASS_0[templates.length];
VAR_4 = new LinkedList<>();
builder = new StringBuilder();
if ((VAR_2 = VAR_8) != null) {
builder.append(VAR_2);
}
counter = 0;
}
protected void ensureParams() throws SQLException {
List<CLASS_0> columns = new ArrayList<>();
for (int VAR_10 = 0, len = VAR_3.length; VAR_10 < len; VAR_10++) {
if (VAR_3[VAR_10] == null) {
columns.FUNC_4(VAR_1.valueOf(VAR_10 + 1));
}
}
if (!columns.FUNC_5()) {
throw SqlExceptionUtils.FUNC_6(ClickHouseUtils.FUNC_7("Missing parameter(s): %s", columns));
}
}
@Override
protected long[] executeAny(boolean asBatch) throws SQLException {
ensureOpen();
boolean continueOnError = false;
if (asBatch) {
if (counter < 1) {
throw SqlExceptionUtils.FUNC_8();
}
continueOnError = getConnection().getJdbcConfig().FUNC_9();
} else {
if (counter != 0) {
throw SqlExceptionUtils.undeterminedExecutionError();
}
addBatch();
}
long[] results = new long[counter];
ClickHouseResponse r = null;
if (builder.length() > 0) { // insert ... values
long rows = 0L;
try {
r = executeStatement(builder.toString(), null, null, null);
updateResult(parsedStmt, r);
if (asBatch && getResultSet() != null) {
throw SqlExceptionUtils.queryInBatchError(results);
}
rows = r.getSummary().getWrittenRows();
// no effective rows for update and delete, and the number for insertion is not
// accurate as well
// if (rows > 0L && rows != counter) {
// log.warn("Expect %d rows being inserted but only got %d", counter, rows);
// }
// FIXME needs to enhance http client before getting back to this
Arrays.fill(results, 1);
} catch (Exception e) {
// just a wild guess...
if (rows < 1) {
results[0] = EXECUTE_FAILED;
} else {
if (rows >= counter) {
rows = counter;
}
for (int VAR_10 = 0, len = (int) rows - 1; VAR_10 < len; VAR_10++) {
results[VAR_10] = 1;
}
results[(int) rows] = EXECUTE_FAILED;
}
if (!continueOnError) {
throw SqlExceptionUtils.batchUpdateError(e, results);
}
log.error("Failed to execute batch insertion of %d records", counter, e);
} finally {
if (asBatch && r != null) {
r.close();
}
clearBatch();
}
} else {
int VAR_11 = 0;
try {
for (CLASS_0[] params : VAR_4) {
builder.setLength(0);
preparedQuery.FUNC_10(builder, params);
try {
r = executeStatement(builder.toString(), null, null, null);
updateResult(parsedStmt, r);
if (asBatch && getResultSet() != null) {
throw SqlExceptionUtils.queryInBatchError(results);
}
int count = getUpdateCount();
results[VAR_11] = count > 0 ? count : 0;
} catch (Exception e) {
results[VAR_11] = EXECUTE_FAILED;
if (!continueOnError) {
throw SqlExceptionUtils.batchUpdateError(e, results);
}
log.error("Failed to execute batch insert at %d of %d", VAR_11 + 1, counter, e);
} finally {
VAR_11++;
if (asBatch && r != null) {
r.close();
}
}
}
} finally {
clearBatch();
}
}
return results;
}
protected int FUNC_11(int parameterIndex) throws SQLException {
if (parameterIndex < 1 || parameterIndex > templates.length) {
throw SqlExceptionUtils.FUNC_6(ClickHouseUtils
.FUNC_7("Parameter index must between 1 and %d but we got %d", templates.length, parameterIndex));
}
return parameterIndex - 1;
}
@Override
public IMPORT_5 executeQuery() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Query failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
IMPORT_5 rs = getResultSet();
return rs == null ? FUNC_12() : rs;
}
@Override
public long executeLargeUpdate() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Update failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
return getLargeUpdateCount();
}
@Override
public void FUNC_13(int parameterIndex, byte VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void FUNC_15(int parameterIndex, short VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void FUNC_16(int parameterIndex, int VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void setLong(int parameterIndex, long VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void FUNC_17(int parameterIndex, float VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void setDouble(int parameterIndex, double VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void setBigDecimal(int parameterIndex, BigDecimal VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = VAR_1.valueOf(VAR_12);
}
}
@Override
public void setString(int parameterIndex, CLASS_0 VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = ClickHouseValues.convertToQuotedString(VAR_12);
}
}
@Override
public void setBytes(int parameterIndex, byte[] VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value == null) {
templates[idx] = value = ClickHouseStringValue.ofNull();
}
VAR_3[idx] = value.FUNC_14(VAR_12).toSqlExpression();
}
@Override
public void FUNC_18() throws SQLException {
ensureOpen();
for (int VAR_10 = 0, len = VAR_3.length; VAR_10 < len; VAR_10++) {
VAR_3[VAR_10] = null;
}
}
@Override
public void setObject(int parameterIndex, Object VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
} else {
if (VAR_12 instanceof ClickHouseValue) {
value = (ClickHouseValue) VAR_12;
templates[idx] = value;
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = ClickHouseValues.FUNC_19(VAR_12);
}
}
}
@Override
public boolean execute() throws SQLException {
ensureParams();
if (executeAny(false)[0] == EXECUTE_FAILED) {
throw new SQLException("Execution failed", SqlExceptionUtils.SQL_STATE_SQL_ERROR);
}
return getResultSet() != null;
}
@Override
public void addBatch() throws SQLException {
ensureOpen();
if (builder.length() > 0) {
int VAR_11 = 1;
for (CLASS_0 v : VAR_3) {
if (v == null) {
throw SqlExceptionUtils
.FUNC_6(ClickHouseUtils.FUNC_7("Missing value for parameter #%d", VAR_11));
}
VAR_11++;
}
preparedQuery.FUNC_10(builder, VAR_3);
} else {
int len = VAR_3.length;
CLASS_0[] newValues = new CLASS_0[len];
for (int VAR_10 = 0; VAR_10 < len; VAR_10++) {
CLASS_0 v = VAR_3[VAR_10];
if (v == null) {
throw SqlExceptionUtils
.FUNC_6(ClickHouseUtils.FUNC_7("Missing value for parameter #%d", VAR_10 + 1));
} else {
newValues[VAR_10] = v;
}
}
VAR_4.FUNC_4(newValues);
}
counter++;
FUNC_18();
}
@Override
public void clearBatch() throws SQLException {
ensureOpen();
this.VAR_4.clear();
this.builder.setLength(0);
if (VAR_2 != null) {
this.builder.append(VAR_2);
}
this.counter = 0;
}
@Override
public void setArray(int parameterIndex, IMPORT_3 VAR_12) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
Object array = VAR_12 != null ? VAR_12.getArray() : VAR_12;
VAR_3[idx] = array != null ? ClickHouseValues.FUNC_19(array)
: ClickHouseValues.EMPTY_ARRAY_EXPR;
}
@Override
public void setDate(int parameterIndex, IMPORT_4 VAR_12, Calendar cal) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
if (VAR_12 == null) {
VAR_3[idx] = ClickHouseValues.NULL_EXPR;
return;
}
IMPORT_6 d;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId VAR_13 = cal.getTimeZone().FUNC_1();
if (VAR_0 == null || VAR_13.FUNC_20(VAR_0)) {
d = VAR_12.toLocalDate();
} else {
Calendar c = (Calendar) cal.FUNC_21();
c.setTime(VAR_12);
d = c.toInstant().atZone(VAR_13).FUNC_22(VAR_0).toLocalDate();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateValue.ofNull();
}
VAR_3[idx] = value.FUNC_14(d).toSqlExpression();
}
@Override
public void setTime(int parameterIndex, Time VAR_12, Calendar cal) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
if (VAR_12 == null) {
VAR_3[idx] = ClickHouseValues.NULL_EXPR;
return;
}
LocalTime VAR_14;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId VAR_13 = cal.getTimeZone().FUNC_1();
if (VAR_13.FUNC_20(timeZoneForTs)) {
VAR_14 = VAR_12.FUNC_23();
} else {
Calendar c = (Calendar) cal.FUNC_21();
c.setTime(VAR_12);
VAR_14 = c.toInstant().atZone(VAR_13).FUNC_22(timeZoneForTs).FUNC_23();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateValue.ofNull();
}
VAR_3[idx] = value.FUNC_14(VAR_14).toSqlExpression();
}
@Override
public void setTimestamp(int parameterIndex, Timestamp VAR_12, Calendar cal) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
if (VAR_12 == null) {
VAR_3[idx] = ClickHouseValues.NULL_EXPR;
return;
}
IMPORT_7 dt;
if (cal == null) {
cal = defaultCalendar;
}
ZoneId VAR_13 = cal.getTimeZone().FUNC_1();
if (VAR_13.FUNC_20(timeZoneForTs)) {
dt = VAR_12.toLocalDateTime();
} else {
Calendar c = (Calendar) cal.FUNC_21();
c.setTime(VAR_12);
dt = c.toInstant().atZone(VAR_13).FUNC_22(timeZoneForTs).toLocalDateTime();
}
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseDateTimeValue.ofNull(dt.getNano() > 0 ? 9 : 0, preferredTimeZone);
}
VAR_3[idx] = value.FUNC_14(dt).toSqlExpression();
}
@Override
public void setNull(int parameterIndex, int sqlType, CLASS_0 typeName) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value != null) {
value.resetToNullOrEmpty();
VAR_3[idx] = value.toSqlExpression();
} else {
VAR_3[idx] = ClickHouseValues.NULL_EXPR;
}
}
@Override
public ParameterMetaData getParameterMetaData() throws SQLException {
// TODO Auto-generated method stub
return null;
}
@Override
public void setObject(int parameterIndex, Object VAR_12, int targetSqlType, int scaleOrLength) throws SQLException {
ensureOpen();
int idx = FUNC_11(parameterIndex);
ClickHouseValue value = templates[idx];
if (value == null) {
value = ClickHouseValues.newValue(getConfig(), JdbcTypeMapping.fromJdbcType(targetSqlType, scaleOrLength));
templates[idx] = value;
}
value.FUNC_14(VAR_12);
VAR_3[idx] = value.toSqlExpression();
}
}
| 0.293523 | {'IMPORT_0': 'clickhouse', 'IMPORT_1': 'internal', 'IMPORT_2': 'sql', 'IMPORT_3': 'Array', 'IMPORT_4': 'Date', 'IMPORT_5': 'ResultSet', 'IMPORT_6': 'LocalDate', 'IMPORT_7': 'LocalDateTime', 'IMPORT_8': 'TimeZone', 'IMPORT_9': 'client', 'IMPORT_10': 'Logger', 'IMPORT_11': 'parser', 'IMPORT_12': 'ClickHouseSqlStatement', 'VAR_0': 'timeZoneForDate', 'CLASS_0': 'String', 'VAR_1': 'String', 'VAR_2': 'insertValuesQuery', 'VAR_3': 'values', 'VAR_4': 'batch', 'CLASS_1': 'ClickHouseConnectionImpl', 'VAR_5': 'resultSetType', 'FUNC_0': 'getDefaultCalendar', 'FUNC_1': 'toZoneId', 'FUNC_2': 'isUseServerTimeZoneForDates', 'VAR_6': 'valuesExpr', 'VAR_7': 'parsedValuesExpr', 'VAR_8': 'prefix', 'VAR_9': 'KEYWORD_VALUES_START', 'FUNC_3': 'get', 'VAR_10': 'i', 'FUNC_4': 'add', 'FUNC_5': 'isEmpty', 'FUNC_6': 'clientError', 'FUNC_7': 'format', 'FUNC_8': 'emptyBatchError', 'FUNC_9': 'isContinueBatchOnError', 'VAR_11': 'index', 'FUNC_10': 'apply', 'FUNC_11': 'toArrayIndex', 'FUNC_12': 'newEmptyResultSet', 'FUNC_13': 'setByte', 'VAR_12': 'x', 'FUNC_14': 'update', 'FUNC_15': 'setShort', 'FUNC_16': 'setInt', 'FUNC_17': 'setFloat', 'FUNC_18': 'clearParameters', 'FUNC_19': 'convertToSqlExpression', 'VAR_13': 'tz', 'FUNC_20': 'equals', 'FUNC_21': 'clone', 'FUNC_22': 'withZoneSameInstant', 'VAR_14': 't', 'FUNC_23': 'toLocalTime'} | java | OOP | 8.06% |
/**
* Callback handler for leader election.
*/
public abstract static class LeaderCallbackHandler {
public abstract void isLeader();
public abstract void notLeader();
} | /**
* Callback handler for leader election.
*/
public abstract static class CLASS_0 {
public abstract void FUNC_0();
public abstract void notLeader();
} | 0.412028 | {'CLASS_0': 'LeaderCallbackHandler', 'FUNC_0': 'isLeader'} | java | OOP | 100.00% |
/**
*
* Databases:
*
* meters
* ------------
* meter_id (TEXT, primary key)
* name (TEXT)
* updated (INT64, unix time)
*
*
* gauges
* -----------
* gauge_id (TEXT, primary key)
* index (INTEGER)
* meter_id (TEXT)
* name (TEXT)
* description (TEXT)
* unit (TEXT)
* min (DOUBLE)
* max (DOUBLE)
* min_increase (DOUBLE)
* max_increase (DOUBLE)
* options (TEXT)
* updated (INT64, unix time)
* datatype (TEXT)
* cumulative (INTEGER, 0 = not cumulative, 1 = is cumulative)
*
*
* gauge_values
* ------------------
* value_id (INT32, primary key)
* gauge_id (INT32)
* value (TEXT)
* sent (INTEGER, 0 = not sent, 1 = sent)
* updated (INT64, unix time)
*
*/
private class MeterSQLiteHelper extends SQLiteOpenHelper{
/**
*
* @param context
* @param databaseName
*/
public MeterSQLiteHelper(Context context, String databaseName){
super(context,databaseName,null,DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
LogUtils.debug(CLASS_NAME, "onCreate", "Creating new tables if needed...");
db.execSQL("CREATE TABLE IF NOT EXISTS "+TABLE_METERS+" ("+
COLUMN_METER_ID+" TEXT PRIMARY KEY,"+
COLUMN_NAME+" TEXT NOT NULL,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
db.execSQL("CREATE TABLE IF NOT EXISTS "+TABLE_GAUGES+" ("+
COLUMN_GAUGE_ID+" TEXT PRIMARY KEY,"+
COLUMN_GAUGE_INDEX+" INTEGER NOT NULL,"+
COLUMN_METER_ID+" TEXT NOT NULL,"+
COLUMN_NAME+" TEXT NOT NULL,"+
COLUMN_DESCRIPTION+" TEXT DEFAULT NULL,"+
COLUMN_UNIT+" TEXT DEFAULT NULL,"+
COLUMN_MIN+" DOUBLE DEFAULT NULL,"+
COLUMN_MAX+" DOUBLE DEFAULT NULL,"+
COLUMN_MIN_INCREASE+" DOUBLE DEFAULT NULL,"+
COLUMN_MAX_INCREASE+" DOUBLE DEFAULT NULL,"+
COLUMN_OPTIONS+" TEXT DEFAULT NULL,"+
COLUMN_DATATYPE+" TEXT NOT NULL,"+
COLUMN_CUMULATIVE+" INTEGER DEFAULT NULL,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
db.execSQL("CREATE TABLE IF NOT EXISTS "+TABLE_GAUGE_VALUES+" ("+
COLUMN_GAUGE_VALUE_ID+" INTEGER PRIMARY KEY,"+
COLUMN_GAUGE_ID+" INTEGER NOT NULL,"+
COLUMN_VALUE+" TEXT NOT NULL,"+
COLUMN_SENT+" INTEGER DEFAULT 0,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
LogUtils.warn(CLASS_NAME, "onUpgrade", "Dropping all tables for DB upgrade. Version "+oldVersion+" to version "+newVersion+".");
db.execSQL("DROP TABLE IF EXISTS "+TABLE_METERS+";");
db.execSQL("DROP TABLE IF EXISTS "+TABLE_GAUGES+";");
db.execSQL("DROP TABLE IF EXISTS "+TABLE_GAUGE_VALUES+";");
onCreate(db);
}
} | /**
*
* Databases:
*
* meters
* ------------
* meter_id (TEXT, primary key)
* name (TEXT)
* updated (INT64, unix time)
*
*
* gauges
* -----------
* gauge_id (TEXT, primary key)
* index (INTEGER)
* meter_id (TEXT)
* name (TEXT)
* description (TEXT)
* unit (TEXT)
* min (DOUBLE)
* max (DOUBLE)
* min_increase (DOUBLE)
* max_increase (DOUBLE)
* options (TEXT)
* updated (INT64, unix time)
* datatype (TEXT)
* cumulative (INTEGER, 0 = not cumulative, 1 = is cumulative)
*
*
* gauge_values
* ------------------
* value_id (INT32, primary key)
* gauge_id (INT32)
* value (TEXT)
* sent (INTEGER, 0 = not sent, 1 = sent)
* updated (INT64, unix time)
*
*/
private class MeterSQLiteHelper extends SQLiteOpenHelper{
/**
*
* @param context
* @param databaseName
*/
public MeterSQLiteHelper(Context context, String databaseName){
super(context,databaseName,null,DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
VAR_0.debug(VAR_1, "onCreate", "Creating new tables if needed...");
db.FUNC_0("CREATE TABLE IF NOT EXISTS "+VAR_2+" ("+
COLUMN_METER_ID+" TEXT PRIMARY KEY,"+
COLUMN_NAME+" TEXT NOT NULL,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
db.FUNC_0("CREATE TABLE IF NOT EXISTS "+TABLE_GAUGES+" ("+
VAR_3+" TEXT PRIMARY KEY,"+
COLUMN_GAUGE_INDEX+" INTEGER NOT NULL,"+
COLUMN_METER_ID+" TEXT NOT NULL,"+
COLUMN_NAME+" TEXT NOT NULL,"+
COLUMN_DESCRIPTION+" TEXT DEFAULT NULL,"+
COLUMN_UNIT+" TEXT DEFAULT NULL,"+
VAR_4+" DOUBLE DEFAULT NULL,"+
COLUMN_MAX+" DOUBLE DEFAULT NULL,"+
COLUMN_MIN_INCREASE+" DOUBLE DEFAULT NULL,"+
COLUMN_MAX_INCREASE+" DOUBLE DEFAULT NULL,"+
VAR_5+" TEXT DEFAULT NULL,"+
COLUMN_DATATYPE+" TEXT NOT NULL,"+
COLUMN_CUMULATIVE+" INTEGER DEFAULT NULL,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
db.FUNC_0("CREATE TABLE IF NOT EXISTS "+VAR_6+" ("+
COLUMN_GAUGE_VALUE_ID+" INTEGER PRIMARY KEY,"+
VAR_3+" INTEGER NOT NULL,"+
COLUMN_VALUE+" TEXT NOT NULL,"+
COLUMN_SENT+" INTEGER DEFAULT 0,"+
COLUMN_UPDATED+" INT(64) NOT NULL);");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int VAR_7) {
VAR_0.warn(VAR_1, "onUpgrade", "Dropping all tables for DB upgrade. Version "+oldVersion+" to version "+VAR_7+".");
db.FUNC_0("DROP TABLE IF EXISTS "+VAR_2+";");
db.FUNC_0("DROP TABLE IF EXISTS "+TABLE_GAUGES+";");
db.FUNC_0("DROP TABLE IF EXISTS "+VAR_6+";");
onCreate(db);
}
} | 0.238461 | {'VAR_0': 'LogUtils', 'VAR_1': 'CLASS_NAME', 'FUNC_0': 'execSQL', 'VAR_2': 'TABLE_METERS', 'VAR_3': 'COLUMN_GAUGE_ID', 'VAR_4': 'COLUMN_MIN', 'VAR_5': 'COLUMN_OPTIONS', 'VAR_6': 'TABLE_GAUGE_VALUES', 'VAR_7': 'newVersion'} | java | Hibrido | 100.00% |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ctakes.temporal.ae.feature;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.ctakes.relationextractor.ae.features.RelationFeaturesExtractor;
import org.apache.ctakes.typesystem.type.textsem.EventMention;
import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
import org.apache.ctakes.typesystem.type.textspan.Sentence;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
import org.cleartk.ml.Feature;
import org.apache.uima.fit.util.JCasUtil;
public class EventArgumentPropertyExtractor implements
RelationFeaturesExtractor<IdentifiedAnnotation,IdentifiedAnnotation> {
@Override
public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1,
IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
List<Feature> feats = new ArrayList<>();
Set<Sentence> coveringSents = new HashSet<>();
if( arg1 instanceof EventMention){
coveringSents.addAll(JCasUtil.selectCovering(jCas, Sentence.class, arg1.getBegin(), arg1.getEnd()));
}else if(arg2 instanceof EventMention){
coveringSents.addAll(JCasUtil.selectCovering(jCas, Sentence.class, arg2.getBegin(), arg2.getEnd()));
}else{
return feats;
}
for(Sentence coveringSent : coveringSents){
List<EventMention> events = JCasUtil.selectCovered(EventMention.class, coveringSent);
List<EventMention> realEvents = new ArrayList<>();
for(EventMention event : events){
// filter out ctakes events
if(event.getClass().equals(EventMention.class)){
realEvents.add(event);
}
}
events = realEvents;
if( events.size()>0){
EventMention anchor = events.get(0);
if(arg1 == anchor){
feats.add(new Feature("Arg1LeftmostEvent"));
}else if(arg2 == anchor){
feats.add(new Feature("Arg2LeftmostEvent"));
}
}
}
if(arg1 instanceof EventMention){
feats.addAll(getEventFeats("mention1property", (EventMention)arg1));
}
if(arg2 instanceof EventMention){
feats.addAll(getEventFeats("mention2property", (EventMention)arg2));
}
return feats;
}
private static Collection<? extends Feature> getEventFeats(String name, EventMention mention) {
List<Feature> feats = new ArrayList<>();
//add contextual modality as a feature
if(mention.getEvent()==null || mention.getEvent().getProperties() == null){
return feats;
}
String contextualModality = mention.getEvent().getProperties().getContextualModality();
if (contextualModality != null)
feats.add(new Feature(name + "_modality", contextualModality));
// feats.add(new Feature(name + "_aspect", mention.getEvent().getProperties().getContextualAspect()));//null
// feats.add(new Feature(name + "_permanence", mention.getEvent().getProperties().getPermanence()));//null
Integer polarity = mention.getEvent().getProperties().getPolarity();
if(polarity!=null )
feats.add(new Feature(name + "_polarity", polarity));
// feats.add(new Feature(name + "_category", mention.getEvent().getProperties().getCategory()));//null
// feats.add(new Feature(name + "_degree", mention.getEvent().getProperties().getDegree()));//null
String docTimeRel = mention.getEvent().getProperties().getDocTimeRel();
if(docTimeRel!=null)
feats.add(new Feature(name + "_doctimerel", docTimeRel));
Integer typeId = mention.getEvent().getProperties().getTypeIndexID();
if(typeId != null)
feats.add(new Feature(name + "_typeId"));
return feats;
}
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.ctakes.temporal.ae.feature;
import java.IMPORT_0.ArrayList;
import java.IMPORT_0.Collection;
import java.IMPORT_0.HashSet;
import java.IMPORT_0.List;
import java.IMPORT_0.Set;
import org.apache.ctakes.relationextractor.ae.features.IMPORT_1;
import org.apache.ctakes.typesystem.type.textsem.EventMention;
import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
import org.apache.ctakes.typesystem.type.textspan.IMPORT_2;
import org.apache.uima.analysis_engine.AnalysisEngineProcessException;
import org.apache.uima.jcas.JCas;
import org.cleartk.IMPORT_3.IMPORT_4;
import org.apache.uima.fit.IMPORT_0.JCasUtil;
public class CLASS_0 implements
IMPORT_1<IdentifiedAnnotation,IdentifiedAnnotation> {
@VAR_0
public List<IMPORT_4> extract(JCas jCas, IdentifiedAnnotation arg1,
IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
List<IMPORT_4> feats = new ArrayList<>();
Set<IMPORT_2> coveringSents = new HashSet<>();
if( arg1 instanceof EventMention){
coveringSents.addAll(JCasUtil.selectCovering(jCas, IMPORT_2.class, arg1.getBegin(), arg1.FUNC_0()));
}else if(arg2 instanceof EventMention){
coveringSents.addAll(JCasUtil.selectCovering(jCas, IMPORT_2.class, arg2.getBegin(), arg2.FUNC_0()));
}else{
return feats;
}
for(IMPORT_2 coveringSent : coveringSents){
List<EventMention> VAR_1 = JCasUtil.selectCovered(EventMention.class, coveringSent);
List<EventMention> VAR_2 = new ArrayList<>();
for(EventMention event : VAR_1){
// filter out ctakes events
if(event.getClass().equals(EventMention.class)){
VAR_2.add(event);
}
}
VAR_1 = VAR_2;
if( VAR_1.size()>0){
EventMention VAR_3 = VAR_1.get(0);
if(arg1 == VAR_3){
feats.add(new IMPORT_4("Arg1LeftmostEvent"));
}else if(arg2 == VAR_3){
feats.add(new IMPORT_4("Arg2LeftmostEvent"));
}
}
}
if(arg1 instanceof EventMention){
feats.addAll(getEventFeats("mention1property", (EventMention)arg1));
}
if(arg2 instanceof EventMention){
feats.addAll(getEventFeats("mention2property", (EventMention)arg2));
}
return feats;
}
private static Collection<? extends IMPORT_4> getEventFeats(CLASS_1 name, EventMention VAR_4) {
List<IMPORT_4> feats = new ArrayList<>();
//add contextual modality as a feature
if(VAR_4.FUNC_1()==null || VAR_4.FUNC_1().getProperties() == null){
return feats;
}
CLASS_1 VAR_5 = VAR_4.FUNC_1().getProperties().FUNC_2();
if (VAR_5 != null)
feats.add(new IMPORT_4(name + "_modality", VAR_5));
// feats.add(new Feature(name + "_aspect", mention.getEvent().getProperties().getContextualAspect()));//null
// feats.add(new Feature(name + "_permanence", mention.getEvent().getProperties().getPermanence()));//null
Integer polarity = VAR_4.FUNC_1().getProperties().getPolarity();
if(polarity!=null )
feats.add(new IMPORT_4(name + "_polarity", polarity));
// feats.add(new Feature(name + "_category", mention.getEvent().getProperties().getCategory()));//null
// feats.add(new Feature(name + "_degree", mention.getEvent().getProperties().getDegree()));//null
CLASS_1 docTimeRel = VAR_4.FUNC_1().getProperties().getDocTimeRel();
if(docTimeRel!=null)
feats.add(new IMPORT_4(name + "_doctimerel", docTimeRel));
Integer typeId = VAR_4.FUNC_1().getProperties().getTypeIndexID();
if(typeId != null)
feats.add(new IMPORT_4(name + "_typeId"));
return feats;
}
}
| 0.187402 | {'IMPORT_0': 'util', 'IMPORT_1': 'RelationFeaturesExtractor', 'IMPORT_2': 'Sentence', 'IMPORT_3': 'ml', 'IMPORT_4': 'Feature', 'CLASS_0': 'EventArgumentPropertyExtractor', 'VAR_0': 'Override', 'FUNC_0': 'getEnd', 'VAR_1': 'events', 'VAR_2': 'realEvents', 'VAR_3': 'anchor', 'CLASS_1': 'String', 'VAR_4': 'mention', 'FUNC_1': 'getEvent', 'VAR_5': 'contextualModality', 'FUNC_2': 'getContextualModality'} | java | Hibrido | 36.91% |
/*
* Copyright (c) 2010-2016. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.axonframework.extensions.mongo.eventsourcing.eventstore;
import com.mongodb.MongoClientOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* <p>
* Factory class used to create a {@code MongoOptions} instance. The instance makes use of the defaults as provided
* by the MongoOptions class. The moment you set a valid value, that value is used to create the options object.
* </p>
*
* @author <NAME>
* @since 2.0 (in incubator since 0.7)
*/
public class MongoOptionsFactory {
private static final Logger logger = LoggerFactory.getLogger(MongoOptionsFactory.class);
private final MongoClientOptions defaults;
private int connectionsPerHost;
private int connectionTimeout;
private int maxWaitTime;
private int threadsAllowedToBlockForConnectionMultiplier;
private int socketTimeOut;
/**
* Default constructor for the factory that initializes the defaults.
*/
public MongoOptionsFactory() {
defaults = MongoClientOptions.builder().build();
}
/**
* Uses the configured parameters to create a MongoOptions instance.
*
* @return MongoOptions instance based on the configured properties
*/
public MongoClientOptions createMongoOptions() {
MongoClientOptions options = MongoClientOptions.builder()
.connectionsPerHost(getConnectionsPerHost())
.connectTimeout(getConnectionTimeout())
.maxWaitTime(getMaxWaitTime())
.threadsAllowedToBlockForConnectionMultiplier(getThreadsAllowedToBlockForConnectionMultiplier())
.socketTimeout(getSocketTimeOut()).build();
if (logger.isDebugEnabled()) {
logger.debug("Mongo Options");
logger.debug("Connections per host :{}", options.getConnectionsPerHost());
logger.debug("Connection timeout : {}", options.getConnectTimeout());
logger.debug("Max wait timeout : {}", options.getMaxWaitTime());
logger.debug("Threads allowed to block : {}", options.getThreadsAllowedToBlockForConnectionMultiplier());
logger.debug("Socket timeout : {}", options.getSocketTimeout());
}
return options;
}
/**
* Getter for connectionsPerHost.
*
* @return number representing the connections per host
*/
public int getConnectionsPerHost() {
return (connectionsPerHost > 0) ? connectionsPerHost : defaults.getConnectionsPerHost();
}
/**
* Setter for the connections per host that are allowed.
*
* @param connectionsPerHost number representing the number of connections per host
*/
public void setConnectionsPerHost(int connectionsPerHost) {
this.connectionsPerHost = connectionsPerHost;
}
/**
* Connection time out in milli seconds for doing something in mongo. Zero is indefinite
*
* @return number representing milli seconds of timeout
*/
public int getConnectionTimeout() {
return (connectionTimeout > 0) ? connectionTimeout : defaults.getConnectTimeout();
}
/**
* Setter for the connection time out.
*
* @param connectionTimeout number representing the connection timeout in millis
*/
public void setConnectionTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
/**
* get the maximum time a blocked thread that waits for a connection should wait.
*
* @return number of milli seconds the thread waits for a connection
*/
public int getMaxWaitTime() {
return (maxWaitTime > 0) ? maxWaitTime : defaults.getMaxWaitTime();
}
/**
* Set the max wait time for a blocked thread in milli seconds.
*
* @param maxWaitTime number representing the number of milli seconds to wait for a thread
*/
public void setMaxWaitTime(int maxWaitTime) {
this.maxWaitTime = maxWaitTime;
}
/**
* Getter for the socket timeout.
*
* @return Number representing the amount of milli seconds to wait for a socket connection
*/
public int getSocketTimeOut() {
return (socketTimeOut > 0) ? socketTimeOut : defaults.getSocketTimeout();
}
/**
* Setter for the socket time out.
*
* @param socketTimeOut number representing the amount of milli seconds to wait for a socket connection
*/
public void setSocketTimeOut(int socketTimeOut) {
this.socketTimeOut = socketTimeOut;
}
/**
* Getter for the amount of threads that block in relation to the amount of possible connections.
*
* @return Number representing the multiplier of maximum allowed blocked connections in relation to the maximum
* allowed connections
*/
public int getThreadsAllowedToBlockForConnectionMultiplier() {
return (threadsAllowedToBlockForConnectionMultiplier > 0)
? threadsAllowedToBlockForConnectionMultiplier
: defaults.getThreadsAllowedToBlockForConnectionMultiplier();
}
/**
* Set the multiplier for the amount of threads to block in relation to the maximum amount of connections.
*
* @param threadsAllowedToBlockForConnectionMultiplier
* Number representing the multiplier of the amount of threads to block in relation to the connections
* that are allowed.
*/
public void setThreadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier) {
this.threadsAllowedToBlockForConnectionMultiplier = threadsAllowedToBlockForConnectionMultiplier;
}
}
| /*
* Copyright (c) 2010-2016. Axon Framework
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_5;
import IMPORT_6.IMPORT_7.IMPORT_8;
import IMPORT_0.IMPORT_9.Logger;
import IMPORT_0.IMPORT_9.IMPORT_10;
/**
* <p>
* Factory class used to create a {@code MongoOptions} instance. The instance makes use of the defaults as provided
* by the MongoOptions class. The moment you set a valid value, that value is used to create the options object.
* </p>
*
* @author <NAME>
* @since 2.0 (in incubator since 0.7)
*/
public class CLASS_0 {
private static final Logger VAR_0 = IMPORT_10.FUNC_0(CLASS_0.class);
private final IMPORT_8 defaults;
private int VAR_1;
private int VAR_2;
private int VAR_3;
private int VAR_4;
private int socketTimeOut;
/**
* Default constructor for the factory that initializes the defaults.
*/
public CLASS_0() {
defaults = IMPORT_8.FUNC_4().build();
}
/**
* Uses the configured parameters to create a MongoOptions instance.
*
* @return MongoOptions instance based on the configured properties
*/
public IMPORT_8 FUNC_5() {
IMPORT_8 VAR_5 = IMPORT_8.FUNC_4()
.FUNC_1(FUNC_6())
.FUNC_7(getConnectionTimeout())
.FUNC_2(FUNC_8())
.FUNC_3(FUNC_9())
.FUNC_10(getSocketTimeOut()).build();
if (VAR_0.FUNC_11()) {
VAR_0.FUNC_12("Mongo Options");
VAR_0.FUNC_12("Connections per host :{}", VAR_5.FUNC_6());
VAR_0.FUNC_12("Connection timeout : {}", VAR_5.getConnectTimeout());
VAR_0.FUNC_12("Max wait timeout : {}", VAR_5.FUNC_8());
VAR_0.FUNC_12("Threads allowed to block : {}", VAR_5.FUNC_9());
VAR_0.FUNC_12("Socket timeout : {}", VAR_5.FUNC_13());
}
return VAR_5;
}
/**
* Getter for connectionsPerHost.
*
* @return number representing the connections per host
*/
public int FUNC_6() {
return (VAR_1 > 0) ? VAR_1 : defaults.FUNC_6();
}
/**
* Setter for the connections per host that are allowed.
*
* @param connectionsPerHost number representing the number of connections per host
*/
public void FUNC_14(int VAR_1) {
this.VAR_1 = VAR_1;
}
/**
* Connection time out in milli seconds for doing something in mongo. Zero is indefinite
*
* @return number representing milli seconds of timeout
*/
public int getConnectionTimeout() {
return (VAR_2 > 0) ? VAR_2 : defaults.getConnectTimeout();
}
/**
* Setter for the connection time out.
*
* @param connectionTimeout number representing the connection timeout in millis
*/
public void FUNC_15(int VAR_2) {
this.VAR_2 = VAR_2;
}
/**
* get the maximum time a blocked thread that waits for a connection should wait.
*
* @return number of milli seconds the thread waits for a connection
*/
public int FUNC_8() {
return (VAR_3 > 0) ? VAR_3 : defaults.FUNC_8();
}
/**
* Set the max wait time for a blocked thread in milli seconds.
*
* @param maxWaitTime number representing the number of milli seconds to wait for a thread
*/
public void setMaxWaitTime(int VAR_3) {
this.VAR_3 = VAR_3;
}
/**
* Getter for the socket timeout.
*
* @return Number representing the amount of milli seconds to wait for a socket connection
*/
public int getSocketTimeOut() {
return (socketTimeOut > 0) ? socketTimeOut : defaults.FUNC_13();
}
/**
* Setter for the socket time out.
*
* @param socketTimeOut number representing the amount of milli seconds to wait for a socket connection
*/
public void FUNC_16(int socketTimeOut) {
this.socketTimeOut = socketTimeOut;
}
/**
* Getter for the amount of threads that block in relation to the amount of possible connections.
*
* @return Number representing the multiplier of maximum allowed blocked connections in relation to the maximum
* allowed connections
*/
public int FUNC_9() {
return (VAR_4 > 0)
? VAR_4
: defaults.FUNC_9();
}
/**
* Set the multiplier for the amount of threads to block in relation to the maximum amount of connections.
*
* @param threadsAllowedToBlockForConnectionMultiplier
* Number representing the multiplier of the amount of threads to block in relation to the connections
* that are allowed.
*/
public void FUNC_17(int VAR_4) {
this.VAR_4 = VAR_4;
}
}
| 0.84205 | {'IMPORT_0': 'org', 'IMPORT_1': 'axonframework', 'IMPORT_2': 'extensions', 'IMPORT_3': 'mongo', 'IMPORT_4': 'eventsourcing', 'IMPORT_5': 'eventstore', 'IMPORT_6': 'com', 'IMPORT_7': 'mongodb', 'IMPORT_8': 'MongoClientOptions', 'IMPORT_9': 'slf4j', 'IMPORT_10': 'LoggerFactory', 'CLASS_0': 'MongoOptionsFactory', 'VAR_0': 'logger', 'FUNC_0': 'getLogger', 'VAR_1': 'connectionsPerHost', 'FUNC_1': 'connectionsPerHost', 'VAR_2': 'connectionTimeout', 'VAR_3': 'maxWaitTime', 'FUNC_2': 'maxWaitTime', 'VAR_4': 'threadsAllowedToBlockForConnectionMultiplier', 'FUNC_3': 'threadsAllowedToBlockForConnectionMultiplier', 'FUNC_4': 'builder', 'FUNC_5': 'createMongoOptions', 'VAR_5': 'options', 'FUNC_6': 'getConnectionsPerHost', 'FUNC_7': 'connectTimeout', 'FUNC_8': 'getMaxWaitTime', 'FUNC_9': 'getThreadsAllowedToBlockForConnectionMultiplier', 'FUNC_10': 'socketTimeout', 'FUNC_11': 'isDebugEnabled', 'FUNC_12': 'debug', 'FUNC_13': 'getSocketTimeout', 'FUNC_14': 'setConnectionsPerHost', 'FUNC_15': 'setConnectionTimeout', 'FUNC_16': 'setSocketTimeOut', 'FUNC_17': 'setThreadsAllowedToBlockForConnectionMultiplier'} | java | Hibrido | 24.29% |
package org.dbflute.erflute.editor.model;
import java.util.Arrays;
import java.util.List;
import org.dbflute.erflute.Activator;
import org.dbflute.erflute.core.DesignResources;
import org.dbflute.erflute.editor.ERFluteMultiPageEditor;
import org.dbflute.erflute.editor.model.diagram_contents.DiagramContents;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.DiagramWalker;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.DiagramWalkerSet;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.category.Category;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.ermodel.ERVirtualDiagram;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.ermodel.WalkerGroup;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.note.WalkerNote;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.table.ERTable;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.table.ERVirtualTable;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.table.TableView;
import org.dbflute.erflute.editor.model.diagram_contents.element.node.table.column.NormalColumn;
import org.dbflute.erflute.editor.model.diagram_contents.not_element.group.GlobalColumnGroupSet;
import org.dbflute.erflute.editor.model.settings.DBSettings;
import org.dbflute.erflute.editor.model.settings.DiagramSettings;
import org.dbflute.erflute.editor.model.settings.PageSettings;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.swt.graphics.Color;
/**
* @author modified by jflute (originated in ermaster)
*
* TODO ymd 現状2つの債務を持っている。
* 1.メインダイアグラムのモデル
* 2.メインダイアグラムと仮想ダイアグラムのコントローラ
*
* この2つの債務を分離したい。ERDiagramにはコントローラの債務だけ残す。
*/
public class ERDiagram extends ViewableModel implements IERDiagram {
// ===================================================================================
// Definition
// ==========
private static final long serialVersionUID = 1L;
public static final String PROPERTY_CHANGE_ALL = "all";
public static final String PROPERTY_CHANGE_DATABASE = "database";
public static final String PROPERTY_CHANGE_SETTINGS = "settings";
public static final String PROPERTY_CHANGE_ADD = "add";
public static final String PROPERTY_CHANGE_DELETE = "delete";
public static final String PROPERTY_CHANGE_ERMODEL = "ermodel";
public static final String PROPERTY_CHANGE_TABLE = "table";
// ===================================================================================
// Attribute
// =========
private DiagramContents diagramContents; // may be replaced, not null
private ERFluteMultiPageEditor editor;
private int[] defaultColor;
private boolean tooltip;
private boolean showMainColumn;
private boolean disableSelectColumn;
private Category currentCategory;
private int currentCategoryIndex;
private ERVirtualDiagram currentVirtualDiagram;
private double zoom = 1.0d;
private int x;
private int y;
private DBSettings dbSettings; // #thinking can I change one via diagramContents?
private PageSettings pageSetting; // #thinking me too
private Point mousePoint = new Point();
private String defaultDiagramName;
// ===================================================================================
// Constructor
// ===========
public ERDiagram(String database) {
this.diagramContents = new DiagramContents();
this.diagramContents.getSettings().setDatabase(database);
this.pageSetting = new PageSettings(); // #thinking why? (dbSettings is not initialized)
setDefaultColor(DesignResources.ERDIAGRAM_DEFAULT_COLOR);
setColor(DesignResources.WHITE);
}
// ===================================================================================
// Initialize
// ==========
public void init() {
diagramContents.setColumnGroupSet(GlobalColumnGroupSet.load());
final DiagramSettings settings = getDiagramContents().getSettings();
settings.getModelProperties().init();
}
// ===================================================================================
// Content Handling
// ================
public void addNewWalker(DiagramWalker walker) {
Activator.debug(this, "addNewWalker()", "...Adding new walker: " + walker);
if (walker instanceof WalkerNote) {
walker.setColor(DesignResources.NOTE_DEFAULT_COLOR);
} else {
walker.setColor(DesignResources.ERDIAGRAM_DEFAULT_COLOR);
}
walker.setFontName(getFontName());
walker.setFontSize(getFontSize());
addWalkerPlainly(walker);
}
public void addWalkerPlainly(final DiagramWalker walker) {
if (isVirtual()) {
getCurrentVirtualDiagram().addWalkerPlainly(walker);
}
walker.setDiagram(this);
// 仮想ダイアグラムへのノートやテーブルグループの追加でない場合
if (!(isVirtual() && (walker instanceof WalkerNote || walker instanceof WalkerGroup))) {
diagramContents.getDiagramWalkers().add(walker);
}
if (editor != null) {
final Category category = editor.getCurrentPageCategory();
if (category != null) {
category.getContents().add(walker);
}
}
if (walker instanceof TableView) {
for (final NormalColumn normalColumn : ((TableView) walker).getNormalColumns()) {
getDiagramContents().getDictionary().add(normalColumn);
}
}
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
public void removeWalker(DiagramWalker walker) {
if (isVirtual()) {
getCurrentVirtualDiagram().removeWalker(walker);
}
diagramContents.getDiagramWalkers().remove(walker);
if (walker instanceof ERTable && !(walker instanceof ERVirtualTable)) {
// メインビューのテーブルを削除したときは、仮想ビューのノードも削除(線が消えずに残ってしまう)
for (final ERVirtualDiagram vdiagram : getDiagramContents().getVirtualDiagramSet()) {
final ERVirtualTable vtable = vdiagram.findVirtualTable((TableView) walker);
vdiagram.removeWalker(vtable);
}
}
if (walker instanceof TableView) {
diagramContents.getDictionary().remove((TableView) walker);
}
for (final Category category : diagramContents.getSettings().getCategorySetting().getAllCategories()) {
category.getContents().remove(walker);
}
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
public void replaceContents(DiagramContents newDiagramContents) {
this.diagramContents = newDiagramContents;
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
@Override
public boolean contains(DiagramWalker... models) {
if (isVirtual()) {
return getCurrentVirtualDiagram().contains(models);
} else {
return Arrays.stream(models).allMatch(m -> diagramContents.getDiagramWalkers().contains(m));
}
}
// ===================================================================================
// ER/Table Handling
// =================
public void addVirtualDiagram(ERVirtualDiagram ermodel) {
diagramContents.getVirtualDiagramSet().add(ermodel);
firePropertyChange(PROPERTY_CHANGE_ADD, null, ermodel);
}
public void removeVirtualDiagram(ERVirtualDiagram ermodel) {
diagramContents.getVirtualDiagramSet().removeByName(ermodel.getName());
firePropertyChange(PROPERTY_CHANGE_DELETE, ermodel, null);
}
public void changeTable(TableView tableView) {
firePropertyChange(PROPERTY_CHANGE_TABLE, null, tableView);
}
/**
* メインビューでテーブルを更新したときに呼ばれます。
* サブビューのテーブルを更新します。
* @param table テーブルビュー
*/
public void doChangeTable(TableView table) {
for (final ERVirtualDiagram model : getDiagramContents().getVirtualDiagramSet()) {
final ERVirtualTable vtable = model.findVirtualTable(table);
if (vtable != null) {
vtable.changeTable();
}
}
}
public ERVirtualDiagram findModelByTable(ERTable table) {
for (final ERVirtualDiagram model : diagramContents.getVirtualDiagramSet()) {
for (final ERVirtualTable vtable : model.getVirtualTables()) {
if (vtable.sameMaterial(table)) {
return model;
}
}
}
return null;
}
// ===================================================================================
// Database Handling
// =================
public void setDatabase(String str) {
final String oldDatabase = getDatabase();
getDiagramContents().getSettings().setDatabase(str);
if (str != null && !str.equals(oldDatabase)) {
firePropertyChange(PROPERTY_CHANGE_DATABASE, oldDatabase, getDatabase());
changeAll();
}
}
public String getDatabase() {
return getDiagramContents().getSettings().getDatabase();
}
public void restoreDatabase(String str) {
getDiagramContents().getSettings().setDatabase(str);
}
// ===================================================================================
// Category Handling
// =================
public void setCurrentCategoryPageName() {
editor.setCurrentCategoryPageName();
}
public void addCategory(Category category) {
category.setColor(defaultColor[0], defaultColor[1], defaultColor[2]);
getDiagramContents().getSettings().getCategorySetting().addCategoryAsSelected(category);
editor.initVirtualPage();
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
public void removeCategory(Category category) {
getDiagramContents().getSettings().getCategorySetting().removeCategory(category);
editor.initVirtualPage();
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
public void restoreCategories() {
editor.initVirtualPage();
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
// ===================================================================================
// Various Handling
// ================
public void change() {
firePropertyChange(PROPERTY_CHANGE_SETTINGS, null, null);
}
public void changeAll() {
firePropertyChange(PROPERTY_CHANGE_ALL, null, null);
}
public void changeAll(List<DiagramWalker> nodeElementList) {
firePropertyChange(PROPERTY_CHANGE_ALL, null, nodeElementList);
}
public void setSettings(DiagramSettings settings) {
getDiagramContents().setSettings(settings);
editor.activatePage();
firePropertyChange(PROPERTY_CHANGE_SETTINGS, null, null);
firePropertyChange(DiagramWalkerSet.PROPERTY_CHANGE_DIAGRAM_WALKER, null, null);
}
// ===================================================================================
// Basic Override
// ==============
@Override
public String toString() {
return getClass().getSimpleName() + ":{" + diagramContents + "}";
}
// ===================================================================================
// Accessor
// ========
public DiagramContents getDiagramContents() {
return diagramContents;
}
public void setEditor(ERFluteMultiPageEditor editor) {
this.editor = editor;
}
public int[] getDefaultColor() {
return defaultColor;
}
public void setDefaultColor(Color color) {
this.defaultColor = new int[3];
this.defaultColor[0] = color.getRed();
this.defaultColor[1] = color.getGreen();
this.defaultColor[2] = color.getBlue();
}
public void setCurrentCategory(Category currentCategory, int currentCategoryIndex) {
this.currentCategory = currentCategory;
this.currentCategoryIndex = currentCategoryIndex;
this.changeAll();
}
public Category getCurrentCategory() {
return currentCategory;
}
public int getCurrentCategoryIndex() {
return currentCategoryIndex;
}
public boolean isTooltip() {
return tooltip;
}
public void setTooltip(boolean tooltip) {
this.tooltip = tooltip;
}
/*
* TODO ymd なるべく使わない方向で。直接触らないでERDiagramを介する。
* クライアントクラスは、getDiagram().getCurrentVirtualDiagram().目的の操作()ではなく、
* getDiagram().目的の操作()を実行する。
*/
public ERVirtualDiagram getCurrentVirtualDiagram() {
return currentVirtualDiagram;
}
public void setCurrentVirtualDiagram(ERVirtualDiagram vdiagram) {
this.currentVirtualDiagram = vdiagram;
if (vdiagram != null) {
this.defaultDiagramName = vdiagram.getName();
vdiagram.changeAll();
} else {
this.defaultDiagramName = null;
}
}
public double getZoom() {
return zoom;
}
public void setZoom(double zoom) {
this.zoom = zoom;
}
public void setLocation(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public DBSettings getDbSettings() {
return dbSettings;
}
public void setDbSettings(DBSettings dbSetting) {
this.dbSettings = dbSetting;
}
public PageSettings getPageSetting() {
return pageSetting;
}
public void setPageSetting(PageSettings pageSetting) {
this.pageSetting = pageSetting;
}
@Override
public ERFluteMultiPageEditor getEditor() {
return editor;
}
public String filter(String str) {
if (str == null) {
return str;
}
final DiagramSettings settings = getDiagramContents().getSettings();
if (settings.isCapital()) {
return str.toUpperCase();
}
return str;
}
public void setShowMainColumn(boolean showMainColumn) {
this.showMainColumn = showMainColumn;
}
public boolean isShowMainColumn() {
return showMainColumn;
}
public boolean isDisableSelectColumn() {
return disableSelectColumn;
}
public void setDisableSelectColumn(boolean disableSelectColumn) {
this.disableSelectColumn = disableSelectColumn;
}
public String getDefaultDiagramName() {
return defaultDiagramName;
}
@Override
public String getName() {
return "Main Diagram";
}
@Override
public Point getMousePoint() {
if (isVirtual()) {
return currentVirtualDiagram.getMousePoint();
} else {
return mousePoint;
}
}
@Override
public void setMousePoint(Point mousePoint) {
if (isVirtual()) {
currentVirtualDiagram.setMousePoint(mousePoint);
} else {
this.mousePoint = mousePoint;
}
}
public boolean isVirtual() {
return getCurrentVirtualDiagram() != null;
}
@SuppressWarnings("deprecation")
public void refresh(DiagramWalker... others) {
// TODO ERModelUtil#refreshDiagram()は、ここだけで使用する。後で実装自体こちらに移す。
ERModelUtil.refreshDiagram(this, others);
}
public void refreshVirtualDiagram(DiagramWalker... others) {
if (isVirtual()) {
refresh(others);
}
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4;
import IMPORT_5.IMPORT_6.Arrays;
import IMPORT_5.IMPORT_6.IMPORT_7;
import IMPORT_0.IMPORT_1.IMPORT_2.Activator;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_8.DesignResources;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.ERFluteMultiPageEditor;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.IMPORT_10;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.IMPORT_12;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.DiagramWalkerSet;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.category.IMPORT_13;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.ermodel.IMPORT_14;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.ermodel.IMPORT_15;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.IMPORT_16.WalkerNote;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.table.IMPORT_17;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.table.ERVirtualTable;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.table.TableView;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.element.IMPORT_11.table.IMPORT_18.IMPORT_19;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.IMPORT_9.not_element.IMPORT_20.IMPORT_21;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.settings.IMPORT_22;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.settings.IMPORT_23;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4.settings.IMPORT_24;
import IMPORT_0.IMPORT_25.draw2d.geometry.IMPORT_26;
import IMPORT_0.IMPORT_25.swt.IMPORT_27.IMPORT_28;
/**
* @author modified by jflute (originated in ermaster)
*
* TODO ymd 現状2つの債務を持っている。
* 1.メインダイアグラムのモデル
* 2.メインダイアグラムと仮想ダイアグラムのコントローラ
*
* この2つの債務を分離したい。ERDiagramにはコントローラの債務だけ残す。
*/
public class CLASS_0 extends CLASS_1 implements CLASS_2 {
// ===================================================================================
// Definition
// ==========
private static final long VAR_0 = 1L;
public static final String VAR_1 = "all";
public static final String PROPERTY_CHANGE_DATABASE = "database";
public static final String PROPERTY_CHANGE_SETTINGS = "settings";
public static final String PROPERTY_CHANGE_ADD = "add";
public static final String PROPERTY_CHANGE_DELETE = "delete";
public static final String VAR_2 = "ermodel";
public static final String PROPERTY_CHANGE_TABLE = "table";
// ===================================================================================
// Attribute
// =========
private IMPORT_10 VAR_3; // may be replaced, not null
private ERFluteMultiPageEditor IMPORT_3;
private int[] defaultColor;
private boolean VAR_4;
private boolean VAR_5;
private boolean VAR_6;
private IMPORT_13 currentCategory;
private int currentCategoryIndex;
private IMPORT_14 VAR_7;
private double zoom = 1.0d;
private int VAR_8;
private int VAR_9;
private IMPORT_22 VAR_10; // #thinking can I change one via diagramContents?
private IMPORT_24 VAR_11; // #thinking me too
private IMPORT_26 mousePoint = new IMPORT_26();
private String VAR_12;
// ===================================================================================
// Constructor
// ===========
public CLASS_0(String VAR_13) {
this.VAR_3 = new IMPORT_10();
this.VAR_3.FUNC_0().FUNC_1(VAR_13);
this.VAR_11 = new IMPORT_24(); // #thinking why? (dbSettings is not initialized)
setDefaultColor(DesignResources.VAR_14);
FUNC_2(DesignResources.VAR_15);
}
// ===================================================================================
// Initialize
// ==========
public void FUNC_3() {
VAR_3.setColumnGroupSet(IMPORT_21.FUNC_4());
final IMPORT_23 settings = FUNC_5().FUNC_0();
settings.getModelProperties().FUNC_3();
}
// ===================================================================================
// Content Handling
// ================
public void FUNC_6(IMPORT_12 walker) {
Activator.FUNC_7(this, "addNewWalker()", "...Adding new walker: " + walker);
if (walker instanceof WalkerNote) {
walker.FUNC_2(DesignResources.NOTE_DEFAULT_COLOR);
} else {
walker.FUNC_2(DesignResources.VAR_14);
}
walker.FUNC_8(FUNC_9());
walker.FUNC_10(FUNC_11());
addWalkerPlainly(walker);
}
public void addWalkerPlainly(final IMPORT_12 walker) {
if (isVirtual()) {
getCurrentVirtualDiagram().addWalkerPlainly(walker);
}
walker.setDiagram(this);
// 仮想ダイアグラムへのノートやテーブルグループの追加でない場合
if (!(isVirtual() && (walker instanceof WalkerNote || walker instanceof IMPORT_15))) {
VAR_3.getDiagramWalkers().add(walker);
}
if (IMPORT_3 != null) {
final IMPORT_13 category = IMPORT_3.FUNC_12();
if (category != null) {
category.getContents().add(walker);
}
}
if (walker instanceof TableView) {
for (final IMPORT_19 normalColumn : ((TableView) walker).FUNC_13()) {
FUNC_5().FUNC_14().add(normalColumn);
}
}
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
public void removeWalker(IMPORT_12 walker) {
if (isVirtual()) {
getCurrentVirtualDiagram().removeWalker(walker);
}
VAR_3.getDiagramWalkers().remove(walker);
if (walker instanceof IMPORT_17 && !(walker instanceof ERVirtualTable)) {
// メインビューのテーブルを削除したときは、仮想ビューのノードも削除(線が消えずに残ってしまう)
for (final IMPORT_14 VAR_17 : FUNC_5().FUNC_16()) {
final ERVirtualTable vtable = VAR_17.FUNC_17((TableView) walker);
VAR_17.removeWalker(vtable);
}
}
if (walker instanceof TableView) {
VAR_3.FUNC_14().remove((TableView) walker);
}
for (final IMPORT_13 category : VAR_3.FUNC_0().FUNC_18().FUNC_19()) {
category.getContents().remove(walker);
}
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
public void FUNC_20(IMPORT_10 VAR_18) {
this.VAR_3 = VAR_18;
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
@VAR_19
public boolean FUNC_21(IMPORT_12... models) {
if (isVirtual()) {
return getCurrentVirtualDiagram().FUNC_21(models);
} else {
return Arrays.FUNC_22(models).FUNC_23(VAR_20 -> VAR_3.getDiagramWalkers().FUNC_21(VAR_20));
}
}
// ===================================================================================
// ER/Table Handling
// =================
public void FUNC_24(IMPORT_14 ermodel) {
VAR_3.FUNC_16().add(ermodel);
FUNC_15(PROPERTY_CHANGE_ADD, null, ermodel);
}
public void FUNC_25(IMPORT_14 ermodel) {
VAR_3.FUNC_16().FUNC_26(ermodel.getName());
FUNC_15(PROPERTY_CHANGE_DELETE, ermodel, null);
}
public void FUNC_27(TableView VAR_21) {
FUNC_15(PROPERTY_CHANGE_TABLE, null, VAR_21);
}
/**
* メインビューでテーブルを更新したときに呼ばれます。
* サブビューのテーブルを更新します。
* @param table テーブルビュー
*/
public void doChangeTable(TableView table) {
for (final IMPORT_14 IMPORT_4 : FUNC_5().FUNC_16()) {
final ERVirtualTable vtable = IMPORT_4.FUNC_17(table);
if (vtable != null) {
vtable.FUNC_27();
}
}
}
public IMPORT_14 FUNC_28(IMPORT_17 table) {
for (final IMPORT_14 IMPORT_4 : VAR_3.FUNC_16()) {
for (final ERVirtualTable vtable : IMPORT_4.FUNC_29()) {
if (vtable.FUNC_30(table)) {
return IMPORT_4;
}
}
}
return null;
}
// ===================================================================================
// Database Handling
// =================
public void FUNC_1(String str) {
final String oldDatabase = FUNC_31();
FUNC_5().FUNC_0().FUNC_1(str);
if (str != null && !str.FUNC_32(oldDatabase)) {
FUNC_15(PROPERTY_CHANGE_DATABASE, oldDatabase, FUNC_31());
FUNC_33();
}
}
public String FUNC_31() {
return FUNC_5().FUNC_0().FUNC_31();
}
public void restoreDatabase(String str) {
FUNC_5().FUNC_0().FUNC_1(str);
}
// ===================================================================================
// Category Handling
// =================
public void setCurrentCategoryPageName() {
IMPORT_3.setCurrentCategoryPageName();
}
public void FUNC_34(IMPORT_13 category) {
category.FUNC_2(defaultColor[0], defaultColor[1], defaultColor[2]);
FUNC_5().FUNC_0().FUNC_18().FUNC_35(category);
IMPORT_3.initVirtualPage();
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
public void FUNC_36(IMPORT_13 category) {
FUNC_5().FUNC_0().FUNC_18().FUNC_36(category);
IMPORT_3.initVirtualPage();
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
public void FUNC_37() {
IMPORT_3.initVirtualPage();
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
// ===================================================================================
// Various Handling
// ================
public void change() {
FUNC_15(PROPERTY_CHANGE_SETTINGS, null, null);
}
public void FUNC_33() {
FUNC_15(VAR_1, null, null);
}
public void FUNC_33(IMPORT_7<IMPORT_12> VAR_22) {
FUNC_15(VAR_1, null, VAR_22);
}
public void FUNC_38(IMPORT_23 settings) {
FUNC_5().FUNC_38(settings);
IMPORT_3.FUNC_39();
FUNC_15(PROPERTY_CHANGE_SETTINGS, null, null);
FUNC_15(DiagramWalkerSet.VAR_16, null, null);
}
// ===================================================================================
// Basic Override
// ==============
@VAR_19
public String FUNC_40() {
return FUNC_41().getSimpleName() + ":{" + VAR_3 + "}";
}
// ===================================================================================
// Accessor
// ========
public IMPORT_10 FUNC_5() {
return VAR_3;
}
public void FUNC_42(ERFluteMultiPageEditor IMPORT_3) {
this.IMPORT_3 = IMPORT_3;
}
public int[] getDefaultColor() {
return defaultColor;
}
public void setDefaultColor(IMPORT_28 VAR_23) {
this.defaultColor = new int[3];
this.defaultColor[0] = VAR_23.FUNC_43();
this.defaultColor[1] = VAR_23.FUNC_44();
this.defaultColor[2] = VAR_23.getBlue();
}
public void setCurrentCategory(IMPORT_13 currentCategory, int currentCategoryIndex) {
this.currentCategory = currentCategory;
this.currentCategoryIndex = currentCategoryIndex;
this.FUNC_33();
}
public IMPORT_13 getCurrentCategory() {
return currentCategory;
}
public int getCurrentCategoryIndex() {
return currentCategoryIndex;
}
public boolean isTooltip() {
return VAR_4;
}
public void FUNC_45(boolean VAR_4) {
this.VAR_4 = VAR_4;
}
/*
* TODO ymd なるべく使わない方向で。直接触らないでERDiagramを介する。
* クライアントクラスは、getDiagram().getCurrentVirtualDiagram().目的の操作()ではなく、
* getDiagram().目的の操作()を実行する。
*/
public IMPORT_14 getCurrentVirtualDiagram() {
return VAR_7;
}
public void FUNC_46(IMPORT_14 VAR_17) {
this.VAR_7 = VAR_17;
if (VAR_17 != null) {
this.VAR_12 = VAR_17.getName();
VAR_17.FUNC_33();
} else {
this.VAR_12 = null;
}
}
public double FUNC_47() {
return zoom;
}
public void FUNC_48(double zoom) {
this.zoom = zoom;
}
public void setLocation(int VAR_8, int VAR_9) {
this.VAR_8 = VAR_8;
this.VAR_9 = VAR_9;
}
public int getX() {
return VAR_8;
}
public int FUNC_49() {
return VAR_9;
}
public IMPORT_22 FUNC_50() {
return VAR_10;
}
public void FUNC_51(IMPORT_22 dbSetting) {
this.VAR_10 = dbSetting;
}
public IMPORT_24 getPageSetting() {
return VAR_11;
}
public void setPageSetting(IMPORT_24 VAR_11) {
this.VAR_11 = VAR_11;
}
@VAR_19
public ERFluteMultiPageEditor getEditor() {
return IMPORT_3;
}
public String filter(String str) {
if (str == null) {
return str;
}
final IMPORT_23 settings = FUNC_5().FUNC_0();
if (settings.isCapital()) {
return str.toUpperCase();
}
return str;
}
public void FUNC_52(boolean VAR_5) {
this.VAR_5 = VAR_5;
}
public boolean isShowMainColumn() {
return VAR_5;
}
public boolean FUNC_53() {
return VAR_6;
}
public void setDisableSelectColumn(boolean VAR_6) {
this.VAR_6 = VAR_6;
}
public String getDefaultDiagramName() {
return VAR_12;
}
@VAR_19
public String getName() {
return "Main Diagram";
}
@VAR_19
public IMPORT_26 FUNC_54() {
if (isVirtual()) {
return VAR_7.FUNC_54();
} else {
return mousePoint;
}
}
@VAR_19
public void setMousePoint(IMPORT_26 mousePoint) {
if (isVirtual()) {
VAR_7.setMousePoint(mousePoint);
} else {
this.mousePoint = mousePoint;
}
}
public boolean isVirtual() {
return getCurrentVirtualDiagram() != null;
}
@VAR_24("deprecation")
public void FUNC_55(IMPORT_12... others) {
// TODO ERModelUtil#refreshDiagram()は、ここだけで使用する。後で実装自体こちらに移す。
VAR_25.refreshDiagram(this, others);
}
public void FUNC_56(IMPORT_12... others) {
if (isVirtual()) {
FUNC_55(others);
}
}
}
| 0.638847 | {'IMPORT_0': 'org', 'IMPORT_1': 'dbflute', 'IMPORT_2': 'erflute', 'IMPORT_3': 'editor', 'IMPORT_4': 'model', 'IMPORT_5': 'java', 'IMPORT_6': 'util', 'IMPORT_7': 'List', 'IMPORT_8': 'core', 'IMPORT_9': 'diagram_contents', 'IMPORT_10': 'DiagramContents', 'IMPORT_11': 'node', 'IMPORT_12': 'DiagramWalker', 'IMPORT_13': 'Category', 'IMPORT_14': 'ERVirtualDiagram', 'IMPORT_15': 'WalkerGroup', 'IMPORT_16': 'note', 'IMPORT_17': 'ERTable', 'IMPORT_18': 'column', 'IMPORT_19': 'NormalColumn', 'IMPORT_20': 'group', 'IMPORT_21': 'GlobalColumnGroupSet', 'IMPORT_22': 'DBSettings', 'IMPORT_23': 'DiagramSettings', 'IMPORT_24': 'PageSettings', 'IMPORT_25': 'eclipse', 'IMPORT_26': 'Point', 'IMPORT_27': 'graphics', 'IMPORT_28': 'Color', 'CLASS_0': 'ERDiagram', 'CLASS_1': 'ViewableModel', 'CLASS_2': 'IERDiagram', 'VAR_0': 'serialVersionUID', 'VAR_1': 'PROPERTY_CHANGE_ALL', 'VAR_2': 'PROPERTY_CHANGE_ERMODEL', 'VAR_3': 'diagramContents', 'VAR_4': 'tooltip', 'VAR_5': 'showMainColumn', 'VAR_6': 'disableSelectColumn', 'VAR_7': 'currentVirtualDiagram', 'VAR_8': 'x', 'VAR_9': 'y', 'VAR_10': 'dbSettings', 'VAR_11': 'pageSetting', 'VAR_12': 'defaultDiagramName', 'VAR_13': 'database', 'FUNC_0': 'getSettings', 'FUNC_1': 'setDatabase', 'VAR_14': 'ERDIAGRAM_DEFAULT_COLOR', 'FUNC_2': 'setColor', 'VAR_15': 'WHITE', 'FUNC_3': 'init', 'FUNC_4': 'load', 'FUNC_5': 'getDiagramContents', 'FUNC_6': 'addNewWalker', 'FUNC_7': 'debug', 'FUNC_8': 'setFontName', 'FUNC_9': 'getFontName', 'FUNC_10': 'setFontSize', 'FUNC_11': 'getFontSize', 'FUNC_12': 'getCurrentPageCategory', 'FUNC_13': 'getNormalColumns', 'FUNC_14': 'getDictionary', 'FUNC_15': 'firePropertyChange', 'VAR_16': 'PROPERTY_CHANGE_DIAGRAM_WALKER', 'VAR_17': 'vdiagram', 'FUNC_16': 'getVirtualDiagramSet', 'FUNC_17': 'findVirtualTable', 'FUNC_18': 'getCategorySetting', 'FUNC_19': 'getAllCategories', 'FUNC_20': 'replaceContents', 'VAR_18': 'newDiagramContents', 'VAR_19': 'Override', 'FUNC_21': 'contains', 'FUNC_22': 'stream', 'FUNC_23': 'allMatch', 'VAR_20': 'm', 'FUNC_24': 'addVirtualDiagram', 'FUNC_25': 'removeVirtualDiagram', 'FUNC_26': 'removeByName', 'FUNC_27': 'changeTable', 'VAR_21': 'tableView', 'FUNC_28': 'findModelByTable', 'FUNC_29': 'getVirtualTables', 'FUNC_30': 'sameMaterial', 'FUNC_31': 'getDatabase', 'FUNC_32': 'equals', 'FUNC_33': 'changeAll', 'FUNC_34': 'addCategory', 'FUNC_35': 'addCategoryAsSelected', 'FUNC_36': 'removeCategory', 'FUNC_37': 'restoreCategories', 'VAR_22': 'nodeElementList', 'FUNC_38': 'setSettings', 'FUNC_39': 'activatePage', 'FUNC_40': 'toString', 'FUNC_41': 'getClass', 'FUNC_42': 'setEditor', 'VAR_23': 'color', 'FUNC_43': 'getRed', 'FUNC_44': 'getGreen', 'FUNC_45': 'setTooltip', 'FUNC_46': 'setCurrentVirtualDiagram', 'FUNC_47': 'getZoom', 'FUNC_48': 'setZoom', 'FUNC_49': 'getY', 'FUNC_50': 'getDbSettings', 'FUNC_51': 'setDbSettings', 'FUNC_52': 'setShowMainColumn', 'FUNC_53': 'isDisableSelectColumn', 'FUNC_54': 'getMousePoint', 'VAR_24': 'SuppressWarnings', 'FUNC_55': 'refresh', 'VAR_25': 'ERModelUtil', 'FUNC_56': 'refreshVirtualDiagram'} | java | Hibrido | 22.30% |
/**
* Bubbles a element at a given position down.
* @param pos the position
*/
private void percolateDown(final int pos) {
int p = pos;
final int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
final int child = right(p) < this.heap.size() && this.s.lt(this.heap.get(right(p)), this.heap.get(left(p))) ? right(p) : left(p);
if (!this.s.lt(this.heap.get(child), y)) {
break;
}
this.heap.set(p, this.heap.get(child));
this.indices.set(this.heap.get(p), p);
p = child;
}
this.heap.set(p, y);
this.indices.set(y, p);
} | /**
* Bubbles a element at a given position down.
* @param pos the position
*/
private void percolateDown(final int VAR_0) {
int p = VAR_0;
final int y = this.heap.get(p);
while (left(p) < this.heap.size()) {
final int child = FUNC_0(p) < this.heap.size() && this.s.lt(this.heap.get(FUNC_0(p)), this.heap.get(left(p))) ? FUNC_0(p) : left(p);
if (!this.s.lt(this.heap.get(child), y)) {
break;
}
this.heap.FUNC_1(p, this.heap.get(child));
this.indices.FUNC_1(this.heap.get(p), p);
p = child;
}
this.heap.FUNC_1(p, y);
this.indices.FUNC_1(y, p);
} | 0.223421 | {'VAR_0': 'pos', 'FUNC_0': 'right', 'FUNC_1': 'set'} | java | Procedural | 24.83% |
/**
* A simple {@link Fragment} subclass.
*/
public class Fragment_SettingAccount extends Fragment {
private LinearLayout linearEditName , linearEditAge , linearEditDescreption ;
private TextView txtChaneName , txtChangeAge , txtChangeDescreption;
private ImageView imgChaneName , imgChangeAge , imgChangeDescreption;
public Fragment_SettingAccount() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.StyleFragmentMessages);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View view = localInflater.inflate(R.layout.fragment__setting_account, container, false);
linkViews(view);
txtChaneName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeName();
}
});
imgChaneName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeName();
}
});
txtChangeAge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeAge();
}
});
imgChangeAge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeAge();
}
});
txtChangeDescreption.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeDiscreption();
}
});
imgChangeDescreption.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeDiscreption();
}
});
return view ;
}
public void changeName(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "name");
startActivity(intentTo);
}
public void changeAge(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "age");
startActivity(intentTo);
}
public void changeDiscreption(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "disk");
startActivity(intentTo);
}
public void linkViews(View view){
txtChaneName = (TextView)view.findViewById(R.id.txtEditName);
txtChangeAge = (TextView)view.findViewById(R.id.txtEditAge);
txtChangeDescreption = (TextView)view.findViewById(R.id.txtViewDescreption);
imgChaneName = (ImageView) view.findViewById(R.id.imgEditName);
imgChangeAge = (ImageView) view.findViewById(R.id.imgEditAge);
imgChangeDescreption = (ImageView) view.findViewById(R.id.imgEditDesk);
}
} | /**
* A simple {@link Fragment} subclass.
*/
public class Fragment_SettingAccount extends Fragment {
private LinearLayout VAR_0 , linearEditAge , linearEditDescreption ;
private TextView txtChaneName , txtChangeAge , txtChangeDescreption;
private ImageView imgChaneName , imgChangeAge , imgChangeDescreption;
public Fragment_SettingAccount() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), R.style.StyleFragmentMessages);
LayoutInflater localInflater = inflater.cloneInContext(contextThemeWrapper);
View view = localInflater.inflate(R.layout.fragment__setting_account, container, false);
linkViews(view);
txtChaneName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeName();
}
});
imgChaneName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeName();
}
});
txtChangeAge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeAge();
}
});
imgChangeAge.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeAge();
}
});
txtChangeDescreption.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeDiscreption();
}
});
imgChangeDescreption.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
changeDiscreption();
}
});
return view ;
}
public void changeName(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "name");
startActivity(intentTo);
}
public void changeAge(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "age");
startActivity(intentTo);
}
public void changeDiscreption(){
Intent intentTo = new Intent(getActivity(),PropertiesOfEdit.class);
intentTo.putExtra("key" , "disk");
startActivity(intentTo);
}
public void linkViews(View view){
txtChaneName = (TextView)view.findViewById(R.id.txtEditName);
txtChangeAge = (TextView)view.findViewById(R.id.txtEditAge);
txtChangeDescreption = (TextView)view.findViewById(R.id.txtViewDescreption);
imgChaneName = (ImageView) view.findViewById(R.id.imgEditName);
imgChangeAge = (ImageView) view.findViewById(R.id.imgEditAge);
imgChangeDescreption = (ImageView) view.findViewById(R.id.imgEditDesk);
}
} | 0.017307 | {'VAR_0': 'linearEditName'} | java | Texto | 0.76% |
package Generator;
import Main.DataOutput;
import Main.SettingProvider;
import java.util.Random;
/**
* The main class of the generator. Used to initialize and execute the other objects.
*/
public class Generator {
private Sensor[] sensorList;
private DataOutput outputHandler;
private long outputSize;
private int sensorCount;
/**
* Initializes all parts of the object. All settings must be set properly before creating the Generator.
*/
public Generator() {
initializeSensorList();
initializeDataOutput();
initializePrimitives();
}
/**
* Creates the list of sensors which will be used to generate the SimpleSensorData. Creates one sensor per requested type.
*/
private void initializeSensorList() {
Random rng = SettingProvider.getRandomNumberGenerator();
NoiseAlgorithm noiseAlgorithm = SettingProvider.getNoiseAlgorithm();
SensorFactory.TYPE[] sensorTypes = SettingProvider.getSettingStore().getSensorTypes();
this.sensorList = new Sensor[sensorTypes.length];
for (int i = 0; i < sensorTypes.length; i++) {
this.sensorList[i] = SensorFactory.createSensor(sensorTypes[i]);
}
}
/**
* Sets the DataOutput handler to forward generated data to.
*/
private void initializeDataOutput() {
this.outputHandler = SettingProvider.getOutputHandler();
}
/**
* Sets all primitive variables needed to execute the generation.
*/
private void initializePrimitives() {
this.outputSize = SettingProvider.getSettingStore().getOutputSize();
this.sensorCount = this.sensorList.length;
}
/**
* Loops through the list of sensors for the set amount of times to generate the SimpleSensorData objects and passes them to the DataOutput one by one.
*/
public void execute() {
Sensor currentSensor;
for (long i = 0; i < this.outputSize; i++) {
currentSensor = this.sensorList[(int) (i % sensorCount)];
this.outputHandler.save(currentSensor.getData());
}
this.outputHandler.flush();
}
}
| package Generator;
import IMPORT_0.IMPORT_1;
import IMPORT_0.IMPORT_2;
import IMPORT_3.IMPORT_4.IMPORT_5;
/**
* The main class of the generator. Used to initialize and execute the other objects.
*/
public class Generator {
private Sensor[] sensorList;
private IMPORT_1 outputHandler;
private long VAR_0;
private int VAR_1;
/**
* Initializes all parts of the object. All settings must be set properly before creating the Generator.
*/
public Generator() {
initializeSensorList();
initializeDataOutput();
FUNC_0();
}
/**
* Creates the list of sensors which will be used to generate the SimpleSensorData. Creates one sensor per requested type.
*/
private void initializeSensorList() {
IMPORT_5 VAR_2 = IMPORT_2.FUNC_1();
NoiseAlgorithm VAR_3 = IMPORT_2.FUNC_2();
SensorFactory.CLASS_0[] VAR_4 = IMPORT_2.getSettingStore().FUNC_3();
this.sensorList = new Sensor[VAR_4.VAR_5];
for (int VAR_6 = 0; VAR_6 < VAR_4.VAR_5; VAR_6++) {
this.sensorList[VAR_6] = SensorFactory.createSensor(VAR_4[VAR_6]);
}
}
/**
* Sets the DataOutput handler to forward generated data to.
*/
private void initializeDataOutput() {
this.outputHandler = IMPORT_2.FUNC_4();
}
/**
* Sets all primitive variables needed to execute the generation.
*/
private void FUNC_0() {
this.VAR_0 = IMPORT_2.getSettingStore().FUNC_5();
this.VAR_1 = this.sensorList.VAR_5;
}
/**
* Loops through the list of sensors for the set amount of times to generate the SimpleSensorData objects and passes them to the DataOutput one by one.
*/
public void execute() {
Sensor currentSensor;
for (long VAR_6 = 0; VAR_6 < this.VAR_0; VAR_6++) {
currentSensor = this.sensorList[(int) (VAR_6 % VAR_1)];
this.outputHandler.save(currentSensor.getData());
}
this.outputHandler.FUNC_6();
}
}
| 0.513083 | {'IMPORT_0': 'Main', 'IMPORT_1': 'DataOutput', 'IMPORT_2': 'SettingProvider', 'IMPORT_3': 'java', 'IMPORT_4': 'util', 'IMPORT_5': 'Random', 'VAR_0': 'outputSize', 'VAR_1': 'sensorCount', 'FUNC_0': 'initializePrimitives', 'VAR_2': 'rng', 'FUNC_1': 'getRandomNumberGenerator', 'VAR_3': 'noiseAlgorithm', 'FUNC_2': 'getNoiseAlgorithm', 'CLASS_0': 'TYPE', 'VAR_4': 'sensorTypes', 'FUNC_3': 'getSensorTypes', 'VAR_5': 'length', 'VAR_6': 'i', 'FUNC_4': 'getOutputHandler', 'FUNC_5': 'getOutputSize', 'FUNC_6': 'flush'} | java | OOP | 96.30% |
/**
* updates all stepped prices set additional price and free entity count
*/
private void consolidateSteppedPrices(PriceModel priceModel) {
updateFreeAmountAndAdditionalPrice(priceModel.getSteppedPrices());
for (PricedEvent event : priceModel.getConsideredEvents()) {
updateFreeAmountAndAdditionalPrice(event.getSteppedPrices());
}
for (PricedParameter parameter : priceModel.getSelectedParameters()) {
updateFreeAmountAndAdditionalPrice(parameter.getSteppedPrices());
}
} | /**
* updates all stepped prices set additional price and free entity count
*/
private void FUNC_0(CLASS_0 VAR_0) {
updateFreeAmountAndAdditionalPrice(VAR_0.FUNC_1());
for (CLASS_1 VAR_1 : VAR_0.getConsideredEvents()) {
updateFreeAmountAndAdditionalPrice(VAR_1.FUNC_1());
}
for (CLASS_2 VAR_2 : VAR_0.getSelectedParameters()) {
updateFreeAmountAndAdditionalPrice(VAR_2.FUNC_1());
}
} | 0.551787 | {'FUNC_0': 'consolidateSteppedPrices', 'CLASS_0': 'PriceModel', 'VAR_0': 'priceModel', 'FUNC_1': 'getSteppedPrices', 'CLASS_1': 'PricedEvent', 'VAR_1': 'event', 'CLASS_2': 'PricedParameter', 'VAR_2': 'parameter'} | java | Procedural | 38.10% |
package org.fluentlenium.example.spring.config;
/**
* Thrown when something wrong occurs with the configuration
*/
public class ConfigException extends RuntimeException {
/**
* Creates configuration exception
*
* @param message message
* @param cause cause
*/
public ConfigException(String message, Exception cause) {
super(message, cause);
}
/**
* Creates configuration exception
*
* @param message message
*/
public ConfigException(String message) {
super(message);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_4;
/**
* Thrown when something wrong occurs with the configuration
*/
public class CLASS_0 extends CLASS_1 {
/**
* Creates configuration exception
*
* @param message message
* @param cause cause
*/
public CLASS_0(CLASS_2 VAR_0, CLASS_3 VAR_1) {
super(VAR_0, VAR_1);
}
/**
* Creates configuration exception
*
* @param message message
*/
public CLASS_0(CLASS_2 VAR_0) {
super(VAR_0);
}
}
| 0.97618 | {'IMPORT_0': 'org', 'IMPORT_1': 'fluentlenium', 'IMPORT_2': 'example', 'IMPORT_3': 'spring', 'IMPORT_4': 'config', 'CLASS_0': 'ConfigException', 'CLASS_1': 'RuntimeException', 'CLASS_2': 'String', 'VAR_0': 'message', 'CLASS_3': 'Exception', 'VAR_1': 'cause'} | java | OOP | 100.00% |
/**
* @param cmd parsed command arguments
* @return false to indicate exit to the calling code, true otherwise.
* @see #parseCommand(String)
*/
private static boolean handleCommand(final List<String> cmd) {
if (cmd == null) return false;
if (cmd.size() == 0) return true;
final var cmdObj = Command.valueOfCmd(cmd.get(0));
if (cmdObj == null) {
System.err.println("Unrecognized command: " + cmd.get(0));
Command.HELP.execute();
return true;
}
return cmdObj.execute(BALANCE, cmd.subList(1, cmd.size()));
} | /**
* @param cmd parsed command arguments
* @return false to indicate exit to the calling code, true otherwise.
* @see #parseCommand(String)
*/
private static boolean handleCommand(final CLASS_0<CLASS_1> VAR_0) {
if (VAR_0 == null) return false;
if (VAR_0.size() == 0) return true;
final ID_0 cmdObj = VAR_1.FUNC_0(VAR_0.FUNC_1(0));
if (cmdObj == null) {
VAR_2.VAR_3.println("Unrecognized command: " + VAR_0.FUNC_1(0));
VAR_1.VAR_4.FUNC_2();
return true;
}
return cmdObj.FUNC_2(VAR_5, VAR_0.FUNC_3(1, VAR_0.size()));
} | 0.653038 | {'CLASS_0': 'List', 'CLASS_1': 'String', 'VAR_0': 'cmd', 'ID_0': 'var', 'VAR_1': 'Command', 'FUNC_0': 'valueOfCmd', 'FUNC_1': 'get', 'VAR_2': 'System', 'VAR_3': 'err', 'VAR_4': 'HELP', 'FUNC_2': 'execute', 'VAR_5': 'BALANCE', 'FUNC_3': 'subList'} | java | Procedural | 45.36% |
/**
* For each value of the map, the Predicate2 is evaluated with the key and value as the parameter,
* and if true, then <code>function</code> is applied.
* The results of these evaluations are collected into the target map.
*/
public static <K1, V1, K2, V2> MutableMap<K2, V2> collectIf(
Map<K1, V1> map,
final Function2<? super K1, ? super V1, Pair<K2, V2>> function,
final Predicate2<? super K1, ? super V1> predicate,
Map<K2, V2> target)
{
final MutableMap<K2, V2> result = MapAdapter.adapt(target);
MapIterate.forEachKeyValue(map, new Procedure2<K1, V1>()
{
public void value(K1 key, V1 value)
{
if (predicate.accept(key, value))
{
Pair<K2, V2> pair = function.value(key, value);
result.put(pair.getOne(), pair.getTwo());
}
}
});
return result;
} | /**
* For each value of the map, the Predicate2 is evaluated with the key and value as the parameter,
* and if true, then <code>function</code> is applied.
* The results of these evaluations are collected into the target map.
*/
public static <CLASS_0, CLASS_1, CLASS_2, V2> CLASS_3<CLASS_2, V2> FUNC_0(
CLASS_4<CLASS_0, CLASS_1> VAR_0,
final Function2<? super CLASS_0, ? super CLASS_1, Pair<CLASS_2, V2>> VAR_1,
final CLASS_5<? super CLASS_0, ? super CLASS_1> VAR_2,
CLASS_4<CLASS_2, V2> VAR_3)
{
final CLASS_3<CLASS_2, V2> VAR_4 = VAR_5.FUNC_1(VAR_3);
MapIterate.FUNC_2(VAR_0, new CLASS_6<CLASS_0, CLASS_1>()
{
public void FUNC_3(CLASS_0 key, CLASS_1 VAR_6)
{
if (VAR_2.accept(key, VAR_6))
{
Pair<CLASS_2, V2> pair = VAR_1.FUNC_3(key, VAR_6);
VAR_4.FUNC_4(pair.getOne(), pair.FUNC_5());
}
}
});
return VAR_4;
} | 0.77102 | {'CLASS_0': 'K1', 'CLASS_1': 'V1', 'CLASS_2': 'K2', 'CLASS_3': 'MutableMap', 'FUNC_0': 'collectIf', 'CLASS_4': 'Map', 'VAR_0': 'map', 'VAR_1': 'function', 'CLASS_5': 'Predicate2', 'VAR_2': 'predicate', 'VAR_3': 'target', 'VAR_4': 'result', 'VAR_5': 'MapAdapter', 'FUNC_1': 'adapt', 'FUNC_2': 'forEachKeyValue', 'CLASS_6': 'Procedure2', 'FUNC_3': 'value', 'VAR_6': 'value', 'FUNC_4': 'put', 'FUNC_5': 'getTwo'} | java | Procedural | 65.07% |
/**
* @author Bernd Bohnet, 01.09.2009
*
* Maps for the Hash Kernel the long values to the int values.
*/
final public class Long2IntExact implements Long2IntInterface {
static gnu.trove.TLongIntHashMap mapt = new gnu.trove.TLongIntHashMap();
static int cnt=0;
public Long2IntExact() {
size=115911564;
}
public Long2IntExact(int s) {
size=s;
}
/** Integer counter for long2int */
final private int size; //0x03ffffff //0x07ffffff
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#size()
*/
public int size() {return size;}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#start()
* has no meaning for this implementation
*/
final public void start() {}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#l2i(long)
*/
final public int l2i(long l) {
if (l<0) return -1;
int i = mapt.get(l);
if (i!=0) return i;
if (i==0 && cnt<size-1) {
cnt++;
mapt.put(l, cnt);
return cnt;
}
return -1;
}
} | /**
* @author Bernd Bohnet, 01.09.2009
*
* Maps for the Hash Kernel the long values to the int values.
*/
final public class CLASS_0 implements CLASS_1 {
static CLASS_2.CLASS_3.CLASS_4 VAR_0 = new CLASS_2.CLASS_3.CLASS_4();
static int VAR_1=0;
public CLASS_0() {
VAR_2=115911564;
}
public CLASS_0(int VAR_3) {
VAR_2=VAR_3;
}
/** Integer counter for long2int */
final private int VAR_2; //0x03ffffff //0x07ffffff
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#size()
*/
public int FUNC_0() {return VAR_2;}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#start()
* has no meaning for this implementation
*/
final public void FUNC_1() {}
/* (non-Javadoc)
* @see is2.sp09k9992.Long2IntIterface#l2i(long)
*/
final public int FUNC_2(long VAR_4) {
if (VAR_4<0) return -1;
int i = VAR_0.FUNC_3(VAR_4);
if (i!=0) return i;
if (i==0 && VAR_1<VAR_2-1) {
VAR_1++;
VAR_0.FUNC_4(VAR_4, VAR_1);
return VAR_1;
}
return -1;
}
} | 0.968586 | {'CLASS_0': 'Long2IntExact', 'CLASS_1': 'Long2IntInterface', 'CLASS_2': 'gnu', 'CLASS_3': 'trove', 'CLASS_4': 'TLongIntHashMap', 'VAR_0': 'mapt', 'VAR_1': 'cnt', 'VAR_2': 'size', 'FUNC_0': 'size', 'VAR_3': 's', 'FUNC_1': 'start', 'FUNC_2': 'l2i', 'VAR_4': 'l', 'FUNC_3': 'get', 'FUNC_4': 'put'} | java | OOP | 100.00% |
package com.what3words.javawrapper.response;
public class APIError {
private String code;
private String message;
private APIError errorEnum;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public void setErrorEnum(APIError errorEnum) {
this.errorEnum = errorEnum;
}
public APIError getErrorEnum() {
return errorEnum;
}
} | package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
public class CLASS_0 {
private CLASS_1 VAR_0;
private CLASS_1 VAR_1;
private CLASS_0 VAR_2;
public CLASS_1 FUNC_0() {
return VAR_0;
}
public void FUNC_1(CLASS_1 VAR_0) {
this.VAR_0 = VAR_0;
}
public CLASS_1 FUNC_2() {
return VAR_1;
}
public void FUNC_3(CLASS_1 VAR_1) {
this.VAR_1 = VAR_1;
}
public void FUNC_4(CLASS_0 VAR_2) {
this.VAR_2 = VAR_2;
}
public CLASS_0 FUNC_5() {
return VAR_2;
}
} | 0.752486 | {'IMPORT_0': 'com', 'IMPORT_1': 'what3words', 'IMPORT_2': 'javawrapper', 'IMPORT_3': 'response', 'CLASS_0': 'APIError', 'CLASS_1': 'String', 'VAR_0': 'code', 'VAR_1': 'message', 'VAR_2': 'errorEnum', 'FUNC_0': 'getCode', 'FUNC_1': 'setCode', 'FUNC_2': 'getMessage', 'FUNC_3': 'setMessage', 'FUNC_4': 'setErrorEnum', 'FUNC_5': 'getErrorEnum'} | java | OOP | 100.00% |
package com.huaweicloud.sdk.aom.v2.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.huaweicloud.sdk.aom.v2.model.MetricDataPoints;
import com.huaweicloud.sdk.aom.v2.model.QuerySample;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.Objects;
/**
* 查询结果详细。
*/
public class SampleDataValue {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="sample")
private QuerySample sample;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="data_points")
private List<MetricDataPoints> dataPoints = null;
public SampleDataValue withSample(QuerySample sample) {
this.sample = sample;
return this;
}
public SampleDataValue withSample(Consumer<QuerySample> sampleSetter) {
if(this.sample == null ){
this.sample = new QuerySample();
sampleSetter.accept(this.sample);
}
return this;
}
/**
* Get sample
* @return sample
*/
public QuerySample getSample() {
return sample;
}
public void setSample(QuerySample sample) {
this.sample = sample;
}
public SampleDataValue withDataPoints(List<MetricDataPoints> dataPoints) {
this.dataPoints = dataPoints;
return this;
}
public SampleDataValue addDataPointsItem(MetricDataPoints dataPointsItem) {
if(this.dataPoints == null) {
this.dataPoints = new ArrayList<>();
}
this.dataPoints.add(dataPointsItem);
return this;
}
public SampleDataValue withDataPoints(Consumer<List<MetricDataPoints>> dataPointsSetter) {
if(this.dataPoints == null) {
this.dataPoints = new ArrayList<>();
}
dataPointsSetter.accept(this.dataPoints);
return this;
}
/**
* 时序数据。
* @return dataPoints
*/
public List<MetricDataPoints> getDataPoints() {
return dataPoints;
}
public void setDataPoints(List<MetricDataPoints> dataPoints) {
this.dataPoints = dataPoints;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SampleDataValue sampleDataValue = (SampleDataValue) o;
return Objects.equals(this.sample, sampleDataValue.sample) &&
Objects.equals(this.dataPoints, sampleDataValue.dataPoints);
}
@Override
public int hashCode() {
return Objects.hash(sample, dataPoints);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class SampleDataValue {\n");
sb.append(" sample: ").append(toIndentedString(sample)).append("\n");
sb.append(" dataPoints: ").append(toIndentedString(dataPoints)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| package com.huaweicloud.sdk.aom.v2.model;
import com.IMPORT_0.jackson.annotation.JsonInclude;
import com.IMPORT_0.jackson.annotation.JsonProperty;
import com.IMPORT_0.jackson.annotation.JsonCreator;
import com.IMPORT_0.jackson.annotation.JsonValue;
import com.huaweicloud.sdk.aom.v2.model.MetricDataPoints;
import com.huaweicloud.sdk.aom.v2.model.QuerySample;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.Objects;
/**
* 查询结果详细。
*/
public class SampleDataValue {
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="sample")
private QuerySample sample;
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty(value="data_points")
private List<MetricDataPoints> dataPoints = null;
public SampleDataValue withSample(QuerySample sample) {
this.sample = sample;
return this;
}
public SampleDataValue withSample(Consumer<QuerySample> sampleSetter) {
if(this.sample == null ){
this.sample = new QuerySample();
sampleSetter.accept(this.sample);
}
return this;
}
/**
* Get sample
* @return sample
*/
public QuerySample getSample() {
return sample;
}
public void FUNC_0(QuerySample sample) {
this.sample = sample;
}
public SampleDataValue withDataPoints(List<MetricDataPoints> dataPoints) {
this.dataPoints = dataPoints;
return this;
}
public SampleDataValue addDataPointsItem(MetricDataPoints dataPointsItem) {
if(this.dataPoints == null) {
this.dataPoints = new ArrayList<>();
}
this.dataPoints.add(dataPointsItem);
return this;
}
public SampleDataValue withDataPoints(Consumer<List<MetricDataPoints>> dataPointsSetter) {
if(this.dataPoints == null) {
this.dataPoints = new ArrayList<>();
}
dataPointsSetter.accept(this.dataPoints);
return this;
}
/**
* 时序数据。
* @return dataPoints
*/
public List<MetricDataPoints> getDataPoints() {
return dataPoints;
}
public void FUNC_1(List<MetricDataPoints> dataPoints) {
this.dataPoints = dataPoints;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SampleDataValue sampleDataValue = (SampleDataValue) o;
return Objects.equals(this.sample, sampleDataValue.sample) &&
Objects.equals(this.dataPoints, sampleDataValue.dataPoints);
}
@Override
public int hashCode() {
return Objects.hash(sample, dataPoints);
}
@Override
public String toString() {
StringBuilder VAR_0 = new StringBuilder();
VAR_0.append("class SampleDataValue {\n");
VAR_0.append(" sample: ").append(toIndentedString(sample)).append("\n");
VAR_0.append(" dataPoints: ").append(toIndentedString(dataPoints)).append("\n");
VAR_0.append("}");
return VAR_0.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| 0.055654 | {'IMPORT_0': 'fasterxml', 'FUNC_0': 'setSample', 'FUNC_1': 'setDataPoints', 'VAR_0': 'sb'} | java | OOP | 66.44% |
/**
* Test the persistence methods for Access Control lists
*
* @author Nathan Sarr
*
*/
@Test(groups = { "baseTests" }, enabled = true)
public class IrAclDAOTest {
/** get the application context */
ApplicationContext ctx = ContextHolder.getApplicationContext();
/** Class type data access */
IrClassTypeDAO irClassTypeDAO = (IrClassTypeDAO) ctx
.getBean("irClassTypeDAO");
/** Language type data access */
LanguageTypeDAO languageTypeDAO = (LanguageTypeDAO) ctx
.getBean("languageTypeDAO");
/** the Institutional repository acl relational data access */
IrAclDAO irAclDAO = (IrAclDAO) ctx.getBean("irAclDAO");
/** Platform transaction manager */
PlatformTransactionManager tm = (PlatformTransactionManager)ctx.getBean("transactionManager");
/** Transaction definition */
TransactionDefinition td = new DefaultTransactionDefinition(TransactionDefinition.PROPAGATION_REQUIRED);
/** Data access for class type permissions. */
IrClassTypePermissionDAO classTypePermissionDAO = (IrClassTypePermissionDAO)
ctx.getBean("irClassTypePermissionDAO");
/** User access control entry */
IrUserAccessControlEntryDAO uaceDAO = (IrUserAccessControlEntryDAO) ctx
.getBean("irUserAccessControlEntryDAO");
/** User access relational data access */
IrUserGroupAccessControlEntryDAO ugaceDAO = (IrUserGroupAccessControlEntryDAO) ctx
.getBean("irUserGroupAccessControlEntryDAO");
/** User relational data access */
IrUserGroupDAO userGroupDAO= (IrUserGroupDAO) ctx.getBean("irUserGroupDAO");
/** User relational data access */
IrUserDAO userDAO= (IrUserDAO) ctx
.getBean("irUserDAO");
/**
* Test Access Control lists DAO
*/
public void baseIrAclDAOTest() throws Exception{
LanguageType lt = new LanguageType();
lt.setName("languageName");
lt.setDescription("languageDescription");
// create a language type to protect with permissions
languageTypeDAO.makePersistent(lt);
IrClassType languageClassType = new IrClassType(LanguageType.class);
irClassTypeDAO.makePersistent(languageClassType);
// start a new transaction
TransactionStatus ts = tm.getTransaction(td);
LanguageType myLanguageType = languageTypeDAO.getById(lt.getId(), false);
// create an access control list for the given object identity
IrAcl irAcl = new IrAcl(myLanguageType, languageClassType);
irAclDAO.makePersistent(irAcl);
IrAcl other = irAclDAO.getById(irAcl.getId(), false);
assert other.equals(irAcl) : "IrAcl's should be the same";
//complete the transaction
tm.commit(ts);
// clean up the database
irAclDAO.makeTransient(other);
irClassTypeDAO.makeTransient(languageClassType);
assert irAclDAO.getById(irAcl.getId(), false) == null : "IrAcls not find irAcl";
languageTypeDAO.makeTransient(languageTypeDAO.getById(lt.getId(), false));
}
/**
* Test Access Control lists DAO for a user and getting the access
* control list for that user
*/
@Test
public void irAclUserDAOTest() throws Exception{
LanguageType lt = new LanguageType();
lt.setName("languageName");
lt.setDescription("languageDescription");
// create a language type to protect with permissions
languageTypeDAO.makePersistent(lt);
IrClassType languageClassType = new IrClassType(LanguageType.class);
irClassTypeDAO.makePersistent(languageClassType);
// start a new transaction
TransactionStatus ts = tm.getTransaction(td);
// create a new access control list
IrAcl irAcl = new IrAcl(lt, languageClassType);
irAclDAO.makePersistent(irAcl);
//complete the transaction
tm.commit(ts);
UserEmail userEmail = new UserEmail("user@email");
UserManager userManager = new UserManager();
IrUser user = userManager.createUser("password", "userName");
user.setLastName("familyName");
user.setFirstName("forename");
user.addUserEmail(userEmail, true);
// save the user
userDAO.makePersistent(user);
// create the user access control entry
IrUserAccessControlEntry uace = irAcl.createUserAccessControlEntry(user);
IrClassTypePermission classTypePermission = new IrClassTypePermission(languageClassType);
classTypePermission.setName("permission");
classTypePermission.setDescription("permissionDescription");
// save the class type permission
classTypePermissionDAO.makePersistent(classTypePermission);
uace.addPermission(classTypePermission);
// persist the access control entry.
uaceDAO.makePersistent(uace);
// start a new transaction
ts = tm.getTransaction(td);
IrAcl acl = irAclDAO.getAcl(lt.getId(), CgLibHelper.cleanClassName(lt.getClass().getName()), user);
assert acl.equals(irAcl): "Acl should be equal to " + irAcl;
IrUserAccessControlEntry other = acl.getUserAccessControlEntry(uace.getId());
assert other.equals(uace) : "User access control entries should be equal";
assert uace.getAcl().equals(irAcl) : "Acl's should be equal";
assert irAcl.getUserAccessControlEntry(uace.getId()).equals(uace) : "Access control should bin in the irAcl";
assert uace.getPermissions().size() == 1 : "Should have at least one permission";
assert uace.getIrClassTypePermissions().contains(classTypePermission) : "Should equal the class type permission";
assert uace.getIrUser().equals(user) : "Users should be equal";
assert uaceDAO.getCount() == 1 : "Should have one uace";
// commit the transaction
tm.commit(ts);
// clean up the database
irAclDAO.makeTransient(irAclDAO.getById(irAcl.getId(), false));
assert uaceDAO.getById(uace.getId(), false) == null : "Should not be able to find the access control entry";
classTypePermissionDAO.makeTransient(classTypePermission);
irClassTypeDAO.makeTransient(languageClassType);
// Start the transaction
ts = tm.getTransaction(td);
userDAO.makeTransient(userDAO.getById(user.getId(), false));
languageTypeDAO.makeTransient(languageTypeDAO.getById(lt.getId(), false));
//commit the transaction
tm.commit(ts);
}
/**
* make sure we can identify a user who has permissions to a given object
*/
@Test
public void irAclUserDAOHasPermissionCountTest() throws Exception{
LanguageType lt = new LanguageType();
lt.setName("languageName");
lt.setDescription("languageDescription");
// create a language type to protect with permissions
languageTypeDAO.makePersistent(lt);
IrClassType languageClassType = new IrClassType(LanguageType.class);
irClassTypeDAO.makePersistent(languageClassType);
// start a new transaction
TransactionStatus ts = tm.getTransaction(td);
// create a new access control list
IrAcl irAcl = new IrAcl(lt, languageClassType);
irAclDAO.makePersistent(irAcl);
//complete the transaction
tm.commit(ts);
UserEmail userEmail = new UserEmail("user@email");
UserManager userManager = new UserManager();
IrUser user = userManager.createUser("password", "userName");
user.setLastName("familyName");
user.setFirstName("forename");
user.addUserEmail(userEmail, true);
// save the user
userDAO.makePersistent(user);
UserEmail userEmail2 = new UserEmail("blah@email");
IrUser user2 = userManager.createUser("password2", "userName2");
user2.setLastName("familyName");
user2.setFirstName("forename");
user2.addUserEmail(userEmail2, true);
userDAO.makePersistent(user2);
// create the user access control entry
IrUserAccessControlEntry uace = irAcl.createUserAccessControlEntry(user);
IrClassTypePermission classTypePermission = new IrClassTypePermission(languageClassType);
classTypePermission.setName("permission");
classTypePermission.setDescription("permissionDescription");
// save the class type permission
classTypePermissionDAO.makePersistent(classTypePermission);
uace.addPermission(classTypePermission);
// persist the access control entry.
uaceDAO.makePersistent(uace);
// start a new transaction
ts = tm.getTransaction(td);
// user has been given the permission
Long count = irAclDAO.hasPermission(lt.getId(), languageClassType.getName(), user, classTypePermission.getName());
assert count.equals(1l) : "Count should equal 1 but equals " + count;
// user 2 has not been given direct permission
count = irAclDAO.hasPermission(lt.getId(), languageClassType.getName(), user2, classTypePermission.getName());
assert count.equals(0l) : "Count should equal 0 but equals " + count;
// commit the transaction
tm.commit(ts);
// test permissions given through a group
ts = tm.getTransaction(td);
IrUserGroup userGroup = new IrUserGroup("userGroup");
userGroup.addUser(user);
userGroup.addUser(user2);
userGroupDAO.makePersistent(userGroup);
// create the user GROUP access control entry
IrUserGroupAccessControlEntry ugace =
irAcl.createGroupAccessControlEntry(userGroup);
ugace.addPermission(classTypePermission);
ugaceDAO.makePersistent(ugace);
tm.commit(ts);
ts = tm.getTransaction(td);
// user has been given the permission
count = irAclDAO.hasPermission(lt.getId(), languageClassType.getName(), user, classTypePermission.getName());
assert count.equals(2l) : "Count should equal 2 but equals " + count;
// user 2 has not been given direct permission
count = irAclDAO.hasPermission(lt.getId(), languageClassType.getName(), user2, classTypePermission.getName());
assert count.equals(1l) : "Count should equal 1 but equals " + count;
tm.commit(ts);
// clean up the database
irAclDAO.makeTransient(irAclDAO.getById(irAcl.getId(), false));
assert uaceDAO.getById(uace.getId(), false) == null : "Should not be able to find the access control entry";
classTypePermissionDAO.makeTransient(classTypePermission);
irClassTypeDAO.makeTransient(languageClassType);
// Start the transaction
ts = tm.getTransaction(td);
userGroupDAO.makeTransient(userGroupDAO.getById(userGroup.getId(), false));
userDAO.makeTransient(userDAO.getById(user.getId(), false));
userDAO.makeTransient(userDAO.getById(user2.getId(), false));
languageTypeDAO.makeTransient(languageTypeDAO.getById(lt.getId(), false));
//commit the transaction
tm.commit(ts);
}
/**
* make sure we can identify a user who has permissions to a given object
*/
@Test
public void irAclGetSidsWithPermissionDAOTest() throws Exception{
LanguageType lt = new LanguageType();
lt.setName("languageName");
lt.setDescription("languageDescription");
// create a language type to protect with permissions
languageTypeDAO.makePersistent(lt);
IrClassType languageClassType = new IrClassType(LanguageType.class);
irClassTypeDAO.makePersistent(languageClassType);
// start a new transaction
TransactionStatus ts = tm.getTransaction(td);
// create a new access control list
IrAcl irAcl = new IrAcl(lt, languageClassType);
irAclDAO.makePersistent(irAcl);
//complete the transaction
tm.commit(ts);
UserEmail userEmail = new UserEmail("user@email");
UserManager userManager = new UserManager();
IrUser user = userManager.createUser("password", "userName");
user.setLastName("familyName");
user.setFirstName("forename");
user.addUserEmail(userEmail, true);
// save the user
userDAO.makePersistent(user);
UserEmail userEmail2 = new UserEmail("blah@email");
IrUser user2 = userManager.createUser("password2", "userName2");
user2.setLastName("familyName");
user2.setFirstName("forename");
user2.addUserEmail(userEmail2, true);
userDAO.makePersistent(user2);
// create the user access control entry
IrUserAccessControlEntry uace = irAcl.createUserAccessControlEntry(user);
IrClassTypePermission classTypePermission = new IrClassTypePermission(languageClassType);
classTypePermission.setName("permission");
classTypePermission.setDescription("permissionDescription");
// save the class type permission
classTypePermissionDAO.makePersistent(classTypePermission);
uace.addPermission(classTypePermission);
// persist the access control entry.
uaceDAO.makePersistent(uace);
// start a new transaction
ts = tm.getTransaction(td);
Set<Sid> sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(), classTypePermission.getName());
assert sids.contains(user) : "Sids should contain " + user + " but doesn't";
assert !sids.contains(user2) : "Sids should NOT contain " + user2 + " but does";
List<Sid> specificSids = new LinkedList<Sid>();
specificSids.add(user2);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(),
classTypePermission.getName(), specificSids);
assert sids.size() == 0 : "Sids size should be 0 but is " + sids.size();
specificSids.add(user);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(),
classTypePermission.getName(), specificSids);
assert sids.contains(user) : "Should contain user " + user + " but does not";
// commit the transaction
tm.commit(ts);
// test permissions given through a group
ts = tm.getTransaction(td);
IrUserGroup userGroup = new IrUserGroup("userGroup");
userGroup.addUser(user);
userGroup.addUser(user2);
userGroupDAO.makePersistent(userGroup);
// create the user GROUP access control entry
IrUserGroupAccessControlEntry ugace =
irAcl.createGroupAccessControlEntry(userGroup);
ugace.addPermission(classTypePermission);
ugaceDAO.makePersistent(ugace);
tm.commit(ts);
ts = tm.getTransaction(td);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(), classTypePermission.getName());
assert sids.contains(user) : "Sids should contain " + user + " but doesn't";
assert !sids.contains(user2) : "Sids should NOT contain " + user2 + " but does";
assert sids.contains(userGroup) : "Sids should contain " + userGroup + "but doesn't";
specificSids = new LinkedList<Sid>();
specificSids.add(user2);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(),
classTypePermission.getName(), specificSids);
assert sids.size() == 0 : "Sids size should be 0 but is " + sids.size();
specificSids.add(user);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(),
classTypePermission.getName(), specificSids);
assert sids.size() == 1 : "Sids size should be 1 but is " + sids.size();
assert sids.contains(user) : "Should contain user " + user + " but does not";
specificSids.add(userGroup);
sids = irAclDAO.getSidsWithPermissionForObject(lt.getId(), languageClassType.getName(),
classTypePermission.getName(), specificSids);
assert sids.size() == 2 : "Sids size should be 2 but is " + sids.size();
assert sids.contains(user) : "Should contain user " + user + " but does not";
assert sids.contains(userGroup) : "Should contain user group " + userGroup + " but does not";
tm.commit(ts);
// clean up the database
irAclDAO.makeTransient(irAclDAO.getById(irAcl.getId(), false));
assert uaceDAO.getById(uace.getId(), false) == null : "Should not be able to find the access control entry";
classTypePermissionDAO.makeTransient(classTypePermission);
irClassTypeDAO.makeTransient(languageClassType);
// Start the transaction
ts = tm.getTransaction(td);
userGroupDAO.makeTransient(userGroupDAO.getById(userGroup.getId(), false));
userDAO.makeTransient(userDAO.getById(user.getId(), false));
userDAO.makeTransient(userDAO.getById(user2.getId(), false));
languageTypeDAO.makeTransient(languageTypeDAO.getById(lt.getId(), false));
//commit the transaction
tm.commit(ts);
}
} | /**
* Test the persistence methods for Access Control lists
*
* @author Nathan Sarr
*
*/
@VAR_0(VAR_1 = { "baseTests" }, VAR_2 = true)
public class IrAclDAOTest {
/** get the application context */
CLASS_0 VAR_3 = VAR_4.FUNC_0();
/** Class type data access */
CLASS_1 VAR_5 = (CLASS_1) VAR_3
.FUNC_1("irClassTypeDAO");
/** Language type data access */
LanguageTypeDAO VAR_6 = (LanguageTypeDAO) VAR_3
.FUNC_1("languageTypeDAO");
/** the Institutional repository acl relational data access */
CLASS_2 VAR_7 = (CLASS_2) VAR_3.FUNC_1("irAclDAO");
/** Platform transaction manager */
CLASS_3 VAR_8 = (CLASS_3)VAR_3.FUNC_1("transactionManager");
/** Transaction definition */
CLASS_4 VAR_10 = new CLASS_5(VAR_9.VAR_11);
/** Data access for class type permissions. */
CLASS_6 VAR_12 = (CLASS_6)
VAR_3.FUNC_1("irClassTypePermissionDAO");
/** User access control entry */
IrUserAccessControlEntryDAO VAR_13 = (IrUserAccessControlEntryDAO) VAR_3
.FUNC_1("irUserAccessControlEntryDAO");
/** User access relational data access */
CLASS_7 VAR_14 = (CLASS_7) VAR_3
.FUNC_1("irUserGroupAccessControlEntryDAO");
/** User relational data access */
CLASS_8 VAR_15= (CLASS_8) VAR_3.FUNC_1("irUserGroupDAO");
/** User relational data access */
CLASS_9 VAR_16= (CLASS_9) VAR_3
.FUNC_1("irUserDAO");
/**
* Test Access Control lists DAO
*/
public void baseIrAclDAOTest() throws CLASS_10{
CLASS_11 VAR_17 = new CLASS_11();
VAR_17.setName("languageName");
VAR_17.setDescription("languageDescription");
// create a language type to protect with permissions
VAR_6.FUNC_2(VAR_17);
CLASS_12 languageClassType = new CLASS_12(CLASS_11.class);
VAR_5.FUNC_2(languageClassType);
// start a new transaction
TransactionStatus VAR_18 = VAR_8.FUNC_3(VAR_10);
CLASS_11 VAR_19 = VAR_6.FUNC_4(VAR_17.FUNC_5(), false);
// create an access control list for the given object identity
CLASS_13 irAcl = new CLASS_13(VAR_19, languageClassType);
VAR_7.FUNC_2(irAcl);
CLASS_13 VAR_20 = VAR_7.FUNC_4(irAcl.FUNC_5(), false);
assert VAR_20.equals(irAcl) : "IrAcl's should be the same";
//complete the transaction
VAR_8.FUNC_6(VAR_18);
// clean up the database
VAR_7.FUNC_7(VAR_20);
VAR_5.FUNC_7(languageClassType);
assert VAR_7.FUNC_4(irAcl.FUNC_5(), false) == null : "IrAcls not find irAcl";
VAR_6.FUNC_7(VAR_6.FUNC_4(VAR_17.FUNC_5(), false));
}
/**
* Test Access Control lists DAO for a user and getting the access
* control list for that user
*/
@VAR_0
public void irAclUserDAOTest() throws CLASS_10{
CLASS_11 VAR_17 = new CLASS_11();
VAR_17.setName("languageName");
VAR_17.setDescription("languageDescription");
// create a language type to protect with permissions
VAR_6.FUNC_2(VAR_17);
CLASS_12 languageClassType = new CLASS_12(CLASS_11.class);
VAR_5.FUNC_2(languageClassType);
// start a new transaction
TransactionStatus VAR_18 = VAR_8.FUNC_3(VAR_10);
// create a new access control list
CLASS_13 irAcl = new CLASS_13(VAR_17, languageClassType);
VAR_7.FUNC_2(irAcl);
//complete the transaction
VAR_8.FUNC_6(VAR_18);
CLASS_14 VAR_21 = new CLASS_14("user@email");
CLASS_15 VAR_22 = new CLASS_15();
CLASS_16 VAR_23 = VAR_22.FUNC_8("password", "userName");
VAR_23.FUNC_9("familyName");
VAR_23.FUNC_10("forename");
VAR_23.addUserEmail(VAR_21, true);
// save the user
VAR_16.FUNC_2(VAR_23);
// create the user access control entry
IrUserAccessControlEntry VAR_24 = irAcl.FUNC_11(VAR_23);
CLASS_17 VAR_25 = new CLASS_17(languageClassType);
VAR_25.setName("permission");
VAR_25.setDescription("permissionDescription");
// save the class type permission
VAR_12.FUNC_2(VAR_25);
VAR_24.FUNC_12(VAR_25);
// persist the access control entry.
VAR_13.FUNC_2(VAR_24);
// start a new transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
CLASS_13 VAR_26 = VAR_7.FUNC_13(VAR_17.FUNC_5(), VAR_27.FUNC_14(VAR_17.FUNC_15().FUNC_16()), VAR_23);
assert VAR_26.equals(irAcl): "Acl should be equal to " + irAcl;
IrUserAccessControlEntry VAR_20 = VAR_26.getUserAccessControlEntry(VAR_24.FUNC_5());
assert VAR_20.equals(VAR_24) : "User access control entries should be equal";
assert VAR_24.FUNC_13().equals(irAcl) : "Acl's should be equal";
assert irAcl.getUserAccessControlEntry(VAR_24.FUNC_5()).equals(VAR_24) : "Access control should bin in the irAcl";
assert VAR_24.getPermissions().size() == 1 : "Should have at least one permission";
assert VAR_24.FUNC_17().contains(VAR_25) : "Should equal the class type permission";
assert VAR_24.FUNC_18().equals(VAR_23) : "Users should be equal";
assert VAR_13.FUNC_19() == 1 : "Should have one uace";
// commit the transaction
VAR_8.FUNC_6(VAR_18);
// clean up the database
VAR_7.FUNC_7(VAR_7.FUNC_4(irAcl.FUNC_5(), false));
assert VAR_13.FUNC_4(VAR_24.FUNC_5(), false) == null : "Should not be able to find the access control entry";
VAR_12.FUNC_7(VAR_25);
VAR_5.FUNC_7(languageClassType);
// Start the transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
VAR_16.FUNC_7(VAR_16.FUNC_4(VAR_23.FUNC_5(), false));
VAR_6.FUNC_7(VAR_6.FUNC_4(VAR_17.FUNC_5(), false));
//commit the transaction
VAR_8.FUNC_6(VAR_18);
}
/**
* make sure we can identify a user who has permissions to a given object
*/
@VAR_0
public void FUNC_20() throws CLASS_10{
CLASS_11 VAR_17 = new CLASS_11();
VAR_17.setName("languageName");
VAR_17.setDescription("languageDescription");
// create a language type to protect with permissions
VAR_6.FUNC_2(VAR_17);
CLASS_12 languageClassType = new CLASS_12(CLASS_11.class);
VAR_5.FUNC_2(languageClassType);
// start a new transaction
TransactionStatus VAR_18 = VAR_8.FUNC_3(VAR_10);
// create a new access control list
CLASS_13 irAcl = new CLASS_13(VAR_17, languageClassType);
VAR_7.FUNC_2(irAcl);
//complete the transaction
VAR_8.FUNC_6(VAR_18);
CLASS_14 VAR_21 = new CLASS_14("user@email");
CLASS_15 VAR_22 = new CLASS_15();
CLASS_16 VAR_23 = VAR_22.FUNC_8("password", "userName");
VAR_23.FUNC_9("familyName");
VAR_23.FUNC_10("forename");
VAR_23.addUserEmail(VAR_21, true);
// save the user
VAR_16.FUNC_2(VAR_23);
CLASS_14 VAR_28 = new CLASS_14("blah@email");
CLASS_16 VAR_29 = VAR_22.FUNC_8("password2", "userName2");
VAR_29.FUNC_9("familyName");
VAR_29.FUNC_10("forename");
VAR_29.addUserEmail(VAR_28, true);
VAR_16.FUNC_2(VAR_29);
// create the user access control entry
IrUserAccessControlEntry VAR_24 = irAcl.FUNC_11(VAR_23);
CLASS_17 VAR_25 = new CLASS_17(languageClassType);
VAR_25.setName("permission");
VAR_25.setDescription("permissionDescription");
// save the class type permission
VAR_12.FUNC_2(VAR_25);
VAR_24.FUNC_12(VAR_25);
// persist the access control entry.
VAR_13.FUNC_2(VAR_24);
// start a new transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
// user has been given the permission
Long VAR_30 = VAR_7.FUNC_21(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_23, VAR_25.FUNC_16());
assert VAR_30.equals(1l) : "Count should equal 1 but equals " + VAR_30;
// user 2 has not been given direct permission
VAR_30 = VAR_7.FUNC_21(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_29, VAR_25.FUNC_16());
assert VAR_30.equals(0l) : "Count should equal 0 but equals " + VAR_30;
// commit the transaction
VAR_8.FUNC_6(VAR_18);
// test permissions given through a group
VAR_18 = VAR_8.FUNC_3(VAR_10);
CLASS_18 VAR_31 = new CLASS_18("userGroup");
VAR_31.addUser(VAR_23);
VAR_31.addUser(VAR_29);
VAR_15.FUNC_2(VAR_31);
// create the user GROUP access control entry
CLASS_19 VAR_32 =
irAcl.createGroupAccessControlEntry(VAR_31);
VAR_32.FUNC_12(VAR_25);
VAR_14.FUNC_2(VAR_32);
VAR_8.FUNC_6(VAR_18);
VAR_18 = VAR_8.FUNC_3(VAR_10);
// user has been given the permission
VAR_30 = VAR_7.FUNC_21(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_23, VAR_25.FUNC_16());
assert VAR_30.equals(2l) : "Count should equal 2 but equals " + VAR_30;
// user 2 has not been given direct permission
VAR_30 = VAR_7.FUNC_21(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_29, VAR_25.FUNC_16());
assert VAR_30.equals(1l) : "Count should equal 1 but equals " + VAR_30;
VAR_8.FUNC_6(VAR_18);
// clean up the database
VAR_7.FUNC_7(VAR_7.FUNC_4(irAcl.FUNC_5(), false));
assert VAR_13.FUNC_4(VAR_24.FUNC_5(), false) == null : "Should not be able to find the access control entry";
VAR_12.FUNC_7(VAR_25);
VAR_5.FUNC_7(languageClassType);
// Start the transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
VAR_15.FUNC_7(VAR_15.FUNC_4(VAR_31.FUNC_5(), false));
VAR_16.FUNC_7(VAR_16.FUNC_4(VAR_23.FUNC_5(), false));
VAR_16.FUNC_7(VAR_16.FUNC_4(VAR_29.FUNC_5(), false));
VAR_6.FUNC_7(VAR_6.FUNC_4(VAR_17.FUNC_5(), false));
//commit the transaction
VAR_8.FUNC_6(VAR_18);
}
/**
* make sure we can identify a user who has permissions to a given object
*/
@VAR_0
public void irAclGetSidsWithPermissionDAOTest() throws CLASS_10{
CLASS_11 VAR_17 = new CLASS_11();
VAR_17.setName("languageName");
VAR_17.setDescription("languageDescription");
// create a language type to protect with permissions
VAR_6.FUNC_2(VAR_17);
CLASS_12 languageClassType = new CLASS_12(CLASS_11.class);
VAR_5.FUNC_2(languageClassType);
// start a new transaction
TransactionStatus VAR_18 = VAR_8.FUNC_3(VAR_10);
// create a new access control list
CLASS_13 irAcl = new CLASS_13(VAR_17, languageClassType);
VAR_7.FUNC_2(irAcl);
//complete the transaction
VAR_8.FUNC_6(VAR_18);
CLASS_14 VAR_21 = new CLASS_14("user@email");
CLASS_15 VAR_22 = new CLASS_15();
CLASS_16 VAR_23 = VAR_22.FUNC_8("password", "userName");
VAR_23.FUNC_9("familyName");
VAR_23.FUNC_10("forename");
VAR_23.addUserEmail(VAR_21, true);
// save the user
VAR_16.FUNC_2(VAR_23);
CLASS_14 VAR_28 = new CLASS_14("blah@email");
CLASS_16 VAR_29 = VAR_22.FUNC_8("password2", "userName2");
VAR_29.FUNC_9("familyName");
VAR_29.FUNC_10("forename");
VAR_29.addUserEmail(VAR_28, true);
VAR_16.FUNC_2(VAR_29);
// create the user access control entry
IrUserAccessControlEntry VAR_24 = irAcl.FUNC_11(VAR_23);
CLASS_17 VAR_25 = new CLASS_17(languageClassType);
VAR_25.setName("permission");
VAR_25.setDescription("permissionDescription");
// save the class type permission
VAR_12.FUNC_2(VAR_25);
VAR_24.FUNC_12(VAR_25);
// persist the access control entry.
VAR_13.FUNC_2(VAR_24);
// start a new transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
CLASS_20<CLASS_21> VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_25.FUNC_16());
assert VAR_33.contains(VAR_23) : "Sids should contain " + VAR_23 + " but doesn't";
assert !VAR_33.contains(VAR_29) : "Sids should NOT contain " + VAR_29 + " but does";
CLASS_22<CLASS_21> specificSids = new CLASS_23<CLASS_21>();
specificSids.FUNC_22(VAR_29);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(),
VAR_25.FUNC_16(), specificSids);
assert VAR_33.size() == 0 : "Sids size should be 0 but is " + VAR_33.size();
specificSids.FUNC_22(VAR_23);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(),
VAR_25.FUNC_16(), specificSids);
assert VAR_33.contains(VAR_23) : "Should contain user " + VAR_23 + " but does not";
// commit the transaction
VAR_8.FUNC_6(VAR_18);
// test permissions given through a group
VAR_18 = VAR_8.FUNC_3(VAR_10);
CLASS_18 VAR_31 = new CLASS_18("userGroup");
VAR_31.addUser(VAR_23);
VAR_31.addUser(VAR_29);
VAR_15.FUNC_2(VAR_31);
// create the user GROUP access control entry
CLASS_19 VAR_32 =
irAcl.createGroupAccessControlEntry(VAR_31);
VAR_32.FUNC_12(VAR_25);
VAR_14.FUNC_2(VAR_32);
VAR_8.FUNC_6(VAR_18);
VAR_18 = VAR_8.FUNC_3(VAR_10);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(), VAR_25.FUNC_16());
assert VAR_33.contains(VAR_23) : "Sids should contain " + VAR_23 + " but doesn't";
assert !VAR_33.contains(VAR_29) : "Sids should NOT contain " + VAR_29 + " but does";
assert VAR_33.contains(VAR_31) : "Sids should contain " + VAR_31 + "but doesn't";
specificSids = new CLASS_23<CLASS_21>();
specificSids.FUNC_22(VAR_29);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(),
VAR_25.FUNC_16(), specificSids);
assert VAR_33.size() == 0 : "Sids size should be 0 but is " + VAR_33.size();
specificSids.FUNC_22(VAR_23);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(),
VAR_25.FUNC_16(), specificSids);
assert VAR_33.size() == 1 : "Sids size should be 1 but is " + VAR_33.size();
assert VAR_33.contains(VAR_23) : "Should contain user " + VAR_23 + " but does not";
specificSids.FUNC_22(VAR_31);
VAR_33 = VAR_7.getSidsWithPermissionForObject(VAR_17.FUNC_5(), languageClassType.FUNC_16(),
VAR_25.FUNC_16(), specificSids);
assert VAR_33.size() == 2 : "Sids size should be 2 but is " + VAR_33.size();
assert VAR_33.contains(VAR_23) : "Should contain user " + VAR_23 + " but does not";
assert VAR_33.contains(VAR_31) : "Should contain user group " + VAR_31 + " but does not";
VAR_8.FUNC_6(VAR_18);
// clean up the database
VAR_7.FUNC_7(VAR_7.FUNC_4(irAcl.FUNC_5(), false));
assert VAR_13.FUNC_4(VAR_24.FUNC_5(), false) == null : "Should not be able to find the access control entry";
VAR_12.FUNC_7(VAR_25);
VAR_5.FUNC_7(languageClassType);
// Start the transaction
VAR_18 = VAR_8.FUNC_3(VAR_10);
VAR_15.FUNC_7(VAR_15.FUNC_4(VAR_31.FUNC_5(), false));
VAR_16.FUNC_7(VAR_16.FUNC_4(VAR_23.FUNC_5(), false));
VAR_16.FUNC_7(VAR_16.FUNC_4(VAR_29.FUNC_5(), false));
VAR_6.FUNC_7(VAR_6.FUNC_4(VAR_17.FUNC_5(), false));
//commit the transaction
VAR_8.FUNC_6(VAR_18);
}
} | 0.77807 | {'VAR_0': 'Test', 'VAR_1': 'groups', 'VAR_2': 'enabled', 'CLASS_0': 'ApplicationContext', 'VAR_3': 'ctx', 'VAR_4': 'ContextHolder', 'FUNC_0': 'getApplicationContext', 'CLASS_1': 'IrClassTypeDAO', 'VAR_5': 'irClassTypeDAO', 'FUNC_1': 'getBean', 'VAR_6': 'languageTypeDAO', 'CLASS_2': 'IrAclDAO', 'VAR_7': 'irAclDAO', 'CLASS_3': 'PlatformTransactionManager', 'VAR_8': 'tm', 'CLASS_4': 'TransactionDefinition', 'VAR_9': 'TransactionDefinition', 'VAR_10': 'td', 'CLASS_5': 'DefaultTransactionDefinition', 'VAR_11': 'PROPAGATION_REQUIRED', 'CLASS_6': 'IrClassTypePermissionDAO', 'VAR_12': 'classTypePermissionDAO', 'VAR_13': 'uaceDAO', 'CLASS_7': 'IrUserGroupAccessControlEntryDAO', 'VAR_14': 'ugaceDAO', 'CLASS_8': 'IrUserGroupDAO', 'VAR_15': 'userGroupDAO', 'CLASS_9': 'IrUserDAO', 'VAR_16': 'userDAO', 'CLASS_10': 'Exception', 'CLASS_11': 'LanguageType', 'VAR_17': 'lt', 'FUNC_2': 'makePersistent', 'CLASS_12': 'IrClassType', 'VAR_18': 'ts', 'FUNC_3': 'getTransaction', 'VAR_19': 'myLanguageType', 'FUNC_4': 'getById', 'FUNC_5': 'getId', 'CLASS_13': 'IrAcl', 'VAR_20': 'other', 'FUNC_6': 'commit', 'FUNC_7': 'makeTransient', 'CLASS_14': 'UserEmail', 'VAR_21': 'userEmail', 'CLASS_15': 'UserManager', 'VAR_22': 'userManager', 'CLASS_16': 'IrUser', 'VAR_23': 'user', 'FUNC_8': 'createUser', 'FUNC_9': 'setLastName', 'FUNC_10': 'setFirstName', 'VAR_24': 'uace', 'FUNC_11': 'createUserAccessControlEntry', 'CLASS_17': 'IrClassTypePermission', 'VAR_25': 'classTypePermission', 'FUNC_12': 'addPermission', 'VAR_26': 'acl', 'FUNC_13': 'getAcl', 'VAR_27': 'CgLibHelper', 'FUNC_14': 'cleanClassName', 'FUNC_15': 'getClass', 'FUNC_16': 'getName', 'FUNC_17': 'getIrClassTypePermissions', 'FUNC_18': 'getIrUser', 'FUNC_19': 'getCount', 'FUNC_20': 'irAclUserDAOHasPermissionCountTest', 'VAR_28': 'userEmail2', 'VAR_29': 'user2', 'VAR_30': 'count', 'FUNC_21': 'hasPermission', 'CLASS_18': 'IrUserGroup', 'VAR_31': 'userGroup', 'CLASS_19': 'IrUserGroupAccessControlEntry', 'VAR_32': 'ugace', 'CLASS_20': 'Set', 'CLASS_21': 'Sid', 'VAR_33': 'sids', 'CLASS_22': 'List', 'CLASS_23': 'LinkedList', 'FUNC_22': 'add'} | java | error | 0 |
/**
* The abstract superclass for all types of class file entries.
*/
public abstract class ClassFileEntry {
protected static final ClassFileEntry[] NONE = new ClassFileEntry[0];
private boolean resolved;
protected abstract void doWrite(DataOutputStream dos) throws IOException;
public abstract boolean equals(Object arg0);
protected ClassFileEntry[] getNestedClassFileEntries() {
return NONE;
}
public abstract int hashCode();
/**
* Allows the constant pool entries to resolve their nested entries
*
* @param pool
*/
protected void resolve(ClassConstantPool pool) {
resolved = true;
}
protected int objectHashCode() {
return super.hashCode();
}
public abstract String toString();
public final void write(DataOutputStream dos) throws IOException {
if (!resolved)
throw new IllegalStateException("Entry has not been resolved");
doWrite(dos);
}
} | /**
* The abstract superclass for all types of class file entries.
*/
public abstract class CLASS_0 {
protected static final CLASS_0[] NONE = new CLASS_0[0];
private boolean resolved;
protected abstract void FUNC_0(DataOutputStream dos) throws IOException;
public abstract boolean FUNC_1(CLASS_1 VAR_0);
protected CLASS_0[] getNestedClassFileEntries() {
return NONE;
}
public abstract int FUNC_2();
/**
* Allows the constant pool entries to resolve their nested entries
*
* @param pool
*/
protected void resolve(CLASS_2 VAR_1) {
resolved = true;
}
protected int objectHashCode() {
return super.FUNC_2();
}
public abstract String FUNC_3();
public final void FUNC_4(DataOutputStream dos) throws IOException {
if (!resolved)
throw new CLASS_3("Entry has not been resolved");
FUNC_0(dos);
}
} | 0.631206 | {'CLASS_0': 'ClassFileEntry', 'FUNC_0': 'doWrite', 'FUNC_1': 'equals', 'CLASS_1': 'Object', 'VAR_0': 'arg0', 'FUNC_2': 'hashCode', 'CLASS_2': 'ClassConstantPool', 'VAR_1': 'pool', 'FUNC_3': 'toString', 'FUNC_4': 'write', 'CLASS_3': 'IllegalStateException'} | java | OOP | 100.00% |
package com.luyunix.mr;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* Java中的序列化
* Created by xuwei
*/
public class JavaSerialize {
public static void main(String[] args) throws Exception{
//创建Student对象,并设置id和name属性
StudentJava studentJava = new StudentJava();
studentJava.setId(1L);
studentJava.setName("Hadoop");
//将Student对象的当前状态写入本地文件中
FileOutputStream fos = new FileOutputStream("D:\\student_java.txt");
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(studentJava);
oos.close();
fos.close();
}
}
class StudentJava implements Serializable{
private static final long serialVersionUID = 1L;
private Long id;
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} | package com.luyunix.mr;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
/**
* Java中的序列化
* Created by xuwei
*/
public class CLASS_0 {
public static void main(String[] VAR_0) throws Exception{
//创建Student对象,并设置id和name属性
StudentJava VAR_1 = new StudentJava();
VAR_1.setId(1L);
VAR_1.FUNC_0("Hadoop");
//将Student对象的当前状态写入本地文件中
FileOutputStream VAR_2 = new FileOutputStream("D:\\student_java.txt");
ObjectOutputStream oos = new ObjectOutputStream(VAR_2);
oos.FUNC_1(VAR_1);
oos.close();
VAR_2.close();
}
}
class StudentJava implements Serializable{
private static final long VAR_3 = 1L;
private CLASS_1 id;
private String VAR_4;
public CLASS_1 getId() {
return id;
}
public void setId(CLASS_1 id) {
this.id = id;
}
public String getName() {
return VAR_4;
}
public void FUNC_0(String VAR_4) {
this.VAR_4 = VAR_4;
}
} | 0.277725 | {'CLASS_0': 'JavaSerialize', 'VAR_0': 'args', 'VAR_1': 'studentJava', 'FUNC_0': 'setName', 'VAR_2': 'fos', 'FUNC_1': 'writeObject', 'VAR_3': 'serialVersionUID', 'CLASS_1': 'Long', 'VAR_4': 'name'} | java | OOP | 100.00% |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.usergrid.persistence.core.util;
import java.io.IOException;
import java.net.DatagramSocket;
import java.net.ServerSocket;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.TreeSet;
/**
* Finds currently available server ports.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
* @see <a href="http://www.iana.org/assignments/port-numbers">IANA.org</a>
*
* TODO: move this to test packages once Query Index uses it correctly.
*/
public class AvailablePortFinder {
/** The minimum number of server port number. */
public static final int MIN_PORT_NUMBER = 1;
/** The maximum number of server port number. */
public static final int MAX_PORT_NUMBER = 49151;
/** Creates a new instance. */
private AvailablePortFinder() {
// Do nothing
}
/**
* Returns the {@link java.util.Set} of currently available port numbers ({@link Integer}). This method is identical to
* <code>getAvailablePorts(MIN_PORT_NUMBER, MAX_PORT_NUMBER)</code>.
* <p/>
* WARNING: this can take a very long time.
*/
public static Set<Integer> getAvailablePorts() {
return getAvailablePorts( MIN_PORT_NUMBER, MAX_PORT_NUMBER );
}
/**
* Gets an available port, MAY be outside of MIN_PORT_NUMBER to MAX_PORT_NUMBER range.
*
* @throws java.util.NoSuchElementException if there are no ports available
*/
public static int getNextAvailable() {
ServerSocket serverSocket = null;
try {
// Here, we simply return an available port found by the system
serverSocket = new ServerSocket( 0 );
int port = serverSocket.getLocalPort();
// Don't forget to close the socket...
serverSocket.close();
return port;
}
catch ( IOException ioe ) {
throw new NoSuchElementException( ioe.getMessage() );
}
}
/**
* Gets the next available port starting at a port.
*
* @param fromPort the port to scan for availability
*
* @throws java.util.NoSuchElementException if there are no ports available
*/
public static int getNextAvailable( int fromPort ) {
if ( fromPort < MIN_PORT_NUMBER || fromPort > MAX_PORT_NUMBER ) {
throw new IllegalArgumentException( "Invalid start port: " + fromPort );
}
for ( int i = fromPort; i <= MAX_PORT_NUMBER; i++ ) {
if ( available( i ) ) {
return i;
}
}
throw new NoSuchElementException( "Could not find an available port " + "above " + fromPort );
}
/**
* Checks to see if a specific port is available.
*
* @param port the port to check for availability
*/
public static boolean available( int port ) {
if ( port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER ) {
throw new IllegalArgumentException( "Invalid start port: " + port );
}
ServerSocket ss = null;
DatagramSocket ds = null;
try {
ss = new ServerSocket( port );
ss.setReuseAddress( true );
ds = new DatagramSocket( port );
ds.setReuseAddress( true );
return true;
}
catch ( IOException e ) {
// Do nothing
}
finally {
if ( ds != null ) {
ds.close();
}
if ( ss != null ) {
try {
ss.close();
}
catch ( IOException e ) {
/* should not be thrown */
}
}
}
return false;
}
/**
* Returns the {@link java.util.Set} of currently avaliable port numbers ({@link Integer}) between the specified port range.
*
* @throws IllegalArgumentException if port range is not between {@link #MIN_PORT_NUMBER} and {@link
* #MAX_PORT_NUMBER} or <code>fromPort</code> if greater than <code>toPort</code>.
*/
public static Set<Integer> getAvailablePorts( int fromPort, int toPort ) {
if ( fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort ) {
throw new IllegalArgumentException( "Invalid port range: " + fromPort + " ~ " + toPort );
}
Set<Integer> result = new TreeSet<Integer>();
for ( int i = fromPort; i <= toPort; i++ ) {
ServerSocket s = null;
try {
s = new ServerSocket( i );
result.add( new Integer( i ) );
}
catch ( IOException e ) {
// Do nothing
}
finally {
if ( s != null ) {
try {
s.close();
}
catch ( IOException e ) {
/* should not be thrown */
}
}
}
}
return result;
}
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package IMPORT_0.IMPORT_1.IMPORT_2.persistence.core.util;
import IMPORT_3.io.IOException;
import IMPORT_3.net.IMPORT_4;
import IMPORT_3.net.ServerSocket;
import IMPORT_3.util.NoSuchElementException;
import IMPORT_3.util.IMPORT_5;
import IMPORT_3.util.IMPORT_6;
/**
* Finds currently available server ports.
*
* @author <a href="http://mina.apache.org">Apache MINA Project</a>
* @see <a href="http://www.iana.org/assignments/port-numbers">IANA.org</a>
*
* TODO: move this to test packages once Query Index uses it correctly.
*/
public class CLASS_0 {
/** The minimum number of server port number. */
public static final int MIN_PORT_NUMBER = 1;
/** The maximum number of server port number. */
public static final int MAX_PORT_NUMBER = 49151;
/** Creates a new instance. */
private CLASS_0() {
// Do nothing
}
/**
* Returns the {@link java.util.Set} of currently available port numbers ({@link Integer}). This method is identical to
* <code>getAvailablePorts(MIN_PORT_NUMBER, MAX_PORT_NUMBER)</code>.
* <p/>
* WARNING: this can take a very long time.
*/
public static IMPORT_5<CLASS_1> getAvailablePorts() {
return getAvailablePorts( MIN_PORT_NUMBER, MAX_PORT_NUMBER );
}
/**
* Gets an available port, MAY be outside of MIN_PORT_NUMBER to MAX_PORT_NUMBER range.
*
* @throws java.util.NoSuchElementException if there are no ports available
*/
public static int getNextAvailable() {
ServerSocket serverSocket = null;
try {
// Here, we simply return an available port found by the system
serverSocket = new ServerSocket( 0 );
int VAR_0 = serverSocket.FUNC_0();
// Don't forget to close the socket...
serverSocket.close();
return VAR_0;
}
catch ( IOException ioe ) {
throw new NoSuchElementException( ioe.FUNC_1() );
}
}
/**
* Gets the next available port starting at a port.
*
* @param fromPort the port to scan for availability
*
* @throws java.util.NoSuchElementException if there are no ports available
*/
public static int getNextAvailable( int fromPort ) {
if ( fromPort < MIN_PORT_NUMBER || fromPort > MAX_PORT_NUMBER ) {
throw new IllegalArgumentException( "Invalid start port: " + fromPort );
}
for ( int VAR_1 = fromPort; VAR_1 <= MAX_PORT_NUMBER; VAR_1++ ) {
if ( available( VAR_1 ) ) {
return VAR_1;
}
}
throw new NoSuchElementException( "Could not find an available port " + "above " + fromPort );
}
/**
* Checks to see if a specific port is available.
*
* @param port the port to check for availability
*/
public static boolean available( int VAR_0 ) {
if ( VAR_0 < MIN_PORT_NUMBER || VAR_0 > MAX_PORT_NUMBER ) {
throw new IllegalArgumentException( "Invalid start port: " + VAR_0 );
}
ServerSocket VAR_2 = null;
IMPORT_4 VAR_3 = null;
try {
VAR_2 = new ServerSocket( VAR_0 );
VAR_2.setReuseAddress( true );
VAR_3 = new IMPORT_4( VAR_0 );
VAR_3.setReuseAddress( true );
return true;
}
catch ( IOException e ) {
// Do nothing
}
finally {
if ( VAR_3 != null ) {
VAR_3.close();
}
if ( VAR_2 != null ) {
try {
VAR_2.close();
}
catch ( IOException e ) {
/* should not be thrown */
}
}
}
return false;
}
/**
* Returns the {@link java.util.Set} of currently avaliable port numbers ({@link Integer}) between the specified port range.
*
* @throws IllegalArgumentException if port range is not between {@link #MIN_PORT_NUMBER} and {@link
* #MAX_PORT_NUMBER} or <code>fromPort</code> if greater than <code>toPort</code>.
*/
public static IMPORT_5<CLASS_1> getAvailablePorts( int fromPort, int toPort ) {
if ( fromPort < MIN_PORT_NUMBER || toPort > MAX_PORT_NUMBER || fromPort > toPort ) {
throw new IllegalArgumentException( "Invalid port range: " + fromPort + " ~ " + toPort );
}
IMPORT_5<CLASS_1> result = new IMPORT_6<CLASS_1>();
for ( int VAR_1 = fromPort; VAR_1 <= toPort; VAR_1++ ) {
ServerSocket VAR_4 = null;
try {
VAR_4 = new ServerSocket( VAR_1 );
result.add( new CLASS_1( VAR_1 ) );
}
catch ( IOException e ) {
// Do nothing
}
finally {
if ( VAR_4 != null ) {
try {
VAR_4.close();
}
catch ( IOException e ) {
/* should not be thrown */
}
}
}
}
return result;
}
}
| 0.419054 | {'IMPORT_0': 'org', 'IMPORT_1': 'apache', 'IMPORT_2': 'usergrid', 'IMPORT_3': 'java', 'IMPORT_4': 'DatagramSocket', 'IMPORT_5': 'Set', 'IMPORT_6': 'TreeSet', 'CLASS_0': 'AvailablePortFinder', 'CLASS_1': 'Integer', 'VAR_0': 'port', 'FUNC_0': 'getLocalPort', 'FUNC_1': 'getMessage', 'VAR_1': 'i', 'VAR_2': 'ss', 'VAR_3': 'ds', 'VAR_4': 's'} | java | Hibrido | 32.05% |
/*
* GridGain Community Edition Licensing
* Copyright 2019 GridGain Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause
* Restriction; you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*
* Commons Clause Restriction
*
* The Software is provided to you by the Licensor under the License, as defined below, subject to
* the following condition.
*
* Without limiting other conditions in the License, the grant of rights under the License will not
* include, and the License does not grant to you, the right to Sell the Software.
* For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you
* under the License to provide to third parties, for a fee or other consideration (including without
* limitation fees for hosting or consulting/ support services related to the Software), a product or
* service whose value derives, entirely or substantially, from the functionality of the Software.
* Any license notice or attribution required by the License must also include this Commons Clause
* License Condition notice.
*
* For purposes of the clause above, the “Licensor” is Copyright 2019 GridGain Systems, Inc.,
* the “License” is the Apache License, Version 2.0, and the Software is the GridGain Community
* Edition software provided with this notice.
*/
package org.apache.ignite.internal.processors.hadoop.impl.v1;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.hadoop.HadoopJobEx;
import org.apache.ignite.internal.processors.hadoop.HadoopMapperUtils;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskContext;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskInput;
import org.apache.ignite.internal.processors.hadoop.impl.v2.HadoopV2TaskContext;
/**
* Hadoop reduce task implementation for v1 API.
*/
public class HadoopV1ReduceTask extends HadoopV1Task {
/** {@code True} if reduce, {@code false} if combine. */
private final boolean reduce;
/**
* Constructor.
*
* @param taskInfo Task info.
* @param reduce {@code True} if reduce, {@code false} if combine.
*/
public HadoopV1ReduceTask(HadoopTaskInfo taskInfo, boolean reduce) {
super(taskInfo);
this.reduce = reduce;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void run(HadoopTaskContext taskCtx) throws IgniteCheckedException {
HadoopJobEx job = taskCtx.job();
HadoopV2TaskContext taskCtx0 = (HadoopV2TaskContext)taskCtx;
if (!reduce && taskCtx.taskInfo().hasMapperIndex())
HadoopMapperUtils.mapperIndex(taskCtx.taskInfo().mapperIndex());
else
HadoopMapperUtils.clearMapperIndex();
try {
JobConf jobConf = taskCtx0.jobConf();
HadoopTaskInput input = taskCtx.input();
HadoopV1OutputCollector collector = null;
try {
collector = collector(jobConf, taskCtx0, reduce || !job.info().hasReducer(), fileName(), taskCtx0.attemptId());
Reducer reducer;
if (reduce) reducer = ReflectionUtils.newInstance(jobConf.getReducerClass(),
jobConf);
else reducer = ReflectionUtils.newInstance(jobConf.getCombinerClass(),
jobConf);
assert reducer != null;
try {
try {
while (input.next()) {
if (isCancelled())
throw new HadoopTaskCancelledException("Reduce task cancelled.");
reducer.reduce(input.key(), input.values(), collector, Reporter.NULL);
}
if (!reduce)
taskCtx.onMapperFinished();
}
finally {
reducer.close();
}
}
finally {
collector.closeWriter();
}
collector.commit();
}
catch (Exception e) {
if (collector != null)
collector.abort();
throw new IgniteCheckedException(e);
}
}
finally {
if (!reduce)
HadoopMapperUtils.clearMapperIndex();
}
}
} | /*
* GridGain Community Edition Licensing
* Copyright 2019 GridGain Systems, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License") modified with Commons Clause
* Restriction; you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*
* Commons Clause Restriction
*
* The Software is provided to you by the Licensor under the License, as defined below, subject to
* the following condition.
*
* Without limiting other conditions in the License, the grant of rights under the License will not
* include, and the License does not grant to you, the right to Sell the Software.
* For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you
* under the License to provide to third parties, for a fee or other consideration (including without
* limitation fees for hosting or consulting/ support services related to the Software), a product or
* service whose value derives, entirely or substantially, from the functionality of the Software.
* Any license notice or attribution required by the License must also include this Commons Clause
* License Condition notice.
*
* For purposes of the clause above, the “Licensor” is Copyright 2019 GridGain Systems, Inc.,
* the “License” is the Apache License, Version 2.0, and the Software is the GridGain Community
* Edition software provided with this notice.
*/
package org.apache.ignite.internal.processors.hadoop.impl.v1;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Reducer;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.hadoop.HadoopJobEx;
import org.apache.ignite.internal.processors.hadoop.HadoopMapperUtils;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskCancelledException;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskContext;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskInfo;
import org.apache.ignite.internal.processors.hadoop.HadoopTaskInput;
import org.apache.ignite.internal.processors.hadoop.impl.v2.HadoopV2TaskContext;
/**
* Hadoop reduce task implementation for v1 API.
*/
public class HadoopV1ReduceTask extends HadoopV1Task {
/** {@code True} if reduce, {@code false} if combine. */
private final boolean reduce;
/**
* Constructor.
*
* @param taskInfo Task info.
* @param reduce {@code True} if reduce, {@code false} if combine.
*/
public HadoopV1ReduceTask(HadoopTaskInfo taskInfo, boolean reduce) {
super(taskInfo);
this.reduce = reduce;
}
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void run(HadoopTaskContext taskCtx) throws IgniteCheckedException {
HadoopJobEx job = taskCtx.job();
HadoopV2TaskContext taskCtx0 = (HadoopV2TaskContext)taskCtx;
if (!reduce && taskCtx.taskInfo().hasMapperIndex())
HadoopMapperUtils.mapperIndex(taskCtx.taskInfo().mapperIndex());
else
HadoopMapperUtils.clearMapperIndex();
try {
JobConf jobConf = taskCtx0.jobConf();
HadoopTaskInput input = taskCtx.input();
HadoopV1OutputCollector collector = null;
try {
collector = collector(jobConf, taskCtx0, reduce || !job.info().hasReducer(), fileName(), taskCtx0.attemptId());
Reducer reducer;
if (reduce) reducer = ReflectionUtils.newInstance(jobConf.getReducerClass(),
jobConf);
else reducer = ReflectionUtils.newInstance(jobConf.getCombinerClass(),
jobConf);
assert reducer != null;
try {
try {
while (input.next()) {
if (isCancelled())
throw new HadoopTaskCancelledException("Reduce task cancelled.");
reducer.reduce(input.key(), input.values(), collector, Reporter.NULL);
}
if (!reduce)
taskCtx.onMapperFinished();
}
finally {
reducer.close();
}
}
finally {
collector.closeWriter();
}
collector.commit();
}
catch (Exception e) {
if (collector != null)
collector.abort();
throw new IgniteCheckedException(e);
}
}
finally {
if (!reduce)
HadoopMapperUtils.clearMapperIndex();
}
}
} | 0.001882 | {} | java | Hibrido | 56.97% |
package com.ss.editor.part3d.editor.impl.scene.handler;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.objects.PhysicsRigidBody;
import com.jme3.scene.Spatial;
import com.ss.editor.util.ControlUtils;
import com.ss.editor.util.NodeUtils;
import org.jetbrains.annotations.NotNull;
import java.util.function.Consumer;
/**
* The handler to reactivate enabled physics controls during transforming spatial.
*
* @author JavaSaBr
*/
public class ReactivatePhysicsControlsTransformationHandler implements Consumer<Spatial> {
@Override
public void accept(@NotNull final Spatial spatial) {
NodeUtils.children(spatial)
.flatMap(ControlUtils::controls)
.filter(RigidBodyControl.class::isInstance)
.map(RigidBodyControl.class::cast)
.filter(RigidBodyControl::isEnabled)
.filter(control -> Float.compare(control.getMass(), 0.0F) != 0)
.filter(control -> !control.isActive())
.forEach(PhysicsRigidBody::activate);
}
}
| package IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3.IMPORT_2.IMPORT_4.IMPORT_5.IMPORT_6;
import IMPORT_0.IMPORT_7.IMPORT_8.IMPORT_9.IMPORT_10;
import IMPORT_0.IMPORT_7.IMPORT_8.IMPORT_11.IMPORT_12;
import IMPORT_0.IMPORT_7.IMPORT_5.IMPORT_13;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_14.IMPORT_15;
import IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_14.IMPORT_16;
import IMPORT_17.IMPORT_18.annotations.IMPORT_19;
import IMPORT_20.IMPORT_14.IMPORT_21.IMPORT_22;
/**
* The handler to reactivate enabled physics controls during transforming spatial.
*
* @author JavaSaBr
*/
public class CLASS_0 implements IMPORT_22<IMPORT_13> {
@VAR_0
public void FUNC_0(@IMPORT_19 final IMPORT_13 VAR_1) {
IMPORT_16.FUNC_1(VAR_1)
.flatMap(IMPORT_15::VAR_2)
.FUNC_2(IMPORT_10.class::VAR_3)
.FUNC_3(IMPORT_10.class::VAR_4)
.FUNC_2(IMPORT_10::VAR_5)
.FUNC_2(IMPORT_9 -> VAR_6.FUNC_4(IMPORT_9.FUNC_5(), 0.0F) != 0)
.FUNC_2(IMPORT_9 -> !IMPORT_9.FUNC_6())
.FUNC_7(IMPORT_12::VAR_7);
}
}
| 0.850154 | {'IMPORT_0': 'com', 'IMPORT_1': 'ss', 'IMPORT_2': 'editor', 'IMPORT_3': 'part3d', 'IMPORT_4': 'impl', 'IMPORT_5': 'scene', 'IMPORT_6': 'handler', 'IMPORT_7': 'jme3', 'IMPORT_8': 'bullet', 'IMPORT_9': 'control', 'IMPORT_10': 'RigidBodyControl', 'IMPORT_11': 'objects', 'IMPORT_12': 'PhysicsRigidBody', 'IMPORT_13': 'Spatial', 'IMPORT_14': 'util', 'IMPORT_15': 'ControlUtils', 'IMPORT_16': 'NodeUtils', 'IMPORT_17': 'org', 'IMPORT_18': 'jetbrains', 'IMPORT_19': 'NotNull', 'IMPORT_20': 'java', 'IMPORT_21': 'function', 'IMPORT_22': 'Consumer', 'CLASS_0': 'ReactivatePhysicsControlsTransformationHandler', 'VAR_0': 'Override', 'FUNC_0': 'accept', 'VAR_1': 'spatial', 'FUNC_1': 'children', 'VAR_2': 'controls', 'FUNC_2': 'filter', 'VAR_3': 'isInstance', 'FUNC_3': 'map', 'VAR_4': 'cast', 'VAR_5': 'isEnabled', 'VAR_6': 'Float', 'FUNC_4': 'compare', 'FUNC_5': 'getMass', 'FUNC_6': 'isActive', 'FUNC_7': 'forEach', 'VAR_7': 'activate'} | java | OOP | 69.17% |
/*
* Copyright 2014 - 2022 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.blazebit.persistence.impl.plan;
import com.blazebit.persistence.ReturningObjectBuilder;
import com.blazebit.persistence.ReturningResult;
import com.blazebit.persistence.impl.DefaultReturningResult;
import com.blazebit.persistence.spi.DbmsDialect;
import com.blazebit.persistence.spi.ExtendedQuerySupport;
import com.blazebit.persistence.spi.ServiceProvider;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
/**
*
* @author <NAME>
* @since 1.2.0
*/
public class CustomReturningModificationQueryPlan<T> implements ModificationQueryPlan, SelectQueryPlan<ReturningResult<T>> {
private final ExtendedQuerySupport extendedQuerySupport;
private final ServiceProvider serviceProvider;
private final DbmsDialect dbmsDialect;
private final Query modificationBaseQuery;
private final Query delegate;
private final ReturningObjectBuilder<T> objectBuilder;
private final List<Query> participatingQueries;
private final String sql;
private final int firstResult;
private final int maxResults;
private final boolean requiresWrapping;
private final boolean queryPlanCacheEnabled;
public CustomReturningModificationQueryPlan(ExtendedQuerySupport extendedQuerySupport, ServiceProvider serviceProvider, Query modificationBaseQuery, Query delegate, ReturningObjectBuilder<T> objectBuilder, List<Query> participatingQueries, String sql, int firstResult, int maxResults, boolean requiresWrapping, boolean queryPlanCacheEnabled) {
this.extendedQuerySupport = extendedQuerySupport;
this.serviceProvider = serviceProvider;
this.dbmsDialect = serviceProvider.getService(DbmsDialect.class);
this.modificationBaseQuery = modificationBaseQuery;
this.delegate = delegate;
this.objectBuilder = objectBuilder;
this.participatingQueries = participatingQueries;
this.sql = sql;
this.firstResult = firstResult;
this.maxResults = maxResults;
this.requiresWrapping = requiresWrapping;
this.queryPlanCacheEnabled = queryPlanCacheEnabled;
}
@Override
public int executeUpdate() {
modificationBaseQuery.setFirstResult(firstResult);
modificationBaseQuery.setMaxResults(maxResults);
ReturningResult<Object[]> result = extendedQuerySupport.executeReturning(serviceProvider, participatingQueries, modificationBaseQuery, delegate, sql, queryPlanCacheEnabled);
return result.getUpdateCount();
}
@Override
public List<ReturningResult<T>> getResultList() {
return Arrays.asList(getSingleResult());
}
@Override
public ReturningResult<T> getSingleResult() {
modificationBaseQuery.setFirstResult(firstResult);
modificationBaseQuery.setMaxResults(maxResults);
ReturningResult<Object[]> result = extendedQuerySupport.executeReturning(serviceProvider, participatingQueries, modificationBaseQuery, delegate, sql, queryPlanCacheEnabled);
List<Object[]> resultList = result.getResultList();
final int updateCount = result.getUpdateCount();
if (requiresWrapping) {
// NOTE: Hibernate will return the object directly for single attribute case instead of an object array
int size = resultList.size();
List<Object[]> newResultList = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
newResultList.add(new Object[]{ resultList.get(i) });
}
resultList = newResultList;
}
return new DefaultReturningResult<T>(resultList, updateCount, dbmsDialect, objectBuilder);
}
public Stream<ReturningResult<T>> getResultStream() {
return getResultList().stream();
}
}
| /*
* Copyright 2014 - 2022 Blazebit.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.IMPORT_0.IMPORT_1.IMPORT_2.plan;
import com.IMPORT_0.IMPORT_1.ReturningObjectBuilder;
import com.IMPORT_0.IMPORT_1.ReturningResult;
import com.IMPORT_0.IMPORT_1.IMPORT_2.IMPORT_3;
import com.IMPORT_0.IMPORT_1.spi.IMPORT_4;
import com.IMPORT_0.IMPORT_1.spi.IMPORT_5;
import com.IMPORT_0.IMPORT_1.spi.ServiceProvider;
import javax.IMPORT_1.IMPORT_6;
import java.util.IMPORT_7;
import java.util.IMPORT_8;
import java.util.IMPORT_9;
import java.util.IMPORT_10.IMPORT_11;
/**
*
* @author <NAME>
* @since 1.2.0
*/
public class CLASS_0<CLASS_1> implements ModificationQueryPlan, SelectQueryPlan<ReturningResult<CLASS_1>> {
private final IMPORT_5 extendedQuerySupport;
private final ServiceProvider serviceProvider;
private final IMPORT_4 dbmsDialect;
private final IMPORT_6 modificationBaseQuery;
private final IMPORT_6 delegate;
private final ReturningObjectBuilder<CLASS_1> objectBuilder;
private final IMPORT_9<IMPORT_6> participatingQueries;
private final CLASS_2 VAR_0;
private final int VAR_1;
private final int VAR_2;
private final boolean requiresWrapping;
private final boolean VAR_3;
public CLASS_0(IMPORT_5 extendedQuerySupport, ServiceProvider serviceProvider, IMPORT_6 modificationBaseQuery, IMPORT_6 delegate, ReturningObjectBuilder<CLASS_1> objectBuilder, IMPORT_9<IMPORT_6> participatingQueries, CLASS_2 VAR_0, int VAR_1, int VAR_2, boolean requiresWrapping, boolean VAR_3) {
this.extendedQuerySupport = extendedQuerySupport;
this.serviceProvider = serviceProvider;
this.dbmsDialect = serviceProvider.FUNC_0(IMPORT_4.class);
this.modificationBaseQuery = modificationBaseQuery;
this.delegate = delegate;
this.objectBuilder = objectBuilder;
this.participatingQueries = participatingQueries;
this.VAR_0 = VAR_0;
this.VAR_1 = VAR_1;
this.VAR_2 = VAR_2;
this.requiresWrapping = requiresWrapping;
this.VAR_3 = VAR_3;
}
@Override
public int executeUpdate() {
modificationBaseQuery.FUNC_1(VAR_1);
modificationBaseQuery.FUNC_2(VAR_2);
ReturningResult<Object[]> VAR_4 = extendedQuerySupport.FUNC_3(serviceProvider, participatingQueries, modificationBaseQuery, delegate, VAR_0, VAR_3);
return VAR_4.getUpdateCount();
}
@Override
public IMPORT_9<ReturningResult<CLASS_1>> getResultList() {
return IMPORT_8.FUNC_4(FUNC_5());
}
@Override
public ReturningResult<CLASS_1> FUNC_5() {
modificationBaseQuery.FUNC_1(VAR_1);
modificationBaseQuery.FUNC_2(VAR_2);
ReturningResult<Object[]> VAR_4 = extendedQuerySupport.FUNC_3(serviceProvider, participatingQueries, modificationBaseQuery, delegate, VAR_0, VAR_3);
IMPORT_9<Object[]> VAR_5 = VAR_4.getResultList();
final int VAR_6 = VAR_4.getUpdateCount();
if (requiresWrapping) {
// NOTE: Hibernate will return the object directly for single attribute case instead of an object array
int VAR_7 = VAR_5.FUNC_6();
IMPORT_9<Object[]> VAR_8 = new IMPORT_7<>(VAR_7);
for (int VAR_9 = 0; VAR_9 < VAR_7; VAR_9++) {
VAR_8.add(new Object[]{ VAR_5.get(VAR_9) });
}
VAR_5 = VAR_8;
}
return new IMPORT_3<CLASS_1>(VAR_5, VAR_6, dbmsDialect, objectBuilder);
}
public IMPORT_11<ReturningResult<CLASS_1>> getResultStream() {
return getResultList().IMPORT_10();
}
}
| 0.487986 | {'IMPORT_0': 'blazebit', 'IMPORT_1': 'persistence', 'IMPORT_2': 'impl', 'IMPORT_3': 'DefaultReturningResult', 'IMPORT_4': 'DbmsDialect', 'IMPORT_5': 'ExtendedQuerySupport', 'IMPORT_6': 'Query', 'IMPORT_7': 'ArrayList', 'IMPORT_8': 'Arrays', 'IMPORT_9': 'List', 'IMPORT_10': 'stream', 'IMPORT_11': 'Stream', 'CLASS_0': 'CustomReturningModificationQueryPlan', 'CLASS_1': 'T', 'CLASS_2': 'String', 'VAR_0': 'sql', 'VAR_1': 'firstResult', 'VAR_2': 'maxResults', 'VAR_3': 'queryPlanCacheEnabled', 'FUNC_0': 'getService', 'FUNC_1': 'setFirstResult', 'FUNC_2': 'setMaxResults', 'VAR_4': 'result', 'FUNC_3': 'executeReturning', 'FUNC_4': 'asList', 'FUNC_5': 'getSingleResult', 'VAR_5': 'resultList', 'VAR_6': 'updateCount', 'VAR_7': 'size', 'FUNC_6': 'size', 'VAR_8': 'newResultList', 'VAR_9': 'i'} | java | Hibrido | 53.43% |
package com.atd.official.controller;
import com.alibaba.fastjson.JSONObject;
import com.atd.official.service.ConfigService;
import com.atd.official.service.impl.ConfigServiceimpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConfigController {
@Autowired
private ConfigService configService;
@RequestMapping(value = "config", method= RequestMethod.GET)
public JSONObject getLatestVideo(String name){
return configService.getConfig(name);
}
}
| package com.IMPORT_0.official.controller;
import com.IMPORT_1.fastjson.JSONObject;
import com.IMPORT_0.official.service.ConfigService;
import com.IMPORT_0.official.service.impl.ConfigServiceimpl;
import org.springframework.IMPORT_2.factory.annotation.IMPORT_3;
import org.springframework.web.bind.annotation.IMPORT_4;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ConfigController {
@IMPORT_3
private ConfigService configService;
@RequestMapping(value = "config", method= RequestMethod.GET)
public JSONObject getLatestVideo(String name){
return configService.getConfig(name);
}
}
| 0.201122 | {'IMPORT_0': 'atd', 'IMPORT_1': 'alibaba', 'IMPORT_2': 'beans', 'IMPORT_3': 'Autowired', 'IMPORT_4': 'CrossOrigin'} | java | OOP | 100.00% |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.