hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
9231bcdf3af4a711115496f902ad8c813033c01b
4,283
java
Java
app/src/main/java/com/l000phone/themovietime/firstpage/search/fragments/SearchResultListFragment.java
zspgithub/TheMovieTime
9568107ed85ad16fd79dad47400e5c2d6acdd027
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/l000phone/themovietime/firstpage/search/fragments/SearchResultListFragment.java
zspgithub/TheMovieTime
9568107ed85ad16fd79dad47400e5c2d6acdd027
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/l000phone/themovietime/firstpage/search/fragments/SearchResultListFragment.java
zspgithub/TheMovieTime
9568107ed85ad16fd79dad47400e5c2d6acdd027
[ "Apache-2.0" ]
null
null
null
34.821138
109
0.706748
995,951
package com.l000phone.themovietime.firstpage.search.fragments; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import com.handmark.pulltorefresh.library.ILoadingLayout; import com.handmark.pulltorefresh.library.PullToRefreshBase; import com.handmark.pulltorefresh.library.PullToRefreshListView; import com.l000phone.themovietime.R; import com.l000phone.themovietime.firstpage.search.adapter.SearchResultAdapter; import com.l000phone.themovietime.firstpage.search.asynctask.SearchResultAsyncTask; import com.l000phone.themovietime.firstpage.search.searchbean.SearchResultBean; import com.l000phone.themovietime.utils.CitySelect; import com.l000phone.themovietime.firstpage.search.asynctask.SearchResultAsyncTask.SearchResultCallback; import java.util.ArrayList; import java.util.List; /** * 搜索结果Fragment * * A simple {@link Fragment} subclass. */ public class SearchResultListFragment extends Fragment implements SearchResultCallback{ private String path = "http://api.m.mtime.cn/Showtime/SearchVoice.api"; private int pageIndex = 1;//返回结果的页码下标 private int searchType;//搜索类型 private String locationId = CitySelect.getCityId(); private String keyword; private String params; private View view; private PullToRefreshListView first_search_result_list; private List<SearchResultBean> beans; private SearchResultAdapter adapter; public SearchResultListFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment view = inflater.inflate(R.layout.first_search_result_list, container, false); initView(); Bundle bundle = getArguments(); keyword = bundle.getString("keyword"); int index = bundle.getInt("index"); params = "locationId="+locationId+"&searchType=3&pageIndex="+pageIndex+"&keyword="+keyword; beans = new ArrayList<>(); adapter = new SearchResultAdapter(getContext(),beans); first_search_result_list.setAdapter(adapter); if (index == 0){ new SearchResultAsyncTask(getContext(),this).execute(path,params); }else{ view = inflater.inflate(R.layout.first_search_result_empty,null); } return view; } private void initView() { first_search_result_list = (PullToRefreshListView) view.findViewById(R.id.first_search_result_list); ILoadingLayout loadingLayout = first_search_result_list.getLoadingLayoutProxy(true,true); loadingLayout.setPullLabel("上拉加载更多..."); loadingLayout.setRefreshingLabel("正在载入..."); loadingLayout.setReleaseLabel("释放加载..."); first_search_result_list.setMode(PullToRefreshBase.Mode.PULL_FROM_END); first_search_result_list.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener2<ListView>() { @Override public void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) { } //上拉刷新 @Override public void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) { pageIndex++; new SearchResultAsyncTask(getContext(), SearchResultListFragment.this).execute(path, params); } }); first_search_result_list.setOnItemClickListener(new AdapterView.OnItemClickListener() { //携带id跳转到电影详情界面 @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Intent intent = new Intent(getActivity(),); // intent.putExtra("id",beans.get(position).getId()); // // startActivity(intent); } }); } //搜索结果回调类 @Override public void getSearchResult(List<SearchResultBean> list) { beans.addAll(list); adapter.notifyDataSetChanged(); } }
9231bebfbde4f6be0459d903382459b0e67ff664
1,597
java
Java
src/main/java/eu/dissco/demoprocessingservice/service/ValidationService.java
DiSSCo/demo-processing-service
01f88d64274657cc4f72238e2a12c4ae4fa00b9c
[ "Apache-2.0" ]
null
null
null
src/main/java/eu/dissco/demoprocessingservice/service/ValidationService.java
DiSSCo/demo-processing-service
01f88d64274657cc4f72238e2a12c4ae4fa00b9c
[ "Apache-2.0" ]
1
2022-03-23T14:04:08.000Z
2022-03-23T14:04:08.000Z
src/main/java/eu/dissco/demoprocessingservice/service/ValidationService.java
DiSSCo/demo-processing-service
01f88d64274657cc4f72238e2a12c4ae4fa00b9c
[ "Apache-2.0" ]
null
null
null
38.02381
117
0.721353
995,952
package eu.dissco.demoprocessingservice.service; import com.networknt.schema.JsonSchema; import com.networknt.schema.JsonSchemaFactory; import com.networknt.schema.SpecVersion; import eu.dissco.demoprocessingservice.exception.MissingSchemaException; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.cnri.cordra.api.*; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @Slf4j @Service @AllArgsConstructor public class ValidationService { private final CordraClient cordraClient; @Cacheable("validation") public JsonSchema retrieveSchema(String type) throws MissingSchemaException { var schema = searchSchema(type); var optionalObject = schema.stream().findFirst(); if (optionalObject.isPresent()) { var factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V201909); return factory.getSchema(optionalObject.get().content.getAsJsonObject().get("schema").toString()); } else { throw new MissingSchemaException("No schema found in Cordra, ensure that type: " + type + " is present"); } } private SearchResults<CordraObject> searchSchema(String type) throws MissingSchemaException { SearchResults<CordraObject> schema; try { schema = cordraClient.search("/name:\"" + type + "\"", new QueryParams(0, 1)); } catch (CordraException e) { throw new MissingSchemaException("Exception occurred during retrieval of schema", e); } return schema; } }
9231bf4f009265a99df0da75e1ed6f862104fe0c
1,274
java
Java
dao/src/main/java/org/thingsboard/server/dao/model/sql/DeviceEntity.java
cemsina/thingsboard
1a85ba828c011c88a4a65724b66653d8fc305b13
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
dao/src/main/java/org/thingsboard/server/dao/model/sql/DeviceEntity.java
cemsina/thingsboard
1a85ba828c011c88a4a65724b66653d8fc305b13
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
dao/src/main/java/org/thingsboard/server/dao/model/sql/DeviceEntity.java
cemsina/thingsboard
1a85ba828c011c88a4a65724b66653d8fc305b13
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
28.311111
75
0.737834
995,953
/** * Copyright © 2016-2021 The Thingsboard Authors * * 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.thingsboard.server.dao.model.sql; import lombok.Data; import lombok.EqualsAndHashCode; import org.thingsboard.server.common.data.Device; import org.thingsboard.server.dao.model.ModelConstants; import javax.persistence.Entity; import javax.persistence.Table; @Data @EqualsAndHashCode(callSuper = true) @Entity @Table(name = ModelConstants.DEVICE_COLUMN_FAMILY_NAME) public final class DeviceEntity extends AbstractDeviceEntity<Device> { public DeviceEntity() { super(); } public DeviceEntity(Device device) { super(device); } @Override public Device toData() { return super.toDevice(); } }
9231bf90bad8cbefdf40cdb56bde951afa974c2d
363
java
Java
src/edu/psu/compbio/seqcode/gse/seqview/paintable/SeqAnalysisProperties.java
shaunmahony/seqcode
08a3b0324025c629c8de5c2a5a2c0d56d5bf4574
[ "MIT" ]
2
2015-07-31T01:09:03.000Z
2016-05-09T15:01:01.000Z
src/edu/psu/compbio/seqcode/gse/seqview/paintable/SeqAnalysisProperties.java
shaunmahony/multigps-archive
08a3b0324025c629c8de5c2a5a2c0d56d5bf4574
[ "MIT" ]
null
null
null
src/edu/psu/compbio/seqcode/gse/seqview/paintable/SeqAnalysisProperties.java
shaunmahony/multigps-archive
08a3b0324025c629c8de5c2a5a2c0d56d5bf4574
[ "MIT" ]
null
null
null
30.25
87
0.710744
995,954
package edu.psu.compbio.seqcode.gse.seqview.paintable; public class SeqAnalysisProperties extends PaintableProperties { public void loadDefaults () { // don't load the track label from the defaults, since it varies by experiment. String origTrackLabel = TrackLabel; super.loadDefaults(); TrackLabel = origTrackLabel; } }
9231c1734ce033662ef55946c925b25d485542cf
3,741
java
Java
app/src/main/java/com/example/android/miwok/NumbersActivity.java
girishb007/miwoik-translater
07b0985c6fcf7803b0d3633200ca8076dd6222bf
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/example/android/miwok/NumbersActivity.java
girishb007/miwoik-translater
07b0985c6fcf7803b0d3633200ca8076dd6222bf
[ "Apache-2.0" ]
1
2017-02-27T20:37:52.000Z
2017-02-27T20:39:00.000Z
app/src/main/java/com/example/android/miwok/NumbersActivity.java
girishb007/miwoik-translater
07b0985c6fcf7803b0d3633200ca8076dd6222bf
[ "Apache-2.0" ]
null
null
null
46.7625
100
0.677626
995,955
/* * Copyright (C) 2016 The Android Open Source Project * * 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.example.android.miwok; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import java.util.ArrayList; public class NumbersActivity extends AppCompatActivity { /** Handles playback of all the sound files */ private MediaPlayer mMediaPlayer; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.word_list); // Create a list of words final ArrayList<Word> words = new ArrayList<Word>(); words.add(new Word("one", "lutti", R.drawable.number_one, R.raw.number_one)); words.add(new Word("two", "otiiko", R.drawable.number_two, R.raw.number_two)); words.add(new Word("three", "tolookosu", R.drawable.number_three, R.raw.number_three)); words.add(new Word("four", "oyyisa", R.drawable.number_four, R.raw.number_four)); words.add(new Word("five", "massokka", R.drawable.number_five, R.raw.number_five)); words.add(new Word("six", "temmokka", R.drawable.number_six, R.raw.number_six)); words.add(new Word("seven", "kenekaku", R.drawable.number_seven, R.raw.number_seven)); words.add(new Word("eight", "kawinta", R.drawable.number_eight, R.raw.number_eight)); words.add(new Word("nine", "wo’e", R.drawable.number_nine, R.raw.number_nine)); words.add(new Word("ten", "na’aacha", R.drawable.number_ten, R.raw.number_ten)); // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The // adapter knows how to create list items for each item in the list. WordAdapter adapter = new WordAdapter(this, words, R.color.category_numbers); // Find the {@link ListView} object in the view hierarchy of the {@link Activity}. // There should be a {@link ListView} with the view ID called list, which is declared in the // word_list.xml layout file. ListView listView = (ListView) findViewById(R.id.list); // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the // {@link ListView} will display list items for each {@link Word} in the list. listView.setAdapter(adapter); // Set a click listener to play the audio when the list item is clicked on listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { // Get the {@link Word} object at the given position the user clicked on Word word = words.get(position); // Create and setup the {@link MediaPlayer} for the audio resource associated // with the current word mMediaPlayer = MediaPlayer.create(NumbersActivity.this, word.getAudioResourceId()); // Start the audio file mMediaPlayer.start(); } }); } }
9231c1cfcf22809b2f9d55bc4079b89a95ca1f2c
613
java
Java
Assignment-4/170010003_170010040_assignment4/submissions/src/processor/pipeline/IF_OF_LatchType.java
abhiisshheekk/CS311-COA-Lab
c5effdc22bd7c1c35ba44fe3a6f8998c8189554e
[ "MIT" ]
null
null
null
Assignment-4/170010003_170010040_assignment4/submissions/src/processor/pipeline/IF_OF_LatchType.java
abhiisshheekk/CS311-COA-Lab
c5effdc22bd7c1c35ba44fe3a6f8998c8189554e
[ "MIT" ]
null
null
null
Assignment-4/170010003_170010040_assignment4/submissions/src/processor/pipeline/IF_OF_LatchType.java
abhiisshheekk/CS311-COA-Lab
c5effdc22bd7c1c35ba44fe3a6f8998c8189554e
[ "MIT" ]
1
2021-09-29T20:47:23.000Z
2021-09-29T20:47:23.000Z
16.131579
54
0.727569
995,956
package processor.pipeline; public class IF_OF_LatchType { boolean OF_enable; int instruction; public if_of_latchtype(boolean of_enable) { of_enable = of_enable; } public if_of_latchtype(boolean of_enable, int inst) { of_enable = of_enable; instruction = inst; } public IF_OF_LatchType() { OF_enable = false; } public void setOF_enable(boolean oF_enable) { OF_enable = oF_enable; } public boolean isOF_enable() { return OF_enable; } public int getInstruction() { return instruction; } public void setInstruction(int instruction) { this.instruction = instruction; } }
9231c21a5999abf36e52373c607035228be9dc72
2,306
java
Java
infra/src/main/java/org/entcore/infra/services/impl/ExecCommandWorker.java
opendigitaleducation/entcore
002ebbf8a1dd6c246af86f1e18b6abf971c08322
[ "Apache-2.0" ]
21
2019-01-30T09:00:54.000Z
2022-02-28T15:15:05.000Z
infra/src/main/java/org/entcore/infra/services/impl/ExecCommandWorker.java
opendigitaleducation/entcore
002ebbf8a1dd6c246af86f1e18b6abf971c08322
[ "Apache-2.0" ]
68
2019-02-14T09:03:17.000Z
2022-03-29T09:35:53.000Z
infra/src/main/java/org/entcore/infra/services/impl/ExecCommandWorker.java
entcore/entcore
6bd35dbedb7a8d9322d41d041476e608654c00b2
[ "Apache-2.0" ]
37
2015-07-01T08:44:03.000Z
2018-04-16T15:49:43.000Z
35.476923
152
0.738942
995,957
/* * Copyright © "Open Digital Education", 2017 * * This program is published by "Open Digital Education". * You must indicate the name of the software and the company in any production /contribution * using the software and indicate on the home page of the software industry in question, * "powered by Open Digital Education" with a reference to the website: https://opendigitaleducation.com/. * * This program is free software, licensed under the terms of the GNU Affero General Public License * as published by the Free Software Foundation, version 3 of the License. * * You can redistribute this application and/or modify it since you respect the terms of the GNU Affero General Public License. * If you modify the source code and then use this modified source code in your creation, you must make available the source code of your modifications. * * You should have received a copy of the GNU Affero General Public License along with the software. * If not, please see : <http://www.gnu.org/licenses/>. Full compliance requires reading the terms of this license and following its directives. */ package org.entcore.infra.services.impl; import io.vertx.core.Handler; import io.vertx.core.eventbus.Message; import io.vertx.core.json.JsonObject; import org.vertx.java.busmods.BusModBase; import java.io.BufferedReader; import java.io.InputStreamReader; import static fr.wseduc.webutils.Utils.isEmpty; public class ExecCommandWorker extends BusModBase implements Handler<Message<JsonObject>> { @Override public void start() { super.start(); vertx.eventBus().localConsumer("exec.command", this); } @Override public void handle(Message<JsonObject> event) { String command = event.body().getString("command"); if (isEmpty(command)) { sendError(event, "Invalid command"); return; } try { Process p = Runtime.getRuntime().exec(command); p.waitFor(); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); StringBuilder sb = new StringBuilder(); String line = ""; while ((line = reader.readLine())!= null) { sb.append(line).append("\n"); } sendOK(event, new JsonObject().put("result", sb.toString())); } catch (Exception e) { sendError(event, "Error executing command : " + command, e); } } }
9231c31967eb7d9bd73b255975a982a3929fd314
641
java
Java
java/pocs/javafx/demogriffonfx2/src/test/java/demogriffonfx/SampleControllerTest.java
joaolsouzajr/labs
49b1287798b15ff1676b2eb0d89de6520c4218f0
[ "MIT" ]
null
null
null
java/pocs/javafx/demogriffonfx2/src/test/java/demogriffonfx/SampleControllerTest.java
joaolsouzajr/labs
49b1287798b15ff1676b2eb0d89de6520c4218f0
[ "MIT" ]
null
null
null
java/pocs/javafx/demogriffonfx2/src/test/java/demogriffonfx/SampleControllerTest.java
joaolsouzajr/labs
49b1287798b15ff1676b2eb0d89de6520c4218f0
[ "MIT" ]
null
null
null
22.892857
65
0.711388
995,958
package demogriffonfx; import griffon.core.test.GriffonUnitRule; import griffon.core.test.TestFor; import org.junit.Rule; import org.junit.Test; import static org.junit.Assert.assertTrue; //import static org.junit.Assert.fail; @TestFor(SampleController.class) public class SampleControllerTest { static { // force initialization JavaFX Toolkit new javafx.embed.swing.JFXPanel(); } private SampleController controller; @Rule public final GriffonUnitRule griffon = new GriffonUnitRule(); @Test public void smokeTest() { //fail("Not yet implemented!"); assertTrue(true); } }
9231c3df731876e37061bd021f94790c55946ad7
1,180
java
Java
mods/grammarSystem/src/main/java/org/terasology/grammarSystem/world/building/TreeLeaf.java
DBCDK/Terasology
17b2855a9e7beb119587f2f8663c9b1d9592787f
[ "Apache-2.0" ]
null
null
null
mods/grammarSystem/src/main/java/org/terasology/grammarSystem/world/building/TreeLeaf.java
DBCDK/Terasology
17b2855a9e7beb119587f2f8663c9b1d9592787f
[ "Apache-2.0" ]
null
null
null
mods/grammarSystem/src/main/java/org/terasology/grammarSystem/world/building/TreeLeaf.java
DBCDK/Terasology
17b2855a9e7beb119587f2f8663c9b1d9592787f
[ "Apache-2.0" ]
null
null
null
22.264151
76
0.665254
995,959
package org.terasology.grammarSystem.world.building; import org.terasology.grammarSystem.logic.grammar.shapes.Shape; import org.terasology.grammarSystem.logic.grammar.shapes.TerminalShape; import org.terasology.model.structures.BlockCollection; import java.util.List; /** * @author Tobias 'Skaldarnar' Nett * <p/> * A tree leaf contains only terminal shapes in the derivation tree. */ public class TreeLeaf extends Tree { private TerminalShape terminal; private Tree parent; public TreeLeaf(TerminalShape terminal) { BlockCollection c = new BlockCollection(); this.terminal = terminal; } @Override public BlockCollection derive() { System.out.println(terminal.getValue()); return terminal.getValue(); } @Override public void setParent(Tree parent) { this.parent = parent; } @Override public Shape getShape() { return terminal; } @Override public List<TreeNode> findActiveNodes() { return null; } public TerminalShape getTerminal() { return terminal; } public Tree getParent() { return parent; } }
9231c3f3e1e54e9dc5a0331aff23ee908e53117a
6,330
java
Java
jadx-core/src/main/java/jadx/core/Jadx.java
skylot/jadx
48252c3c3d553c1075cbc828e3e7aa7955544735
[ "Apache-2.0" ]
30,785
2015-01-01T08:27:01.000Z
2022-03-31T19:45:36.000Z
jadx-core/src/main/java/jadx/core/Jadx.java
jpstotz/jadx
c2a4a7a6c26ce28c1a2bffb05d45c7213e4d2829
[ "Apache-2.0" ]
1,263
2015-01-06T19:10:02.000Z
2022-03-31T16:30:21.000Z
jadx-core/src/main/java/jadx/core/Jadx.java
jpstotz/jadx
c2a4a7a6c26ce28c1a2bffb05d45c7213e4d2829
[ "Apache-2.0" ]
4,097
2015-01-04T05:58:26.000Z
2022-03-31T07:26:09.000Z
32.96875
82
0.762717
995,960
package jadx.core; import java.io.InputStream; import java.net.URL; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.Manifest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import jadx.api.CommentsLevel; import jadx.api.JadxArgs; import jadx.core.dex.visitors.AttachCommentsVisitor; import jadx.core.dex.visitors.AttachMethodDetails; import jadx.core.dex.visitors.AttachTryCatchVisitor; import jadx.core.dex.visitors.CheckCode; import jadx.core.dex.visitors.ClassModifier; import jadx.core.dex.visitors.ConstInlineVisitor; import jadx.core.dex.visitors.ConstructorVisitor; import jadx.core.dex.visitors.DeboxingVisitor; import jadx.core.dex.visitors.DotGraphVisitor; import jadx.core.dex.visitors.EnumVisitor; import jadx.core.dex.visitors.ExtractFieldInit; import jadx.core.dex.visitors.FallbackModeVisitor; import jadx.core.dex.visitors.FixAccessModifiers; import jadx.core.dex.visitors.GenericTypesVisitor; import jadx.core.dex.visitors.IDexTreeVisitor; import jadx.core.dex.visitors.InitCodeVariables; import jadx.core.dex.visitors.InlineMethods; import jadx.core.dex.visitors.MarkMethodsForInline; import jadx.core.dex.visitors.MethodInvokeVisitor; import jadx.core.dex.visitors.ModVisitor; import jadx.core.dex.visitors.MoveInlineVisitor; import jadx.core.dex.visitors.OverrideMethodVisitor; import jadx.core.dex.visitors.PrepareForCodeGen; import jadx.core.dex.visitors.ProcessAnonymous; import jadx.core.dex.visitors.ProcessInstructionsVisitor; import jadx.core.dex.visitors.ReSugarCode; import jadx.core.dex.visitors.RenameVisitor; import jadx.core.dex.visitors.ShadowFieldVisitor; import jadx.core.dex.visitors.SignatureProcessor; import jadx.core.dex.visitors.SimplifyVisitor; import jadx.core.dex.visitors.blocks.BlockProcessor; import jadx.core.dex.visitors.blocks.BlockSplitter; import jadx.core.dex.visitors.debuginfo.DebugInfoApplyVisitor; import jadx.core.dex.visitors.debuginfo.DebugInfoAttachVisitor; import jadx.core.dex.visitors.finaly.MarkFinallyVisitor; import jadx.core.dex.visitors.regions.CheckRegions; import jadx.core.dex.visitors.regions.CleanRegions; import jadx.core.dex.visitors.regions.IfRegionVisitor; import jadx.core.dex.visitors.regions.LoopRegionVisitor; import jadx.core.dex.visitors.regions.RegionMakerVisitor; import jadx.core.dex.visitors.regions.ReturnVisitor; import jadx.core.dex.visitors.regions.variables.ProcessVariables; import jadx.core.dex.visitors.shrink.CodeShrinkVisitor; import jadx.core.dex.visitors.ssa.SSATransform; import jadx.core.dex.visitors.typeinference.TypeInferenceVisitor; import jadx.core.dex.visitors.usage.UsageInfoVisitor; public class Jadx { private static final Logger LOG = LoggerFactory.getLogger(Jadx.class); private Jadx() { } static { if (Consts.DEBUG) { LOG.info("debug enabled"); } } public static List<IDexTreeVisitor> getFallbackPassesList() { List<IDexTreeVisitor> passes = new ArrayList<>(); passes.add(new AttachTryCatchVisitor()); passes.add(new AttachCommentsVisitor()); passes.add(new ProcessInstructionsVisitor()); passes.add(new FallbackModeVisitor()); return passes; } public static List<IDexTreeVisitor> getPreDecompilePassesList() { List<IDexTreeVisitor> passes = new ArrayList<>(); passes.add(new SignatureProcessor()); passes.add(new OverrideMethodVisitor()); passes.add(new RenameVisitor()); passes.add(new UsageInfoVisitor()); passes.add(new ProcessAnonymous()); return passes; } public static List<IDexTreeVisitor> getPassesList(JadxArgs args) { if (args.isFallbackMode()) { return getFallbackPassesList(); } List<IDexTreeVisitor> passes = new ArrayList<>(); // instructions IR passes.add(new CheckCode()); if (args.isDebugInfo()) { passes.add(new DebugInfoAttachVisitor()); } passes.add(new AttachTryCatchVisitor()); if (args.getCommentsLevel() != CommentsLevel.NONE) { passes.add(new AttachCommentsVisitor()); } passes.add(new AttachMethodDetails()); passes.add(new ProcessInstructionsVisitor()); // blocks IR passes.add(new BlockSplitter()); passes.add(new BlockProcessor()); if (args.isRawCFGOutput()) { passes.add(DotGraphVisitor.dumpRaw()); } passes.add(new SSATransform()); passes.add(new MoveInlineVisitor()); passes.add(new ConstructorVisitor()); passes.add(new InitCodeVariables()); if (args.isExtractFinally()) { passes.add(new MarkFinallyVisitor()); } passes.add(new ConstInlineVisitor()); passes.add(new TypeInferenceVisitor()); if (args.isDebugInfo()) { passes.add(new DebugInfoApplyVisitor()); } if (args.isInlineMethods()) { passes.add(new InlineMethods()); } passes.add(new GenericTypesVisitor()); passes.add(new ShadowFieldVisitor()); passes.add(new DeboxingVisitor()); passes.add(new ModVisitor()); passes.add(new CodeShrinkVisitor()); passes.add(new ReSugarCode()); if (args.isCfgOutput()) { passes.add(DotGraphVisitor.dump()); } // regions IR passes.add(new RegionMakerVisitor()); passes.add(new IfRegionVisitor()); passes.add(new ReturnVisitor()); passes.add(new CleanRegions()); passes.add(new CodeShrinkVisitor()); passes.add(new MethodInvokeVisitor()); passes.add(new SimplifyVisitor()); passes.add(new CheckRegions()); passes.add(new EnumVisitor()); passes.add(new ExtractFieldInit()); passes.add(new FixAccessModifiers()); passes.add(new ClassModifier()); passes.add(new LoopRegionVisitor()); if (args.isInlineMethods()) { passes.add(new MarkMethodsForInline()); } passes.add(new ProcessVariables()); passes.add(new PrepareForCodeGen()); if (args.isCfgOutput()) { passes.add(DotGraphVisitor.dumpRegions()); } return passes; } public static String getVersion() { try { ClassLoader classLoader = Jadx.class.getClassLoader(); if (classLoader != null) { Enumeration<URL> resources = classLoader.getResources("META-INF/MANIFEST.MF"); while (resources.hasMoreElements()) { try (InputStream is = resources.nextElement().openStream()) { Manifest manifest = new Manifest(is); String ver = manifest.getMainAttributes().getValue("jadx-version"); if (ver != null) { return ver; } } } } } catch (Exception e) { LOG.error("Can't get manifest file", e); } return "dev"; } }
9231c466d7b4a43d46181165aa74ba006d4e244d
695
java
Java
node/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
anweisen/DyCloud
0bd95e2c8afac9026905f7e0dbdd6122bfe28473
[ "Apache-2.0" ]
7
2021-11-01T14:13:16.000Z
2022-02-27T19:26:13.000Z
node/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
anweisen/MinecraftCloud
0bd95e2c8afac9026905f7e0dbdd6122bfe28473
[ "Apache-2.0" ]
null
null
null
node/src/main/java/org/slf4j/impl/StaticLoggerBinder.java
anweisen/MinecraftCloud
0bd95e2c8afac9026905f7e0dbdd6122bfe28473
[ "Apache-2.0" ]
null
null
null
21.71875
78
0.774101
995,961
package org.slf4j.impl; import org.slf4j.ILoggerFactory; import org.slf4j.helpers.NOPLoggerFactory; import org.slf4j.spi.LoggerFactoryBinder; /** * Slf4j NOP implementation needed for the java docker api * * @author anweisen | https://github.com/anweisen * @since 1.0 */ public class StaticLoggerBinder implements LoggerFactoryBinder { private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder(); public static StaticLoggerBinder getSingleton() { return SINGLETON; } @Override public ILoggerFactory getLoggerFactory() { return new NOPLoggerFactory(); } @Override public String getLoggerFactoryClassStr() { return NOPLoggerFactory.class.getName(); } }
9231c468b1387870e4e7000dab2cf91f43e41667
346
java
Java
joverseerjar/src/org/joverseer/domain/structuredOrderResults/Kidnap.java
GnarlyDave/joverseer
70d67603507b85a6dcbbfcd29c4ddd0feb5166b4
[ "BSD-3-Clause" ]
3
2016-07-01T00:46:13.000Z
2020-06-19T09:46:40.000Z
joverseerjar/src/org/joverseer/domain/structuredOrderResults/Kidnap.java
GnarlyDave/joverseer
70d67603507b85a6dcbbfcd29c4ddd0feb5166b4
[ "BSD-3-Clause" ]
95
2015-07-21T13:40:35.000Z
2021-12-14T17:32:50.000Z
joverseerjar/src/org/joverseer/domain/structuredOrderResults/Kidnap.java
GnarlyDave/joverseer
70d67603507b85a6dcbbfcd29c4ddd0feb5166b4
[ "BSD-3-Clause" ]
2
2016-10-26T12:29:51.000Z
2017-08-08T21:38:31.000Z
17.3
56
0.684971
995,962
package org.joverseer.domain.structuredOrderResults; /** * Stores Kidnaps (Order result) * * @author Marios Skounakis * */ public class Kidnap implements IStructuredOrderResult { String target; public String getTarget() { return this.target; } public void setTarget(String target) { this.target = target; } }
9231c570911dfdf264134647de10f941ea43ded7
1,482
java
Java
src/main/java/com/ambrosoft/exercises/LCSPrinceton.java
JacekAmbroziak/Ambrosoft
e1a1c5e60fe51c7925f224647bf2137d62cc2c6d
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ambrosoft/exercises/LCSPrinceton.java
JacekAmbroziak/Ambrosoft
e1a1c5e60fe51c7925f224647bf2137d62cc2c6d
[ "Apache-2.0" ]
null
null
null
src/main/java/com/ambrosoft/exercises/LCSPrinceton.java
JacekAmbroziak/Ambrosoft
e1a1c5e60fe51c7925f224647bf2137d62cc2c6d
[ "Apache-2.0" ]
null
null
null
27.962264
84
0.402834
995,963
package com.ambrosoft.exercises; /** * Created by jacek on 1/9/17. */ public class LCSPrinceton { /* Sedgewick considers suffixes, not prefixes, which would work well with lists */ static String lcs(String s, String t) { int n = s.length(); int m = t.length(); int[][] opt = new int[n + 1][m + 1]; // bottom up filling of optimal length table for (int i = n; --i >= 0; ) { for (int j = m; --j >= 0; ) { if (s.charAt(i) == t.charAt(j)) { opt[i][j] = opt[i + 1][j + 1] + 1; } else { opt[i][j] = Math.max(opt[i + 1][j], opt[i][j + 1]); } } } final StringBuilder sb = new StringBuilder(Math.min(n, m)); for (int i = 0, j = 0; i < n && j < m; ) { if (s.charAt(i) == t.charAt(j)) { sb.append(s.charAt(i)); ++i; ++j; } else if (opt[i + 1][j] >= opt[i][j + 1]) { ++i; } else { ++j; } } return sb.toString(); } static void test(String s, String t) { String lcs = lcs(s, t); System.out.println(String.format("%s, %s -> %s", s, t, lcs)); } public static void main(String[] args) { test("abcba", "abba"); test("- - G G C - - A - C C A C G", "A C G G C G G A T - - A C G"); } }
9231c58d44a534665faebddb67022fa2b88ba4a8
2,323
java
Java
ToDo3/app/src/main/java/com/example/todo/MainActivity.java
pinhanderler/Software-Development-Methodologies
eaa081a61facd3aad87a0aaffcb54e85d45cda85
[ "MIT" ]
null
null
null
ToDo3/app/src/main/java/com/example/todo/MainActivity.java
pinhanderler/Software-Development-Methodologies
eaa081a61facd3aad87a0aaffcb54e85d45cda85
[ "MIT" ]
8
2021-03-24T16:15:22.000Z
2021-06-05T21:51:32.000Z
ToDo3/app/src/main/java/com/example/todo/MainActivity.java
pinhanderler/Software-Development-Methodologies
eaa081a61facd3aad87a0aaffcb54e85d45cda85
[ "MIT" ]
1
2021-02-23T11:42:33.000Z
2021-02-23T11:42:33.000Z
31.821918
91
0.733965
995,964
package com.example.todo; import android.content.DialogInterface; import android.os.Bundle; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.example.todo.Adapters.ToDoAdapter; import com.example.todo.Model.ToDoModel; import com.example.todo.Utils.DatabaseHandler; import com.google.android.material.floatingactionbutton.FloatingActionButton; import net.penguincoders.todo.R; import java.util.Collections; import java.util.List; import java.util.Objects; public class MainActivity extends AppCompatActivity implements DialogCloseListener { private DatabaseHandler db; private RecyclerView tasksRecyclerView; private ToDoAdapter tasksAdapter; private FloatingActionButton fab; private List<ToDoModel> taskList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Objects.requireNonNull(getSupportActionBar()).hide(); db = new DatabaseHandler(this); db.openDatabase(); tasksRecyclerView = findViewById(R.id.tasksRecyclerView); tasksRecyclerView.setLayoutManager(new LinearLayoutManager(this)); tasksAdapter = new ToDoAdapter(db,MainActivity.this); tasksRecyclerView.setAdapter(tasksAdapter); ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new RecyclerItemTouchHelper(tasksAdapter)); itemTouchHelper.attachToRecyclerView(tasksRecyclerView); fab = findViewById(R.id.fab); taskList = db.getAllTasks(); Collections.reverse(taskList); tasksAdapter.setTasks(taskList); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddNewTask.newInstance().show(getSupportFragmentManager(), AddNewTask.TAG); } }); } @Override public void handleDialogClose(DialogInterface dialog){ taskList = db.getAllTasks(); Collections.reverse(taskList); tasksAdapter.setTasks(taskList); tasksAdapter.notifyDataSetChanged(); } }
9231c5e92c20ca3fce2718f26d6c38a513907e16
313
java
Java
jbosscc-as7-examples-master/web-application-example/web-application-example-ejb/src/main/java/de/akquinet/jbosscc/dao/CommentDao.java
himnay/j2ee-jboss-examples
2d8a89ad2b47535638eca11afeb42d61f21902a7
[ "Apache-2.0" ]
1
2021-04-27T10:37:16.000Z
2021-04-27T10:37:16.000Z
jbosscc-as7-examples-master/web-application-example/web-application-example-ejb/src/main/java/de/akquinet/jbosscc/dao/CommentDao.java
himnay/j2ee-jboss-examples
2d8a89ad2b47535638eca11afeb42d61f21902a7
[ "Apache-2.0" ]
2
2022-01-21T23:21:38.000Z
2022-01-27T16:18:24.000Z
jbosscc-as7-examples-master/web-application-example/web-application-example-ejb/src/main/java/de/akquinet/jbosscc/dao/CommentDao.java
himnay/j2ee-jboss-examples
2d8a89ad2b47535638eca11afeb42d61f21902a7
[ "Apache-2.0" ]
1
2021-05-17T05:06:43.000Z
2021-05-17T05:06:43.000Z
18.411765
50
0.795527
995,965
package de.akquinet.jbosscc.dao; import java.util.List; import javax.ejb.Local; import de.akquinet.jbosscc.BlogEntry; import de.akquinet.jbosscc.Comment; import de.akquinet.jbosscc.dao.common.Dao; @Local public interface CommentDao extends Dao<Comment> { List<Comment> findComments(BlogEntry blogEntry); }
9231c6269d221181e731cd4300d63dd29be68433
240
java
Java
app/src/org/commcare/logging/DeviceReportElement.java
echisMOH/echisCommCareMOH
a3971fb19e3af1a2b3eba0f545e2930983405367
[ "Apache-2.0" ]
14
2017-04-12T14:38:33.000Z
2022-03-29T19:16:13.000Z
app/src/org/commcare/logging/DeviceReportElement.java
echisMOH/echisCommCareMOH
a3971fb19e3af1a2b3eba0f545e2930983405367
[ "Apache-2.0" ]
672
2016-06-27T13:39:09.000Z
2022-03-24T06:57:07.000Z
app/src/org/commcare/logging/DeviceReportElement.java
echisMOH/echisCommCareMOH
a3971fb19e3af1a2b3eba0f545e2930983405367
[ "Apache-2.0" ]
14
2016-09-24T09:26:00.000Z
2020-08-20T07:00:07.000Z
18.461538
74
0.783333
995,966
package org.commcare.logging; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; /** * @author ctsims */ public interface DeviceReportElement { void writeToDeviceReport(XmlSerializer serializer) throws IOException; }
9231c62889590cfa62dae1a27a1a8fba3f1c0a92
4,235
java
Java
zpoi/src/org/zkoss/poi/ss/usermodel/AutoFilter.java
Jonathan25021/dataspread-web
5ce273e334925eecabbd93c5759365a309ab6773
[ "MIT" ]
134
2017-11-02T20:05:40.000Z
2022-03-16T17:26:06.000Z
zpoi/src/org/zkoss/poi/ss/usermodel/AutoFilter.java
Jonathan25021/dataspread-web
5ce273e334925eecabbd93c5759365a309ab6773
[ "MIT" ]
144
2017-08-27T07:54:50.000Z
2022-02-17T17:48:58.000Z
zpoi/src/org/zkoss/poi/ss/usermodel/AutoFilter.java
Jonathan25021/dataspread-web
5ce273e334925eecabbd93c5759365a309ab6773
[ "MIT" ]
31
2017-06-04T12:30:05.000Z
2021-11-15T10:42:20.000Z
38.518182
115
0.681142
995,967
/* ==================================================================== 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.zkoss.poi.ss.usermodel; import java.util.List; import org.zkoss.poi.ss.util.CellRangeAddress; /** * Represents autofiltering for the specified worksheet. * * <p> * Filtering data is a quick and easy way to find and work with a subset of data in a range of cells or table. * For example, you can filter to see only the values that you specify, filter to see the top or bottom values, * or filter to quickly see duplicate values. * </p> * * TODO YK: For now (Aug 2010) POI only supports setting a basic autofilter on a range of cells. * In future, when we support more auto-filter functions like custom criteria, sort, etc. we will add * corresponding methods to this interface. */ public interface AutoFilter { /** * Apply a custom filter * * <p> * A custom AutoFilter specifies an operator and a value. * There can be at most two customFilters specified, and in that case the parent element * specifies whether the two conditions are joined by 'and' or 'or'. For any cells whose * values do not meet the specified criteria, the corresponding rows shall be hidden from * view when the filter is applied. * </p> * * <p> * Example: * <blockquote><pre> * AutoFilter filter = sheet.setAutoFilter(CellRangeAddress.valueOf("A1:F200")); * filter.applyFilter(0, FilterOperator.GreaterThanOrEqual", "0.2"); * filter.applyFilter(1, FilterOperator.LessThanOrEqual"", "0.5"); * </pre></blockquote> * </p> * * @param columnIndex 0-based column index * @param operator the operator to apply * @param criteria top or bottom value used in the filter criteria. * * TODO YK: think how to combine AutoFilter with with DataValidationConstraint, they are really close relatives * void applyFilter(int columnIndex, FilterOperator operator, String criteria); */ /** * Apply a filter against a list of values * * <p> * Example: * <blockquote><pre> * AutoFilter filter = sheet.setAutoFilter(CellRangeAddress.valueOf("A1:F200")); * filter.applyFilter(0, "apache", "poi", "java", "api"); * </pre></blockquote> * </p> * * @param columnIndex 0-based column index * @param values the filter values * * void applyFilter(int columnIndex, String ... values); */ //20110510, envkt@example.com //inner filterOp for #filter public final static int FILTEROP_AND = 0x01; public final static int FILTEROP_BOTTOM10 = 0x02; public final static int FILTEROP_BOTOOM10PERCENT = 0x03; public final static int FILTEROP_OR = 0x04; public final static int FILTEROP_TOP10 = 0x05; public final static int FILTEROP_TOP10PERCENT = 0x06; public final static int FILTEROP_VALUES = 0x07; /** * Returns the filtered Range. */ CellRangeAddress getRangeAddress(); /** * Return filter setting of each filtered column. */ List<FilterColumn> getFilterColumns(); /** * Returns the column filter information of the specified column; null if the column is not filtered. * @param col the nth column (1st column in the filter range is 0) * @return the column filter information of the specified column; null if the column is not filtered. */ FilterColumn getFilterColumn(int col); }
9231c658070fdc1a8f077a843a45fb4c55949b40
997
java
Java
src/main/java/com/litongjava/utils/io/StreamUtils.java
litongjava/litongjava-utils
a94c37604631868c037d30f11080c9f749b022ba
[ "Apache-2.0" ]
null
null
null
src/main/java/com/litongjava/utils/io/StreamUtils.java
litongjava/litongjava-utils
a94c37604631868c037d30f11080c9f749b022ba
[ "Apache-2.0" ]
null
null
null
src/main/java/com/litongjava/utils/io/StreamUtils.java
litongjava/litongjava-utils
a94c37604631868c037d30f11080c9f749b022ba
[ "Apache-2.0" ]
null
null
null
23.738095
78
0.682046
995,968
package com.litongjava.utils.io; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; /** * @author bill robot * @date 2020年8月22日_上午1:08:25 * @version 1.0 * @desc */ public class StreamUtils { public static final int BUFFER_SIZE = 4096; public static int copy(InputStream in, OutputStream out) throws IOException{ int byteCount = 0; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); byteCount += bytesRead; } return byteCount; } public static void copy(File file, OutputStream outputStream) { FileInputStream fileInputStream=null; try { fileInputStream = new FileInputStream(file); copy(fileInputStream, outputStream); } catch (IOException e) { e.printStackTrace(); }finally { IOUtils.closeQuietly(fileInputStream); } } }
9231c69e651e7684710fc32de0d7e9f4a189c0dd
703
java
Java
2019/src/main/java/com/github/mtjody/day1/FuelCalculator.java
MTjody/advent-of-code
70ba8bc010e114dfc9fc2a97a718befde444bf0a
[ "Apache-2.0" ]
null
null
null
2019/src/main/java/com/github/mtjody/day1/FuelCalculator.java
MTjody/advent-of-code
70ba8bc010e114dfc9fc2a97a718befde444bf0a
[ "Apache-2.0" ]
null
null
null
2019/src/main/java/com/github/mtjody/day1/FuelCalculator.java
MTjody/advent-of-code
70ba8bc010e114dfc9fc2a97a718befde444bf0a
[ "Apache-2.0" ]
null
null
null
31.954545
115
0.621622
995,969
package com.github.mtjody.day1; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.stream.Stream; public class FuelCalculator { public static void main(String[] args) { String fileName = new FuelCalculator().getClass().getClassLoader().getResource("day1/input.txt").getFile(); try (Stream<String> lines = Files.lines(Paths.get(fileName))) { int result = lines.mapToInt(numAsString -> Integer.parseInt(numAsString)) .map(num -> num / 3 - 2) .sum(); System.out.print("Result is " + result); } catch (IOException e) { e.printStackTrace(); } } }
9231c7042e09f9d8848855572c53f2e2953b20a2
1,604
java
Java
tigergraph/src/main/java/com/ldbc/impls/workloads/ldbc/snb/tigergraph/TigerGraphDbConnectionState.java
jackliantigergraph/ldbc_snb_interactive_impls
58c4c2950348ea42b2e67dc516b9e74c965041b5
[ "Apache-2.0" ]
null
null
null
tigergraph/src/main/java/com/ldbc/impls/workloads/ldbc/snb/tigergraph/TigerGraphDbConnectionState.java
jackliantigergraph/ldbc_snb_interactive_impls
58c4c2950348ea42b2e67dc516b9e74c965041b5
[ "Apache-2.0" ]
null
null
null
tigergraph/src/main/java/com/ldbc/impls/workloads/ldbc/snb/tigergraph/TigerGraphDbConnectionState.java
jackliantigergraph/ldbc_snb_interactive_impls
58c4c2950348ea42b2e67dc516b9e74c965041b5
[ "Apache-2.0" ]
2
2022-01-25T20:50:36.000Z
2022-02-02T19:08:23.000Z
30.264151
100
0.725062
995,970
package com.ldbc.impls.workloads.ldbc.snb.tigergraph; import com.ldbc.impls.workloads.ldbc.snb.BaseDbConnectionState; import io.github.karol_brejna_i.tigergraph.restppclient.api.QueryApi; import io.github.karol_brejna_i.tigergraph.restppclient.invoker.ApiClient; import io.github.karol_brejna_i.tigergraph.restppclient.invoker.Configuration; import java.io.IOException; import java.util.Map; public class TigerGraphDbConnectionState extends BaseDbConnectionState<TigerGraphQueryStore> { protected final String endpoint; private final QueryApi apiInstance; private final String graphName; private final boolean debug; public TigerGraphDbConnectionState(Map<String, String> properties, TigerGraphQueryStore store) { super(properties, store); this.endpoint = properties.get("endpoint"); this.graphName = properties.get("databaseName"); String debugValue = properties.getOrDefault("debug", "false"); this.debug = Boolean.parseBoolean(debugValue); ApiClient defaultApiClient = Configuration.getDefaultApiClient(); defaultApiClient.setBasePath(this.endpoint); Configuration.setDefaultApiClient(defaultApiClient); this.apiInstance = new QueryApi(); } @Override public void close() throws IOException { // no-op } public QueryApi getApiInstance() { return apiInstance; } public String getGraphName() { return graphName; } public boolean isPrintNames() { return printNames; } public boolean isDebug() { return debug; } }
9231c7afd4d89eee6abc05b67137eadac445e3b5
636
java
Java
robotium-solo/src/main/java/com/samstewart/hadaly/actions/ScrollAction.java
upsight/Hadaly
b9b016aea7fafa8c7ae6aab06209d672cb99070c
[ "Apache-2.0" ]
null
null
null
robotium-solo/src/main/java/com/samstewart/hadaly/actions/ScrollAction.java
upsight/Hadaly
b9b016aea7fafa8c7ae6aab06209d672cb99070c
[ "Apache-2.0" ]
null
null
null
robotium-solo/src/main/java/com/samstewart/hadaly/actions/ScrollAction.java
upsight/Hadaly
b9b016aea7fafa8c7ae6aab06209d672cb99070c
[ "Apache-2.0" ]
null
null
null
20.516129
87
0.759434
995,971
package com.samstewart.hadaly.actions; import android.app.Activity; import android.graphics.PointF; import android.test.InstrumentationTestCase; import android.view.View; /** * Simple scroll action on a scrollview */ public class ScrollAction implements Action { public ScrollAction(PointF scrollStart, PointF scrollEnd) { } @Override public void setView(View view) { // TODO Auto-generated method stub } @Override public void doAction(Activity activity, InstrumentationTestCase testCase, View view) { // TODO Auto-generated method stub // view.setSelection(lineToMoveTo); // .scrollBy, .smoothScrollBy } }
9231c84bfb9e21d4e3bbd9128bc4a4553da4a781
93
java
Java
corpus/class/eclipse.jdt.ui/8731.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/eclipse.jdt.ui/8731.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/eclipse.jdt.ui/8731.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
7.75
20
0.451613
995,972
package p; class A { int[] m()[] { return null; } } class B extends A { }
9231c87d198473b90c2c60e553eee45e51875df6
28,658
java
Java
wonderjam-boot/src/test/java/hu/cherubits/wonderjam/TopFlavonContentTest.java
lordoftheflies/wonderjameeee
618bd07e3d4c37fec193c6564892f3ec6956c357
[ "MIT" ]
null
null
null
wonderjam-boot/src/test/java/hu/cherubits/wonderjam/TopFlavonContentTest.java
lordoftheflies/wonderjameeee
618bd07e3d4c37fec193c6564892f3ec6956c357
[ "MIT" ]
4
2017-08-19T12:48:16.000Z
2017-08-20T13:01:37.000Z
wonderjam-boot/src/test/java/hu/cherubits/wonderjam/TopFlavonContentTest.java
lordoftheflies/wonderjameeee
618bd07e3d4c37fec193c6564892f3ec6956c357
[ "MIT" ]
null
null
null
55.589147
504
0.733545
995,973
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package hu.cherubits.wonderjam; import hu.cherubits.wonderjam.common.ContentType; import hu.cherubits.wonderjam.dal.AccountRepository; import hu.cherubits.wonderjam.dal.ContainerContentRepository; import hu.cherubits.wonderjam.dal.ContentRepository; import hu.cherubits.wonderjam.dal.LocaleRepository; import hu.cherubits.wonderjam.dal.MailBoxRepository; import hu.cherubits.wonderjam.dal.MessageRepository; import hu.cherubits.wonderjam.dal.NetworkTreeRepository; import hu.cherubits.wonderjam.dal.ResourceRepository; import hu.cherubits.wonderjam.entities.AccountEntity; import hu.cherubits.wonderjam.entities.ContainerContentEntity; import hu.cherubits.wonderjam.entities.ContentEntity; import hu.cherubits.wonderjam.entities.ImageContentEntity; import hu.cherubits.wonderjam.entities.LocaleEntity; import hu.cherubits.wonderjam.entities.MailBoxEntity; import hu.cherubits.wonderjam.entities.NetworkNodeEntity; import hu.cherubits.wonderjam.entities.NetworkNodeType; import hu.cherubits.wonderjam.entities.ReferenceContentEntity; import hu.cherubits.wonderjam.entities.TextContentEntity; import hu.cherubits.wonderjam.entities.VideoContentEntity; import java.util.UUID; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.junit.FixMethodOrder; import org.junit.runners.MethodSorters; /** * * @author lordoftheflies */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TopFlavonContentTest extends ChristeamServerApplicationTests { // @Autowired // private WebApplicationContext webApplicationContext; // // @Autowired // private ContentManagementService contentManagementServiceMock; // private MediaType contentType = new MediaType(MediaType.APPLICATION_JSON.getType(), // MediaType.APPLICATION_JSON.getSubtype(), // Charset.forName("utf8")); @Autowired private ContentRepository contentRepository; @Autowired private ContainerContentRepository containerContentRepository; @Autowired private NetworkTreeRepository networkRepo; @Autowired private AccountRepository accountRepo; @Autowired private MessageRepository messageRepository; @Autowired private LocaleRepository localeDao; @Autowired private ResourceRepository resourceDao; @Autowired private MailBoxRepository mailBoxRepository; private final String SPOON_ICON = "wonderjam-icons:spoon"; private final String CAN_ICON = "wonderjam-icons:can"; @Test public void atestCleanUp() { messageRepository.deleteAll(); contentRepository.deleteAll(); containerContentRepository.deleteAll(); accountRepo.deleteAll(); mailBoxRepository.deleteAll(); networkRepo.deleteAll(); } private NetworkNodeEntity heglasNode; private NetworkNodeEntity balazspeczelyNode; @Test public void btestLocale() { LocaleEntity englishLocale = new LocaleEntity(); englishLocale.setDisplayName("English"); englishLocale.setLanguageCode("en"); localeDao.save(englishLocale); LocaleEntity polishLocale = new LocaleEntity(); polishLocale.setDisplayName("Polskie"); polishLocale.setLanguageCode("po"); localeDao.save(polishLocale); LocaleEntity hungarianLocale = new LocaleEntity(); hungarianLocale.setDisplayName("Magyar"); hungarianLocale.setLanguageCode("hu"); localeDao.save(hungarianLocale); } @Test public void ctestNetwork() { AccountEntity heglas = new AccountEntity(); heglas.setEmail("anpch@example.com"); heglas.setName("Teszt adminisztrátor"); heglas.setPassword("qwe123"); heglas.setPreferredLanguage("en"); heglas = accountRepo.save(heglas); heglasNode = new NetworkNodeEntity(); heglasNode.setActive(true); heglasNode.setCodes(1); heglas.setState(NetworkNodeType.ADMIN); heglasNode = networkRepo.save(heglasNode); heglas.setNode(heglasNode); heglas = accountRepo.save(heglas); MailBoxEntity heglasMb = new MailBoxEntity(); heglasMb.setOwner(heglasNode); mailBoxRepository.save(heglasMb); AccountEntity balazspeczely = new AccountEntity(); balazspeczely.setEmail("dycjh@example.com"); balazspeczely.setName("Teszt felhasználó"); balazspeczely.setPassword("qwe123"); balazspeczely.setPreferredLanguage("hu"); balazspeczely = accountRepo.save(balazspeczely); balazspeczelyNode = new NetworkNodeEntity(); balazspeczelyNode.setActive(true); balazspeczelyNode.setCodes(2); balazspeczely.setState(NetworkNodeType.USER); balazspeczelyNode = networkRepo.save(balazspeczelyNode); balazspeczely.setNode(balazspeczelyNode); balazspeczely = accountRepo.save(balazspeczely); MailBoxEntity balazspeczelyMb = new MailBoxEntity(); balazspeczelyMb.setOwner(balazspeczelyNode); mailBoxRepository.save(balazspeczelyMb); AccountEntity cseszkupopoveszku = new AccountEntity(); cseszkupopoveszku.setEmail("hzdkv@example.com"); cseszkupopoveszku.setName("Cherubits (Adminisztrátor)"); cseszkupopoveszku.setPassword("qwe123"); cseszkupopoveszku.setPreferredLanguage("en"); cseszkupopoveszku = accountRepo.save(cseszkupopoveszku); NetworkNodeEntity cseszkupopoveszkuNode = new NetworkNodeEntity(); cseszkupopoveszku.setState(NetworkNodeType.ADMIN); cseszkupopoveszkuNode.setActive(true); cseszkupopoveszkuNode.setCodes(3); cseszkupopoveszkuNode = networkRepo.save(cseszkupopoveszkuNode); cseszkupopoveszku.setNode(cseszkupopoveszkuNode); cseszkupopoveszku = accountRepo.save(cseszkupopoveszku); MailBoxEntity cseszkupopoveszkuMb = new MailBoxEntity(); cseszkupopoveszkuMb.setOwner(cseszkupopoveszkuNode); mailBoxRepository.save(cseszkupopoveszkuMb); AccountEntity parazita = new AccountEntity(); parazita.setEmail("envkt@example.com"); parazita.setName("Cherubits (Felhasználó)"); parazita.setPassword("qwe123"); parazita.setPreferredLanguage("hu"); parazita = accountRepo.save(parazita); NetworkNodeEntity parazitaNode = new NetworkNodeEntity(); parazitaNode.setActive(true); parazitaNode.setCodes(4); parazita.setState(NetworkNodeType.USER); parazitaNode = networkRepo.save(parazitaNode); parazita.setNode(parazitaNode); parazita = accountRepo.save(parazita); MailBoxEntity parazitaMb = new MailBoxEntity(); parazitaMb.setOwner(parazitaNode); mailBoxRepository.save(parazitaMb); AccountEntity tesztelek = new AccountEntity(); tesztelek.setEmail("lyhxr@example.com"); tesztelek.setName("Teszt Elek"); tesztelek.setPassword("qwe123"); tesztelek.setPreferredLanguage("hu"); tesztelek = accountRepo.save(tesztelek); NetworkNodeEntity tesztelekNode = new NetworkNodeEntity(); tesztelekNode.setActive(true); tesztelek.setState(NetworkNodeType.USER); tesztelekNode.setCodes(5); tesztelekNode = networkRepo.save(tesztelekNode); tesztelek.setNode(tesztelekNode); tesztelek = accountRepo.save(tesztelek); MailBoxEntity tesztelekMb = new MailBoxEntity(); tesztelekMb.setOwner(tesztelekNode); mailBoxRepository.save(tesztelekMb); AccountEntity feriahegyrol = new AccountEntity(); feriahegyrol.setEmail("anpch@example.com"); feriahegyrol.setName("Ferdinand Highlander"); feriahegyrol.setPassword("qwe123"); feriahegyrol = accountRepo.save(feriahegyrol); feriahegyrol.setPreferredLanguage("en"); NetworkNodeEntity feriahegyrolNode = new NetworkNodeEntity(); feriahegyrolNode.setActive(true); feriahegyrol.setState(NetworkNodeType.USER); feriahegyrolNode.setCodes(6); feriahegyrolNode = networkRepo.save(feriahegyrolNode); feriahegyrol.setNode(feriahegyrolNode); feriahegyrol = accountRepo.save(feriahegyrol); MailBoxEntity feriahegyrolMb = new MailBoxEntity(); feriahegyrolMb.setOwner(feriahegyrolNode); mailBoxRepository.save(feriahegyrolMb); AccountEntity romanok = new AccountEntity(); romanok.setName("Digitális Védelem"); romanok = accountRepo.save(romanok); NetworkNodeEntity romanokNode = new NetworkNodeEntity(); romanokNode.setActive(true); romanokNode.setCodes(7); romanok.setState(NetworkNodeType.GROUP); romanokNode = networkRepo.save(romanokNode); romanok.setNode(romanokNode); romanok = accountRepo.save(romanok); AccountEntity gorogok = new AccountEntity(); gorogok.setName("Görögország"); gorogok = accountRepo.save(gorogok); NetworkNodeEntity gorogokNode = new NetworkNodeEntity(); gorogokNode.setActive(true); gorogokNode.setCodes(8); gorogokNode = networkRepo.save(gorogokNode); gorogok.setNode(gorogokNode); gorogok.setState(NetworkNodeType.GROUP); gorogok = accountRepo.save(gorogok); AccountEntity magyarok = new AccountEntity(); magyarok.setName("Magyarország"); magyarok = accountRepo.save(magyarok); NetworkNodeEntity magyarokNode = new NetworkNodeEntity(); magyarokNode.setActive(true); magyarokNode.setCodes(9); magyarok.setState(NetworkNodeType.GROUP); magyarokNode = networkRepo.save(magyarokNode); magyarok.setNode(magyarokNode); magyarok = accountRepo.save(magyarok); magyarokNode.setParent(heglasNode); networkRepo.save(magyarokNode); balazspeczelyNode.setParent(heglasNode); networkRepo.save(balazspeczelyNode); romanokNode.setParent(heglasNode); networkRepo.save(romanokNode); cseszkupopoveszkuNode.setParent(romanokNode); networkRepo.save(cseszkupopoveszkuNode); gorogokNode.setParent(balazspeczelyNode); networkRepo.save(gorogokNode); tesztelekNode.setParent(balazspeczelyNode); networkRepo.save(tesztelekNode); feriahegyrolNode.setParent(balazspeczelyNode); networkRepo.save(feriahegyrolNode); parazitaNode.setParent(romanokNode); networkRepo.save(parazitaNode); } /** * Test of publish method, of class ContentManagementService. */ @Test public void dtestCustomArticle() throws Exception { System.out.println("publish"); ContainerContentEntity productsContainer = new ContainerContentEntity(); productsContainer.setContentType(ContentType.linked); productsContainer.setNode(heglasNode); productsContainer.setPublicIndicator(true); productsContainer.setTitle("Products"); productsContainer = containerContentRepository.save(productsContainer); ContainerContentEntity flavonEndActiveContainer = new ContainerContentEntity(); flavonEndActiveContainer.setContentType(ContentType.assembled); flavonEndActiveContainer.setDraft(false); flavonEndActiveContainer.setNode(heglasNode); flavonEndActiveContainer.setPublicIndicator(true); flavonEndActiveContainer.setTitle("FLAVON ACTIVE"); flavonEndActiveContainer.setParent(productsContainer); flavonEndActiveContainer = containerContentRepository.save(flavonEndActiveContainer); text(flavonEndActiveContainer, null, FLAVON_ACTIVE_P0_ENG, 0); image(flavonEndActiveContainer, FLAVON_ACTIVE_PNG, 1); oeti(flavonEndActiveContainer, FLAVON_ACTIVE_OETI, FLAVON_ACTIVE_SPOON, FLAVON_ACTIVE_CAN, 2); text(flavonEndActiveContainer, null, FLAVON_ACTIVE_P1_ENG, 3); text(flavonEndActiveContainer, null, FLAVON_ACTIVE_P2_ENG, 4); text(flavonEndActiveContainer, FLAVON_ACTIVE_T3_ENG, "<ul>" + "<li>who has an active, dynamic, sporty lifestyle</li>" + "<li>who craves for healthy stimulation</li>" + "<li>who wants to successfully meet the challenges of the 21st century</li>" + "<li>who would like to enjoy the benefits of today’s super fruits</li>" + "</ul>", 5); ContainerContentEntity flavonGreenContainer = new ContainerContentEntity(); flavonGreenContainer.setContentType(ContentType.assembled); flavonGreenContainer.setDraft(false); flavonGreenContainer.setNode(heglasNode); flavonGreenContainer.setPublicIndicator(true); flavonGreenContainer.setTitle("FLAVON GREEN"); flavonGreenContainer.setParent(productsContainer); flavonGreenContainer = containerContentRepository.save(flavonGreenContainer); text(flavonGreenContainer, null, FLAVON_GREEN_P0_ENG, 0); image(flavonGreenContainer, FLAVON_GREEN_PNG, 1); oeti(flavonGreenContainer, FLAVON_GREEN_OETI, FLAVON_GREEN_SPOON, FLAVON_GREEN_CAN, 2); text(flavonGreenContainer, null, FLAVON_GREEN_P1_ENG, 3); text(flavonGreenContainer, null, FLAVON_GREEN_P2_ENG, 4); text(flavonGreenContainer, FLAVON_GREEN_T3_ENG, "<ul>" + "<li>who cannot ensure the intake of sufficient vegetables</li>" + "<li>who considers it important to continuously take in vitamins and minerals from a pure source</li>" + "<li>who would like to consume vegetables in a new form they have not tried before</li>" + "<li>who is a conscientious consumer and would like to complete a modern diet</li>" + "</ul>", 5); ContainerContentEntity flavonMaxContainer = new ContainerContentEntity(); flavonMaxContainer.setContentType(ContentType.assembled); flavonMaxContainer.setDraft(false); flavonMaxContainer.setNode(heglasNode); flavonMaxContainer.setPublicIndicator(true); flavonMaxContainer.setTitle("FLAVON MAX"); flavonMaxContainer.setParent(productsContainer); flavonMaxContainer = containerContentRepository.save(flavonMaxContainer); text(flavonMaxContainer, null, FLAVON_MAX_P0_ENG, 0); image(flavonMaxContainer, FLAVON_MAX_PNG, 1); oeti(flavonMaxContainer, FLAVON_MAX_OETI, FLAVON_MAX_SPOON, FLAVON_MAX_CAN, 2); text(flavonMaxContainer, null, FLAVON_MAX_P1_ENG, 3); text(flavonMaxContainer, null, FLAVON_MAX_P2_ENG, 4); text(flavonMaxContainer, FLAVON_MAX_T3_ENG, "<ul>" + "<li>who does not consume enough fruits</li>" + "<li>who wants to complement their current one-sided nutrition</li>" + "<li>who takes good care of the their own and their family’s health</li>" + "<li>who wants to enjoy and take advantage of an innovative product</li>" + "</ul>", 5); ContainerContentEntity flavonJoyContainer = new ContainerContentEntity(); flavonJoyContainer.setContentType(ContentType.assembled); flavonJoyContainer.setDraft(false); flavonJoyContainer.setNode(heglasNode); flavonJoyContainer.setPublicIndicator(true); flavonJoyContainer.setTitle("FLAVON JOY"); flavonJoyContainer.setParent(productsContainer); flavonJoyContainer = containerContentRepository.save(flavonJoyContainer); text(flavonJoyContainer, null, FLAVON_JOY_P0_ENG, 0); image(flavonJoyContainer, FLAVON_JOY_PNG, 1); oeti(flavonJoyContainer, FLAVON_JOY_OETI, FLAVON_JOY_SPOON, FLAVON_JOY_CAN, 2); text(flavonJoyContainer, null, FLAVON_JOY_P1_ENG, 3); text(flavonJoyContainer, null, FLAVON_JOY_P2_ENG, 4); text(flavonJoyContainer, FLAVON_JOY_T3_ENG, "<ul>" + "<li>who is exposed to constant stress, does sport regularly</li>" + "<li>who needs more mental energy</li>" + "<li>who would like to satisfy their desire for sweets in a healthy way</li>" + "<li>who wants to make a conscious choice of cocoa bean, ancient spices and the synergy of super fruits and vegetables</li>" + "</ul>", 5); ContainerContentEntity videosContainer = new ContainerContentEntity(); videosContainer.setContentType(ContentType.linked); videosContainer.setNode(heglasNode); videosContainer.setPublicIndicator(true); videosContainer.setTitle("Medical presentations"); videosContainer = containerContentRepository.save(videosContainer); ContainerContentEntity video1Container = new ContainerContentEntity(); video1Container.setContentType(ContentType.linked); video1Container.setParent(videosContainer); video1Container.setNode(heglasNode); video1Container.setPublicIndicator(true); video1Container.setTitle("Lisa Ann Robinson"); video1Container = containerContentRepository.save(video1Container); video(video1Container, null, "/backend/video/LisaAnnRobinson.mp4", 0); ContainerContentEntity video1ContainerYoutube = new ContainerContentEntity(); video1ContainerYoutube.setContentType(ContentType.linked); video1ContainerYoutube.setParent(videosContainer); video1ContainerYoutube.setNode(heglasNode); video1ContainerYoutube.setPublicIndicator(true); video1ContainerYoutube.setTitle("Lisa Ann Robinson (Youtube)"); video1ContainerYoutube = containerContentRepository.save(video1ContainerYoutube); video(video1ContainerYoutube, null, "https://youtu.be/v7Osy8OpoOk", 0); ContainerContentEntity video2Container = new ContainerContentEntity(); video2Container.setContentType(ContentType.linked); video2Container.setParent(videosContainer); video2Container.setNode(heglasNode); video2Container.setPublicIndicator(true); video2Container.setTitle("Dr. Leonard Ariel Lado"); video2Container = containerContentRepository.save(video2Container); video(video2Container, null, "/backend/video/DrLeonardArielLado.mp4", 1); ContainerContentEntity video2ContainerYoutube = new ContainerContentEntity(); video2ContainerYoutube.setContentType(ContentType.linked); video2ContainerYoutube.setParent(videosContainer); video2ContainerYoutube.setNode(heglasNode); video2ContainerYoutube.setPublicIndicator(true); video2ContainerYoutube.setTitle("Dr. Leonard Ariel Lado (Youtube)"); video2ContainerYoutube = containerContentRepository.save(video2ContainerYoutube); video(video2ContainerYoutube, null, "https://youtu.be/8Fua1F_RYWM", 1); ContainerContentEntity video3Container = new ContainerContentEntity(); video3Container.setContentType(ContentType.linked); video3Container.setParent(videosContainer); video3Container.setNode(heglasNode); video3Container.setPublicIndicator(true); video3Container.setTitle("Dr. Brian Thornburg"); video3Container = containerContentRepository.save(video3Container); video(video3Container, null, "/backend/video/DrBrianThornburg.mp4", 2); ContainerContentEntity video3ContainerYoutube = new ContainerContentEntity(); video3ContainerYoutube.setContentType(ContentType.linked); video3ContainerYoutube.setParent(videosContainer); video3ContainerYoutube.setNode(heglasNode); video3ContainerYoutube.setPublicIndicator(true); video3ContainerYoutube.setTitle("Dr. Brian Thornburg (Youtube)"); video3ContainerYoutube = containerContentRepository.save(video3ContainerYoutube); video(video3ContainerYoutube, null, "https://youtu.be/DyS2jC0DLZc", 2); ContainerContentEntity video4Container = new ContainerContentEntity(); video4Container.setContentType(ContentType.linked); video4Container.setParent(productsContainer); video4Container.setNode(heglasNode); video4Container.setPublicIndicator(true); video4Container.setTitle("Flavon"); video4Container = containerContentRepository.save(video4Container); video(video4Container, null, "https://www.youtube.com/watch?v=MArvZyBm_bU", 3); } private VideoContentEntity video(ContainerContentEntity container, String title, String content, int index) { VideoContentEntity flavonEndActiveParagraph0 = new VideoContentEntity(); flavonEndActiveParagraph0.setTitle(title); flavonEndActiveParagraph0.setContent(content); flavonEndActiveParagraph0.setFontSize(12); flavonEndActiveParagraph0.setOrderIndex(index); flavonEndActiveParagraph0.setParent(container); flavonEndActiveParagraph0.setWidth(1000); flavonEndActiveParagraph0.setHeight(600); flavonEndActiveParagraph0 = contentRepository.save(flavonEndActiveParagraph0); return flavonEndActiveParagraph0; } private TextContentEntity text(ContainerContentEntity container, String title, String content, int index) { TextContentEntity flavonEndActiveParagraph0 = new TextContentEntity(); flavonEndActiveParagraph0.setTitle(title); flavonEndActiveParagraph0.setContent(content); flavonEndActiveParagraph0.setFontSize(12); flavonEndActiveParagraph0.setOrderIndex(index); flavonEndActiveParagraph0.setParent(container); flavonEndActiveParagraph0 = contentRepository.save(flavonEndActiveParagraph0); return flavonEndActiveParagraph0; } private ImageContentEntity image(ContainerContentEntity container, String image, int index) { ImageContentEntity p = new ImageContentEntity(); p.setContent("/data/" + image); p.setHeight(300); p.setOrderIndex(index); p.setParent(container); p.setWidth(300); p = contentRepository.save(p); return p; } private TextContentEntity oeti(ContainerContentEntity container, String oeti, int spoon, int can, int index) { TextContentEntity p = new TextContentEntity(); p.setTitle(FLAVON_ACTIVE_OETI); p.setContent("<ul>" + "<li><span>1</span> x <iron-icon icon=\"" + SPOON_ICON + "\"></iron-icon>=<span>" + spoon + "</span><label>T-ORAC</label></li>" + "<li><span>1</span> x <iron-icon icon=\"" + CAN_ICON + "\"></iron-icon>=<span>" + can + "</span><label>T-ORAC</label></li>" + "</ul>"); p.setFontSize(12); p.setOrderIndex(index); p.setParent(container); p = contentRepository.save(p); return p; } private static final String FLAVON_ACTIVE_OETI = "OÉTI notification number: 10026/2011"; private static final String FLAVON_ACTIVE_T3_ENG = "The consumption of Flavon Active is recommended for everyone"; private static final String FLAVON_ACTIVE_P2_ENG = "The fifth member of our product line is again the result of serious innovation. The product is a possible solution to the challenges of present times. It helps us every day to do our best even when we are under high pressure."; private static final String FLAVON_ACTIVE_P1_ENG = "We often hear that this accelerated rhythm calls for some response. What can we do? We should not react to challenges by ruining our body! Both our body and soul need to stay healthy because they are indispensable for an active life."; private static final String FLAVON_ACTIVE_P0_ENG = "If we want to stay on top, to meet the expectations and face the challenges of the 21st century, to keep up with the accelerated pace of the world, we need to live a conscious and active life. This challenge affects all of us."; private static final String FLAVON_ACTIVE_PNG = "flavon_active.png"; private static final int FLAVON_ACTIVE_CAN = 1523760; private static final int FLAVON_ACTIVE_SPOON = 38094; private static final String FLAVON_GREEN_OETI = "OÉTI notification number: 10027/2011"; private static final String FLAVON_GREEN_T3_ENG = "The consumption of Flavon Green is recommended for adults"; private static final String FLAVON_GREEN_P2_ENG = "Although numerous researches prove that regular vegetable consumption protects our health, only a few people consume the required amount day by day. Flavon Green can be the solution, because we can cover the significant part of the daily vegetable intake with a product constituted of only well-selected ingredients of high quality."; private static final String FLAVON_GREEN_P1_ENG = "Flavon Green provides the positive physiological effects of vegetables in a complex way. The included vegetables help us maintain a balanced diet rich in vitamins, minerals, antioxidants and fibres."; private static final String FLAVON_GREEN_P0_ENG = "Regular vegetable consumption is a significant and inevitable part of healthy nutrition. Vegetables supply our body with essential nutrients, fibre and vitamins and have a beneficial effect on our general well-being. Flavon Green is a revolutionary product, a true innovation for vegetable consumption that reshapes previous habits."; private static final String FLAVON_GREEN_PNG = "flavon_green.png"; private static final int FLAVON_GREEN_CAN = 482880; private static final int FLAVON_GREEN_SPOON = 12072; private static final String FLAVON_MAX_OETI = "OÉTI notification number: 10029/2011"; private static final String FLAVON_MAX_T3_ENG = "The consumption of Flavon Max is recommended for everybody"; private static final String FLAVON_MAX_P2_ENG = "Flavon max was created for the people of the 21st century. It is a health-conscious product that supports life quality and its plant ingredients help the proper function of the antioxidant defence system and suitably support the function of the immune system."; private static final String FLAVON_MAX_P1_ENG = "High quality dietary supplements play a major role in one’s nutrition today. By constantly consuming them we might prevent the occurrence of deficiency symptoms caused by inadequate nutrition. Flavon broke with previous methods! Instead of pills and powder, it created a delicious and easily consumable gel-consistency form which makes it possible for its product to supply the human body with the necessary active substances."; private static final String FLAVON_MAX_P0_ENG = "The lifestyle of the 21st century including increasing daily stress, polluted environment, and nutrition deficiencies has extremely bad effects on our body and organism. Our body needs help to be able to win over these negative effects."; private static final String FLAVON_MAX_PNG = "flavon_max.png"; private static final int FLAVON_MAX_CAN = 435840; private static final int FLAVON_MAX_SPOON = 10896; private static final String FLAVON_JOY_OETI = "OÉTI notification number: 16853/2015"; private static final String FLAVON_JOY_T3_ENG = "The consumption of Flavon Joy is recommended for everyone"; private static final String FLAVON_JOY_P2_ENG = "Flavon Joy delivers polyphenols to our body in a complex way to keep it healthy, and in case of health conscious consuming, not only does it protect the health of our organism, it may also boost our mental/psychical characteristics, learning skills and shock absorbing capacity."; private static final String FLAVON_JOY_P1_ENG = "From children, through pregnant women and adults exposed to stronger oxidative stress, up to the older generation, anyone can consume it who craves for a tasty, sweet dietary supplement that has unique physiological effects at the same time."; private static final String FLAVON_JOY_P0_ENG = "Premium category Flavon Joy includes one of the ancient natural treasures, the fruit of cocoa tree due to which it has become a curio on the market of dietary supplements. Keeping the gel-consistency that is beneficial regarding bioavailability, we combined such fruit and vegetable ingredients and spices that have strong synergetic interactions, thus by enhancing each other’s effects. Therefore, it protects and pampers our body in all age group."; private static final String FLAVON_JOY_PNG = "flavon_green.png"; private static final int FLAVON_JOY_CAN = 2424240; private static final int FLAVON_JOY_SPOON = 60606; }
9231c9d60a0c22b17bca47d695d548f11a3160d6
4,884
java
Java
src/main/java/ProductionRecord.java
dmiless/OOPProductionProject
9cdba18178954e44a4661a6c3f423366910c4a96
[ "MIT" ]
null
null
null
src/main/java/ProductionRecord.java
dmiless/OOPProductionProject
9cdba18178954e44a4661a6c3f423366910c4a96
[ "MIT" ]
null
null
null
src/main/java/ProductionRecord.java
dmiless/OOPProductionProject
9cdba18178954e44a4661a6c3f423366910c4a96
[ "MIT" ]
null
null
null
25.305699
99
0.664005
995,974
import java.util.Date; /** * The ProductionRecord class for adding new product info from GUI and pass back to display data. * * @author Dylan Miles */ public class ProductionRecord { /** * the int to hold the product number of the product. */ private int productionNumber; /** * the int to hold the product ID of the product. */ private int productId; /** * the String to hold the serialNumber of the product. */ private String serialNumber; /** * the Date to hold the dateProduced of the product. */ private Date dateProduced; /** * the String to hold the name of the product. */ private String productName; /** * ProductionRecord constructor to construct the new data from the passed information. * * @param product - product class passed to access that info * @param prodCount - count of products */ public ProductionRecord(Product product, int prodCount) { this.productionNumber = prodCount; this.productId = product.getId(); this.serialNumber = getSerialNum(product.getManufacturer(), product.getType(), prodCount); this.dateProduced = new Date(); this.productName = product.getName(); } /** * getSerialNum method to set the serial number from the passed arguments and increment the count * of audio/visual. * * @param manufacturer - to take first 3 letters of manufacturer * @param type - check the item type to increment * @param prodCount - increase the count of item type * @return String - fully constructed serial number */ public String getSerialNum(String manufacturer, ItemType type, int prodCount) { if (type.label.equals("AU") || type.label.equals("AM")) { Controller.audioCount = 1 + Controller.audioCount; prodCount = Controller.audioCount; } else if (type.label.equals("VI") || type.label.equals("VM")) { Controller.visualCount = 1 + Controller.visualCount; prodCount = Controller.visualCount; } return manufacturer.substring(0, 3) + type.label + String.format("%05d", prodCount); } /** * Gets the serialNumber of this product. * * @return this Product's serialNumber. */ public String getSerialNum() { return serialNumber; } /** * ProductionRecord constructor to construct the new data from the passed information. * * @param productionNumber - production number * @param productId - product ID * @param serialNumber - serial number * @param dateProduced - date produced */ public ProductionRecord(int productionNumber, int productId, String serialNumber, Date dateProduced) { this.productionNumber = productionNumber; this.productId = productId; this.serialNumber = serialNumber; this.dateProduced = new Date(dateProduced.getTime()); this.productName = getProductName(); } /** * toString to display the ProductionRecord's information. */ public String toString() { return "Product Num: " + productionNumber + " Product Name: " + productName + " Serial Num: " + serialNumber + " Date: " + dateProduced; } //getters /** * Gets the productionNumber of this product. * * @return this Product's productionNumber. */ public int getProductionNum() { return productionNumber; } /** * Gets the productID of this product. * * @return this Product's productID. */ public int getProductId() { return productId; } /** * Gets the date of this product. * * @return this Product's date. */ public Date getProdDate() { return new Date(dateProduced.getTime()); } /** * Gets the name of this product. * * @return this Product's name. */ public String getProductName() { return productName; } //setters /** * Sets the productionNumber of this Product. * * @param productionNumber This Product's new number. */ public void setProductionNum(int productionNumber) { this.productionNumber = productionNumber; } /** * Sets the productID of this Product. * * @param productId This Product's new ID. */ public void setProductId(int productId) { this.productId = productId; } /** * Sets the serialNumber of this Product. * * @param serialNumber This Product's new serialNumber. */ public void setSerialNum(String serialNumber) { this.serialNumber = serialNumber; } /** * Sets the dateProduced of this Product. * * @param dateProduced This Product's new dateProduced. */ public void setProdDate(Date dateProduced) { this.dateProduced = new Date(dateProduced.getTime()); } /** * Sets the productName of this Product. * * @param productName This Product's new name. */ public void setProductName(String productName) { this.productName = productName; } }
9231c9f7e8bc2d735e36ac5432009ed842c8d3e8
1,169
java
Java
wovenpay/src/main/java/com/wovenpay/wovenpayments/models/ListTransactionsResponse.java
wovenpay/wovenpay-android
31e101d516e748fee8552d7a87137ab7dd2699ab
[ "MIT" ]
null
null
null
wovenpay/src/main/java/com/wovenpay/wovenpayments/models/ListTransactionsResponse.java
wovenpay/wovenpay-android
31e101d516e748fee8552d7a87137ab7dd2699ab
[ "MIT" ]
null
null
null
wovenpay/src/main/java/com/wovenpay/wovenpayments/models/ListTransactionsResponse.java
wovenpay/wovenpay-android
31e101d516e748fee8552d7a87137ab7dd2699ab
[ "MIT" ]
null
null
null
20.875
65
0.658683
995,975
package com.wovenpay.wovenpayments.models; import java.util.ArrayList; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class ListTransactionsResponse { @SerializedName("count") @Expose private Integer count; @SerializedName("next") @Expose private Object next; @SerializedName("previous") @Expose private Object previous; @SerializedName("results") @Expose private List<Transaction> transactions = new ArrayList<>(); public Integer getCount() { return count; } public void setCount(Integer count) { this.count = count; } public Object getNext() { return next; } public void setNext(Object next) { this.next = next; } public Object getPrevious() { return previous; } public void setPrevious(Object previous) { this.previous = previous; } public List<Transaction> getTransactions() { return transactions; } public void setTransactions(List<Transaction> transactions) { this.transactions = transactions; } }
9231caf75cbb13927d072c28a354a9d20a81d68d
926
java
Java
src/main/java/com/code/boy/concurrent/sync/InterruptExceptionDemo.java
lwu-gd-china/code-boy
47183e36febf0f0d4bf32f2f9e2e1ccda35e7344
[ "Apache-2.0" ]
null
null
null
src/main/java/com/code/boy/concurrent/sync/InterruptExceptionDemo.java
lwu-gd-china/code-boy
47183e36febf0f0d4bf32f2f9e2e1ccda35e7344
[ "Apache-2.0" ]
null
null
null
src/main/java/com/code/boy/concurrent/sync/InterruptExceptionDemo.java
lwu-gd-china/code-boy
47183e36febf0f0d4bf32f2f9e2e1ccda35e7344
[ "Apache-2.0" ]
null
null
null
23.74359
104
0.609071
995,976
package com.code.boy.concurrent.sync; public class InterruptExceptionDemo { private final Object syncLock = new Object(); /** * if thread is interrupted, an interrupted exception will be thrown upon invocation of wait() method. */ private void interruptException() { Thread t = new Thread(new Runnable() { @SuppressWarnings("ResultOfMethodCallIgnored") public void run() { synchronized (syncLock) { try { syncLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); Thread.interrupted(); } } } }); t.start(); try { Thread.sleep(5000L); } catch (InterruptedException e) { e.printStackTrace(); } t.interrupt(); } public static void main(String[] args) { InterruptExceptionDemo demo = new InterruptExceptionDemo(); demo.interruptException(); } }
9231cb069919c834308962ffb972526dd93a375c
2,333
java
Java
app/models/business/BaseBusinessLogic.java
LisiutinAndrei/WorldNews
05f3b0d3b7bc129a9f9f48a7199339066ee20dc9
[ "Apache-2.0" ]
null
null
null
app/models/business/BaseBusinessLogic.java
LisiutinAndrei/WorldNews
05f3b0d3b7bc129a9f9f48a7199339066ee20dc9
[ "Apache-2.0" ]
null
null
null
app/models/business/BaseBusinessLogic.java
LisiutinAndrei/WorldNews
05f3b0d3b7bc129a9f9f48a7199339066ee20dc9
[ "Apache-2.0" ]
null
null
null
33.811594
119
0.646378
995,977
package models.business; import _infrastructure.IoC; import models.domain.repositories.factory.IRepositoriesFactory; import models.utils.configuration.IConfigurationProvider; import models.utils.infrastructurePackages.accountSession.IAccountSession; import models.utils.infrastructurePackages.response.BaseResponsePackage; import models.utils.infrastructurePackages.response.IResponsePackage; import play.db.jpa.JPA; import javax.persistence.EntityManager; public class BaseBusinessLogic { // @Inject public IRepositoriesFactory _repositoriesFactory; // @Inject private IConfigurationProvider _config; public BaseBusinessLogic() { super(); this._config = IoC.getService(IConfigurationProvider.class); this._repositoriesFactory = IoC.getService(IRepositoriesFactory.class); } private EntityManager _getEntityManager() { return JPA.em(); } protected <T> IResponsePackage<T> _createResponse(IAccountSession accountSession) { IResponsePackage<T> response = new BaseResponsePackage<T>(accountSession); return response; } protected String _getConfig(String path) { return this._config.get(path); } protected <T> T runSqlAction(play.libs.F.Function<EntityManager, T> func) { try { return JPA.withTransaction(() -> { return func.apply(this._getEntityManager()); }); } catch (Throwable throwable) { throw new RuntimeException(throwable); } } protected <P1, T> T runSqlAction(play.libs.F.Function2<P1, EntityManager, T> func, P1 param1) { try { return JPA.withTransaction(() -> { return func.apply(param1, this._getEntityManager()); }); } catch (Throwable throwable) { throw new RuntimeException(throwable); } } protected <P1, P2, T> T runSqlAction(play.libs.F.Function3<P1, P2, EntityManager, T> func, P1 param1, P2 param2) { try { return JPA.withTransaction(() -> { return func.apply(param1, param2, this._getEntityManager()); }); } catch (Throwable throwable) { throw new RuntimeException(throwable); } } }
9231ce3ae99b872aa204a0c2a8e40a8de3073e71
2,041
java
Java
addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/tests/GroupCreationTests.java
IBardievsky/java_for_QA
6c48eed78e073c1add026fbb9652954dca96e8b9
[ "Apache-2.0" ]
null
null
null
addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/tests/GroupCreationTests.java
IBardievsky/java_for_QA
6c48eed78e073c1add026fbb9652954dca96e8b9
[ "Apache-2.0" ]
null
null
null
addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/tests/GroupCreationTests.java
IBardievsky/java_for_QA
6c48eed78e073c1add026fbb9652954dca96e8b9
[ "Apache-2.0" ]
null
null
null
32.396825
111
0.697697
995,978
package ru.stqa.pft.addressbook.tests; import com.thoughtworks.xstream.XStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import ru.stqa.pft.addressbook.model.GroupData; import ru.stqa.pft.addressbook.model.Groups; import java.io.*; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.stream.Collectors; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.MatcherAssert.assertThat; public class GroupCreationTests extends TestBase { @DataProvider public Iterator<Object[]> validGroups() throws IOException { try(BufferedReader reader = new BufferedReader(new FileReader(new File("src/test/resources/groups.xml")))){ String xml = ""; String line = reader.readLine(); while (line != null) { xml += line; line = reader.readLine(); } XStream xstream = new XStream(); xstream.processAnnotations(GroupData.class); List<GroupData> groups = (List<GroupData>) xstream.fromXML(xml); return groups.stream().map((g) -> new Object[]{g}).collect(Collectors.toList()).iterator(); } } @Test(dataProvider = "validGroups") public void testGroupCreation(GroupData group) { app.gotoGroupPage(); Groups before = app.db().groups(); app.group().create(group); assertThat(app.group().count(), equalTo(before.size() + 1)); Groups after = app.db().groups(); assertThat(after, equalTo( before.withAdded(group.withId(after.stream().mapToInt((g) -> g.getId()).max().getAsInt())))); } @Test(enabled = false) public void testBadGroupCreation() { app.gotoGroupPage(); Groups before = app.group().all(); GroupData group = new GroupData().withName("test1'").withHeader("test2").withFooter("test3"); app.group().create(group); assertThat(app.group().count(), equalTo(before.size())); Groups after = app.group().all(); assertThat(after, equalTo(before)); } }
9231ce811b31709015ed6bda7224d71bec11328e
2,885
java
Java
java-source/src/main/java/net/corda/training/state/IOUState.java
ooharawork/corda-training-solutions
699f4753e21d1530e42680f5abdbcf8069a25310
[ "Apache-2.0" ]
null
null
null
java-source/src/main/java/net/corda/training/state/IOUState.java
ooharawork/corda-training-solutions
699f4753e21d1530e42680f5abdbcf8069a25310
[ "Apache-2.0" ]
null
null
null
java-source/src/main/java/net/corda/training/state/IOUState.java
ooharawork/corda-training-solutions
699f4753e21d1530e42680f5abdbcf8069a25310
[ "Apache-2.0" ]
null
null
null
33.941176
127
0.705026
995,979
package net.corda.training.state; import com.google.common.collect.ImmutableList; import java.util.*; import net.corda.core.contracts.Amount; import net.corda.core.contracts.LinearState; import net.corda.core.contracts.UniqueIdentifier; import net.corda.core.identity.Party; import net.corda.core.identity.AbstractParty; import net.corda.core.serialization.ConstructorForDeserialization; /** * The IOU State object, with the following properties: * - [amount] The amount owed by the [borrower] to the [lender] * - [lender] The lending party. * - [borrower] The borrowing party. * - [paid] Records how much of the [amount] has been paid. * - [linearId] A unique id shared by all LinearState states representing the same agreement throughout history within * the vaults of all parties. Verify methods should check that one input and one output share the id in a transaction, * except at issuance/termination. */ public class IOUState implements LinearState { private final Amount<Currency> amount; private final Party lender; private final Party borrower; private final Amount<Currency> paid; private final UniqueIdentifier linearId; // Private constructor used only for copying a State object @ConstructorForDeserialization private IOUState(Amount<Currency> amount, Party lender, Party borrower, Amount<Currency> paid, UniqueIdentifier linearId) { this.amount = amount; this.lender = lender; this.borrower = borrower; this.paid = paid; this.linearId = linearId; } // For new states public IOUState(Amount<Currency> amount, Party lender, Party borrower) { this(amount, lender, borrower, new Amount<>(0, amount.getToken()), new UniqueIdentifier()); } public Amount<Currency> getAmount() { return amount; } public Party getLender() { return lender; } public Party getBorrower() { return borrower; } public Amount<Currency> getPaid() { return paid; } @Override public List<AbstractParty> getParticipants() { return ImmutableList.of(lender, borrower); } @Override public UniqueIdentifier getLinearId() { return linearId; } /** * Helper methods for when building transactions for settling and transferring IOUs. * - [pay] adds an amount to the paid property. It does no validation. * - [withNewLender] creates a copy of the current state with a newly specified lender. For use when transferring. */ public IOUState pay(Amount<Currency> amountToPay) { Amount<Currency> newAmountPaid = this.paid.plus(amountToPay); return new IOUState(amount, lender, borrower, newAmountPaid, linearId); } public IOUState withNewLender(Party newLender) { return new IOUState(amount, newLender, borrower, paid, linearId); } }
9231cf0859b307edf465a495396e4ed908c94dd3
2,024
java
Java
src/cc/ccoder/model/dao/impl/ShippingDaoImpl.java
chencong-plan/cShop
f586966e2a75e92da58e7100973b3de33b588425
[ "Apache-2.0" ]
null
null
null
src/cc/ccoder/model/dao/impl/ShippingDaoImpl.java
chencong-plan/cShop
f586966e2a75e92da58e7100973b3de33b588425
[ "Apache-2.0" ]
null
null
null
src/cc/ccoder/model/dao/impl/ShippingDaoImpl.java
chencong-plan/cShop
f586966e2a75e92da58e7100973b3de33b588425
[ "Apache-2.0" ]
null
null
null
27.726027
89
0.737154
995,980
package cc.ccoder.model.dao.impl; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import cc.ccoder.model.dao.IShippingDao; import cc.ccoder.model.entity.Shipping; import cc.ccoder.model.entity.User; /** * 地址实体 添加地址dao层方法 * * @author chencong * */ @Transactional @Repository("iShippingDao") public class ShippingDaoImpl implements IShippingDao { @Autowired private SessionFactory sessionFactory; @Override public boolean addShipping(Shipping shipping) { Session session = this.sessionFactory.getCurrentSession(); try { session.saveOrUpdate(shipping); return true; } catch (HibernateException e) { e.printStackTrace(); return false; } } @Override public List<Shipping> getShippingByUserId(Integer userId, Integer pageNum, Integer pageSize) { Session session = this.sessionFactory.getCurrentSession(); Query query = session.createQuery("from Shipping where userId = ?"); query.setParameter(0, userId); query.setFirstResult(pageNum); query.setMaxResults(pageSize); return query.list(); } @Override public boolean deleteShippingById(Integer shippingId, Integer userId) { Session session = this.sessionFactory.getCurrentSession(); Query query = session.createQuery("delete from Shipping where userId = ? and id = ?"); query.setParameter(0, userId); query.setParameter(1, shippingId); int row = query.executeUpdate(); if (row == 1) { return true; } return false; } @Override public Shipping getShippingById(Integer shippingId) { Session session = this.sessionFactory.getCurrentSession(); Shipping shipping = (Shipping) session.get(Shipping.class, shippingId); return shipping; } }
9231cfd6b79fc6c512528b6ae12830842c84145a
1,092
java
Java
src/main/java/com/weizihe/algorithm/MapKeyDeep.java
dhdak/technology-toy
62ffc1af67c55ac151b8a94a0683dcc886c8f33f
[ "Apache-2.0" ]
null
null
null
src/main/java/com/weizihe/algorithm/MapKeyDeep.java
dhdak/technology-toy
62ffc1af67c55ac151b8a94a0683dcc886c8f33f
[ "Apache-2.0" ]
null
null
null
src/main/java/com/weizihe/algorithm/MapKeyDeep.java
dhdak/technology-toy
62ffc1af67c55ac151b8a94a0683dcc886c8f33f
[ "Apache-2.0" ]
null
null
null
24.818182
101
0.551282
995,981
package com.weizihe.algorithm; import java.util.HashMap; import java.util.Map; /** * 获取某个key,出现的最深的位置,就是层数 * * @author weizihe * @date 2021-05-20 16:40 */ public class MapKeyDeep { public static void main(String[] args) { Map<String,Object> map =new HashMap<>(); Map<String,Object> map2 =new HashMap<>(); Map<String,Object> map3 =new HashMap<>(); map3.put("key1",null); map2.put("key2",map3); map2.put("key5",null); map.put("key1",null); map.put("key2",map2); int deep = recursion(0, 1, "key1", map); System.out.println(deep); } public static int recursion(Integer maxDepth, Integer depth, String key, Map<String,Object> map){ if (map.containsKey(key)) { if (maxDepth < depth) { maxDepth = depth; } } for (String keys : map.keySet()) { if (map.get(keys) instanceof Map) { return recursion(maxDepth,depth+1, key,(HashMap)map.get(keys)); } } return maxDepth; } }
9231d0e9abe5feecb932fca1099da670471f5e0f
2,266
java
Java
src/main/java/com/sensiblemetrics/api/alpenidos/pattern/fsm2/impl/CTransition.java
AlexRogalskiy/java4you
7657177bcc3acc4029e19a63f21fe4d65c714aac
[ "MIT" ]
null
null
null
src/main/java/com/sensiblemetrics/api/alpenidos/pattern/fsm2/impl/CTransition.java
AlexRogalskiy/java4you
7657177bcc3acc4029e19a63f21fe4d65c714aac
[ "MIT" ]
144
2021-01-21T00:11:18.000Z
2022-03-31T21:35:01.000Z
src/main/java/com/sensiblemetrics/api/alpenidos/pattern/fsm2/impl/CTransition.java
AlexRogalskiy/java4you
7657177bcc3acc4029e19a63f21fe4d65c714aac
[ "MIT" ]
null
null
null
33.820896
101
0.736099
995,982
/* * The MIT License * * Copyright 2018 WildBees Labs. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.sensiblemetrics.api.alpenidos.pattern.fsm2.impl; import com.sensiblemetrics.api.alpenidos.pattern.fsm2.iface.ICState; import com.sensiblemetrics.api.alpenidos.pattern.fsm2.iface.ICTransition; import com.sensiblemetrics.api.alpenidos.pattern.utils.ValidationUtils; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; import java.util.Objects; /** * Custom transition implementation * * @param <C> * @param <S> * @author Alex * @version 1.0.0 * @since 2017-08-07 */ @Data @EqualsAndHashCode @ToString public class CTransition<C, S extends ICState<C, ICTransition<C, S>>> implements ICTransition<C, S> { protected final C value; protected final S state; public CTransition(final C value, final S state) { ValidationUtils.notNull(value, "Condition should not be null"); ValidationUtils.notNull(state, "State should not be null"); this.value = value; this.state = state; } public S state() { return this.state; } public boolean isPossible(final C value) { return Objects.equals(this.value, value); } }
9231d14562294a0177a736eb798046ea8701c99d
1,992
java
Java
src/main/java/com/webcheckers/ui/GetSignInRoute.java
crsmelee/webcheckers
dc5653a12c33afa740822025c62420473eed24c7
[ "MIT" ]
null
null
null
src/main/java/com/webcheckers/ui/GetSignInRoute.java
crsmelee/webcheckers
dc5653a12c33afa740822025c62420473eed24c7
[ "MIT" ]
null
null
null
src/main/java/com/webcheckers/ui/GetSignInRoute.java
crsmelee/webcheckers
dc5653a12c33afa740822025c62420473eed24c7
[ "MIT" ]
null
null
null
34.344828
174
0.704819
995,983
package com.webcheckers.ui; import spark.*; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.logging.Logger; /** * from the home page, this displays the sign in page. This is the initial sign in page if the play has not tried to * sign in yet. * created by Johnny, Disney, Andy, Ani */ public class GetSignInRoute implements Route { private static final Logger LOG = Logger.getLogger(GetSignInRoute.class.getName()); private final TemplateEngine templateEngine; static final String SIGN_IN_MESSAGE_ATTR = "signInMessage"; static final String SIGN_IN_MESSAGE = "This game requires you to make an account. An account must have a username and a password"; static final String SIGN_IN_HELP_ATTR = "signInHelp"; static final String SIGN_IN_HELP_MESSAGE = "If you have an account, just sign in with your username and password. Otherwise, I'll automatically make an account for you."; /** * Create the Spark Route (UI controller) for the * {@code GET /} HTTP request. * * @param templateEngine the HTML template rendering engine */ public GetSignInRoute(TemplateEngine templateEngine) { //Validation Objects.requireNonNull(templateEngine, "template engine cannot be empty"); this.templateEngine = templateEngine; LOG.config("GetSignInRoute is initialized."); } /** * Render the WebCheckers SignIn page. * * @param request the HTTP request * @param response the HTTP response * @return the rendered HTML for the SignIn page */ @Override public Object handle(Request request, Response response) throws Exception { LOG.config("GetSignInRoute is invoked."); Map<String, Object> vm = new HashMap<>(); vm.put(SIGN_IN_MESSAGE_ATTR, SIGN_IN_MESSAGE); vm.put(SIGN_IN_HELP_ATTR, SIGN_IN_HELP_MESSAGE); return templateEngine.render(new ModelAndView(vm, "signIn.ftl")); } }
9231d14671d62085b77cfe9cf7857886eb645622
10,398
java
Java
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/editors/data/preferences/PrefPageResultSetPresentationGrid.java
halitanildonmez/dbeaver
f9b42d9cedaff1208f0088635acb5142b599b13e
[ "Apache-2.0" ]
2
2020-10-19T03:34:04.000Z
2020-10-19T03:34:31.000Z
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/editors/data/preferences/PrefPageResultSetPresentationGrid.java
halitanildonmez/dbeaver
f9b42d9cedaff1208f0088635acb5142b599b13e
[ "Apache-2.0" ]
1
2020-08-26T08:26:12.000Z
2020-08-26T08:26:12.000Z
plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/editors/data/preferences/PrefPageResultSetPresentationGrid.java
halitanildonmez/dbeaver
f9b42d9cedaff1208f0088635acb5142b599b13e
[ "Apache-2.0" ]
2
2019-04-18T14:56:22.000Z
2021-05-18T09:38:43.000Z
58.785311
246
0.77703
995,984
/* * DBeaver - Universal Database Manager * Copyright (C) 2010-2020 DBeaver Corp and others * Copyright (C) 2011-2012 Eugene Fradkin (kenaa@example.com) * * 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.jkiss.dbeaver.ui.editors.data.preferences; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.*; import org.jkiss.dbeaver.Log; import org.jkiss.dbeaver.model.DBPDataSourceContainer; import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore; import org.jkiss.dbeaver.ui.UIUtils; import org.jkiss.dbeaver.ui.controls.resultset.ResultSetPreferences; import org.jkiss.dbeaver.ui.controls.resultset.spreadsheet.Spreadsheet; import org.jkiss.dbeaver.ui.editors.data.internal.DataEditorsMessages; import org.jkiss.dbeaver.ui.preferences.TargetPrefPage; import org.jkiss.dbeaver.utils.PrefUtils; import org.jkiss.utils.CommonUtils; /** * PrefPageResultSetGrid */ public class PrefPageResultSetPresentationGrid extends TargetPrefPage { private static final Log log = Log.getLog(PrefPageResultSetPresentationGrid.class); public static final String PAGE_ID = "org.jkiss.dbeaver.preferences.main.resultset.grid"; //$NON-NLS-1$ private Button gridShowOddRows; private Button colorizeDataTypes; //private Button gridShowCellIcons; private Button gridShowAttrIcons; private Button gridShowAttrFilters; private Button gridShowAttrOrder; private Button useSmoothScrolling; private Button showBooleanAsCheckbox; private Combo gridDoubleClickBehavior; private Text gridRowBatchSize; public PrefPageResultSetPresentationGrid() { super(); } @Override protected boolean hasDataSourceSpecificOptions(DBPDataSourceContainer dataSourceDescriptor) { DBPPreferenceStore store = dataSourceDescriptor.getPreferenceStore(); return store.contains(ResultSetPreferences.RESULT_SET_SHOW_ODD_ROWS) || store.contains(ResultSetPreferences.RESULT_SET_COLORIZE_DATA_TYPES) || //store.contains(ResultSetPreferences.RESULT_SET_SHOW_CELL_ICONS) || store.contains(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ICONS) || store.contains(ResultSetPreferences.RESULT_SET_SHOW_ATTR_FILTERS) || store.contains(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ORDERING) || store.contains(ResultSetPreferences.RESULT_SET_USE_SMOOTH_SCROLLING) || store.contains(ResultSetPreferences.RESULT_SET_SHOW_BOOLEAN_AS_CHECKBOX) || store.contains(ResultSetPreferences.RESULT_SET_DOUBLE_CLICK) || store.contains(ResultSetPreferences.RESULT_SET_ROW_BATCH_SIZE); } @Override protected boolean supportsDataSourceSpecificOptions() { return true; } @Override protected Control createPreferenceContent(Composite parent) { Composite composite = UIUtils.createPlaceholder(parent, 2, 5); { Group uiGroup = UIUtils.createControlGroup(composite, DataEditorsMessages.pref_page_database_resultsets_group_grid, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0); gridShowOddRows = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_mark_odd_rows, null, false, 2); colorizeDataTypes = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_colorize_data_types, null, false, 2); //gridShowCellIcons = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_cell_icons, null, false, 2); gridShowAttrIcons = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_icons, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_icons_tip, false, 2); gridShowAttrFilters = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_filters, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_filters_tip, false, 2); gridShowAttrOrder = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_ordering, DataEditorsMessages.pref_page_database_resultsets_label_show_attr_ordering_tip, false, 2); useSmoothScrolling = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_use_smooth_scrolling, DataEditorsMessages.pref_page_database_resultsets_label_use_smooth_scrolling_tip, false, 2); showBooleanAsCheckbox = UIUtils.createCheckbox(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_show_boolean_as_checkbox, DataEditorsMessages.pref_page_database_resultsets_label_show_boolean_as_checkbox_tip, false, 2); gridDoubleClickBehavior = UIUtils.createLabelCombo(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_double_click_behavior, SWT.READ_ONLY); gridDoubleClickBehavior.add(DataEditorsMessages.pref_page_result_selector_none, Spreadsheet.DoubleClickBehavior.NONE.ordinal()); gridDoubleClickBehavior.add(DataEditorsMessages.pref_page_result_selector_editor, Spreadsheet.DoubleClickBehavior.EDITOR.ordinal()); gridDoubleClickBehavior.add(DataEditorsMessages.pref_page_result_selector_inline_editor, Spreadsheet.DoubleClickBehavior.INLINE_EDITOR.ordinal()); gridDoubleClickBehavior.add("Copy selected cell", Spreadsheet.DoubleClickBehavior.COPY_VALUE.ordinal()); gridDoubleClickBehavior.add("Paste cell value into editor", Spreadsheet.DoubleClickBehavior.COPY_PASTE_VALUE.ordinal()); gridRowBatchSize = UIUtils.createLabelText(uiGroup, DataEditorsMessages.pref_page_database_resultsets_label_row_batch_size, "", SWT.BORDER); gridRowBatchSize.setToolTipText(DataEditorsMessages.pref_page_database_resultsets_label_row_batch_size_tip); } return composite; } @Override protected void loadPreferences(DBPPreferenceStore store) { try { gridShowOddRows.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_ODD_ROWS)); colorizeDataTypes.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_COLORIZE_DATA_TYPES)); //gridShowCellIcons.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_CELL_ICONS)); gridShowAttrIcons.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ICONS)); gridShowAttrFilters.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_ATTR_FILTERS)); gridShowAttrOrder.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ORDERING)); useSmoothScrolling.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_USE_SMOOTH_SCROLLING)); showBooleanAsCheckbox.setSelection(store.getBoolean(ResultSetPreferences.RESULT_SET_SHOW_BOOLEAN_AS_CHECKBOX)); gridDoubleClickBehavior.select( CommonUtils.valueOf( Spreadsheet.DoubleClickBehavior.class, store.getString(ResultSetPreferences.RESULT_SET_DOUBLE_CLICK), Spreadsheet.DoubleClickBehavior.NONE) .ordinal()); gridRowBatchSize.setText(store.getString(ResultSetPreferences.RESULT_SET_ROW_BATCH_SIZE)); } catch (Exception e) { log.warn(e); } } @Override protected void savePreferences(DBPPreferenceStore store) { try { store.setValue(ResultSetPreferences.RESULT_SET_SHOW_ODD_ROWS, gridShowOddRows.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_COLORIZE_DATA_TYPES, colorizeDataTypes.getSelection()); //store.setValue(ResultSetPreferences.RESULT_SET_SHOW_CELL_ICONS, gridShowCellIcons.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ICONS, gridShowAttrIcons.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_SHOW_ATTR_FILTERS, gridShowAttrFilters.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ORDERING, gridShowAttrOrder.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_USE_SMOOTH_SCROLLING, useSmoothScrolling.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_SHOW_BOOLEAN_AS_CHECKBOX, showBooleanAsCheckbox.getSelection()); store.setValue(ResultSetPreferences.RESULT_SET_DOUBLE_CLICK, CommonUtils.fromOrdinal( Spreadsheet.DoubleClickBehavior.class, gridDoubleClickBehavior.getSelectionIndex()).name()); store.setValue(ResultSetPreferences.RESULT_SET_ROW_BATCH_SIZE, CommonUtils.toInt(gridRowBatchSize.getText())); } catch (Exception e) { log.warn(e); } PrefUtils.savePreferenceStore(store); } @Override protected void clearPreferences(DBPPreferenceStore store) { store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_ODD_ROWS); store.setToDefault(ResultSetPreferences.RESULT_SET_COLORIZE_DATA_TYPES); //store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_CELL_ICONS); store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ICONS); store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_ATTR_FILTERS); store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_ATTR_ORDERING); store.setToDefault(ResultSetPreferences.RESULT_SET_USE_SMOOTH_SCROLLING); store.setToDefault(ResultSetPreferences.RESULT_SET_SHOW_BOOLEAN_AS_CHECKBOX); store.setToDefault(ResultSetPreferences.RESULT_SET_DOUBLE_CLICK); store.setToDefault(ResultSetPreferences.RESULT_SET_ROW_BATCH_SIZE); } @Override protected String getPropertyPageID() { return PAGE_ID; } }
9231d1f1ac5226bf5d27c9e93555016932361d9b
661
java
Java
src/main/java/org/mve/asm/attribute/bootstrap/BootstrapMethod.java
MeiVinEight/ReflectionFX
df2ead480a80e46cbabf7988381ad16c8d58e20b
[ "MIT" ]
21
2020-06-12T15:30:48.000Z
2022-03-30T01:58:23.000Z
src/main/java/org/mve/asm/attribute/bootstrap/BootstrapMethod.java
MeiVinEight/ReflectionFX
df2ead480a80e46cbabf7988381ad16c8d58e20b
[ "MIT" ]
3
2020-07-04T09:25:18.000Z
2021-07-03T19:26:27.000Z
src/main/java/org/mve/asm/attribute/bootstrap/BootstrapMethod.java
MeiVinEight/ReflectionFX
df2ead480a80e46cbabf7988381ad16c8d58e20b
[ "MIT" ]
3
2021-06-07T13:06:16.000Z
2021-06-12T12:53:35.000Z
18.885714
71
0.742814
995,985
package org.mve.asm.attribute.bootstrap; import org.mve.asm.constant.MethodHandle; import java.util.Arrays; public class BootstrapMethod { public MethodHandle method; public Object[] argument = new Object[0]; public BootstrapMethod(MethodHandle method, Object... argument) { this.method = method; this.argument = argument; } public BootstrapMethod() { } public BootstrapMethod method(MethodHandle method) { this.method = method; return this; } public BootstrapMethod argument(Object value) { this.argument = Arrays.copyOf(this.argument, this.argument.length+1); this.argument[this.argument.length-1] = value; return this; } }
9231d2af100cdb482546fd80c06f360ca12d1975
164,445
java
Java
merging/main/server-4q/com/cyc/cycjava/cycl/rule_disambiguation.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
10
2016-09-03T18:41:14.000Z
2020-01-17T16:29:19.000Z
merging/main/server-4q/com/cyc/cycjava/cycl/rule_disambiguation.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
3
2016-09-01T19:15:27.000Z
2016-10-12T16:28:48.000Z
merging/main/server-4q/com/cyc/cycjava/cycl/rule_disambiguation.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
1
2017-11-21T13:29:31.000Z
2017-11-21T13:29:31.000Z
57.639327
529
0.588914
995,986
/** * Copyright (c) 1995 - 2019 Cycorp, Inc. All rights reserved. */ package com.cyc.cycjava.cycl; import static com.cyc.cycjava.cycl.constant_handles.invalid_constantP; import static com.cyc.cycjava.cycl.constant_handles.reader_make_constant_shell; import static com.cyc.cycjava.cycl.id_index.do_id_index_empty_p; import static com.cyc.cycjava.cycl.id_index.do_id_index_id_and_object_validP; import static com.cyc.cycjava.cycl.id_index.do_id_index_next_id; import static com.cyc.cycjava.cycl.id_index.do_id_index_next_state; import static com.cyc.cycjava.cycl.id_index.do_id_index_state_object; import static com.cyc.cycjava.cycl.id_index.id_index_dense_objects; import static com.cyc.cycjava.cycl.id_index.id_index_dense_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_next_id; import static com.cyc.cycjava.cycl.id_index.id_index_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_skip_tombstones_p; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_id_threshold; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_objects; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_tombstone_p; import static com.cyc.cycjava.cycl.utilities_macros.$last_percent_progress_index$; import static com.cyc.cycjava.cycl.utilities_macros.$last_percent_progress_prediction$; import static com.cyc.cycjava.cycl.utilities_macros.$percent_progress_start_time$; import static com.cyc.cycjava.cycl.utilities_macros.$progress_note$; import static com.cyc.cycjava.cycl.utilities_macros.$progress_sofar$; import static com.cyc.cycjava.cycl.utilities_macros.$progress_start_time$; import static com.cyc.cycjava.cycl.utilities_macros.$progress_total$; import static com.cyc.cycjava.cycl.utilities_macros.$within_noting_percent_progress$; import static com.cyc.cycjava.cycl.utilities_macros.note_percent_progress; import static com.cyc.cycjava.cycl.utilities_macros.noting_percent_progress_postamble; import static com.cyc.cycjava.cycl.utilities_macros.noting_percent_progress_preamble; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.append; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.cons; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.list; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.listS; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Equality.identity; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Functions.funcall; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntryKey; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntrySetIterator; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntryValue; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.gethash_without_values; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.iteratorHasNext; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.iteratorNextEntry; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.make_hash_table; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.releaseEntrySetIterator; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.sethash; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Numbers.add; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Numbers.numG; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Numbers.subtract; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.PrintLow.format; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.length; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.nreverse; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.reverse; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.def_csetf; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.makeStructDeclNative; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.register_method; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Symbols.symbol_function; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Threads.$is_thread_performing_cleanupP$; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Time.get_universal_time; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Types.hash_table_p; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Types.listp; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Types.stringp; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Types.sublisp_null; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.getValuesAsVector; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.restoreValuesFromVector; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Vectors.aref; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeBoolean; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeDouble; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeInteger; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeKeyword; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeString; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeSymbol; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeUninternedSymbol; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.cdestructuring_bind.cdestructuring_bind_error; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.cdestructuring_bind.destructuring_bind_must_consp; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.cadr; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.cddr; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.putf; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.second; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.print_high.$print_object_method_table$; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.print_high.$print_pretty$; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.reader.bq_cons; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.reader.read; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.streams_high.close; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.streams_high.write_string; import static com.cyc.tool.subl.util.SubLFiles.declareFunction; import static com.cyc.tool.subl.util.SubLFiles.declareMacro; import static com.cyc.tool.subl.util.SubLFiles.defconstant; import static com.cyc.tool.subl.util.SubLFiles.defparameter; import java.util.Iterator; import java.util.Map; import org.armedbear.lisp.Lisp; import com.cyc.cycjava.cycl.inference.ask_utilities; import com.cyc.cycjava.cycl.inference.harness.inference_datastructures_problem_store; import com.cyc.cycjava.cycl.nl.document_disambiguation; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.Errors; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.Filesys; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLSpecialOperatorDeclarations; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLStructDecl; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLStructDeclNative; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLThread; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.UnaryFunction; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLList; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObject; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLProcess; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLString; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLStructNative; import com.cyc.tool.subl.jrtl.nativeCode.type.number.SubLFloat; import com.cyc.tool.subl.jrtl.nativeCode.type.number.SubLInteger; import com.cyc.tool.subl.jrtl.nativeCode.type.symbol.SubLSymbol; import com.cyc.tool.subl.jrtl.translatedCode.sublisp.compatibility; import com.cyc.tool.subl.jrtl.translatedCode.sublisp.stream_macros; import com.cyc.tool.subl.jrtl.translatedCode.sublisp.visitation; import com.cyc.tool.subl.util.SubLFile; import com.cyc.tool.subl.util.SubLFiles.LispMethod; import com.cyc.tool.subl.util.SubLTrampolineFile; import com.cyc.tool.subl.util.SubLTranslatedFile; /** * Copyright (c) 1995 - 2019 Cycorp, Inc. All rights reserved. * module: RULE-DISAMBIGUATION * source file: /cyc/top/cycl/rule-disambiguation.lisp * created: 2019/07/03 17:38:57 */ public final class rule_disambiguation extends SubLTranslatedFile implements V12 { public static final class $rule_disambiguator_native extends SubLStructNative { public SubLStructDecl getStructDecl() { return structDecl; } public SubLObject getField2() { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$rule_file; } public SubLObject getField3() { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$count_file; } public SubLObject getField4() { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$rules; } public SubLObject getField5() { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$counts; } public SubLObject setField2(SubLObject value) { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$rule_file = value; } public SubLObject setField3(SubLObject value) { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$count_file = value; } public SubLObject setField4(SubLObject value) { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$rules = value; } public SubLObject setField5(SubLObject value) { return com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.this.$counts = value; } public SubLObject $rule_file = Lisp.NIL; public SubLObject $count_file = Lisp.NIL; public SubLObject $rules = Lisp.NIL; public SubLObject $counts = Lisp.NIL; private static final SubLStructDeclNative structDecl = makeStructDeclNative(com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.class, RULE_DISAMBIGUATOR, RULE_DISAMBIGUATOR_P, $list_alt8, $list_alt9, new String[]{ "$rule_file", "$count_file", "$rules", "$counts" }, $list_alt10, $list_alt11, RDIS_PRINT); } public static final SubLFile me = new rule_disambiguation(); public static final String myName = "com.cyc.cycjava.cycl.rule_disambiguation"; // defparameter @LispMethod(comment = "defparameter") private static final SubLSymbol $word_sense_disambiguation_rule_file$ = makeSymbol("*WORD-SENSE-DISAMBIGUATION-RULE-FILE*"); // defparameter @LispMethod(comment = "defparameter") private static final SubLSymbol $word_sense_disambiguation_count_file$ = makeSymbol("*WORD-SENSE-DISAMBIGUATION-COUNT-FILE*"); // defconstant @LispMethod(comment = "defconstant") public static final SubLSymbol $dtp_rule_disambiguator$ = makeSymbol("*DTP-RULE-DISAMBIGUATOR*"); // Internal Constants @LispMethod(comment = "Internal Constants") static private final SubLString $str0$data_word_sense_disambiguation_ru = makeString("data/word-sense-disambiguation-rules.fht"); static private final SubLString $str1$data_word_sense_disambiguation_co = makeString("data/word-sense-disambiguation-counts.fht"); static private final SubLList $list2 = list(list(makeSymbol("DISAMBIGUATOR")), makeSymbol("&BODY"), makeSymbol("BODY")); static private final SubLList $list4 = list(list(makeSymbol("NEW-RULE-DISAMBIGUATOR"))); private static final SubLSymbol FINALIZE_RULE_DISAMBIGUATOR = makeSymbol("FINALIZE-RULE-DISAMBIGUATOR"); private static final SubLSymbol RULE_DISAMBIGUATOR = makeSymbol("RULE-DISAMBIGUATOR"); private static final SubLSymbol RULE_DISAMBIGUATOR_P = makeSymbol("RULE-DISAMBIGUATOR-P"); static private final SubLList $list8 = list(makeSymbol("RULE-FILE"), makeSymbol("COUNT-FILE"), makeSymbol("RULES"), makeSymbol("COUNTS")); static private final SubLList $list9 = list(makeKeyword("RULE-FILE"), makeKeyword("COUNT-FILE"), makeKeyword("RULES"), makeKeyword("COUNTS")); static private final SubLList $list10 = list(makeSymbol("RDIS-RULE-FILE"), makeSymbol("RDIS-COUNT-FILE"), makeSymbol("RDIS-RULES"), makeSymbol("RDIS-COUNTS")); static private final SubLList $list11 = list(makeSymbol("_CSETF-RDIS-RULE-FILE"), makeSymbol("_CSETF-RDIS-COUNT-FILE"), makeSymbol("_CSETF-RDIS-RULES"), makeSymbol("_CSETF-RDIS-COUNTS")); private static final SubLSymbol RDIS_PRINT = makeSymbol("RDIS-PRINT"); private static final SubLSymbol RULE_DISAMBIGUATOR_PRINT_FUNCTION_TRAMPOLINE = makeSymbol("RULE-DISAMBIGUATOR-PRINT-FUNCTION-TRAMPOLINE"); private static final SubLList $list14 = list(makeSymbol("OPTIMIZE-FUNCALL"), makeSymbol("RULE-DISAMBIGUATOR-P")); private static final SubLSymbol RDIS_RULE_FILE = makeSymbol("RDIS-RULE-FILE"); private static final SubLSymbol _CSETF_RDIS_RULE_FILE = makeSymbol("_CSETF-RDIS-RULE-FILE"); private static final SubLSymbol RDIS_COUNT_FILE = makeSymbol("RDIS-COUNT-FILE"); private static final SubLSymbol _CSETF_RDIS_COUNT_FILE = makeSymbol("_CSETF-RDIS-COUNT-FILE"); private static final SubLSymbol RDIS_RULES = makeSymbol("RDIS-RULES"); private static final SubLSymbol _CSETF_RDIS_RULES = makeSymbol("_CSETF-RDIS-RULES"); private static final SubLSymbol RDIS_COUNTS = makeSymbol("RDIS-COUNTS"); private static final SubLSymbol _CSETF_RDIS_COUNTS = makeSymbol("_CSETF-RDIS-COUNTS"); private static final SubLString $str27$Invalid_slot__S_for_construction_ = makeString("Invalid slot ~S for construction function"); private static final SubLSymbol MAKE_RULE_DISAMBIGUATOR = makeSymbol("MAKE-RULE-DISAMBIGUATOR"); private static final SubLSymbol VISIT_DEFSTRUCT_OBJECT_RULE_DISAMBIGUATOR_METHOD = makeSymbol("VISIT-DEFSTRUCT-OBJECT-RULE-DISAMBIGUATOR-METHOD"); private static final SubLString $str34$__RULE_DISAMBIGUATOR_ = makeString("#<RULE-DISAMBIGUATOR "); private static final SubLString $$$_ = makeString(" "); private static final SubLString $str36$_ = makeString(">"); private static final SubLList $list37 = list(list(makeSymbol("BAG"), makeSymbol("WORD")), makeSymbol("&BODY"), makeSymbol("BODY")); private static final SubLSymbol $sym38$CYCL = makeUninternedSymbol("CYCL"); private static final SubLSymbol $sym39$GENL_CYCL = makeUninternedSymbol("GENL-CYCL"); private static final SubLSymbol WORD_CYCLS = makeSymbol("WORD-CYCLS"); private static final SubLSymbol CINC_HASH = makeSymbol("CINC-HASH"); private static final SubLList $list44 = list(MINUS_ONE_INTEGER); private static final SubLSymbol GET_UPWARDS_CLOSURE = makeSymbol("GET-UPWARDS-CLOSURE"); private static final SubLSymbol DOCUMENT_DISAMBIGUATE_RULE_DISAMBIGUATOR_METHOD = makeSymbol("DOCUMENT-DISAMBIGUATE-RULE-DISAMBIGUATOR-METHOD"); private static final SubLSymbol DOCUMENT_P = makeSymbol("DOCUMENT-P"); private static final SubLObject $const51$ContextuallyDependentLexicalMappi = reader_make_constant_shell("ContextuallyDependentLexicalMapping"); private static final SubLString $str53$Can_t_load_rules_from__a = makeString("Can't load rules from ~a"); private static final SubLString $str54$Can_t_load_counts_from__a = makeString("Can't load counts from ~a"); private static final SubLInteger $int$1024 = makeInteger(1024); private static final SubLList $list56 = list(makeSymbol("?X"), makeSymbol("?Y")); private static final SubLList $list58 = list(new SubLObject[]{ makeKeyword("INFERENCE-MODE"), makeKeyword("SHALLOW"), makeKeyword("ALLOW-INDETERMINATE-RESULTS?"), NIL, makeKeyword("DISJUNCTION-FREE-EL-VARS-POLICY"), makeKeyword("COMPUTE-INTERSECTION"), makeKeyword("INTERMEDIATE-STEP-VALIDATION-LEVEL"), makeKeyword("MINIMAL"), makeKeyword("MAX-TIME"), makeInteger(57600), makeKeyword("PROBABLY-APPROXIMATELY-DONE"), makeDouble(1.0), makeKeyword("ANSWER-LANGUAGE"), makeKeyword("EL"), makeKeyword("CONTINUABLE?"), NIL }); private static final SubLString $str59$data_word_sense_disambiguation_ru = makeString("data/word-sense-disambiguation-rules.txt"); private static final SubLInteger $int$65536 = makeInteger(65536); private static final SubLString $str64$Unable_to_open__S = makeString("Unable to open ~S"); private static final SubLString $str65$___ = makeString("(~%"); private static final SubLString $str66$__S____S___ = makeString("(~S . ~S)~%"); private static final SubLString $str67$___ = makeString(")~%"); private static final SubLList $list69 = list(makeSymbol("?LICENSOR")); private static final SubLSymbol $kw72$ALLOW_INDETERMINATE_RESULTS_ = makeKeyword("ALLOW-INDETERMINATE-RESULTS?"); private static final SubLSymbol $DISJUNCTION_FREE_EL_VARS_POLICY = makeKeyword("DISJUNCTION-FREE-EL-VARS-POLICY"); private static final SubLSymbol $INTERMEDIATE_STEP_VALIDATION_LEVEL = makeKeyword("INTERMEDIATE-STEP-VALIDATION-LEVEL"); private static final SubLInteger $int$57600 = makeInteger(57600); private static final SubLSymbol $PROBABLY_APPROXIMATELY_DONE = makeKeyword("PROBABLY-APPROXIMATELY-DONE"); private static final SubLFloat $float$1_0 = makeDouble(1.0); private static final SubLString $str85$_tmp_ = makeString("/tmp/"); private static final SubLString $str87$_a_is_invalid = makeString("~a is invalid"); private static final SubLString $str88$Can_t_load__a___a = makeString("Can't load ~a: ~a"); private static final SubLString $$$cdolist = makeString("cdolist"); private static final SubLSymbol $IMAGE_INDEPENDENT_CFASL = makeKeyword("IMAGE-INDEPENDENT-CFASL"); private static final SubLString $$$Iterating_over_FHT = makeString("Iterating over FHT"); private static final SubLList $list93 = cons(makeSymbol("LICENSED?"), makeSymbol("TERM")); private static final SubLString $str94$don_t_know_how_to_convert__A = makeString("don't know how to convert ~A"); private static final SubLString $str95$_A__A_ = makeString("~A,~A,"); private static final SubLString $str96$_A_ = makeString("~A,"); private static final SubLString $str97$__ = makeString("~%"); private static final SubLList $list98 = list(makeKeyword("INTERMEDIATE-STEP-VALIDATION-LEVEL"), makeKeyword("MINIMAL")); private static final SubLString $$$mapping_Cyc_FORTs = makeString("mapping Cyc FORTs"); private static final SubLString $str101$_host_george_term_id_lists_ = makeString("/host/george/term-id-lists/"); private static final SubLString $str102$_host_george_disambig_rules_ = makeString("/host/george/disambig-rules/"); private static final SubLString $str103$_Afort_id__4__0D_cfasl = makeString("~Afort-id-~4,'0D.cfasl"); private static final SubLString $str104$_Adisambiguator_rule_file__4__0D_ = makeString("~Adisambiguator-rule-file-~4,'0D.txt"); private static final SubLString $str105$created_using_CREATE_RULE_DISAMBI = makeString("created using CREATE-RULE-DISAMBIGUATION-CONDOR-JOBS in RULE-DISAMBIGUATION"); private static final SubLString $str106$arguments______progn__load____hom = makeString("arguments = \"\'(progn (load \"\"/home/daves/cycl/rule-disambiguation.lisp\"\") (load-transcript-file \"\"/cyc/top/transcripts/0917/billie-20061025103022-21843-local-0-sent.ts\"\" nil :none) (load-transcript-file \"\"/cyc/top/transcripts/0917/billie-20061025103022-21843-local-1-sent.ts\"\" nil :none) (create-disambiguator-rules-file-from-fort-file-id ~A))\'\"~%"); private static final SubLString $str107$queue____ = makeString("queue~%~%"); public static final SubLObject with_new_rule_disambiguator_alt(SubLObject macroform, SubLObject environment) { { SubLObject datum = macroform.rest(); SubLObject current = datum; destructuring_bind_must_consp(current, datum, $list_alt2); { SubLObject temp = current.rest(); current = current.first(); { SubLObject disambiguator = NIL; destructuring_bind_must_consp(current, datum, $list_alt2); disambiguator = current.first(); current = current.rest(); if (NIL == current) { current = temp; { SubLObject body = current; return listS(CLET, list(bq_cons(disambiguator, $list_alt4)), append(body, list(list(FINALIZE_RULE_DISAMBIGUATOR, disambiguator)))); } } else { cdestructuring_bind_error(datum, $list_alt2); } } } } return NIL; } public static SubLObject with_new_rule_disambiguator(final SubLObject macroform, final SubLObject environment) { SubLObject current; final SubLObject datum = current = macroform.rest(); destructuring_bind_must_consp(current, datum, $list2); final SubLObject temp = current.rest(); current = current.first(); SubLObject disambiguator = NIL; destructuring_bind_must_consp(current, datum, $list2); disambiguator = current.first(); current = current.rest(); if (NIL == current) { final SubLObject body; current = body = temp; return listS(CLET, list(bq_cons(disambiguator, $list4)), append(body, list(list(FINALIZE_RULE_DISAMBIGUATOR, disambiguator)))); } cdestructuring_bind_error(datum, $list2); return NIL; } public static final SubLObject rule_disambiguator_print_function_trampoline_alt(SubLObject v_object, SubLObject stream) { rdis_print(v_object, stream, ZERO_INTEGER); return NIL; } public static SubLObject rule_disambiguator_print_function_trampoline(final SubLObject v_object, final SubLObject stream) { rdis_print(v_object, stream, ZERO_INTEGER); return NIL; } public static final SubLObject rule_disambiguator_p_alt(SubLObject v_object) { return v_object.getClass() == com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.class ? ((SubLObject) (T)) : NIL; } public static SubLObject rule_disambiguator_p(final SubLObject v_object) { return v_object.getClass() == com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native.class ? T : NIL; } public static final SubLObject rdis_rule_file_alt(SubLObject v_object) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.getField2(); } public static SubLObject rdis_rule_file(final SubLObject v_object) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.getField2(); } public static final SubLObject rdis_count_file_alt(SubLObject v_object) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.getField3(); } public static SubLObject rdis_count_file(final SubLObject v_object) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.getField3(); } public static final SubLObject rdis_rules_alt(SubLObject v_object) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.getField4(); } public static SubLObject rdis_rules(final SubLObject v_object) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.getField4(); } public static final SubLObject rdis_counts_alt(SubLObject v_object) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.getField5(); } public static SubLObject rdis_counts(final SubLObject v_object) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.getField5(); } public static final SubLObject _csetf_rdis_rule_file_alt(SubLObject v_object, SubLObject value) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.setField2(value); } public static SubLObject _csetf_rdis_rule_file(final SubLObject v_object, final SubLObject value) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.setField2(value); } public static final SubLObject _csetf_rdis_count_file_alt(SubLObject v_object, SubLObject value) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.setField3(value); } public static SubLObject _csetf_rdis_count_file(final SubLObject v_object, final SubLObject value) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.setField3(value); } public static final SubLObject _csetf_rdis_rules_alt(SubLObject v_object, SubLObject value) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.setField4(value); } public static SubLObject _csetf_rdis_rules(final SubLObject v_object, final SubLObject value) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.setField4(value); } public static final SubLObject _csetf_rdis_counts_alt(SubLObject v_object, SubLObject value) { SubLTrampolineFile.checkType(v_object, RULE_DISAMBIGUATOR_P); return v_object.setField5(value); } public static SubLObject _csetf_rdis_counts(final SubLObject v_object, final SubLObject value) { assert NIL != rule_disambiguator_p(v_object) : "! rule_disambiguation.rule_disambiguator_p(v_object) " + "rule_disambiguation.rule_disambiguator_p error :" + v_object; return v_object.setField5(value); } public static final SubLObject make_rule_disambiguator_alt(SubLObject arglist) { if (arglist == UNPROVIDED) { arglist = NIL; } { SubLObject v_new = new com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native(); SubLObject next = NIL; for (next = arglist; NIL != next; next = cddr(next)) { { SubLObject current_arg = next.first(); SubLObject current_value = cadr(next); SubLObject pcase_var = current_arg; if (pcase_var.eql($RULE_FILE)) { _csetf_rdis_rule_file(v_new, current_value); } else { if (pcase_var.eql($COUNT_FILE)) { _csetf_rdis_count_file(v_new, current_value); } else { if (pcase_var.eql($RULES)) { _csetf_rdis_rules(v_new, current_value); } else { if (pcase_var.eql($COUNTS)) { _csetf_rdis_counts(v_new, current_value); } else { Errors.error($str_alt26$Invalid_slot__S_for_construction_, current_arg); } } } } } } return v_new; } } public static SubLObject make_rule_disambiguator(SubLObject arglist) { if (arglist == UNPROVIDED) { arglist = NIL; } final SubLObject v_new = new com.cyc.cycjava.cycl.rule_disambiguation.$rule_disambiguator_native(); SubLObject next; SubLObject current_arg; SubLObject current_value; SubLObject pcase_var; for (next = NIL, next = arglist; NIL != next; next = cddr(next)) { current_arg = next.first(); current_value = cadr(next); pcase_var = current_arg; if (pcase_var.eql($RULE_FILE)) { _csetf_rdis_rule_file(v_new, current_value); } else if (pcase_var.eql($COUNT_FILE)) { _csetf_rdis_count_file(v_new, current_value); } else if (pcase_var.eql($RULES)) { _csetf_rdis_rules(v_new, current_value); } else if (pcase_var.eql($COUNTS)) { _csetf_rdis_counts(v_new, current_value); } else { Errors.error($str27$Invalid_slot__S_for_construction_, current_arg); } } return v_new; } public static SubLObject visit_defstruct_rule_disambiguator(final SubLObject obj, final SubLObject visitor_fn) { funcall(visitor_fn, obj, $BEGIN, MAKE_RULE_DISAMBIGUATOR, FOUR_INTEGER); funcall(visitor_fn, obj, $SLOT, $RULE_FILE, rdis_rule_file(obj)); funcall(visitor_fn, obj, $SLOT, $COUNT_FILE, rdis_count_file(obj)); funcall(visitor_fn, obj, $SLOT, $RULES, rdis_rules(obj)); funcall(visitor_fn, obj, $SLOT, $COUNTS, rdis_counts(obj)); funcall(visitor_fn, obj, $END, MAKE_RULE_DISAMBIGUATOR, FOUR_INTEGER); return obj; } public static SubLObject visit_defstruct_object_rule_disambiguator_method(final SubLObject obj, final SubLObject visitor_fn) { return visit_defstruct_rule_disambiguator(obj, visitor_fn); } /** * returns a new rule-disambiguator using the rules in PATH */ @LispMethod(comment = "returns a new rule-disambiguator using the rules in PATH") public static final SubLObject new_rule_disambiguator_alt(SubLObject rulepath, SubLObject countpath) { if (rulepath == UNPROVIDED) { rulepath = $word_sense_disambiguation_rule_file$.getDynamicValue(); } if (countpath == UNPROVIDED) { countpath = $word_sense_disambiguation_count_file$.getDynamicValue(); } SubLTrampolineFile.checkType(rulepath, STRINGP); SubLTrampolineFile.checkType(countpath, STRINGP); { SubLObject dis = make_rule_disambiguator(UNPROVIDED); _csetf_rdis_rule_file(dis, rulepath); _csetf_rdis_rules(dis, load_disambiguator_rules(rulepath)); _csetf_rdis_count_file(dis, countpath); _csetf_rdis_counts(dis, load_disambiguator_counts(countpath)); return dis; } } /** * returns a new rule-disambiguator using the rules in PATH */ @LispMethod(comment = "returns a new rule-disambiguator using the rules in PATH") public static SubLObject new_rule_disambiguator(SubLObject rulepath, SubLObject countpath) { if (rulepath == UNPROVIDED) { rulepath = $word_sense_disambiguation_rule_file$.getDynamicValue(); } if (countpath == UNPROVIDED) { countpath = $word_sense_disambiguation_count_file$.getDynamicValue(); } assert NIL != stringp(rulepath) : "! stringp(rulepath) " + ("Types.stringp(rulepath) " + "CommonSymbols.NIL != Types.stringp(rulepath) ") + rulepath; assert NIL != stringp(countpath) : "! stringp(countpath) " + ("Types.stringp(countpath) " + "CommonSymbols.NIL != Types.stringp(countpath) ") + countpath; final SubLObject dis = make_rule_disambiguator(UNPROVIDED); _csetf_rdis_rule_file(dis, rulepath); _csetf_rdis_rules(dis, load_disambiguator_rules(rulepath)); _csetf_rdis_count_file(dis, countpath); _csetf_rdis_counts(dis, load_disambiguator_counts(countpath)); return dis; } /** * frees all resources of disambiguator RDIS */ @LispMethod(comment = "frees all resources of disambiguator RDIS") public static final SubLObject finalize_rule_disambiguator_alt(SubLObject rdis) { SubLTrampolineFile.checkType(rdis, RULE_DISAMBIGUATOR_P); file_backed_cache.file_backed_cache_finalize(rdis_rules(rdis)); file_backed_cache.file_backed_cache_finalize(rdis_counts(rdis)); return T; } /** * frees all resources of disambiguator RDIS */ @LispMethod(comment = "frees all resources of disambiguator RDIS") public static SubLObject finalize_rule_disambiguator(final SubLObject rdis) { assert NIL != rule_disambiguator_p(rdis) : "! rule_disambiguation.rule_disambiguator_p(rdis) " + ("rule_disambiguation.rule_disambiguator_p(rdis) " + "CommonSymbols.NIL != rule_disambiguation.rule_disambiguator_p(rdis) ") + rdis; file_backed_cache.file_backed_cache_finalize(rdis_rules(rdis)); file_backed_cache.file_backed_cache_finalize(rdis_counts(rdis)); return T; } /** * prints RDIS to STREAM, ignoring DEPTH */ @LispMethod(comment = "prints RDIS to STREAM, ignoring DEPTH") public static final SubLObject rdis_print_alt(SubLObject rdis, SubLObject stream, SubLObject depth) { write_string($str_alt28$__RULE_DISAMBIGUATOR_, stream, UNPROVIDED, UNPROVIDED); write_string(rdis_rule_file(rdis), stream, UNPROVIDED, UNPROVIDED); write_string($str_alt29$_, stream, UNPROVIDED, UNPROVIDED); write_string(rdis_count_file(rdis), stream, UNPROVIDED, UNPROVIDED); write_string($str_alt30$_, stream, UNPROVIDED, UNPROVIDED); return rdis; } /** * prints RDIS to STREAM, ignoring DEPTH */ @LispMethod(comment = "prints RDIS to STREAM, ignoring DEPTH") public static SubLObject rdis_print(final SubLObject rdis, final SubLObject stream, final SubLObject depth) { write_string($str34$__RULE_DISAMBIGUATOR_, stream, UNPROVIDED, UNPROVIDED); write_string(rdis_rule_file(rdis), stream, UNPROVIDED, UNPROVIDED); write_string($$$_, stream, UNPROVIDED, UNPROVIDED); write_string(rdis_count_file(rdis), stream, UNPROVIDED, UNPROVIDED); write_string($str36$_, stream, UNPROVIDED, UNPROVIDED); return rdis; } /** * Don't use any of the senses that were added to bag because of this word. Expected to be used * when disambiguating WORD. */ @LispMethod(comment = "Don\'t use any of the senses that were added to bag because of this word. Expected to be used\r\nwhen disambiguating WORD.\nDon\'t use any of the senses that were added to bag because of this word. Expected to be used\nwhen disambiguating WORD.") public static final SubLObject with_sense_bag_excepting_word_alt(SubLObject macroform, SubLObject environment) { { SubLObject datum = macroform.rest(); SubLObject current = datum; destructuring_bind_must_consp(current, datum, $list_alt31); { SubLObject temp = current.rest(); current = current.first(); { SubLObject v_bag = NIL; SubLObject word = NIL; destructuring_bind_must_consp(current, datum, $list_alt31); v_bag = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list_alt31); word = current.first(); current = current.rest(); if (NIL == current) { current = temp; { SubLObject body = current; SubLObject cycl = $sym32$CYCL; SubLObject genl_cycl = $sym33$GENL_CYCL; return listS(PROGN, list(CDOLIST, list(cycl, list(WORD_CYCLS, word)), listS(CINC_HASH, cycl, v_bag, $list_alt38), list(CDOLIST, list(genl_cycl, list(GET_UPWARDS_CLOSURE, cycl)), listS(CINC_HASH, genl_cycl, v_bag, $list_alt38))), append(body, list(list(CDOLIST, list(cycl, list(WORD_CYCLS, word)), list(CINC_HASH, cycl, v_bag), list(CDOLIST, list(genl_cycl, list(GET_UPWARDS_CLOSURE, cycl)), list(CINC_HASH, genl_cycl, v_bag)))))); } } else { cdestructuring_bind_error(datum, $list_alt31); } } } } return NIL; } /** * Don't use any of the senses that were added to bag because of this word. Expected to be used * when disambiguating WORD. */ @LispMethod(comment = "Don\'t use any of the senses that were added to bag because of this word. Expected to be used\r\nwhen disambiguating WORD.\nDon\'t use any of the senses that were added to bag because of this word. Expected to be used\nwhen disambiguating WORD.") public static SubLObject with_sense_bag_excepting_word(final SubLObject macroform, final SubLObject environment) { SubLObject current; final SubLObject datum = current = macroform.rest(); destructuring_bind_must_consp(current, datum, $list37); final SubLObject temp = current.rest(); current = current.first(); SubLObject v_bag = NIL; SubLObject word = NIL; destructuring_bind_must_consp(current, datum, $list37); v_bag = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list37); word = current.first(); current = current.rest(); if (NIL == current) { final SubLObject body; current = body = temp; final SubLObject cycl = $sym38$CYCL; final SubLObject genl_cycl = $sym39$GENL_CYCL; return listS(PROGN, list(CDOLIST, list(cycl, list(WORD_CYCLS, word)), listS(CINC_HASH, cycl, v_bag, $list44), list(CDOLIST, list(genl_cycl, list(GET_UPWARDS_CLOSURE, cycl)), listS(CINC_HASH, genl_cycl, v_bag, $list44))), append(body, list(list(CDOLIST, list(cycl, list(WORD_CYCLS, word)), list(CINC_HASH, cycl, v_bag), list(CDOLIST, list(genl_cycl, list(GET_UPWARDS_CLOSURE, cycl)), list(CINC_HASH, genl_cycl, v_bag)))))); } cdestructuring_bind_error(datum, $list37); return NIL; } public static SubLObject document_disambiguate_rule_disambiguator_method(final SubLObject disambiguator, final SubLObject doc, SubLObject v_context) { if (v_context == UNPROVIDED) { v_context = new_sense_bag(doc); } return rdis_disambiguate(disambiguator, doc, v_context); } /** * disambiguates each word in DOC by discarding senses that aren't licensed by sense set CONTEXT */ @LispMethod(comment = "disambiguates each word in DOC by discarding senses that aren\'t licensed by sense set CONTEXT") public static final SubLObject rdis_disambiguate_alt(SubLObject rdis, SubLObject doc, SubLObject v_context) { if (v_context == UNPROVIDED) { v_context = new_sense_bag(doc); } SubLTrampolineFile.checkType(rdis, RULE_DISAMBIGUATOR_P); SubLTrampolineFile.checkType(doc, DOCUMENT_P); SubLTrampolineFile.checkType(v_context, HASH_TABLE_P); { SubLObject vector_var = document.document_paragraphs(doc); SubLObject backwardP_var = NIL; SubLObject length = length(vector_var); SubLObject v_iteration = NIL; for (v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { { SubLObject element_num = (NIL != backwardP_var) ? ((SubLObject) (subtract(length, v_iteration, ONE_INTEGER))) : v_iteration; SubLObject paragraph = aref(vector_var, element_num); SubLObject vector_var_1 = document.paragraph_sentences(paragraph); SubLObject backwardP_var_2 = NIL; SubLObject length_3 = length(vector_var_1); SubLObject v_iteration_4 = NIL; for (v_iteration_4 = ZERO_INTEGER; v_iteration_4.numL(length_3); v_iteration_4 = add(v_iteration_4, ONE_INTEGER)) { { SubLObject element_num_5 = (NIL != backwardP_var_2) ? ((SubLObject) (subtract(length_3, v_iteration_4, ONE_INTEGER))) : v_iteration_4; SubLObject sentence = aref(vector_var_1, element_num_5); SubLObject vector_var_6 = document.sentence_yield(sentence); SubLObject backwardP_var_7 = NIL; SubLObject length_8 = length(vector_var_6); SubLObject v_iteration_9 = NIL; for (v_iteration_9 = ZERO_INTEGER; v_iteration_9.numL(length_8); v_iteration_9 = add(v_iteration_9, ONE_INTEGER)) { { SubLObject element_num_10 = (NIL != backwardP_var_7) ? ((SubLObject) (subtract(length_8, v_iteration_9, ONE_INTEGER))) : v_iteration_9; SubLObject word = aref(vector_var_6, element_num_10); { SubLObject cdolist_list_var = document.word_cycls(word); SubLObject cycl = NIL; for (cycl = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , cycl = cdolist_list_var.first()) { hash_table_utilities.cinc_hash(cycl, v_context, MINUS_ONE_INTEGER, UNPROVIDED); { SubLObject cdolist_list_var_11 = document_annotation_widgets.get_upwards_closure(cycl); SubLObject genl_cycl = NIL; for (genl_cycl = cdolist_list_var_11.first(); NIL != cdolist_list_var_11; cdolist_list_var_11 = cdolist_list_var_11.rest() , genl_cycl = cdolist_list_var_11.first()) { hash_table_utilities.cinc_hash(genl_cycl, v_context, MINUS_ONE_INTEGER, UNPROVIDED); } } } } { SubLObject sense_markers = document.word_interps(word); SubLObject new_senses = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; for (sense_marker = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , sense_marker = cdolist_list_var.first()) { if (NIL != is_licensed_p(sense_marker, rdis_rules(rdis), v_context)) { new_senses = cons(sense_marker, new_senses); } } if (NIL == new_senses) { new_senses = sense_markers_not_requiring_licensing(rule_void(sense_markers, rdis_rules(rdis))); } putf(document.word_info(word), $INTERPS, new_senses); } { SubLObject cdolist_list_var = document.word_cycls(word); SubLObject cycl = NIL; for (cycl = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , cycl = cdolist_list_var.first()) { hash_table_utilities.cinc_hash(cycl, v_context, UNPROVIDED, UNPROVIDED); { SubLObject cdolist_list_var_12 = document_annotation_widgets.get_upwards_closure(cycl); SubLObject genl_cycl = NIL; for (genl_cycl = cdolist_list_var_12.first(); NIL != cdolist_list_var_12; cdolist_list_var_12 = cdolist_list_var_12.rest() , genl_cycl = cdolist_list_var_12.first()) { hash_table_utilities.cinc_hash(genl_cycl, v_context, UNPROVIDED, UNPROVIDED); } } } } } } } } } } } return doc; } /** * disambiguates each word in DOC by discarding senses that aren't licensed by sense set CONTEXT */ @LispMethod(comment = "disambiguates each word in DOC by discarding senses that aren\'t licensed by sense set CONTEXT") public static SubLObject rdis_disambiguate(final SubLObject rdis, final SubLObject doc, SubLObject v_context) { if (v_context == UNPROVIDED) { v_context = new_sense_bag(doc); } assert NIL != rule_disambiguator_p(rdis) : "! rule_disambiguation.rule_disambiguator_p(rdis) " + ("rule_disambiguation.rule_disambiguator_p(rdis) " + "CommonSymbols.NIL != rule_disambiguation.rule_disambiguator_p(rdis) ") + rdis; assert NIL != document.document_p(doc) : "! document.document_p(doc) " + ("document.document_p(doc) " + "CommonSymbols.NIL != document.document_p(doc) ") + doc; assert NIL != hash_table_p(v_context) : "! hash_table_p(v_context) " + ("Types.hash_table_p(v_context) " + "CommonSymbols.NIL != Types.hash_table_p(v_context) ") + v_context; final SubLObject vector_var = document.document_paragraphs(doc); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject element_num; SubLObject paragraph; SubLObject vector_var_$1; SubLObject backwardP_var_$2; SubLObject length_$3; SubLObject v_iteration_$4; SubLObject element_num_$5; SubLObject sentence; SubLObject cdolist_list_var; SubLObject word; SubLObject cdolist_list_var_$6; SubLObject cycl; SubLObject cdolist_list_var_$7; SubLObject genl_cycl; SubLObject sense_markers; SubLObject new_senses; SubLObject cdolist_list_var_$8; SubLObject sense_marker; SubLObject cdolist_list_var_$9; SubLObject cdolist_list_var_$10; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { element_num = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; paragraph = aref(vector_var, element_num); vector_var_$1 = document.paragraph_sentences(paragraph); backwardP_var_$2 = NIL; for (length_$3 = length(vector_var_$1), v_iteration_$4 = NIL, v_iteration_$4 = ZERO_INTEGER; v_iteration_$4.numL(length_$3); v_iteration_$4 = add(v_iteration_$4, ONE_INTEGER)) { element_num_$5 = (NIL != backwardP_var_$2) ? subtract(length_$3, v_iteration_$4, ONE_INTEGER) : v_iteration_$4; sentence = aref(vector_var_$1, element_num_$5); cdolist_list_var = document.sentence_yield_exhaustive(sentence); word = NIL; word = cdolist_list_var.first(); while (NIL != cdolist_list_var) { cdolist_list_var_$6 = document.word_cycls(word); cycl = NIL; cycl = cdolist_list_var_$6.first(); while (NIL != cdolist_list_var_$6) { hash_table_utilities.cinc_hash(cycl, v_context, MINUS_ONE_INTEGER, UNPROVIDED); cdolist_list_var_$7 = document_annotation_widgets.get_upwards_closure(cycl); genl_cycl = NIL; genl_cycl = cdolist_list_var_$7.first(); while (NIL != cdolist_list_var_$7) { hash_table_utilities.cinc_hash(genl_cycl, v_context, MINUS_ONE_INTEGER, UNPROVIDED); cdolist_list_var_$7 = cdolist_list_var_$7.rest(); genl_cycl = cdolist_list_var_$7.first(); } cdolist_list_var_$6 = cdolist_list_var_$6.rest(); cycl = cdolist_list_var_$6.first(); } sense_markers = document.word_interps(word); new_senses = NIL; cdolist_list_var_$8 = sense_markers; sense_marker = NIL; sense_marker = cdolist_list_var_$8.first(); while (NIL != cdolist_list_var_$8) { if (NIL != is_licensed_p(sense_marker, rdis_rules(rdis), v_context)) { new_senses = cons(sense_marker, new_senses); } cdolist_list_var_$8 = cdolist_list_var_$8.rest(); sense_marker = cdolist_list_var_$8.first(); } if (NIL == new_senses) { new_senses = sense_markers_not_requiring_licensing(rule_void(sense_markers, rdis_rules(rdis))); } putf(document.word_info(word), $INTERPS, new_senses); cdolist_list_var_$9 = document.word_cycls(word); cycl = NIL; cycl = cdolist_list_var_$9.first(); while (NIL != cdolist_list_var_$9) { hash_table_utilities.cinc_hash(cycl, v_context, UNPROVIDED, UNPROVIDED); cdolist_list_var_$10 = document_annotation_widgets.get_upwards_closure(cycl); genl_cycl = NIL; genl_cycl = cdolist_list_var_$10.first(); while (NIL != cdolist_list_var_$10) { hash_table_utilities.cinc_hash(genl_cycl, v_context, UNPROVIDED, UNPROVIDED); cdolist_list_var_$10 = cdolist_list_var_$10.rest(); genl_cycl = cdolist_list_var_$10.first(); } cdolist_list_var_$9 = cdolist_list_var_$9.rest(); cycl = cdolist_list_var_$9.first(); } cdolist_list_var = cdolist_list_var.rest(); word = cdolist_list_var.first(); } } } return doc; } public static final SubLObject sense_markers_not_requiring_licensing_alt(SubLObject sense_markers) { { SubLObject valid_markers = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; for (sense_marker = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , sense_marker = cdolist_list_var.first()) { if (!((NIL != list_utilities.tree_find($$VanishinglyRareLexicalMapping, nl_api_datastructures.get_nl_interp_pragmatics(sense_marker), UNPROVIDED, UNPROVIDED)) || (NIL != list_utilities.tree_find($const44$ContextuallyDependentLexicalMappi, nl_api_datastructures.get_nl_interp_pragmatics(sense_marker), UNPROVIDED, UNPROVIDED)))) { valid_markers = cons(sense_marker, valid_markers); } } return valid_markers; } } public static SubLObject sense_markers_not_requiring_licensing(final SubLObject sense_markers) { SubLObject valid_markers = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; sense_marker = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if ((NIL == list_utilities.tree_find($$VanishinglyRareLexicalMapping, nl_api_datastructures.get_nl_interp_pragmatics(sense_marker), UNPROVIDED, UNPROVIDED)) && (NIL == list_utilities.tree_find($const51$ContextuallyDependentLexicalMappi, nl_api_datastructures.get_nl_interp_pragmatics(sense_marker), UNPROVIDED, UNPROVIDED))) { valid_markers = cons(sense_marker, valid_markers); } cdolist_list_var = cdolist_list_var.rest(); sense_marker = cdolist_list_var.first(); } return valid_markers; } /** * returns those sense markers in SENSE-MARKERS that don't have a rule in RULES */ @LispMethod(comment = "returns those sense markers in SENSE-MARKERS that don\'t have a rule in RULES") public static final SubLObject rule_void_alt(SubLObject sense_markers, SubLObject rules) { { SubLObject rule_void = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; for (sense_marker = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , sense_marker = cdolist_list_var.first()) { if (file_backed_cache.file_backed_cache_lookup(sense_marker, rules, UNPROVIDED, UNPROVIDED) == $NOT_FOUND) { rule_void = cons(sense_marker, rule_void); } } return rule_void; } } /** * returns those sense markers in SENSE-MARKERS that don't have a rule in RULES */ @LispMethod(comment = "returns those sense markers in SENSE-MARKERS that don\'t have a rule in RULES") public static SubLObject rule_void(final SubLObject sense_markers, final SubLObject rules) { SubLObject rule_void = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; sense_marker = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (file_backed_cache.file_backed_cache_lookup(sense_marker, rules, UNPROVIDED, UNPROVIDED) == $NOT_FOUND) { rule_void = cons(sense_marker, rule_void); } cdolist_list_var = cdolist_list_var.rest(); sense_marker = cdolist_list_var.first(); } return rule_void; } /** * returns a file hash table connected to PATH */ @LispMethod(comment = "returns a file hash table connected to PATH") public static final SubLObject load_disambiguator_rules_alt(SubLObject path) { if (NIL == Filesys.probe_file(path)) { Errors.error($str_alt46$Can_t_load_rules_from__a, path); } return file_backed_cache.file_backed_cache_create(path, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED); } /** * returns a file hash table connected to PATH */ @LispMethod(comment = "returns a file hash table connected to PATH") public static SubLObject load_disambiguator_rules(final SubLObject path) { if (NIL == Filesys.probe_file(path)) { Errors.error($str53$Can_t_load_rules_from__a, path); } return file_backed_cache.file_backed_cache_create(path, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED); } /** * returns a file hash table connected to PATH */ @LispMethod(comment = "returns a file hash table connected to PATH") public static final SubLObject load_disambiguator_counts_alt(SubLObject path) { if (NIL == Filesys.probe_file(path)) { Errors.error($str_alt47$Can_t_load_counts_from__a, path); } return file_backed_cache.file_backed_cache_create(path, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED); } /** * returns a file hash table connected to PATH */ @LispMethod(comment = "returns a file hash table connected to PATH") public static SubLObject load_disambiguator_counts(final SubLObject path) { if (NIL == Filesys.probe_file(path)) { Errors.error($str54$Can_t_load_counts_from__a, path); } return file_backed_cache.file_backed_cache_create(path, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED); } /** * returns the subset of SENSE-MARKERS with the highest counts according to table COUNTS * * @unknown that SENSE-MARKERS as used in this file are instances of nl-interpretation-p */ @LispMethod(comment = "returns the subset of SENSE-MARKERS with the highest counts according to table COUNTS\r\n\r\n@unknown that SENSE-MARKERS as used in this file are instances of nl-interpretation-p") public static final SubLObject highest_count_sense_markers_alt(SubLObject sense_markers, SubLObject counts) { { SubLObject max_count = ZERO_INTEGER; SubLObject highest_count_sense_markers = NIL; SubLObject count = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; for (sense_marker = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , sense_marker = cdolist_list_var.first()) { count = file_backed_cache.file_backed_cache_lookup(nl_api_datastructures.get_nl_interp_cycl(sense_marker), counts, ZERO_INTEGER, UNPROVIDED); if (count.numG(max_count)) { max_count = count; highest_count_sense_markers = list(sense_marker); } else { if (count.numE(max_count)) { highest_count_sense_markers = cons(sense_marker, highest_count_sense_markers); } } } return nreverse(highest_count_sense_markers); } } /** * returns the subset of SENSE-MARKERS with the highest counts according to table COUNTS * * @unknown that SENSE-MARKERS as used in this file are instances of nl-interpretation-p */ @LispMethod(comment = "returns the subset of SENSE-MARKERS with the highest counts according to table COUNTS\r\n\r\n@unknown that SENSE-MARKERS as used in this file are instances of nl-interpretation-p") public static SubLObject highest_count_sense_markers(final SubLObject sense_markers, final SubLObject counts) { SubLObject max_count = ZERO_INTEGER; SubLObject highest_count_sense_markers = NIL; SubLObject count = NIL; SubLObject cdolist_list_var = sense_markers; SubLObject sense_marker = NIL; sense_marker = cdolist_list_var.first(); while (NIL != cdolist_list_var) { count = file_backed_cache.file_backed_cache_lookup(nl_api_datastructures.get_nl_interp_cycl(sense_marker), counts, ZERO_INTEGER, UNPROVIDED); if (count.numG(max_count)) { max_count = count; highest_count_sense_markers = list(sense_marker); } else if (count.numE(max_count)) { highest_count_sense_markers = cons(sense_marker, highest_count_sense_markers); } cdolist_list_var = cdolist_list_var.rest(); sense_marker = cdolist_list_var.first(); } return nreverse(highest_count_sense_markers); } /** * returns t if WORD has more than one sense associated with it, nil otherwise */ @LispMethod(comment = "returns t if WORD has more than one sense associated with it, nil otherwise") public static final SubLObject ambiguous_p_alt(SubLObject word) { return numG(length(document.word_interps(word)), ONE_INTEGER); } /** * returns t if WORD has more than one sense associated with it, nil otherwise */ @LispMethod(comment = "returns t if WORD has more than one sense associated with it, nil otherwise") public static SubLObject ambiguous_p(final SubLObject word) { return numG(length(document.word_interps(word)), ONE_INTEGER); } /** * return t if SENSE-MARKER is licensed according the RULES and CONTEXT */ @LispMethod(comment = "return t if SENSE-MARKER is licensed according the RULES and CONTEXT") public static final SubLObject is_licensed_p_alt(SubLObject sense_marker, SubLObject rules, SubLObject v_context) { { SubLObject sense = nl_api_datastructures.get_nl_interp_cycl(sense_marker); SubLObject rule = file_backed_cache.file_backed_cache_lookup(sense, rules, NIL, UNPROVIDED); SubLObject is_licensed = NIL; SubLObject not_licensed = NIL; SubLObject v_term = NIL; if (NIL == is_licensed) { { SubLObject csome_list_var = rule; SubLObject clause = NIL; for (clause = csome_list_var.first(); !((NIL != is_licensed) || (NIL == csome_list_var)); csome_list_var = csome_list_var.rest() , clause = csome_list_var.first()) { if (NIL != positive_clause_p(clause)) { v_term = clause_term(clause); is_licensed = makeBoolean((NIL != is_licensed) || (NIL != sense_bag_licensesP(v_term, v_context))); } } } } if (NIL != is_licensed) { if (NIL == not_licensed) { { SubLObject csome_list_var = rule; SubLObject clause = NIL; for (clause = csome_list_var.first(); !((NIL != not_licensed) || (NIL == csome_list_var)); csome_list_var = csome_list_var.rest() , clause = csome_list_var.first()) { if (NIL != negative_clause_p(clause)) { v_term = clause_term(clause); is_licensed = makeBoolean((NIL != is_licensed) && (NIL == sense_bag_licensesP(v_term, v_context))); not_licensed = makeBoolean(NIL == is_licensed); } } } } } return is_licensed; } } /** * return t if SENSE-MARKER is licensed according the RULES and CONTEXT */ @LispMethod(comment = "return t if SENSE-MARKER is licensed according the RULES and CONTEXT") public static SubLObject is_licensed_p(final SubLObject sense_marker, final SubLObject rules, final SubLObject v_context) { final SubLObject sense = nl_api_datastructures.get_nl_interp_cycl(sense_marker); final SubLObject rule = file_backed_cache.file_backed_cache_lookup(sense, rules, NIL, UNPROVIDED); SubLObject is_licensed = NIL; SubLObject not_licensed = NIL; SubLObject v_term = NIL; if (NIL == is_licensed) { SubLObject csome_list_var = rule; SubLObject clause = NIL; clause = csome_list_var.first(); while ((NIL == is_licensed) && (NIL != csome_list_var)) { if (NIL != positive_clause_p(clause)) { v_term = clause_term(clause); is_licensed = makeBoolean((NIL != is_licensed) || (NIL != sense_bag_licensesP(v_term, v_context))); } csome_list_var = csome_list_var.rest(); clause = csome_list_var.first(); } } if ((NIL != is_licensed) && (NIL == not_licensed)) { SubLObject csome_list_var = rule; SubLObject clause = NIL; clause = csome_list_var.first(); while ((NIL == not_licensed) && (NIL != csome_list_var)) { if (NIL != negative_clause_p(clause)) { v_term = clause_term(clause); is_licensed = makeBoolean((NIL != is_licensed) && (NIL == sense_bag_licensesP(v_term, v_context))); not_licensed = makeBoolean(NIL == is_licensed); } csome_list_var = csome_list_var.rest(); clause = csome_list_var.first(); } } return is_licensed; } /** * returns t iff CLAUSE is a positive clause */ @LispMethod(comment = "returns t iff CLAUSE is a positive clause") public static final SubLObject positive_clause_p_alt(SubLObject clause) { return clause_sign(clause); } /** * returns t iff CLAUSE is a positive clause */ @LispMethod(comment = "returns t iff CLAUSE is a positive clause") public static SubLObject positive_clause_p(final SubLObject clause) { return clause_sign(clause); } /** * returns t iff CLAUSE is a negative clause */ @LispMethod(comment = "returns t iff CLAUSE is a negative clause") public static final SubLObject negative_clause_p_alt(SubLObject clause) { return makeBoolean(NIL == clause_sign(clause)); } /** * returns t iff CLAUSE is a negative clause */ @LispMethod(comment = "returns t iff CLAUSE is a negative clause") public static SubLObject negative_clause_p(final SubLObject clause) { return makeBoolean(NIL == clause_sign(clause)); } /** * returns the sign of CLAUSE */ @LispMethod(comment = "returns the sign of CLAUSE") public static final SubLObject clause_sign_alt(SubLObject clause) { return clause.first(); } /** * returns the sign of CLAUSE */ @LispMethod(comment = "returns the sign of CLAUSE") public static SubLObject clause_sign(final SubLObject clause) { return clause.first(); } /** * returns the term of CLAUSE */ @LispMethod(comment = "returns the term of CLAUSE") public static final SubLObject clause_term_alt(SubLObject clause) { return clause.rest(); } /** * returns the term of CLAUSE */ @LispMethod(comment = "returns the term of CLAUSE") public static SubLObject clause_term(final SubLObject clause) { return clause.rest(); } /** * returns a set containing all senses in DOC */ @LispMethod(comment = "returns a set containing all senses in DOC") public static final SubLObject new_sense_bag_alt(SubLObject doc) { SubLTrampolineFile.checkType(doc, DOCUMENT_P); { SubLObject senses = make_hash_table($int$1024, EQUAL, UNPROVIDED); SubLObject sense = NIL; SubLObject vector_var = document.document_paragraphs(doc); SubLObject backwardP_var = NIL; SubLObject length = length(vector_var); SubLObject v_iteration = NIL; for (v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { { SubLObject element_num = (NIL != backwardP_var) ? ((SubLObject) (subtract(length, v_iteration, ONE_INTEGER))) : v_iteration; SubLObject paragraph = aref(vector_var, element_num); SubLObject vector_var_13 = document.paragraph_sentences(paragraph); SubLObject backwardP_var_14 = NIL; SubLObject length_15 = length(vector_var_13); SubLObject v_iteration_16 = NIL; for (v_iteration_16 = ZERO_INTEGER; v_iteration_16.numL(length_15); v_iteration_16 = add(v_iteration_16, ONE_INTEGER)) { { SubLObject element_num_17 = (NIL != backwardP_var_14) ? ((SubLObject) (subtract(length_15, v_iteration_16, ONE_INTEGER))) : v_iteration_16; SubLObject sentence = aref(vector_var_13, element_num_17); SubLObject vector_var_18 = document.sentence_yield(sentence); SubLObject backwardP_var_19 = NIL; SubLObject length_20 = length(vector_var_18); SubLObject v_iteration_21 = NIL; for (v_iteration_21 = ZERO_INTEGER; v_iteration_21.numL(length_20); v_iteration_21 = add(v_iteration_21, ONE_INTEGER)) { { SubLObject element_num_22 = (NIL != backwardP_var_19) ? ((SubLObject) (subtract(length_20, v_iteration_21, ONE_INTEGER))) : v_iteration_21; SubLObject word = aref(vector_var_18, element_num_22); SubLObject cdolist_list_var = document.word_interps(word); SubLObject sense_marker = NIL; for (sense_marker = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , sense_marker = cdolist_list_var.first()) { sense = nl_api_datastructures.get_nl_interp_cycl(sense_marker); hash_table_utilities.cinc_hash(sense, senses, UNPROVIDED, UNPROVIDED); { SubLObject cdolist_list_var_23 = document_annotation_widgets.get_upwards_closure(sense); SubLObject general = NIL; for (general = cdolist_list_var_23.first(); NIL != cdolist_list_var_23; cdolist_list_var_23 = cdolist_list_var_23.rest() , general = cdolist_list_var_23.first()) { hash_table_utilities.cinc_hash(general, senses, UNPROVIDED, UNPROVIDED); } } } } } } } } } return senses; } } /** * returns a set containing all senses in DOC */ @LispMethod(comment = "returns a set containing all senses in DOC") public static SubLObject new_sense_bag(final SubLObject doc) { assert NIL != document.document_p(doc) : "! document.document_p(doc) " + ("document.document_p(doc) " + "CommonSymbols.NIL != document.document_p(doc) ") + doc; final SubLObject senses = make_hash_table($int$1024, EQUAL, UNPROVIDED); SubLObject sense = NIL; final SubLObject vector_var = document.document_paragraphs(doc); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject element_num; SubLObject paragraph; SubLObject vector_var_$11; SubLObject backwardP_var_$12; SubLObject length_$13; SubLObject v_iteration_$14; SubLObject element_num_$15; SubLObject sentence; SubLObject cdolist_list_var; SubLObject word; SubLObject cdolist_list_var_$16; SubLObject sense_marker; SubLObject cdolist_list_var_$17; SubLObject general; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { element_num = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; paragraph = aref(vector_var, element_num); vector_var_$11 = document.paragraph_sentences(paragraph); backwardP_var_$12 = NIL; for (length_$13 = length(vector_var_$11), v_iteration_$14 = NIL, v_iteration_$14 = ZERO_INTEGER; v_iteration_$14.numL(length_$13); v_iteration_$14 = add(v_iteration_$14, ONE_INTEGER)) { element_num_$15 = (NIL != backwardP_var_$12) ? subtract(length_$13, v_iteration_$14, ONE_INTEGER) : v_iteration_$14; sentence = aref(vector_var_$11, element_num_$15); cdolist_list_var = document.sentence_yield_exhaustive(sentence); word = NIL; word = cdolist_list_var.first(); while (NIL != cdolist_list_var) { cdolist_list_var_$16 = document.word_interps(word); sense_marker = NIL; sense_marker = cdolist_list_var_$16.first(); while (NIL != cdolist_list_var_$16) { sense = nl_api_datastructures.get_nl_interp_cycl(sense_marker); hash_table_utilities.cinc_hash(sense, senses, UNPROVIDED, UNPROVIDED); cdolist_list_var_$17 = document_annotation_widgets.get_upwards_closure(sense); general = NIL; general = cdolist_list_var_$17.first(); while (NIL != cdolist_list_var_$17) { hash_table_utilities.cinc_hash(general, senses, UNPROVIDED, UNPROVIDED); cdolist_list_var_$17 = cdolist_list_var_$17.rest(); general = cdolist_list_var_$17.first(); } cdolist_list_var_$16 = cdolist_list_var_$16.rest(); sense_marker = cdolist_list_var_$16.first(); } cdolist_list_var = cdolist_list_var.rest(); word = cdolist_list_var.first(); } } } return senses; } /** * returns t if TERM is licensed by sense bag BAG */ @LispMethod(comment = "returns t if TERM is licensed by sense bag BAG") public static final SubLObject sense_bag_licensesP_alt(SubLObject v_term, SubLObject v_bag) { return subl_promotions.positive_integer_p(gethash_without_values(v_term, v_bag, UNPROVIDED)); } /** * returns t if TERM is licensed by sense bag BAG */ @LispMethod(comment = "returns t if TERM is licensed by sense bag BAG") public static SubLObject sense_bag_licensesP(final SubLObject v_term, final SubLObject v_bag) { return subl_promotions.positive_integer_p(gethash_without_values(v_term, v_bag, UNPROVIDED)); } public static final SubLObject disambiguation_rule_query_alt(SubLObject pred) { return ask_utilities.query_template($list_alt49, bq_cons(pred, $list_alt49), $$InferencePSC, $list_alt51); } public static SubLObject disambiguation_rule_query(final SubLObject pred) { return ask_utilities.query_template($list56, bq_cons(pred, $list56), $$InferencePSC, $list58); } public static final SubLObject create_disambiguator_rules_file_alt(SubLObject f_out) { if (f_out == UNPROVIDED) { f_out = $str_alt52$data_word_sense_disambiguation_ru; } { final SubLThread thread = SubLProcess.currentSubLThread(); { SubLObject licensing_term_pairs = disambiguation_rule_query($$isLicensedBy); SubLObject delicensing_term_pairs = disambiguation_rule_query($$isDelicensedBy); SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); { SubLObject cdolist_list_var = licensing_term_pairs; SubLObject licensing_term_pair = NIL; for (licensing_term_pair = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , licensing_term_pair = cdolist_list_var.first()) { hash_table_utilities.push_hash(licensing_term_pair.first(), cons(T, second(licensing_term_pair)), rule_hash_table); } } { SubLObject cdolist_list_var = delicensing_term_pairs; SubLObject delicensing_term_pair = NIL; for (delicensing_term_pair = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , delicensing_term_pair = cdolist_list_var.first()) { hash_table_utilities.push_hash(delicensing_term_pair.first(), cons(NIL, second(delicensing_term_pair)), rule_hash_table); } } { SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT, NIL); if (!stream.isStream()) { Errors.error($str_alt57$Unable_to_open__S, f_out); } { SubLObject s_out = stream; { SubLObject _prev_bind_0 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str_alt58$___); { SubLObject key = NIL; SubLObject value = NIL; { final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str_alt59$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } } } format(s_out, $str_alt60$___); } finally { $print_pretty$.rebind(_prev_bind_0, thread); } } } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); if (stream.isStream()) { close(stream, UNPROVIDED); } } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } } return $DONE; } } } public static SubLObject create_disambiguator_rules_file(SubLObject f_out) { if (f_out == UNPROVIDED) { f_out = $str59$data_word_sense_disambiguation_ru; } final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject licensing_term_pairs = disambiguation_rule_query($$isLicensedBy); final SubLObject delicensing_term_pairs = disambiguation_rule_query($$isDelicensedBy); final SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); SubLObject cdolist_list_var = licensing_term_pairs; SubLObject licensing_term_pair = NIL; licensing_term_pair = cdolist_list_var.first(); while (NIL != cdolist_list_var) { hash_table_utilities.push_hash(licensing_term_pair.first(), cons(T, second(licensing_term_pair)), rule_hash_table); cdolist_list_var = cdolist_list_var.rest(); licensing_term_pair = cdolist_list_var.first(); } cdolist_list_var = delicensing_term_pairs; SubLObject delicensing_term_pair = NIL; delicensing_term_pair = cdolist_list_var.first(); while (NIL != cdolist_list_var) { hash_table_utilities.push_hash(delicensing_term_pair.first(), cons(NIL, second(delicensing_term_pair)), rule_hash_table); cdolist_list_var = cdolist_list_var.rest(); delicensing_term_pair = cdolist_list_var.first(); } SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT); if (!stream.isStream()) { Errors.error($str64$Unable_to_open__S, f_out); } final SubLObject s_out = stream; final SubLObject _prev_bind_0 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str65$___); SubLObject key = NIL; SubLObject value = NIL; final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str66$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } format(s_out, $str67$___); } finally { $print_pretty$.rebind(_prev_bind_0, thread); } } finally { final SubLObject _prev_bind_2 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); if (stream.isStream()) { close(stream, UNPROVIDED); } restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_2, thread); } } return $DONE; } public static final SubLObject fort_disambiguation_rule_query_alt(SubLObject fort, SubLObject pred, SubLObject pstore) { return ask_utilities.query_template(bq_cons(fort, $list_alt62), listS(pred, fort, $list_alt62), $$InferencePSC, list(new SubLObject[]{ $INFERENCE_MODE, $SHALLOW, $kw65$ALLOW_INDETERMINATE_RESULTS_, NIL, $DISJUNCTION_FREE_EL_VARS_POLICY, $COMPUTE_INTERSECTION, $INTERMEDIATE_STEP_VALIDATION_LEVEL, $MINIMAL, $MAX_TIME, $int$57600, $PROBABLY_APPROXIMATELY_DONE, $float$1_0, $ANSWER_LANGUAGE, $EL, $CONTINUABLE_, NIL, $PROBLEM_STORE, pstore })); } public static SubLObject fort_disambiguation_rule_query(final SubLObject fort, final SubLObject pred, final SubLObject pstore) { return ask_utilities.query_template(bq_cons(fort, $list69), listS(pred, fort, $list69), $$InferencePSC, list(new SubLObject[]{ $INFERENCE_MODE, $SHALLOW, $kw72$ALLOW_INDETERMINATE_RESULTS_, NIL, $DISJUNCTION_FREE_EL_VARS_POLICY, $COMPUTE_INTERSECTION, $INTERMEDIATE_STEP_VALIDATION_LEVEL, $MINIMAL, $MAX_TIME, $int$57600, $PROBABLY_APPROXIMATELY_DONE, $float$1_0, $ANSWER_LANGUAGE, $EL, $CONTINUABLE_, NIL, $PROBLEM_STORE, pstore })); } /** * Creates a file hash table at PATH using TESTFN and SERIALIZATION with the same contents as ALIST */ @LispMethod(comment = "Creates a file hash table at PATH using TESTFN and SERIALIZATION with the same contents as ALIST") public static final SubLObject term_alist_to_file_hash_table_alt(SubLObject alist, SubLObject path, SubLObject testfn, SubLObject serialization, SubLObject tempstem) { if (testfn == UNPROVIDED) { testfn = file_hash_table.$default_fht_test_function$.getGlobalValue(); } if (serialization == UNPROVIDED) { serialization = file_hash_table.$default_fht_serialization_protocol$.getGlobalValue(); } if (tempstem == UNPROVIDED) { tempstem = $str_alt78$_tmp_; } SubLTrampolineFile.checkType(alist, LISTP); SubLTrampolineFile.checkType(path, STRINGP); { SubLObject fht = file_hash_table.fast_create_file_hash_table(path, tempstem, testfn, serialization); SubLObject cdolist_list_var = reverse(alist); SubLObject keyXvalue = NIL; for (keyXvalue = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , keyXvalue = cdolist_list_var.first()) { { SubLObject key = keyXvalue.first(); if ((NIL != invalid_constantP(key, UNPROVIDED)) || (NIL != narts_high.invalid_nartP(key, UNPROVIDED))) { Errors.warn($str_alt80$_a_is_invalid, key); } else { file_hash_table.fast_put_file_hash_table(keyXvalue.first(), fht, keyXvalue.rest()); } } } file_hash_table.finalize_fast_create_file_hash_table(fht, UNPROVIDED, UNPROVIDED); } return path; } /** * Creates a file hash table at PATH using TESTFN and SERIALIZATION with the same contents as ALIST */ @LispMethod(comment = "Creates a file hash table at PATH using TESTFN and SERIALIZATION with the same contents as ALIST") public static SubLObject term_alist_to_file_hash_table(final SubLObject alist, final SubLObject path, SubLObject testfn, SubLObject serialization, SubLObject tempstem) { if (testfn == UNPROVIDED) { testfn = file_hash_table.$default_fht_test_function$.getGlobalValue(); } if (serialization == UNPROVIDED) { serialization = file_hash_table.$default_fht_serialization_protocol$.getGlobalValue(); } if (tempstem == UNPROVIDED) { tempstem = $str85$_tmp_; } assert NIL != listp(alist) : "! listp(alist) " + ("Types.listp(alist) " + "CommonSymbols.NIL != Types.listp(alist) ") + alist; assert NIL != stringp(path) : "! stringp(path) " + ("Types.stringp(path) " + "CommonSymbols.NIL != Types.stringp(path) ") + path; final SubLObject fht = file_hash_table.fast_create_file_hash_table(path, tempstem, testfn, serialization); SubLObject cdolist_list_var = reverse(alist); SubLObject keyXvalue = NIL; keyXvalue = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject key = keyXvalue.first(); if ((NIL != invalid_constantP(key, UNPROVIDED)) || (NIL != narts_high.invalid_nartP(key, UNPROVIDED))) { Errors.warn($str87$_a_is_invalid, key); } else { file_hash_table.fast_put_file_hash_table(keyXvalue.first(), fht, keyXvalue.rest()); } cdolist_list_var = cdolist_list_var.rest(); keyXvalue = cdolist_list_var.first(); } file_hash_table.finalize_fast_create_file_hash_table(fht, UNPROVIDED, UNPROVIDED); return path; } public static final SubLObject alist_file_to_fht_alt(SubLObject infile, SubLObject outfht) { { final SubLThread thread = SubLProcess.currentSubLThread(); SubLTrampolineFile.checkType(infile, STRINGP); SubLTrampolineFile.checkType(outfht, STRINGP); if (NIL == Filesys.probe_file(infile)) { Errors.error($str_alt81$Can_t_load__a___a, infile, file_utilities.why_not_probe_fileP(infile)); } { SubLObject alist = NIL; SubLObject hash = make_hash_table($int$1024, EQUAL, UNPROVIDED); SubLObject stream = NIL; try { stream = compatibility.open_text(infile, $INPUT, NIL); if (!stream.isStream()) { Errors.error($str_alt57$Unable_to_open__S, infile); } { SubLObject in = stream; alist = read(in, T, NIL, UNPROVIDED); } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); if (stream.isStream()) { close(stream, UNPROVIDED); } } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } { SubLObject list_var = alist; $progress_note$.setDynamicValue($$$cdolist, thread); $progress_start_time$.setDynamicValue(get_universal_time(), thread); $progress_total$.setDynamicValue(length(list_var), thread); $progress_sofar$.setDynamicValue(ZERO_INTEGER, thread); { SubLObject _prev_bind_0 = $last_percent_progress_index$.currentBinding(thread); SubLObject _prev_bind_1 = $last_percent_progress_prediction$.currentBinding(thread); SubLObject _prev_bind_2 = $within_noting_percent_progress$.currentBinding(thread); SubLObject _prev_bind_3 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); { SubLObject csome_list_var = list_var; SubLObject keyXvalue = NIL; for (keyXvalue = csome_list_var.first(); NIL != csome_list_var; csome_list_var = csome_list_var.rest() , keyXvalue = csome_list_var.first()) { note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); { SubLObject key = keyXvalue.first(); if ((NIL != invalid_constantP(key, UNPROVIDED)) || (NIL != narts_high.invalid_nartP(key, UNPROVIDED))) { Errors.warn($str_alt80$_a_is_invalid, key); } else { sethash(keyXvalue.first(), hash, keyXvalue.rest()); } } } } noting_percent_progress_postamble(); } finally { $percent_progress_start_time$.rebind(_prev_bind_3, thread); $within_noting_percent_progress$.rebind(_prev_bind_2, thread); $last_percent_progress_prediction$.rebind(_prev_bind_1, thread); $last_percent_progress_index$.rebind(_prev_bind_0, thread); } } } return file_hash_table.hash_table_to_file_hash_table(hash, outfht, $str_alt78$_tmp_, EQUAL, $IMAGE_INDEPENDENT_CFASL, UNPROVIDED); } } } public static SubLObject alist_file_to_fht(final SubLObject infile, final SubLObject outfht) { final SubLThread thread = SubLProcess.currentSubLThread(); assert NIL != stringp(infile) : "! stringp(infile) " + ("Types.stringp(infile) " + "CommonSymbols.NIL != Types.stringp(infile) ") + infile; assert NIL != stringp(outfht) : "! stringp(outfht) " + ("Types.stringp(outfht) " + "CommonSymbols.NIL != Types.stringp(outfht) ") + outfht; if (NIL == Filesys.probe_file(infile)) { Errors.error($str88$Can_t_load__a___a, infile, file_utilities.why_not_probe_fileP(infile)); } SubLObject alist = NIL; final SubLObject hash = make_hash_table($int$1024, EQUAL, UNPROVIDED); SubLObject stream = NIL; try { stream = compatibility.open_text(infile, $INPUT); if (!stream.isStream()) { Errors.error($str64$Unable_to_open__S, infile); } final SubLObject in = stream; alist = read(in, T, NIL, UNPROVIDED); } finally { final SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); if (stream.isStream()) { close(stream, UNPROVIDED); } restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } final SubLObject list_var = alist; final SubLObject _prev_bind_2 = $progress_note$.currentBinding(thread); final SubLObject _prev_bind_3 = $progress_start_time$.currentBinding(thread); final SubLObject _prev_bind_4 = $progress_total$.currentBinding(thread); final SubLObject _prev_bind_5 = $progress_sofar$.currentBinding(thread); final SubLObject _prev_bind_6 = $last_percent_progress_index$.currentBinding(thread); final SubLObject _prev_bind_7 = $last_percent_progress_prediction$.currentBinding(thread); final SubLObject _prev_bind_8 = $within_noting_percent_progress$.currentBinding(thread); final SubLObject _prev_bind_9 = $percent_progress_start_time$.currentBinding(thread); try { $progress_note$.bind($$$cdolist, thread); $progress_start_time$.bind(get_universal_time(), thread); $progress_total$.bind(length(list_var), thread); $progress_sofar$.bind(ZERO_INTEGER, thread); $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); try { noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); SubLObject csome_list_var = list_var; SubLObject keyXvalue = NIL; keyXvalue = csome_list_var.first(); while (NIL != csome_list_var) { final SubLObject key = keyXvalue.first(); if ((NIL != invalid_constantP(key, UNPROVIDED)) || (NIL != narts_high.invalid_nartP(key, UNPROVIDED))) { Errors.warn($str87$_a_is_invalid, key); } else { sethash(keyXvalue.first(), hash, keyXvalue.rest()); } $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); csome_list_var = csome_list_var.rest(); keyXvalue = csome_list_var.first(); } } finally { final SubLObject _prev_bind_0_$18 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values2 = getValuesAsVector(); noting_percent_progress_postamble(); restoreValuesFromVector(_values2); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$18, thread); } } } finally { $percent_progress_start_time$.rebind(_prev_bind_9, thread); $within_noting_percent_progress$.rebind(_prev_bind_8, thread); $last_percent_progress_prediction$.rebind(_prev_bind_7, thread); $last_percent_progress_index$.rebind(_prev_bind_6, thread); $progress_sofar$.rebind(_prev_bind_5, thread); $progress_total$.rebind(_prev_bind_4, thread); $progress_start_time$.rebind(_prev_bind_3, thread); $progress_note$.rebind(_prev_bind_2, thread); } return file_hash_table.hash_table_to_file_hash_table(hash, outfht, $str85$_tmp_, EQUAL, $IMAGE_INDEPENDENT_CFASL, UNPROVIDED); } public static final SubLObject disambiguator_rule_fht_to_hl_id_text_file_alt(SubLObject infht, SubLObject outfile) { { final SubLThread thread = SubLProcess.currentSubLThread(); if (NIL == Filesys.probe_file(infht)) { Errors.error($str_alt81$Can_t_load__a___a, infht, file_utilities.why_not_probe_fileP(infht)); } { SubLObject fht = file_hash_table.open_file_hash_table_read_only(infht, UNPROVIDED, UNPROVIDED); SubLObject doneP = NIL; SubLObject stream = NIL; try { { SubLObject _prev_bind_0 = stream_macros.$stream_requires_locking$.currentBinding(thread); try { stream_macros.$stream_requires_locking$.bind(NIL, thread); stream = compatibility.open_text(outfile, $OUTPUT, NIL); } finally { stream_macros.$stream_requires_locking$.rebind(_prev_bind_0, thread); } } if (!stream.isStream()) { Errors.error($str_alt57$Unable_to_open__S, outfile); } { SubLObject out = stream; SubLObject table_var = fht; $progress_note$.setDynamicValue($$$Iterating_over_FHT, thread); $progress_start_time$.setDynamicValue(get_universal_time(), thread); $progress_total$.setDynamicValue(file_hash_table.file_hash_table_count(table_var), thread); $progress_sofar$.setDynamicValue(ZERO_INTEGER, thread); { SubLObject _prev_bind_0 = $last_percent_progress_index$.currentBinding(thread); SubLObject _prev_bind_1 = $last_percent_progress_prediction$.currentBinding(thread); SubLObject _prev_bind_2 = $within_noting_percent_progress$.currentBinding(thread); SubLObject _prev_bind_3 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); { SubLObject continuation = NIL; SubLObject completeP = NIL; while ((NIL == doneP) && (NIL == completeP)) { thread.resetMultipleValues(); { SubLObject the_key = file_hash_table.get_file_hash_table_any(table_var, continuation, NIL); SubLObject the_value = thread.secondMultipleValue(); SubLObject next = thread.thirdMultipleValue(); thread.resetMultipleValues(); if (NIL != next) { { SubLObject key = the_key; SubLObject licensers = the_value; note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); { SubLObject licensing_terms = NIL; { SubLObject cdolist_list_var = licensers; SubLObject licenser = NIL; for (licenser = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , licenser = cdolist_list_var.first()) { { SubLObject datum = licenser; SubLObject current = datum; SubLObject licensedP = NIL; SubLObject v_term = NIL; destructuring_bind_must_consp(current, datum, $list_alt86); licensedP = current.first(); current = current.rest(); v_term = current; if (licensedP == T) { licensing_terms = cons(v_term, licensing_terms); } else { Errors.warn($str_alt87$don_t_know_how_to_convert__A, licensedP); } } } } format(out, $str_alt88$_A__A_, kb_utilities.compact_hl_external_id_string(key), T); { SubLObject cdolist_list_var = licensing_terms; SubLObject v_term = NIL; for (v_term = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , v_term = cdolist_list_var.first()) { format(out, $str_alt89$_A_, kb_utilities.compact_hl_external_id_string(v_term)); } } } format(out, $str_alt90$__); } } continuation = next; completeP = sublisp_null(next); } } } noting_percent_progress_postamble(); } finally { $percent_progress_start_time$.rebind(_prev_bind_3, thread); $within_noting_percent_progress$.rebind(_prev_bind_2, thread); $last_percent_progress_prediction$.rebind(_prev_bind_1, thread); $last_percent_progress_index$.rebind(_prev_bind_0, thread); } } } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); if (stream.isStream()) { close(stream, UNPROVIDED); } } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } } return outfile; } } public static SubLObject disambiguator_rule_fht_to_hl_id_text_file(final SubLObject infht, final SubLObject outfile) { final SubLThread thread = SubLProcess.currentSubLThread(); if (NIL == Filesys.probe_file(infht)) { Errors.error($str88$Can_t_load__a___a, infht, file_utilities.why_not_probe_fileP(infht)); } final SubLObject fht = file_hash_table.open_file_hash_table_read_only(infht, UNPROVIDED, UNPROVIDED); final SubLObject doneP = NIL; SubLObject stream = NIL; try { final SubLObject _prev_bind_0 = stream_macros.$stream_requires_locking$.currentBinding(thread); try { stream_macros.$stream_requires_locking$.bind(NIL, thread); stream = compatibility.open_text(outfile, $OUTPUT); } finally { stream_macros.$stream_requires_locking$.rebind(_prev_bind_0, thread); } if (!stream.isStream()) { Errors.error($str64$Unable_to_open__S, outfile); } final SubLObject out = stream; final SubLObject table_var = fht; $progress_note$.setDynamicValue($$$Iterating_over_FHT, thread); $progress_start_time$.setDynamicValue(get_universal_time(), thread); $progress_total$.setDynamicValue(file_hash_table.file_hash_table_count(table_var), thread); $progress_sofar$.setDynamicValue(ZERO_INTEGER, thread); final SubLObject _prev_bind_2 = $last_percent_progress_index$.currentBinding(thread); final SubLObject _prev_bind_3 = $last_percent_progress_prediction$.currentBinding(thread); final SubLObject _prev_bind_4 = $within_noting_percent_progress$.currentBinding(thread); final SubLObject _prev_bind_5 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); try { noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); SubLObject continuation = NIL; SubLObject next; for (SubLObject completeP = NIL; (NIL == doneP) && (NIL == completeP); completeP = sublisp_null(next)) { thread.resetMultipleValues(); final SubLObject the_key = file_hash_table.get_file_hash_table_any(table_var, continuation, NIL); final SubLObject the_value = thread.secondMultipleValue(); next = thread.thirdMultipleValue(); thread.resetMultipleValues(); if (NIL != next) { final SubLObject key = the_key; final SubLObject licensers = the_value; note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); SubLObject licensing_terms = NIL; SubLObject cdolist_list_var = licensers; SubLObject licenser = NIL; licenser = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject current; final SubLObject datum = current = licenser; SubLObject licensedP = NIL; SubLObject v_term = NIL; destructuring_bind_must_consp(current, datum, $list93); licensedP = current.first(); current = v_term = current.rest(); if (licensedP == T) { licensing_terms = cons(v_term, licensing_terms); } else { Errors.warn($str94$don_t_know_how_to_convert__A, licensedP); } cdolist_list_var = cdolist_list_var.rest(); licenser = cdolist_list_var.first(); } format(out, $str95$_A__A_, kb_utilities.compact_hl_external_id_string(key), T); cdolist_list_var = licensing_terms; SubLObject v_term2 = NIL; v_term2 = cdolist_list_var.first(); while (NIL != cdolist_list_var) { format(out, $str96$_A_, kb_utilities.compact_hl_external_id_string(v_term2)); cdolist_list_var = cdolist_list_var.rest(); v_term2 = cdolist_list_var.first(); } format(out, $str97$__); } continuation = next; } } finally { final SubLObject _prev_bind_0_$19 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); noting_percent_progress_postamble(); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$19, thread); } } } finally { $percent_progress_start_time$.rebind(_prev_bind_5, thread); $within_noting_percent_progress$.rebind(_prev_bind_4, thread); $last_percent_progress_prediction$.rebind(_prev_bind_3, thread); $last_percent_progress_index$.rebind(_prev_bind_2, thread); } } finally { final SubLObject _prev_bind_6 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values2 = getValuesAsVector(); if (stream.isStream()) { close(stream, UNPROVIDED); } restoreValuesFromVector(_values2); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_6, thread); } } return outfile; } public static final SubLObject create_disambiguator_rules_file_from_forts_alt(SubLObject f_out) { { final SubLThread thread = SubLProcess.currentSubLThread(); SubLTrampolineFile.checkType(f_out, STRINGP); { SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); SubLObject store = NIL; try { store = inference_datastructures_problem_store.new_problem_store($list_alt91); { SubLObject message = $$$mapping_Cyc_FORTs; SubLObject total = forts.fort_count(); SubLObject sofar = ZERO_INTEGER; { SubLObject _prev_bind_0 = $last_percent_progress_index$.currentBinding(thread); SubLObject _prev_bind_1 = $last_percent_progress_prediction$.currentBinding(thread); SubLObject _prev_bind_2 = $within_noting_percent_progress$.currentBinding(thread); SubLObject _prev_bind_3 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); noting_percent_progress_preamble(message); { SubLObject cdolist_list_var = forts.do_forts_tables(); SubLObject table_var = NIL; for (table_var = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , table_var = cdolist_list_var.first()) { if (NIL == do_id_index_empty_p(table_var, $SKIP)) { { SubLObject id = do_id_index_next_id(table_var, T, NIL, NIL); SubLObject state_var = do_id_index_next_state(table_var, T, id, NIL); SubLObject fort = NIL; while (NIL != id) { fort = do_id_index_state_object(table_var, $SKIP, id, state_var); if (NIL != do_id_index_id_and_object_validP(id, fort, $SKIP)) { sofar = add(sofar, ONE_INTEGER); note_percent_progress(sofar, total); { SubLObject cdolist_list_var_24 = fort_disambiguation_rule_query(fort, $$isLicensedBy, store); SubLObject pair = NIL; for (pair = cdolist_list_var_24.first(); NIL != cdolist_list_var_24; cdolist_list_var_24 = cdolist_list_var_24.rest() , pair = cdolist_list_var_24.first()) { hash_table_utilities.push_hash(pair.first(), cons(T, second(pair)), rule_hash_table); } } { SubLObject cdolist_list_var_25 = fort_disambiguation_rule_query(fort, $$isDelicensedBy, store); SubLObject pair = NIL; for (pair = cdolist_list_var_25.first(); NIL != cdolist_list_var_25; cdolist_list_var_25 = cdolist_list_var_25.rest() , pair = cdolist_list_var_25.first()) { hash_table_utilities.push_hash(pair.first(), cons(NIL, second(pair)), rule_hash_table); } } } id = do_id_index_next_id(table_var, T, id, state_var); state_var = do_id_index_next_state(table_var, T, id, state_var); } } } } } noting_percent_progress_postamble(); } finally { $percent_progress_start_time$.rebind(_prev_bind_3, thread); $within_noting_percent_progress$.rebind(_prev_bind_2, thread); $last_percent_progress_prediction$.rebind(_prev_bind_1, thread); $last_percent_progress_index$.rebind(_prev_bind_0, thread); } } } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); inference_datastructures_problem_store.destroy_problem_store(store); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } { SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT, NIL); if (!stream.isStream()) { Errors.error($str_alt57$Unable_to_open__S, f_out); } { SubLObject s_out = stream; { SubLObject _prev_bind_0 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str_alt58$___); { SubLObject key = NIL; SubLObject value = NIL; { final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str_alt59$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } } } format(s_out, $str_alt60$___); } finally { $print_pretty$.rebind(_prev_bind_0, thread); } } } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); if (stream.isStream()) { close(stream, UNPROVIDED); } } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } } return $DONE; } } } public static SubLObject create_disambiguator_rules_file_from_forts(final SubLObject f_out) { final SubLThread thread = SubLProcess.currentSubLThread(); assert NIL != stringp(f_out) : "! stringp(f_out) " + ("Types.stringp(f_out) " + "CommonSymbols.NIL != Types.stringp(f_out) ") + f_out; final SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); SubLObject store = NIL; try { store = inference_datastructures_problem_store.new_problem_store($list98); final SubLObject message = $$$mapping_Cyc_FORTs; final SubLObject total = forts.fort_count(); SubLObject sofar = ZERO_INTEGER; final SubLObject _prev_bind_0 = $last_percent_progress_index$.currentBinding(thread); final SubLObject _prev_bind_2 = $last_percent_progress_prediction$.currentBinding(thread); final SubLObject _prev_bind_3 = $within_noting_percent_progress$.currentBinding(thread); final SubLObject _prev_bind_4 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); try { noting_percent_progress_preamble(message); SubLObject cdolist_list_var = forts.do_forts_tables(); SubLObject table_var = NIL; table_var = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject idx = table_var; if (NIL == id_index_objects_empty_p(idx, $SKIP)) { final SubLObject idx_$20 = idx; if (NIL == id_index_dense_objects_empty_p(idx_$20, $SKIP)) { final SubLObject vector_var = id_index_dense_objects(idx_$20); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject id; SubLObject fort; SubLObject cdolist_list_var_$21; SubLObject pair; SubLObject cdolist_list_var_$22; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { id = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; fort = aref(vector_var, id); if ((NIL == id_index_tombstone_p(fort)) || (NIL == id_index_skip_tombstones_p($SKIP))) { if (NIL != id_index_tombstone_p(fort)) { fort = $SKIP; } sofar = add(sofar, ONE_INTEGER); note_percent_progress(sofar, total); cdolist_list_var_$21 = fort_disambiguation_rule_query(fort, $$isLicensedBy, store); pair = NIL; pair = cdolist_list_var_$21.first(); while (NIL != cdolist_list_var_$21) { hash_table_utilities.push_hash(pair.first(), cons(T, second(pair)), rule_hash_table); cdolist_list_var_$21 = cdolist_list_var_$21.rest(); pair = cdolist_list_var_$21.first(); } cdolist_list_var_$22 = fort_disambiguation_rule_query(fort, $$isDelicensedBy, store); pair = NIL; pair = cdolist_list_var_$22.first(); while (NIL != cdolist_list_var_$22) { hash_table_utilities.push_hash(pair.first(), cons(NIL, second(pair)), rule_hash_table); cdolist_list_var_$22 = cdolist_list_var_$22.rest(); pair = cdolist_list_var_$22.first(); } } } } final SubLObject idx_$21 = idx; if ((NIL == id_index_sparse_objects_empty_p(idx_$21)) || (NIL == id_index_skip_tombstones_p($SKIP))) { final SubLObject sparse = id_index_sparse_objects(idx_$21); SubLObject id2 = id_index_sparse_id_threshold(idx_$21); final SubLObject end_id = id_index_next_id(idx_$21); final SubLObject v_default = (NIL != id_index_skip_tombstones_p($SKIP)) ? NIL : $SKIP; while (id2.numL(end_id)) { final SubLObject fort2 = gethash_without_values(id2, sparse, v_default); if ((NIL == id_index_skip_tombstones_p($SKIP)) || (NIL == id_index_tombstone_p(fort2))) { sofar = add(sofar, ONE_INTEGER); note_percent_progress(sofar, total); SubLObject cdolist_list_var_$23 = fort_disambiguation_rule_query(fort2, $$isLicensedBy, store); SubLObject pair2 = NIL; pair2 = cdolist_list_var_$23.first(); while (NIL != cdolist_list_var_$23) { hash_table_utilities.push_hash(pair2.first(), cons(T, second(pair2)), rule_hash_table); cdolist_list_var_$23 = cdolist_list_var_$23.rest(); pair2 = cdolist_list_var_$23.first(); } SubLObject cdolist_list_var_$24 = fort_disambiguation_rule_query(fort2, $$isDelicensedBy, store); pair2 = NIL; pair2 = cdolist_list_var_$24.first(); while (NIL != cdolist_list_var_$24) { hash_table_utilities.push_hash(pair2.first(), cons(NIL, second(pair2)), rule_hash_table); cdolist_list_var_$24 = cdolist_list_var_$24.rest(); pair2 = cdolist_list_var_$24.first(); } } id2 = add(id2, ONE_INTEGER); } } } cdolist_list_var = cdolist_list_var.rest(); table_var = cdolist_list_var.first(); } } finally { final SubLObject _prev_bind_0_$26 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); noting_percent_progress_postamble(); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$26, thread); } } } finally { $percent_progress_start_time$.rebind(_prev_bind_4, thread); $within_noting_percent_progress$.rebind(_prev_bind_3, thread); $last_percent_progress_prediction$.rebind(_prev_bind_2, thread); $last_percent_progress_index$.rebind(_prev_bind_0, thread); } } finally { final SubLObject _prev_bind_5 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values2 = getValuesAsVector(); inference_datastructures_problem_store.destroy_problem_store(store); restoreValuesFromVector(_values2); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_5, thread); } } SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT); if (!stream.isStream()) { Errors.error($str64$Unable_to_open__S, f_out); } final SubLObject s_out = stream; final SubLObject _prev_bind_6 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str65$___); SubLObject key = NIL; SubLObject value = NIL; final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str66$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } format(s_out, $str67$___); } finally { $print_pretty$.rebind(_prev_bind_6, thread); } } finally { final SubLObject _prev_bind_7 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values3 = getValuesAsVector(); if (stream.isStream()) { close(stream, UNPROVIDED); } restoreValuesFromVector(_values3); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_7, thread); } } return $DONE; } public static final SubLObject create_disambiguator_rules_file_from_fort_list_alt(SubLObject fort_list, SubLObject f_out) { { final SubLThread thread = SubLProcess.currentSubLThread(); SubLTrampolineFile.checkType(f_out, STRINGP); { SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); SubLObject list_var = fort_list; $progress_note$.setDynamicValue($$$cdolist, thread); $progress_start_time$.setDynamicValue(get_universal_time(), thread); $progress_total$.setDynamicValue(length(list_var), thread); $progress_sofar$.setDynamicValue(ZERO_INTEGER, thread); { SubLObject _prev_bind_0 = $last_percent_progress_index$.currentBinding(thread); SubLObject _prev_bind_1 = $last_percent_progress_prediction$.currentBinding(thread); SubLObject _prev_bind_2 = $within_noting_percent_progress$.currentBinding(thread); SubLObject _prev_bind_3 = $percent_progress_start_time$.currentBinding(thread); try { $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); { SubLObject csome_list_var = list_var; SubLObject fort = NIL; for (fort = csome_list_var.first(); NIL != csome_list_var; csome_list_var = csome_list_var.rest() , fort = csome_list_var.first()) { note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); { SubLObject store = NIL; try { store = inference_datastructures_problem_store.new_problem_store(NIL); { SubLObject cdolist_list_var = fort_disambiguation_rule_query(fort, $$isLicensedBy, store); SubLObject pair = NIL; for (pair = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , pair = cdolist_list_var.first()) { hash_table_utilities.push_hash(pair.first(), cons(T, second(pair)), rule_hash_table); } } { SubLObject cdolist_list_var = fort_disambiguation_rule_query(fort, $$isDelicensedBy, store); SubLObject pair = NIL; for (pair = cdolist_list_var.first(); NIL != cdolist_list_var; cdolist_list_var = cdolist_list_var.rest() , pair = cdolist_list_var.first()) { hash_table_utilities.push_hash(pair.first(), cons(NIL, second(pair)), rule_hash_table); } } } finally { { SubLObject _prev_bind_0_26 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); inference_datastructures_problem_store.destroy_problem_store(store); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_26, thread); } } } } } } noting_percent_progress_postamble(); } finally { $percent_progress_start_time$.rebind(_prev_bind_3, thread); $within_noting_percent_progress$.rebind(_prev_bind_2, thread); $last_percent_progress_prediction$.rebind(_prev_bind_1, thread); $last_percent_progress_index$.rebind(_prev_bind_0, thread); } } { SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT, NIL); if (!stream.isStream()) { Errors.error($str_alt57$Unable_to_open__S, f_out); } { SubLObject s_out = stream; { SubLObject _prev_bind_0 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str_alt58$___); { SubLObject key = NIL; SubLObject value = NIL; { final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str_alt59$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } } } format(s_out, $str_alt60$___); } finally { $print_pretty$.rebind(_prev_bind_0, thread); } } } } finally { { SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); if (stream.isStream()) { close(stream, UNPROVIDED); } } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } } return $DONE; } } } public static SubLObject create_disambiguator_rules_file_from_fort_list(final SubLObject fort_list, final SubLObject f_out) { final SubLThread thread = SubLProcess.currentSubLThread(); assert NIL != stringp(f_out) : "! stringp(f_out) " + ("Types.stringp(f_out) " + "CommonSymbols.NIL != Types.stringp(f_out) ") + f_out; final SubLObject rule_hash_table = make_hash_table($int$65536, EQUAL, UNPROVIDED); final SubLObject _prev_bind_0 = $progress_note$.currentBinding(thread); final SubLObject _prev_bind_2 = $progress_start_time$.currentBinding(thread); final SubLObject _prev_bind_3 = $progress_total$.currentBinding(thread); final SubLObject _prev_bind_4 = $progress_sofar$.currentBinding(thread); final SubLObject _prev_bind_5 = $last_percent_progress_index$.currentBinding(thread); final SubLObject _prev_bind_6 = $last_percent_progress_prediction$.currentBinding(thread); final SubLObject _prev_bind_7 = $within_noting_percent_progress$.currentBinding(thread); final SubLObject _prev_bind_8 = $percent_progress_start_time$.currentBinding(thread); try { $progress_note$.bind($$$cdolist, thread); $progress_start_time$.bind(get_universal_time(), thread); $progress_total$.bind(length(fort_list), thread); $progress_sofar$.bind(ZERO_INTEGER, thread); $last_percent_progress_index$.bind(ZERO_INTEGER, thread); $last_percent_progress_prediction$.bind(NIL, thread); $within_noting_percent_progress$.bind(T, thread); $percent_progress_start_time$.bind(get_universal_time(), thread); try { noting_percent_progress_preamble($progress_note$.getDynamicValue(thread)); SubLObject csome_list_var = fort_list; SubLObject fort = NIL; fort = csome_list_var.first(); while (NIL != csome_list_var) { SubLObject store = NIL; try { store = inference_datastructures_problem_store.new_problem_store(NIL); SubLObject cdolist_list_var = fort_disambiguation_rule_query(fort, $$isLicensedBy, store); SubLObject pair = NIL; pair = cdolist_list_var.first(); while (NIL != cdolist_list_var) { hash_table_utilities.push_hash(pair.first(), cons(T, second(pair)), rule_hash_table); cdolist_list_var = cdolist_list_var.rest(); pair = cdolist_list_var.first(); } cdolist_list_var = fort_disambiguation_rule_query(fort, $$isDelicensedBy, store); pair = NIL; pair = cdolist_list_var.first(); while (NIL != cdolist_list_var) { hash_table_utilities.push_hash(pair.first(), cons(NIL, second(pair)), rule_hash_table); cdolist_list_var = cdolist_list_var.rest(); pair = cdolist_list_var.first(); } } finally { final SubLObject _prev_bind_0_$27 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); inference_datastructures_problem_store.destroy_problem_store(store); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$27, thread); } } $progress_sofar$.setDynamicValue(add($progress_sofar$.getDynamicValue(thread), ONE_INTEGER), thread); note_percent_progress($progress_sofar$.getDynamicValue(thread), $progress_total$.getDynamicValue(thread)); csome_list_var = csome_list_var.rest(); fort = csome_list_var.first(); } } finally { final SubLObject _prev_bind_0_$28 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values2 = getValuesAsVector(); noting_percent_progress_postamble(); restoreValuesFromVector(_values2); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$28, thread); } } } finally { $percent_progress_start_time$.rebind(_prev_bind_8, thread); $within_noting_percent_progress$.rebind(_prev_bind_7, thread); $last_percent_progress_prediction$.rebind(_prev_bind_6, thread); $last_percent_progress_index$.rebind(_prev_bind_5, thread); $progress_sofar$.rebind(_prev_bind_4, thread); $progress_total$.rebind(_prev_bind_3, thread); $progress_start_time$.rebind(_prev_bind_2, thread); $progress_note$.rebind(_prev_bind_0, thread); } SubLObject stream = NIL; try { stream = compatibility.open_text(f_out, $OUTPUT); if (!stream.isStream()) { Errors.error($str64$Unable_to_open__S, f_out); } final SubLObject s_out = stream; final SubLObject _prev_bind_9 = $print_pretty$.currentBinding(thread); try { $print_pretty$.bind(NIL, thread); format(s_out, $str65$___); SubLObject key = NIL; SubLObject value = NIL; final Iterator cdohash_iterator = getEntrySetIterator(rule_hash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); key = getEntryKey(cdohash_entry); value = getEntryValue(cdohash_entry); format(s_out, $str66$__S____S___, key, value); } } finally { releaseEntrySetIterator(cdohash_iterator); } format(s_out, $str67$___); } finally { $print_pretty$.rebind(_prev_bind_9, thread); } } finally { final SubLObject _prev_bind_10 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values3 = getValuesAsVector(); if (stream.isStream()) { close(stream, UNPROVIDED); } restoreValuesFromVector(_values3); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_10, thread); } } return $DONE; } public static final SubLObject create_disambiguator_rules_file_from_fort_file_id_alt(SubLObject file_id_num, SubLObject in_path, SubLObject out_path) { if (in_path == UNPROVIDED) { in_path = $str_alt94$_host_george_term_id_lists_; } if (out_path == UNPROVIDED) { out_path = $str_alt95$_host_george_disambig_rules_; } { SubLObject file_name = format(NIL, $str_alt96$_Afort_id__4__0D_cfasl, in_path, file_id_num); SubLObject terms = cfasl_utilities.cfasl_load(file_name); SubLObject out_file_name = format(NIL, $str_alt97$_Adisambiguator_rule_file__4__0D_, out_path, file_id_num); return create_disambiguator_rules_file_from_fort_list(terms, out_file_name); } } public static SubLObject create_disambiguator_rules_file_from_fort_file_id(final SubLObject file_id_num, SubLObject in_path, SubLObject out_path) { if (in_path == UNPROVIDED) { in_path = $str101$_host_george_term_id_lists_; } if (out_path == UNPROVIDED) { out_path = $str102$_host_george_disambig_rules_; } final SubLObject file_name = format(NIL, $str103$_Afort_id__4__0D_cfasl, in_path, file_id_num); final SubLObject terms = cfasl_utilities.cfasl_load(file_name); final SubLObject out_file_name = format(NIL, $str104$_Adisambiguator_rule_file__4__0D_, out_path, file_id_num); return create_disambiguator_rules_file_from_fort_list(terms, out_file_name); } public static final SubLObject create_rule_disambugation_condor_jobs_alt(SubLObject count) { { SubLObject n = NIL; for (n = ZERO_INTEGER; n.numL(count); n = add(n, ONE_INTEGER)) { format(T, $str_alt98$created_using_CREATE_RULE_DISAMBI); format(T, $str_alt99$arguments______progn__load____hom, n); format(T, $str_alt100$queue____); } } return NIL; } public static SubLObject create_rule_disambugation_condor_jobs(final SubLObject count) { SubLObject n; for (n = NIL, n = ZERO_INTEGER; n.numL(count); n = add(n, ONE_INTEGER)) { format(T, $str105$created_using_CREATE_RULE_DISAMBI); format(T, $str106$arguments______progn__load____hom, n); format(T, $str107$queue____); } return NIL; } public static SubLObject declare_rule_disambiguation_file() { declareMacro("with_new_rule_disambiguator", "WITH-NEW-RULE-DISAMBIGUATOR"); declareFunction("rule_disambiguator_print_function_trampoline", "RULE-DISAMBIGUATOR-PRINT-FUNCTION-TRAMPOLINE", 2, 0, false); declareFunction("rule_disambiguator_p", "RULE-DISAMBIGUATOR-P", 1, 0, false); new rule_disambiguation.$rule_disambiguator_p$UnaryFunction(); declareFunction("rdis_rule_file", "RDIS-RULE-FILE", 1, 0, false); declareFunction("rdis_count_file", "RDIS-COUNT-FILE", 1, 0, false); declareFunction("rdis_rules", "RDIS-RULES", 1, 0, false); declareFunction("rdis_counts", "RDIS-COUNTS", 1, 0, false); declareFunction("_csetf_rdis_rule_file", "_CSETF-RDIS-RULE-FILE", 2, 0, false); declareFunction("_csetf_rdis_count_file", "_CSETF-RDIS-COUNT-FILE", 2, 0, false); declareFunction("_csetf_rdis_rules", "_CSETF-RDIS-RULES", 2, 0, false); declareFunction("_csetf_rdis_counts", "_CSETF-RDIS-COUNTS", 2, 0, false); declareFunction("make_rule_disambiguator", "MAKE-RULE-DISAMBIGUATOR", 0, 1, false); declareFunction("visit_defstruct_rule_disambiguator", "VISIT-DEFSTRUCT-RULE-DISAMBIGUATOR", 2, 0, false); declareFunction("visit_defstruct_object_rule_disambiguator_method", "VISIT-DEFSTRUCT-OBJECT-RULE-DISAMBIGUATOR-METHOD", 2, 0, false); declareFunction("new_rule_disambiguator", "NEW-RULE-DISAMBIGUATOR", 0, 2, false); declareFunction("finalize_rule_disambiguator", "FINALIZE-RULE-DISAMBIGUATOR", 1, 0, false); declareFunction("rdis_print", "RDIS-PRINT", 3, 0, false); declareMacro("with_sense_bag_excepting_word", "WITH-SENSE-BAG-EXCEPTING-WORD"); declareFunction("document_disambiguate_rule_disambiguator_method", "DOCUMENT-DISAMBIGUATE-RULE-DISAMBIGUATOR-METHOD", 2, 1, false); declareFunction("rdis_disambiguate", "RDIS-DISAMBIGUATE", 2, 1, false); declareFunction("sense_markers_not_requiring_licensing", "SENSE-MARKERS-NOT-REQUIRING-LICENSING", 1, 0, false); declareFunction("rule_void", "RULE-VOID", 2, 0, false); declareFunction("load_disambiguator_rules", "LOAD-DISAMBIGUATOR-RULES", 1, 0, false); declareFunction("load_disambiguator_counts", "LOAD-DISAMBIGUATOR-COUNTS", 1, 0, false); declareFunction("highest_count_sense_markers", "HIGHEST-COUNT-SENSE-MARKERS", 2, 0, false); declareFunction("ambiguous_p", "AMBIGUOUS-P", 1, 0, false); declareFunction("is_licensed_p", "IS-LICENSED-P", 3, 0, false); declareFunction("positive_clause_p", "POSITIVE-CLAUSE-P", 1, 0, false); declareFunction("negative_clause_p", "NEGATIVE-CLAUSE-P", 1, 0, false); declareFunction("clause_sign", "CLAUSE-SIGN", 1, 0, false); declareFunction("clause_term", "CLAUSE-TERM", 1, 0, false); declareFunction("new_sense_bag", "NEW-SENSE-BAG", 1, 0, false); declareFunction("sense_bag_licensesP", "SENSE-BAG-LICENSES?", 2, 0, false); declareFunction("disambiguation_rule_query", "DISAMBIGUATION-RULE-QUERY", 1, 0, false); declareFunction("create_disambiguator_rules_file", "CREATE-DISAMBIGUATOR-RULES-FILE", 0, 1, false); declareFunction("fort_disambiguation_rule_query", "FORT-DISAMBIGUATION-RULE-QUERY", 3, 0, false); declareFunction("term_alist_to_file_hash_table", "TERM-ALIST-TO-FILE-HASH-TABLE", 2, 3, false); declareFunction("alist_file_to_fht", "ALIST-FILE-TO-FHT", 2, 0, false); declareFunction("disambiguator_rule_fht_to_hl_id_text_file", "DISAMBIGUATOR-RULE-FHT-TO-HL-ID-TEXT-FILE", 2, 0, false); declareFunction("create_disambiguator_rules_file_from_forts", "CREATE-DISAMBIGUATOR-RULES-FILE-FROM-FORTS", 1, 0, false); declareFunction("create_disambiguator_rules_file_from_fort_list", "CREATE-DISAMBIGUATOR-RULES-FILE-FROM-FORT-LIST", 2, 0, false); declareFunction("create_disambiguator_rules_file_from_fort_file_id", "CREATE-DISAMBIGUATOR-RULES-FILE-FROM-FORT-FILE-ID", 1, 2, false); declareFunction("create_rule_disambugation_condor_jobs", "CREATE-RULE-DISAMBUGATION-CONDOR-JOBS", 1, 0, false); return NIL; } // Internal Constants @LispMethod(comment = "Internal Constants") static private final SubLString $str_alt0$data_word_sense_disambiguation_ru = makeString("data/word-sense-disambiguation-rules.fht"); static private final SubLString $str_alt1$data_word_sense_disambiguation_co = makeString("data/word-sense-disambiguation-counts.fht"); static private final SubLList $list_alt2 = list(list(makeSymbol("DISAMBIGUATOR")), makeSymbol("&BODY"), makeSymbol("BODY")); static private final SubLList $list_alt4 = list(list(makeSymbol("NEW-RULE-DISAMBIGUATOR"))); static private final SubLList $list_alt8 = list(makeSymbol("RULE-FILE"), makeSymbol("COUNT-FILE"), makeSymbol("RULES"), makeSymbol("COUNTS")); static private final SubLList $list_alt9 = list(makeKeyword("RULE-FILE"), makeKeyword("COUNT-FILE"), makeKeyword("RULES"), makeKeyword("COUNTS")); static private final SubLList $list_alt10 = list(makeSymbol("RDIS-RULE-FILE"), makeSymbol("RDIS-COUNT-FILE"), makeSymbol("RDIS-RULES"), makeSymbol("RDIS-COUNTS")); static private final SubLList $list_alt11 = list(makeSymbol("_CSETF-RDIS-RULE-FILE"), makeSymbol("_CSETF-RDIS-COUNT-FILE"), makeSymbol("_CSETF-RDIS-RULES"), makeSymbol("_CSETF-RDIS-COUNTS")); public static SubLObject init_rule_disambiguation_file() { defparameter("*WORD-SENSE-DISAMBIGUATION-RULE-FILE*", $str0$data_word_sense_disambiguation_ru); defparameter("*WORD-SENSE-DISAMBIGUATION-COUNT-FILE*", $str1$data_word_sense_disambiguation_co); defconstant("*DTP-RULE-DISAMBIGUATOR*", RULE_DISAMBIGUATOR); return NIL; } public static SubLObject setup_rule_disambiguation_file() { register_method($print_object_method_table$.getGlobalValue(), $dtp_rule_disambiguator$.getGlobalValue(), symbol_function(RULE_DISAMBIGUATOR_PRINT_FUNCTION_TRAMPOLINE)); SubLSpecialOperatorDeclarations.proclaim($list14); def_csetf(RDIS_RULE_FILE, _CSETF_RDIS_RULE_FILE); def_csetf(RDIS_COUNT_FILE, _CSETF_RDIS_COUNT_FILE); def_csetf(RDIS_RULES, _CSETF_RDIS_RULES); def_csetf(RDIS_COUNTS, _CSETF_RDIS_COUNTS); identity(RULE_DISAMBIGUATOR); register_method(visitation.$visit_defstruct_object_method_table$.getGlobalValue(), $dtp_rule_disambiguator$.getGlobalValue(), symbol_function(VISIT_DEFSTRUCT_OBJECT_RULE_DISAMBIGUATOR_METHOD)); register_method(document_disambiguation.$document_disambiguate_method_table$.getGlobalValue(), $dtp_rule_disambiguator$.getGlobalValue(), symbol_function(DOCUMENT_DISAMBIGUATE_RULE_DISAMBIGUATOR_METHOD)); return NIL; } static private final SubLString $str_alt26$Invalid_slot__S_for_construction_ = makeString("Invalid slot ~S for construction function"); static private final SubLString $str_alt28$__RULE_DISAMBIGUATOR_ = makeString("#<RULE-DISAMBIGUATOR "); static private final SubLString $str_alt29$_ = makeString(" "); static private final SubLString $str_alt30$_ = makeString(">"); static private final SubLList $list_alt31 = list(list(makeSymbol("BAG"), makeSymbol("WORD")), makeSymbol("&BODY"), makeSymbol("BODY")); static private final SubLSymbol $sym32$CYCL = makeUninternedSymbol("CYCL"); static private final SubLSymbol $sym33$GENL_CYCL = makeUninternedSymbol("GENL-CYCL"); @Override public void declareFunctions() { declare_rule_disambiguation_file(); } static private final SubLList $list_alt38 = list(MINUS_ONE_INTEGER); @Override public void initializeVariables() { init_rule_disambiguation_file(); } @Override public void runTopLevelForms() { setup_rule_disambiguation_file(); } public static final SubLObject $const44$ContextuallyDependentLexicalMappi = reader_make_constant_shell("ContextuallyDependentLexicalMapping"); static private final SubLString $str_alt46$Can_t_load_rules_from__a = makeString("Can't load rules from ~a"); static private final SubLString $str_alt47$Can_t_load_counts_from__a = makeString("Can't load counts from ~a"); static private final SubLList $list_alt49 = list(makeSymbol("?X"), makeSymbol("?Y")); static private final SubLList $list_alt51 = list(new SubLObject[]{ makeKeyword("INFERENCE-MODE"), makeKeyword("SHALLOW"), makeKeyword("ALLOW-INDETERMINATE-RESULTS?"), NIL, makeKeyword("DISJUNCTION-FREE-EL-VARS-POLICY"), makeKeyword("COMPUTE-INTERSECTION"), makeKeyword("INTERMEDIATE-STEP-VALIDATION-LEVEL"), makeKeyword("MINIMAL"), makeKeyword("MAX-TIME"), makeInteger(57600), makeKeyword("PROBABLY-APPROXIMATELY-DONE"), makeDouble(1.0), makeKeyword("ANSWER-LANGUAGE"), makeKeyword("EL"), makeKeyword("CONTINUABLE?"), NIL }); static private final SubLString $str_alt52$data_word_sense_disambiguation_ru = makeString("data/word-sense-disambiguation-rules.txt"); static private final SubLString $str_alt57$Unable_to_open__S = makeString("Unable to open ~S"); static private final SubLString $str_alt58$___ = makeString("(~%"); static private final SubLString $str_alt59$__S____S___ = makeString("(~S . ~S)~%"); static private final SubLString $str_alt60$___ = makeString(")~%"); public static final class $rule_disambiguator_p$UnaryFunction extends UnaryFunction { public $rule_disambiguator_p$UnaryFunction() { super(extractFunctionNamed("RULE-DISAMBIGUATOR-P")); } @Override public SubLObject processItem(final SubLObject arg1) { return rule_disambiguator_p(arg1); } } static private final SubLList $list_alt62 = list(makeSymbol("?LICENSOR")); public static final SubLSymbol $kw65$ALLOW_INDETERMINATE_RESULTS_ = makeKeyword("ALLOW-INDETERMINATE-RESULTS?"); static private final SubLString $str_alt78$_tmp_ = makeString("/tmp/"); static private final SubLString $str_alt80$_a_is_invalid = makeString("~a is invalid"); static private final SubLString $str_alt81$Can_t_load__a___a = makeString("Can't load ~a: ~a"); static private final SubLList $list_alt86 = cons(makeSymbol("LICENSED?"), makeSymbol("TERM")); static private final SubLString $str_alt87$don_t_know_how_to_convert__A = makeString("don't know how to convert ~A"); static private final SubLString $str_alt88$_A__A_ = makeString("~A,~A,"); static private final SubLString $str_alt89$_A_ = makeString("~A,"); static private final SubLString $str_alt90$__ = makeString("~%"); static private final SubLList $list_alt91 = list(makeKeyword("INTERMEDIATE-STEP-VALIDATION-LEVEL"), makeKeyword("MINIMAL")); static private final SubLString $str_alt94$_host_george_term_id_lists_ = makeString("/host/george/term-id-lists/"); static private final SubLString $str_alt95$_host_george_disambig_rules_ = makeString("/host/george/disambig-rules/"); static private final SubLString $str_alt96$_Afort_id__4__0D_cfasl = makeString("~Afort-id-~4,'0D.cfasl"); static private final SubLString $str_alt97$_Adisambiguator_rule_file__4__0D_ = makeString("~Adisambiguator-rule-file-~4,'0D.txt"); static private final SubLString $str_alt98$created_using_CREATE_RULE_DISAMBI = makeString("created using CREATE-RULE-DISAMBIGUATION-CONDOR-JOBS in RULE-DISAMBIGUATION"); static private final SubLString $str_alt99$arguments______progn__load____hom = makeString("arguments = \"\'(progn (load \"\"/home/daves/cycl/rule-disambiguation.lisp\"\") (load-transcript-file \"\"/cyc/top/transcripts/0917/billie-20061025103022-21843-local-0-sent.ts\"\" nil :none) (load-transcript-file \"\"/cyc/top/transcripts/0917/billie-20061025103022-21843-local-1-sent.ts\"\" nil :none) (create-disambiguator-rules-file-from-fort-file-id ~A))\'\"~%"); static private final SubLString $str_alt100$queue____ = makeString("queue~%~%"); } /** * Total time: 755 ms */
9231d2b5294eb36e8d8b09cd2e8ee787c9552d5e
2,876
java
Java
src/main/java/com/factern/model/InformationListResponse.java
Factern/factern-client-java
f18df518bfb9cd765858cf8be3058f97ff43f79f
[ "MIT" ]
null
null
null
src/main/java/com/factern/model/InformationListResponse.java
Factern/factern-client-java
f18df518bfb9cd765858cf8be3058f97ff43f79f
[ "MIT" ]
null
null
null
src/main/java/com/factern/model/InformationListResponse.java
Factern/factern-client-java
f18df518bfb9cd765858cf8be3058f97ff43f79f
[ "MIT" ]
3
2018-06-25T20:22:35.000Z
2018-08-01T17:57:59.000Z
23.768595
82
0.693672
995,987
/* * Factern API */ package com.factern.model; import java.util.Objects; import java.util.Arrays; import com.factern.model.Information; import com.factern.model.Summary; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * InformationListResponse */ public class InformationListResponse { public static final String SERIALIZED_NAME_NODES = "nodes"; @SerializedName(SERIALIZED_NAME_NODES) private List<Information> nodes = new ArrayList<Information>(); public static final String SERIALIZED_NAME_SUMMARY = "summary"; @SerializedName(SERIALIZED_NAME_SUMMARY) private Summary summary = null; public InformationListResponse nodes(List<Information> nodes) { this.nodes = nodes; return this; } public InformationListResponse addNodesItem(Information nodesItem) { this.nodes.add(nodesItem); return this; } /** * Get nodes * @return nodes **/ @ApiModelProperty(required = true, value = "") public List<Information> getNodes() { return nodes; } public void setNodes(List<Information> nodes) { this.nodes = nodes; } public InformationListResponse summary(Summary summary) { this.summary = summary; return this; } /** * Get summary * @return summary **/ @ApiModelProperty(value = "") public Summary getSummary() { return summary; } public void setSummary(Summary summary) { this.summary = summary; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } InformationListResponse informationListResponse = (InformationListResponse) o; return Objects.equals(this.nodes, informationListResponse.nodes) && Objects.equals(this.summary, informationListResponse.summary); } @Override public int hashCode() { return Objects.hash(nodes, summary); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InformationListResponse {\n"); sb.append(" nodes: ").append(toIndentedString(nodes)).append("\n"); sb.append(" summary: ").append(toIndentedString(summary)).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 "); } }
9231d3327621d4ecf0ec8d5991fb22d271328df5
25,357
java
Java
20190902_v1_1/src/wpos/src/main/java/wpos/presenter/BasePresenter.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
4
2021-11-11T08:57:32.000Z
2022-03-21T02:56:08.000Z
20190902_v1_1/src/wpos/src/main/java/wpos/presenter/BasePresenter.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
null
null
null
20190902_v1_1/src/wpos/src/main/java/wpos/presenter/BasePresenter.java
Boxin-ChinaGD/BXERP
4273910059086ab9b76bd547c679d852a1129a0c
[ "Apache-2.0" ]
2
2021-12-20T08:34:31.000Z
2022-02-09T06:52:41.000Z
38.950845
148
0.634144
995,988
package wpos.presenter; //import android.database.Cursor; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.stereotype.Component; import wpos.event.BaseEvent; import wpos.event.UI.BaseSQLiteEvent; import wpos.helper.Constants; import wpos.model.*; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks.ReentrantReadWriteLock; import static wpos.presenter.CommodityPresenter.Query_CommodityShopInfo_TABLE; /** * 本类提供同步接口和异步接口。<br /> * 提供异步接口是为了保证Android界面的流畅性。<br /> * 同步接口大部分在测试代码中使用。异步接口大部分在非测试代码中使用。<br /> */ @Component("basePresenter") public class BasePresenter { private Log log = LogFactory.getLog(this.getClass()); public static final String SYNC_Type_C = "C"; //创建型同步块 public static final String SYNC_Type_U = "U"; //更新型同步块 public static final String SYNC_Type_D = "D"; //删除型同步块 /** * 使用的 SQLite 数据库不支持并发(同时)修改数据库,所以涉及 CUD 数据库的方法需要公用一个锁 gloabalWriteLock * */ public static final ReentrantReadWriteLock globalWriteLock = new ReentrantReadWriteLock(); /** * 本地创建一个对象A后会保存在SQLite中,然后同步到服务器,服务器会返回一个新ID给对象A,对象A的ID需要更新为服务器的ID。如果在服务器返回ID前,有新的对象B被创建,B的ID可能覆盖掉对象A的ID。 * 为此,需要在创建对象A时,生成一个较大的ID,其值=当前SQLite最大的ID X 2 + SQLITE_ID_GAP */ public static final int SQLITE_ID_GAP = 10000; public static final int SQLITE_EXECUTE_NUMBER = 1; public static final Integer generateTableID(Integer maxID) { return maxID * 2 + SQLITE_ID_GAP; } // protected DaoSession dao; // protected BaseMapper baseMapper; public ErrorInfo.EnumErrorCode getLastErrorCode() { return lastErrorCode; } protected ErrorInfo.EnumErrorCode lastErrorCode; public String getLastErrorMessage() { return lastErrorMessage; } protected String lastErrorMessage; @PersistenceContext protected EntityManager entityManager; // public BasePresenter(final BaseMapper baseMapper) { // this.baseMapper = baseMapper; // } /** * 拿到已经同步或未同步到服务器的最大ID * * @param bSynchronized true,拿到已经同步到服务器的最大ID;false,拿到未同步到服务器的最大ID * @param sFieldNameOfSyncDatetime 标识是否同步的日期型字段 * @return */ public Integer getMaxId(boolean bSynchronized, String sFieldNameOfSyncDatetime, Class modelClass) { // TODO EntityManager没有游标 String sTableName = getTableName(); String queryTable = getQueryTable(); Integer maxId = 0; try { String op = (bSynchronized ? " != " : " = "); String sql = " where F_ID = (select max(F_ID) from " + sTableName + " where " + sFieldNameOfSyncDatetime + " " + op + "0" + ")"; Query dataQuery = entityManager.createNativeQuery(queryTable + sql, modelClass); List<BaseModel> list = dataQuery.getResultList(); if (list != null && list.size() > 0) { maxId = list.get(0).getID(); } lastErrorCode = ErrorInfo.EnumErrorCode.EC_NoError; } catch (Exception e) { log.info("读取SQLite的表" + sTableName + "的最大ID时出错,错误信息:" + e.getMessage()); lastErrorCode = ErrorInfo.EnumErrorCode.EC_OtherError; } return maxId; } protected String getTableName() { throw new RuntimeException("Not yet implemented!"); } protected String getQueryTable() { throw new RuntimeException("Not yet implemented!"); } protected Class getClassName() { throw new RuntimeException("Not yet implemented!"); } /** * 生成临时对象(替身)ID。待同步成功,服务器返回真身后,删除本地的替身 * //... 将来加上锁 * * @param sFieldNameOfSyncDatetime * @return */ public Integer generateTmpRowID(String sFieldNameOfSyncDatetime, Class modelClass) { Integer maxIDSynchronized = getMaxId(true, sFieldNameOfSyncDatetime, modelClass); //真正数据ID if (lastErrorCode != ErrorInfo.EnumErrorCode.EC_NoError) { return -1; } Integer maxIDNotSynchronized = getMaxId(false, sFieldNameOfSyncDatetime, modelClass); //临时数据ID if (lastErrorCode != ErrorInfo.EnumErrorCode.EC_NoError) { return -2; } if (maxIDSynchronized == 0 && maxIDNotSynchronized == 0) { return BasePresenter.generateTableID(0); } else if (maxIDSynchronized == 0 && maxIDNotSynchronized > 0) { return maxIDNotSynchronized + 1; } else if (maxIDSynchronized > 0 && maxIDNotSynchronized == 0) { return BasePresenter.generateTableID(maxIDSynchronized); } //else if (maxIDSynchronized > 0 && maxIDNotSynchronized > 0) { return maxIDNotSynchronized + 1;//...这里虽然正确地得到了MAXID,但可能maxIDSynchronized接近了替身的位置,导致服务器返回真身时,插入替身所在的位置,导致插入失败。这种情况一般不会出现 // } } /** * 查找F_SyncDatetime为“1970-01-01 08:00:00 000”的数据 * * @return */ // public List<?> getTmpDataID(String tableName) { // List<Long> idList = new ArrayList<>(); // String sql = "select * from " + tableName + " where F_SyncDatetime = '0'"; // try { // Cursor cursor = dao.getDatabase().rawQuery(sql, null); // cursor.moveToNext(); // if (cursor.moveToFirst() == false) { // log.info("找不到数据"); // } else { // log.info("时间:" + cursor.getString(cursor.getColumnIndex("F_SyncDatetime"))); // idList.add(cursor.getLong(0)); // while (cursor.moveToNext()) { // idList.add(Long.valueOf(cursor.getString(0))); // } // } // } catch (Exception e) { // log.info("getTmpData出错,错误信息:" + e.getMessage()); // } // return idList; // } /** * 分页返回本地SQLite的数据 * * @param tableName 数据表名称 * @param pageIndex 页码 * @param pageSize 每一页的数据量 * @return */ public List<?> retrieveNAsyncByPage(String tableName, int pageIndex, int pageSize) { List<BaseModel> list = new ArrayList<BaseModel>(); // String sql = "select * from " + tableName + " Limit " + pageSize + " Offset " + ((pageIndex - 1) * pageSize); // String countSQL = "select count(*) from " + tableName; try { // TODO // Cursor countCursor = dao.getDatabase().rawQuery(sql, null); // Cursor cursor = dao.getDatabase().rawQuery(sql, null); // cursor.moveToNext(); // if (cursor.moveToFirst() == false) { // log.info("pagingRetrieveNAsync找不到数据!"); // } else { // Commodity commodity = new Commodity(); // commodity.setID(cursor.getLong(0)); // commodity.setName(cursor.getString(2)); // commodity.setCategoryID(cursor.getInt(8)); // commodity.setSpecification(cursor.getString(4)); // commodity.setNO(cursor.getInt(25)); // commodity.setPackageUnitID(cursor.getInt(5)); // list.add(commodity); // while (cursor.moveToNext()) { // commodity = new Commodity(); // commodity.setID(cursor.getLong(0)); // commodity.setName(cursor.getString(2)); // commodity.setCategoryID(cursor.getInt(8)); // commodity.setSpecification(cursor.getString(4)); // commodity.setNO(cursor.getInt(25)); // commodity.setPackageUnitID(cursor.getInt(5)); // list.add(commodity); // } // } String sql = String.format("Limit '%s', '%s'", new String[]{String.valueOf((pageIndex - 1) * pageSize), String.valueOf(pageSize)}); Query query = entityManager.createNativeQuery(CommodityPresenter.QUERY_Commodity_TABLE + sql, Commodity.class); List<Commodity> commodityList = query.getResultList(); for(Commodity commodity : commodityList) { String[] condition = {String.valueOf(commodity.getID()), String.valueOf(Constants.shopID)}; String sqlCommShoInfo = String.format("where F_CommodityID = '%s' and F_ShopID = '%s'", condition); Query queryCommShoInfo = entityManager.createNativeQuery(Query_CommodityShopInfo_TABLE + sqlCommShoInfo, CommodityShopInfo.class); List<CommodityShopInfo> commodityShopInfoList = queryCommShoInfo.getResultList(); commodity.setListSlave2(commodityShopInfoList); } return commodityList; // return query.getResultList(); } catch (Exception e) { e.printStackTrace(); log.error("retrieveNAsyncByPage出错,错误信息:" + e.getMessage()); } return list; } /** * 查询本地某个表的总条数 * * @return -1,查询出现异常。>-1,查询正常 */ public Integer retrieveCount() { String countSQL = "select count(1) from " + getTableName(); try { // Cursor countCursor = dao.getDatabase().rawQuery(countSQL, null); // Cursor cursor = dao.getDatabase().rawQuery(countSQL, null); // cursor.moveToFirst(); // Integer count = cursor.getInt(0); // cursor.close(); // return count; return 0; } catch (Exception e) { e.printStackTrace(); log.error("retrieveCount,错误信息:" + e.getMessage()); return -1; } } protected List<?> createNSync(int iUseCaseID, final List<?> list) { throw new RuntimeException("Not yet implemented!"); } protected BaseModel createSync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } protected boolean updateSync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } protected BaseModel retrieve1Sync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } protected List<?> retrieveNSync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } protected BaseModel deleteSync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } protected BaseModel deleteNSync(int iUseCaseID, final BaseModel bm) { throw new RuntimeException("Not yet implemented!"); } public void createTableSync() { throw new RuntimeException("Not yet implemented!"); } public List<?> createNObjectSync(int iUseCaseID, final List<?> list) { if (list != null) { List<BaseModel> bmList = (List<BaseModel>) list; for (BaseModel bm : bmList) { String err = bm.checkCreate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } } } return createNSync(iUseCaseID, list); } public BaseModel createObjectSync(int iUseCaseID, final BaseModel bm) { String err = bm.checkCreate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } return createSync(iUseCaseID, bm); } public boolean updateObjectSync(int iUseCaseID, final BaseModel bm) { String err = bm.checkUpdate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return false; } return updateSync(iUseCaseID, bm); } public BaseModel retrieve1ObjectSync(int iUseCaseID, final BaseModel bm) { if (bm != null) { String err = bm.checkRetrieve1(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } } return retrieve1Sync(iUseCaseID, bm); } public List<?> retrieveNObjectSync(int iUseCaseID, final BaseModel bm) { if (bm != null) { String err = bm.checkRetrieveN(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } } return retrieveNSync(iUseCaseID, bm); } public BaseModel deleteObjectSync(int iUseCaseID, final BaseModel bm) { String err = bm.checkDelete(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } return deleteSync(iUseCaseID, bm); } public BaseModel deleteNObjectSync(int iUseCaseID, final BaseModel bm) { if (bm != null) { String err = bm.checkDelete(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); lastErrorCode = ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField; lastErrorMessage = err; return null; } } return deleteNSync(iUseCaseID, bm); } protected boolean createOrReplaceNAsync(int iUseCaseID, final List<?> list, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean createOrReplaceAsync(int iUseCaseID, final BaseModel baseModel, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean createNAsync(int iUseCaseID, final List<?> list, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean createAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 将已经存在于SQLite中的bmOld删除,将服务器返回的bmNew插入SQLite中 * * @param iUseCaseID * @param bmOld 要删除的已经存在于SQLite中的旧的对象。其ID是本地SQLite中的ID * @param bmNew 要插入SQLite中的新对象。其ID是服务器DB中的ID * @param event * @return */ protected boolean createReplacerAsync(final int iUseCaseID, final BaseModel bmOld, final BaseModel bmNew, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 将已经存在于SQLite中的bmOldList删除,将服务器返回的bmNewList插入SQLite中 * * @param iUseCaseID * @param bmOldList 要删除的已经存在于SQLite中的旧的对象集合。其中本地SQLite的ID * @param bmNewList 要插入SQLite中新的对象集合,其ID是服务器DB中的ID * @param event * @return */ protected boolean createReplacerNAsync(final int iUseCaseID, final List<?> bmOldList, final List<?> bmNewList, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 根据返回的数据的 string1 的类型进行增删CUD操作.根据返回的数据查找SQLite中对应的数据,如果同一个小票ID,string1==C和string1==U,查找SQLite如果不存在就create, 存在就进行update * 同一个小票ID如果string1==CommodityCategory,就对SQLite中对应的数据进行create * 同一个小票ID如果string1==U,就对SQLite中对应的数据进行update * 同一个小票ID如果string1==D,就对SQLite中对应的数据进行delete * 在httpevent进行操作m,去掉重复ID * 1.判断是否存在相同ID,若不存在就对SQLite中的数据进行相应操作 * 2.如果存在相同ID,判断是否存在D类型,如果存在D类型,查找SQLite中是否存在对应数据,如果有就对其进行delete操作,如果没有就不进行任何操作 * 3.如果不存在D类型,只有C和U型,就进行create操作. * * @param iUseCaseID * @param bmNewList server返回的对象List * @param event * @return */ protected boolean refreshByServerDataAsync(final int iUseCaseID, final List<?> bmNewList, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * @param iUseCaseID * @param bmNewList server返回的对象List * @param event * @return */ protected boolean refreshByServerDataAsyncC(final int iUseCaseID, final List<?> bmNewList, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 向SQLite插入主表和从表的数据 * * @param iUseCaseID * @param bmMaster 主表数据,里面有从表数据的指针 * @param event * @return */ protected boolean createMasterSlaveAsync(final int iUseCaseID, final BaseModel bmMaster, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 向SQLite修改主表和从表的数据 * * @param iUseCaseID * @param bmMaster 主表数据,里面有从表数据的指针 * @param event * @return */ protected boolean updateMasterSlaveAsync(final int iUseCaseID, final BaseModel bmMaster, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 想SQLite删除主从表数据 * * @param iUseCaseID * @param bm 主表数据,里面有从表数据的指针 * @param event * @return */ protected boolean deleteMasterSlaveAsync(final int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean updateAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean retrieve1Async(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean retrieveNAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean deleteAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } protected boolean updateNAsync(int iUseCaseID, final List<?> bmList, final BaseSQLiteEvent event) { throw new RuntimeException("Not yet implemented!"); } /** * 将网络返回的对象(真身)bmNew插入SQLite中,并在此前将临时对象(替身)bmOld删除 */ public boolean createReplacerObjectAsync(final int iUseCaseID, final BaseModel bmOld, final BaseModel bmNew, final BaseSQLiteEvent event) { return createReplacerAsync(iUseCaseID, bmOld, bmNew, event); } /** * 将网络返回的对象集合(真身)bmNewList插入SQLite中,并在此前将临时对象集合(替身) bmOldList删除 */ public boolean createReplacerNObjectASync(final int iUseCaseID, final List<?> bmOldList, final List<?> bmNewList, final BaseSQLiteEvent event) { return createReplacerNAsync(iUseCaseID, bmOldList, bmNewList, event); } public boolean refreshByServerDataObjectsAsync(final int iUseCaseID, final List<?> bmNewList, final BaseSQLiteEvent event) { return refreshByServerDataAsync(iUseCaseID, bmNewList, event); } public boolean refreshByServerDataObjectsAsyncC(final int iUseCaseID, final List<?> bmNewList, final BaseSQLiteEvent event) { return refreshByServerDataAsyncC(iUseCaseID, bmNewList, event); } /** * 向SQLite插入主从表对象。一般情况下,这些主从表对象是临时对象(替身),服务器返回对象(真身)后,将删除替身 */ public boolean createMasterSlaveObjectAsync(final int iUseCaseID, final BaseModel bmMaster, final BaseSQLiteEvent event) { return createMasterSlaveAsync(iUseCaseID, bmMaster, event); } public boolean updateMasterSlaveObjectAsync(final int iUseCaseID, final BaseModel bmMaster, final BaseSQLiteEvent event) { return updateMasterSlaveAsync(iUseCaseID, bmMaster, event); } public boolean deleteMasterSlaveObjectAsync(final int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { return deleteMasterSlaveAsync(iUseCaseID, bm, event); } public boolean createOrReplaceNObjectAsync(int iUseCaseID, final List<?> list, final BaseSQLiteEvent event) { return createOrReplaceNAsync(iUseCaseID, list, event); } public boolean createOrReplaceObjectAsync(int iUseCaseID, final BaseModel baseModel, final BaseSQLiteEvent event) { return createOrReplaceAsync(iUseCaseID, baseModel, event); } public boolean createNObjectAsync(int iUseCaseID, final List<?> list, final BaseSQLiteEvent event) { if (list != null) { List<BaseModel> bmList = (List<BaseModel>) list; for (BaseModel bm : bmList) { String err = bm.checkCreate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } } } return createNAsync(iUseCaseID, list, event); } public boolean createObjectAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { String err = bm.checkCreate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } return createAsync(iUseCaseID, bm, event); } public boolean updateObjectAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { String err = bm.checkUpdate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } return updateAsync(iUseCaseID, bm, event); } public boolean retrieve1ObjectAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { if (bm != null) { String err = bm.checkRetrieve1(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } } return retrieve1Async(iUseCaseID, bm, event); } public boolean retrieveNObjectAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { if (bm != null) { String err = bm.checkRetrieveN(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } } return retrieveNAsync(iUseCaseID, bm, event); } public boolean deleteObjectAsync(int iUseCaseID, final BaseModel bm, final BaseSQLiteEvent event) { String err = bm.checkDelete(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } return deleteAsync(iUseCaseID, bm, event); } public boolean updateNObjectAsync(int iUseCaseID, final List<?> bmList, final BaseSQLiteEvent event) { if (bmList != null) { List<BaseModel> list = (List<BaseModel>) bmList; for (BaseModel bm : list) { String err = bm.checkUpdate(iUseCaseID); if (err.length() > 0) { Constants.checkModelLog(log, bm, err); event.setLastErrorCode(ErrorInfo.EnumErrorCode.EC_WrongFormatForInputField); event.setLastErrorMessage(err); event.setStatus(BaseEvent.EnumEventStatus.EES_SQLite_NoAction); event.setEventProcessed(true); return false; } } } return updateNAsync(iUseCaseID, bmList, event); } }
9231d38082212f3e26027fbcc2899c3f0c52ca07
1,660
java
Java
Week 2/id_415/LeetCode_105_415/Test105.java
54nidong/algorithm004-05
43d93f941ca73130fe187922fe8bca8ad878b119
[ "Apache-2.0" ]
null
null
null
Week 2/id_415/LeetCode_105_415/Test105.java
54nidong/algorithm004-05
43d93f941ca73130fe187922fe8bca8ad878b119
[ "Apache-2.0" ]
null
null
null
Week 2/id_415/LeetCode_105_415/Test105.java
54nidong/algorithm004-05
43d93f941ca73130fe187922fe8bca8ad878b119
[ "Apache-2.0" ]
null
null
null
28.62069
134
0.578313
995,989
package com.nidong.shop.shoppingMall.biz.suanfa.week2; /** * 根据一棵树的前序遍历与中序遍历构造二叉树。 * * 注意: * 你可以假设树中没有重复的元素。 * * 例如,给出 * * 前序遍历 preorder = [3,9,20,15,7] * 中序遍历 inorder = [9,3,15,20,7] * 返回如下的二叉树: * * 3 * / \ * 9 20 * / \ * 15 7 * * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal * 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ public class Test105 { public static void main(String[] args) { int preorder[] = {3,9,20,15,7}; int inorder[] = {3,9,20,15,7}; buildTree(preorder, inorder); } public static TreeNode buildTree(int[] preorder, int[] inorder) { if (preorder == null || preorder.length == 0 || inorder == null || inorder.length == 0 || preorder.length != inorder.length) { return null; } return help(preorder, 0, preorder.length - 1, inorder, 0, inorder.length - 1); } private static TreeNode help(int[] preorder, int pStart, int pEnd, int[] inorder, int iStart, int iEnd) { //递归的第一步:递归终止条件,避免死循环 if (pStart > pEnd || iStart > iEnd) { return null; } //重建根节点 TreeNode treeNode = new TreeNode(preorder[pStart]); int index = 0; //index找到根节点在中序遍历的位置 while (inorder[iStart + index] != preorder[pStart]) { index++; } //重建左子树 treeNode.left = help(preorder, pStart + 1, pStart + index, inorder, iStart, iStart + index - 1); //重建右子树 treeNode.right = help(preorder, pStart + index + 1, pEnd, inorder, iStart + index + 1, iEnd); return treeNode; } }
9231d3e4a34874a5f9445d29614dcb7051f55c19
2,453
java
Java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/shared/SqlQueryResult.java
dhis2/dhis2
c4caf4187b25c1a71813dd815a473ddff5f98456
[ "BSD-3-Clause" ]
null
null
null
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/shared/SqlQueryResult.java
dhis2/dhis2
c4caf4187b25c1a71813dd815a473ddff5f98456
[ "BSD-3-Clause" ]
null
null
null
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/shared/SqlQueryResult.java
dhis2/dhis2
c4caf4187b25c1a71813dd815a473ddff5f98456
[ "BSD-3-Clause" ]
null
null
null
34.069444
82
0.731757
995,990
/* * Copyright (c) 2004-2022, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.hisp.dhis.analytics.shared; import java.util.List; import java.util.Map; import lombok.AllArgsConstructor; import org.apache.commons.collections4.MapUtils; /** * @see org.hisp.dhis.analytics.shared.QueryResult * * @author maikel arabori */ @AllArgsConstructor public class SqlQueryResult implements QueryResult<Map<Column, List<Object>>> { /** * Represents the query result. It maps each column to the respective list * of rows. */ private final Map<Column, List<Object>> resultMap; /** * @see QueryResult#result() * * @return a map that contains all rows for each column */ @Override public Map<Column, List<Object>> result() { return resultMap; } /** * @see QueryResult#isEmpty() */ @Override public boolean isEmpty() { return MapUtils.isEmpty( resultMap ); } }
9231d433ab6460567a5a6a0304360de7eea12807
205
java
Java
autodata-compiler/src/test/resources/equals/inputs/BooleanField.java
evant/autodata
2bf0e149ee0f10d4fb9da6dcf620c58bdcc45777
[ "Apache-2.0" ]
2
2015-05-02T12:58:56.000Z
2016-03-05T15:31:06.000Z
autodata-compiler/src/test/resources/equals/inputs/BooleanField.java
evant/autodata
2bf0e149ee0f10d4fb9da6dcf620c58bdcc45777
[ "Apache-2.0" ]
9
2015-04-22T03:06:08.000Z
2015-05-06T00:28:26.000Z
autodata-compiler/src/test/resources/equals/inputs/BooleanField.java
evant/autodata
2bf0e149ee0f10d4fb9da6dcf620c58bdcc45777
[ "Apache-2.0" ]
null
null
null
22.777778
46
0.790244
995,991
import me.tatarka.autodata.base.AutoData; import me.tatarka.autodata.plugins.AutoEquals; @AutoData(defaults = false) @AutoEquals public abstract class BooleanField { public abstract boolean test(); }
9231d4da3fe5f6a45b96699d29194f6c7ab4d040
434
java
Java
src/main/java/com/valhallagame/ymer/message/character/UnequipItemParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
src/main/java/com/valhallagame/ymer/message/character/UnequipItemParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
src/main/java/com/valhallagame/ymer/message/character/UnequipItemParameter.java
saiaku-gaming/ymer
9530093fd051aed85235627953a644ea3c5e71d1
[ "MIT" ]
null
null
null
21.7
57
0.81106
995,992
package com.valhallagame.ymer.message.character; import com.valhallagame.common.validation.CheckLowercase; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.NotBlank; @Data @NoArgsConstructor @AllArgsConstructor public final class UnequipItemParameter { @NotBlank @CheckLowercase String characterName; @NotBlank String itemSlot; }
9231d4fedab659ff34f26a80829449fa08261b33
549
java
Java
wallet/src/main/kotlin/org/trustnote/db/entity/Devices.java
TrustNoteDevelopers/wallet_android
ad70672b9edd67177c3321ba3b669e453eb89f59
[ "MIT" ]
4
2018-04-19T23:33:49.000Z
2018-07-30T01:51:21.000Z
wallet/src/main/kotlin/org/trustnote/db/entity/Devices.java
TrustNoteDevelopers/wallet_android
ad70672b9edd67177c3321ba3b669e453eb89f59
[ "MIT" ]
null
null
null
wallet/src/main/kotlin/org/trustnote/db/entity/Devices.java
TrustNoteDevelopers/wallet_android
ad70672b9edd67177c3321ba3b669e453eb89f59
[ "MIT" ]
5
2018-04-16T10:01:29.000Z
2019-07-26T22:03:43.000Z
17.709677
48
0.704918
995,993
package org.trustnote.db.entity; import android.arch.persistence.room.ColumnInfo; import android.arch.persistence.room.Entity; import java.lang.String; @Entity( tableName = "devices" ) public class Devices extends TBaseEntity { @ColumnInfo( name = "device_address" ) public String deviceAddress; @ColumnInfo( name = "pubkey" ) public String pubkey; @ColumnInfo( name = "temp_pubkey_package" ) public String tempPubkeyPackage; @ColumnInfo( name = "creation_date" ) public long creationDate; }
9231d558bdb585c0ac748d0ab1edc04a6d06b74f
1,204
java
Java
think/src/main/java/generics/TupleTest.java
androidmalin/EffectiveJava
f70b7180341056b02cd9eb66116d96c934cd7884
[ "Apache-2.0" ]
4
2021-02-20T03:05:45.000Z
2021-12-23T04:42:38.000Z
think/src/main/java/generics/TupleTest.java
androidmalin/EffectiveJava
f70b7180341056b02cd9eb66116d96c934cd7884
[ "Apache-2.0" ]
null
null
null
think/src/main/java/generics/TupleTest.java
androidmalin/EffectiveJava
f70b7180341056b02cd9eb66116d96c934cd7884
[ "Apache-2.0" ]
null
null
null
23.153846
71
0.547342
995,994
package generics; import net.mindview.util.FiveTuple; import net.mindview.util.FourTuple; import net.mindview.util.ThreeTuple; import net.mindview.util.TwoTuple; class Amphibian { } class Vehicle { } public class TupleTest { static TwoTuple<String, Integer> f() { // Autoboxing converts the int to Integer: return new TwoTuple<>("hi", 47); } static ThreeTuple<Amphibian, String, Integer> g() { return new ThreeTuple<>(new Amphibian(), "hi", 47); } static FourTuple<Vehicle, Amphibian, String, Integer> h() { return new FourTuple<>( new Vehicle(), new Amphibian(), "hi", 47 ); } static FiveTuple<Vehicle, Amphibian, String, Integer, Double> k() { return new FiveTuple<>( new Vehicle(), new Amphibian(), "hi" , 47, 11.1 ); } public static void main(String[] args) { TwoTuple<String, Integer> twoTuple = f(); System.out.println(twoTuple); System.out.println(g()); System.out.println(h()); System.out.println(k()); } }
9231d5eac9afac345ea0690e684e536efef008d0
5,317
java
Java
src/main/java/com/pjn/pl/LSAContainer.java
damianck/pjn
04a179f8698ef6307a12f68643f3e3fd3ae02199
[ "MIT" ]
null
null
null
src/main/java/com/pjn/pl/LSAContainer.java
damianck/pjn
04a179f8698ef6307a12f68643f3e3fd3ae02199
[ "MIT" ]
null
null
null
src/main/java/com/pjn/pl/LSAContainer.java
damianck/pjn
04a179f8698ef6307a12f68643f3e3fd3ae02199
[ "MIT" ]
null
null
null
36.417808
120
0.537521
995,995
package com.pjn.pl; import tml.corpus.CorpusParameters; import tml.corpus.SearchResultsCorpus; import tml.storage.Repository; import tml.vectorspace.TermWeighting; import tml.vectorspace.operations.PassagesSimilarity; import tml.vectorspace.operations.RapidAutomaticKeywordExtraction; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.sql.SQLException; /** * Created by miky on 20/06/2017. */ public class LSAContainer extends JPanel{ /** * */ private static final long serialVersionUID = 1L; private SpringLayout layout; private JButton dodajTekst,analizujTekst; public LSAContainer() { layout = new SpringLayout(); createContainer(); } private void createContainer() { setLayout(layout); analizujTekst = new JButton("Analizuj teksty"); dodajTekst = new JButton("Dodaj teksty do bazy danych z folderu repoSource"); //Layout Begin layout.putConstraint(SpringLayout.WEST, analizujTekst, 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, analizujTekst, 10, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, analizujTekst, -10, SpringLayout.EAST, this); layout.putConstraint(SpringLayout.WEST, dodajTekst, 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, dodajTekst, 40, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.EAST, dodajTekst, -10, SpringLayout.EAST, this); //Layout End analizujTekst.addActionListener(new Operacje(1)); dodajTekst.addActionListener(new Operacje(2)); add(analizujTekst); add(dodajTekst); } private class Operacje implements ActionListener { private int nrAkcji; public Operacje(int nrAkcji) { this.nrAkcji = nrAkcji; } public void actionPerformed(ActionEvent arg0) { switch (nrAkcji) { case 1: { //LSA Repository repository; try { repository = new Repository("repo"); SearchResultsCorpus corpus = new SearchResultsCorpus("type:document"); corpus.getParameters().setTermSelectionCriterion(CorpusParameters.TermSelection.DF); corpus.getParameters().setTermSelectionThreshold(0); corpus.getParameters().setDimensionalityReduction(CorpusParameters.DimensionalityReduction.NUM); corpus.getParameters().setDimensionalityReductionThreshold(50); corpus.getParameters().setTermWeightGlobal(TermWeighting.GlobalWeight.Entropy); corpus.getParameters().setTermWeightLocal(TermWeighting.LocalWeight.LOGTF); corpus.load(repository); System.out.println("Corpus loaded and Semantic space calculated"); System.out.println("Total documents:" + corpus.getPassages().length); PassagesSimilarity distances = new PassagesSimilarity(); distances.setCorpus(corpus); distances.start(); System.out.println("------------------------LSA------------------------"); distances.printResults(); RapidAutomaticKeywordExtraction rake = new RapidAutomaticKeywordExtraction(); rake.setCorpus(corpus); rake.start(); System.out.println("------------------------RAKE------------------------"); String[][] test = rake.getResultsStringTable(); for(int i=0; i < test.length; i++) { System.out.println("Słowo/a: "+test[i][0]+"; Frekwencja: "+test[i][1]); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { e1.printStackTrace(); } //RAKE }; break; case 2:{ Repository repository1; try { repository1 = new Repository("repo"); repository1.addDocumentsInFolder("repoSource"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Documents added to repository successfully!"); }; break; } } } }
9231d646b2c63bf2299e77e7af9a29e1162f590d
118
java
Java
src/model/interactWithServer/GameHistory.java
Mohammadreza-mz/ShatranjClient
68a008c8839e547ffd531a8dafb6d236663ce1b1
[ "MIT" ]
1
2022-03-05T14:09:34.000Z
2022-03-05T14:09:34.000Z
src/model/interactWithServer/GameHistory.java
Mohammadreza-mz/ShatranjClient
68a008c8839e547ffd531a8dafb6d236663ce1b1
[ "MIT" ]
null
null
null
src/model/interactWithServer/GameHistory.java
Mohammadreza-mz/ShatranjClient
68a008c8839e547ffd531a8dafb6d236663ce1b1
[ "MIT" ]
null
null
null
16.857143
50
0.830508
995,996
package model.interactWithServer; import java.io.Serializable; public class GameHistory implements Serializable { }
9231d81bb1f63dd9875a9c55ffc74d136e8d1dce
4,337
java
Java
groove/test/groove/test/type/TypeCheckTest.java
svenkonings/JavaGraph
6b4dfe965acfcaba8281a66764c3377346cee921
[ "Apache-2.0" ]
1
2017-06-27T14:37:08.000Z
2017-06-27T14:37:08.000Z
groove/test/groove/test/type/TypeCheckTest.java
svenkonings/JavaGraph
6b4dfe965acfcaba8281a66764c3377346cee921
[ "Apache-2.0" ]
null
null
null
groove/test/groove/test/type/TypeCheckTest.java
svenkonings/JavaGraph
6b4dfe965acfcaba8281a66764c3377346cee921
[ "Apache-2.0" ]
null
null
null
31.889706
92
0.600646
995,997
/* GROOVE: GRaphs for Object Oriented VErification * Copyright 2003--2010 University of Twente * * 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. * * $Id: TypeCheckTest.java 5873 2017-04-05 07:39:56Z rensink $ */ package groove.test.type; import java.io.IOException; import java.util.EnumSet; import java.util.Map; import org.junit.Test; import groove.grammar.QualName; import groove.grammar.model.GrammarModel; import groove.grammar.model.NamedResourceModel; import groove.grammar.model.ResourceKind; import groove.util.Groove; import groove.util.parse.FormatException; import junit.framework.Assert; /** Set of tests for graph typing. */ public class TypeCheckTest { /** Location of the samples. */ static public final String INPUT_DIR = "junit/types"; private static final String ERR_PREFIX = "ERR-"; private static final String OK_PREFIX = "OK-"; /** Tests type specialisation. */ @Test public void testTypeSpecialisation() { test("type-specialisation"); } /** Tests abstract node and edge types and edge shadowing. */ @Test public void testShadow() { test("shadow"); } /** Tests regular expression typing. */ @Test public void testRegExpr() { test("regexpr"); } /** Tests wildcard expression typing. */ @Test public void testWildcards() { test("wildcards"); } /** Tests expression typing. */ @Test public void testExpressions() { test("expressions"); } /** Tests for regression. */ @Test public void testRegression() { test("regression"); } /** Tests node identity constraints. */ @Test public void testNodeIds() { test("nodeids"); } /** Tests all rules in a named grammar (to be loaded from {@link #INPUT_DIR}). */ private void test(String grammarName) { try { GrammarModel grammarView = Groove.loadGrammar(INPUT_DIR + "/" + grammarName); for (ResourceKind kind : EnumSet.of(ResourceKind.RULE, ResourceKind.HOST, ResourceKind.TYPE)) { for (Map.Entry<QualName,? extends NamedResourceModel<?>> entry : grammarView .getResourceMap(kind) .entrySet()) { String name = entry.getKey() .last(); NamedResourceModel<?> model = entry.getValue(); if (name.startsWith(OK_PREFIX)) { testCorrect(model); } else if (name.startsWith(ERR_PREFIX)) { testErroneous(model); } } } } catch (IOException e) { Assert.fail(e.getMessage()); } } /** Tests that a given rule has no errors. */ private void testCorrect(NamedResourceModel<?> model) { String kindName = model.getKind() .getName(); QualName modelName = model.getQualName(); try { model.toResource(); } catch (NullPointerException e) { Assert.fail(kindName + " " + modelName + " does not exist"); } catch (FormatException e) { Assert.fail(e.getMessage()); } } /** Tests that a given rule has errors. */ private void testErroneous(NamedResourceModel<?> model) { String kindName = model.getKind() .getName(); QualName modelName = model.getQualName(); try { model.toResource(); Assert.fail(kindName + " " + modelName + " has no errors"); } catch (NullPointerException e) { Assert.fail(kindName + " " + modelName + " does not exist"); } catch (FormatException e) { // do nothing; this is the expected case } } }
9231d8afd226cba0dd95a707d34b15d9ae1a57eb
7,261
java
Java
heat-core-utils/src/test/java/com/hotels/heat/core/runner/TestBaseRunnerTest.java
HotelsDotCom/heat
3e3dd1863eea2012009c45fe6110b4934559c259
[ "Apache-2.0" ]
46
2017-10-20T09:05:15.000Z
2020-08-29T22:22:56.000Z
heat-core-utils/src/test/java/com/hotels/heat/core/runner/TestBaseRunnerTest.java
ExpediaGroup/heat
3e3dd1863eea2012009c45fe6110b4934559c259
[ "Apache-2.0" ]
22
2017-11-08T14:01:52.000Z
2019-06-13T19:22:11.000Z
heat-core-utils/src/test/java/com/hotels/heat/core/runner/TestBaseRunnerTest.java
HotelsDotCom/heat
3e3dd1863eea2012009c45fe6110b4934559c259
[ "Apache-2.0" ]
13
2018-02-13T11:21:53.000Z
2020-11-27T07:36:49.000Z
55.853846
133
0.70376
995,998
/** * Copyright (C) 2015-2019 Expedia, Inc. * * 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.hotels.heat.core.runner; import org.junit.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.hotels.heat.core.environment.EnvironmentHandler; import com.hotels.heat.core.handlers.TestSuiteHandler; /** * Unit test for TestBaseRunner. */ public class TestBaseRunnerTest { private TestBaseRunner underTest; @BeforeMethod public void setUp() { underTest = new TestBaseRunner(); underTest.beforeTestSuite("envPropFilePath", "webappName", null); underTest.beforeTestCase("/testCases/path/filename.json", "env1,env2,env3", null); } @Test (enabled = true) public void isTestSkippableTest() { /* * Correct usage of system parameters */ // No parameters System.clearProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST); System.setProperty("environment", "env1"); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysEnv(); Assert.assertFalse(underTest.isTestCaseSkippable("suiteName0", "001", "SVC_NAME", "http://my.service.com/svc")); // Only TestSuite System.setProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST, "suiteName1"); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); Assert.assertFalse(underTest.isTestCaseSkippable("suiteName1", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("suiteNameXXX", "001", "SVC_NAME", "http://my.service.com/svc")); // TestId and Suite combinations System.setProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST, "test_suite_name5" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "001"); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name5", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_name5", "002", "SVC_NAME", "http://my.service.com/svc")); /* * Test with multi TestIds */ // Only TestSuite System.setProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST, "suiteName1,suiteName2,suiteName3"); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); Assert.assertFalse(underTest.isTestCaseSkippable("suiteName1", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("suiteName2", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("suiteNameXXX", "003", "SVC_NAME", "http://my.service.com/svc")); // TestId and Suite combinations System.setProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST, "test_suite_name5" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "001," + "test_suite_name5" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "002," + "test_suite_name6" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "001," + "test_suite_name7"); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_name5", "003", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_name6", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name5", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name5", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name6", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name7", "003", "SVC_NAME", "http://my.service.com/svc")); // TestId and Suite combinations WITH spaces and upper/lower cases System.setProperty(EnvironmentHandler.SYS_PROP_HEAT_TEST, " test_SUITE_name5" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "001 ," + "test_suite_NAME5" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "002, " + "TEST_SUITE_NAME6" + TestBaseRunner.TESTCASE_ID_SEPARATOR + "001 ," + " TEST_suite_name7 "); TestSuiteHandler.getInstance().getEnvironmentHandler().reloadSysTestIds(); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_name5", "003", "SVC_NAME", "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_name6", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name5", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name5", "002", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name6", "001", "SVC_NAME", "http://my.service.com/svc")); Assert.assertFalse(underTest.isTestCaseSkippable("test_suite_name7", "003", "SVC_NAME", "http://my.service.com/svc")); /* * Missing Common params */ Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", null, "http://my.service.com/svc")); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", "SVC_NAME", null)); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", null, null)); underTest.setInputJsonPath(null); Assert.assertTrue(underTest.isTestCaseSkippable("test_suite_nameXXX", "001", "SVC_NAME", "http://my.service.com/svc")); } }
9231d8fa96db1ebf1e5425a3b24b200717ff1e98
1,872
java
Java
src/test/java/org/jpasecurity/model/acl/User.java
Chucky90/jpasecurity
ae4959658aec9b7ef142a467ce434ac9152925ba
[ "Apache-2.0" ]
10
2017-07-19T09:57:47.000Z
2021-06-22T12:36:23.000Z
src/test/java/org/jpasecurity/model/acl/User.java
Chucky90/jpasecurity
ae4959658aec9b7ef142a467ce434ac9152925ba
[ "Apache-2.0" ]
58
2017-08-08T05:44:43.000Z
2020-10-13T03:59:50.000Z
src/test/java/org/jpasecurity/model/acl/User.java
Chucky90/jpasecurity
ae4959658aec9b7ef142a467ce434ac9152925ba
[ "Apache-2.0" ]
10
2017-04-23T03:40:28.000Z
2020-12-18T13:27:35.000Z
25.297297
77
0.682158
995,999
/* * Copyright 2011 Stefan Hildebrandt * * 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.jpasecurity.model.acl; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; @Entity public class User extends AbstractEntity { @ManyToMany(fetch = FetchType.LAZY) private List<Group> groups; @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = "USER_ROLE", joinColumns = @JoinColumn(name = "USER_ID"), inverseJoinColumns = @JoinColumn(name = "ROLE_ID")) private List<Role> roles; private String firstName; private String lastName; public List<Group> getGroups() { return groups; } public void setGroups(List<Group> groups) { this.groups = groups; } public List<Role> getRoles() { return roles; } public void setRoles(List<Role> roles) { this.roles = roles; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } }
9231d90bacc3e01c180b0431451d2d06583fef1a
195
java
Java
app/src/main/java/io/github/noeppi_noeppi/nodecg_io_android/util/ToJSONArray.java
noeppi-noeppi/nodecg-io-android
f1ec983dcbec54aeb34d5ce211750a7c55aba2d4
[ "MIT" ]
1
2020-11-13T19:21:16.000Z
2020-11-13T19:21:16.000Z
app/src/main/java/io/github/noeppi_noeppi/nodecg_io_android/util/ToJSONArray.java
noeppi-noeppi/nodecg-io-android
f1ec983dcbec54aeb34d5ce211750a7c55aba2d4
[ "MIT" ]
null
null
null
app/src/main/java/io/github/noeppi_noeppi/nodecg_io_android/util/ToJSONArray.java
noeppi-noeppi/nodecg-io-android
f1ec983dcbec54aeb34d5ce211750a7c55aba2d4
[ "MIT" ]
null
null
null
19.5
55
0.805128
996,000
package io.github.noeppi_noeppi.nodecg_io_android.util; import org.json.JSONArray; import org.json.JSONException; public interface ToJSONArray { JSONArray toJSON() throws JSONException; }
9231d9de91523389ed8e4edeab3413c9444eab3e
2,039
java
Java
Javac2007/流程/code/025Types_methods/rank.java
codefollower/Open-Source-Research
b9f2aed9d0f060b80be45f713c3d48fe91f247b2
[ "Apache-2.0" ]
184
2015-01-04T03:38:20.000Z
2022-03-30T05:47:21.000Z
Javac2007/流程/code/025Types_methods/rank.java
codefollower/Open-Source-Research
b9f2aed9d0f060b80be45f713c3d48fe91f247b2
[ "Apache-2.0" ]
1
2016-01-17T09:18:17.000Z
2016-01-17T09:18:17.000Z
Javac2007/流程/code/025Types_methods/rank.java
codefollower/Open-Source-Research
b9f2aed9d0f060b80be45f713c3d48fe91f247b2
[ "Apache-2.0" ]
101
2015-01-16T23:46:31.000Z
2022-03-30T05:47:06.000Z
32.887097
68
0.467876
996,001
//rank // <editor-fold defaultstate="collapsed" desc="rank"> /** * The rank of a class is the length of the longest path between * the class and java.lang.Object in the class inheritance * graph. Undefined for all but reference types. */ public int rank(Type t) { //只有ClassType、TypeVar有rank_field字段 try {//我加上的 DEBUG.P(this,"rank(Type t)"); DEBUG.P("t="+t+" t.tag="+TypeTags.toString(t.tag)); switch(t.tag) { case CLASS: { ClassType cls = (ClassType)t; DEBUG.P("cls.rank_field="+cls.rank_field); if (cls.rank_field < 0) { Name fullname = cls.tsym.getQualifiedName(); DEBUG.P("fullname="+fullname); if (fullname == fullname.table.java_lang_Object) cls.rank_field = 0; else { int r = rank(supertype(cls)); for (List<Type> l = interfaces(cls); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } cls.rank_field = r + 1; } } DEBUG.P("cls.rank_field="+cls.rank_field); return cls.rank_field; } case TYPEVAR: { TypeVar tvar = (TypeVar)t; DEBUG.P("tvar.rank_field="+tvar.rank_field); if (tvar.rank_field < 0) { int r = rank(supertype(tvar)); for (List<Type> l = interfaces(tvar); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } tvar.rank_field = r + 1; } DEBUG.P("tvar.rank_field="+tvar.rank_field); return tvar.rank_field; } case ERROR: return 0; default: throw new AssertionError(); } }finally{//我加上的 DEBUG.P(0,this,"rank(Type t)"); } } // </editor-fold> //
9231da9f7b74d8c00c91fdaec41cd108f9f2ef1b
1,193
java
Java
demo/src/main/java/xunhu/test/sample/demo_xunhu/timePicket/NumericWheelAdapter.java
Qunter/XunHu
f444faf91403c93bb06dd24b9dad4b1438974954
[ "Apache-2.0" ]
null
null
null
demo/src/main/java/xunhu/test/sample/demo_xunhu/timePicket/NumericWheelAdapter.java
Qunter/XunHu
f444faf91403c93bb06dd24b9dad4b1438974954
[ "Apache-2.0" ]
null
null
null
demo/src/main/java/xunhu/test/sample/demo_xunhu/timePicket/NumericWheelAdapter.java
Qunter/XunHu
f444faf91403c93bb06dd24b9dad4b1438974954
[ "Apache-2.0" ]
null
null
null
20.568966
82
0.701593
996,002
package xunhu.test.sample.demo_xunhu.timePicket; /** * wheel适配器 */ public class NumericWheelAdapter implements WheelAdapter { /** 默认的最大值 */ public static final int DEFAULT_MAX_VALUE = 9; /** 默认的最小值 */ private static final int DEFAULT_MIN_VALUE = 0; private int minValue; private int maxValue; private String format; public NumericWheelAdapter() { this(DEFAULT_MIN_VALUE, DEFAULT_MAX_VALUE); } public NumericWheelAdapter(int minValue, int maxValue) { this(minValue, maxValue, null); } public NumericWheelAdapter(int minValue, int maxValue, String format) { this.minValue = minValue; this.maxValue = maxValue; this.format = format; } @Override public String getItem(int index) { if (index >= 0 && index < getItemsCount()) { int value = minValue + index; return format != null ? String.format(format, value) : Integer.toString(value); } return null; } @Override public int getItemsCount() { return maxValue - minValue + 1; } @Override public int getMaximumLength() { int max = Math.max(Math.abs(maxValue), Math.abs(minValue)); int maxLen = Integer.toString(max).length(); if (minValue < 0) { maxLen++; } return maxLen; } }
9231db771e7bbca2b0f6e81de0484d31ee38b29e
564
java
Java
api-v3/src/main/java/ru/easydonate/easydonate4j/api/v3/response/plugin/easydonate/surcharge/SurchargeGetDiscountResponse.java
EasyDonate/EasyDonate4J
22cd9cfb605693ec6ccee7933637dec98e76b6ed
[ "MIT" ]
3
2021-12-21T09:19:14.000Z
2022-01-21T19:24:30.000Z
api-v3/src/main/java/ru/easydonate/easydonate4j/api/v3/response/plugin/easydonate/surcharge/SurchargeGetDiscountResponse.java
SoKnight/EasyDonate4J
3eff854c06a60abbfa4446aa8a95ae3188137c1c
[ "MIT" ]
1
2021-05-05T16:00:23.000Z
2021-05-06T11:24:11.000Z
api-v3/src/main/java/ru/easydonate/easydonate4j/api/v3/response/plugin/easydonate/surcharge/SurchargeGetDiscountResponse.java
SoKnight/EasyDonate4J
3eff854c06a60abbfa4446aa8a95ae3188137c1c
[ "MIT" ]
2
2021-10-05T10:13:44.000Z
2021-11-11T13:03:30.000Z
51.272727
98
0.85461
996,003
package ru.easydonate.easydonate4j.api.v3.response.plugin.easydonate.surcharge; import ru.easydonate.easydonate4j.api.v3.data.model.plugin.PluginType; import ru.easydonate.easydonate4j.api.v3.data.model.plugin.easydonate.surcharge.SurchargeDiscount; import ru.easydonate.easydonate4j.api.v3.response.ApiResponse; import ru.easydonate.easydonate4j.api.v3.response.plugin.PluginApiResponse; @PluginApiResponse(pluginType = PluginType.SURCHARGE, apiMethod = "getDiscountFor") public interface SurchargeGetDiscountResponse extends ApiResponse<SurchargeDiscount> { }
9231dcd9798296fccc01bff7f7dc8b518a32a0d0
1,844
java
Java
app/src/main/java/com/myanmar/tmn/news/viewHolder/FavouriteUserViewHolder.java
MrMyatNoe/PADC-3-F-TMN-MM-News
bf6ef42f3c66f9b2e9d897c578ac395a28d855bf
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/myanmar/tmn/news/viewHolder/FavouriteUserViewHolder.java
MrMyatNoe/PADC-3-F-TMN-MM-News
bf6ef42f3c66f9b2e9d897c578ac395a28d855bf
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/myanmar/tmn/news/viewHolder/FavouriteUserViewHolder.java
MrMyatNoe/PADC-3-F-TMN-MM-News
bf6ef42f3c66f9b2e9d897c578ac395a28d855bf
[ "Apache-2.0" ]
null
null
null
29.741935
99
0.706616
996,004
package com.myanmar.tmn.news.viewHolder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.myanmar.tmn.news.R; import com.myanmar.tmn.news.data.vo.FavouriteVO; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by msi on 2/4/2018. */ public class FavouriteUserViewHolder extends RecyclerView.ViewHolder { @BindView(R.id.user_profile) ImageView userProfile; @BindView(R.id.tv_name) TextView tvName; @BindView(R.id.tv_phone) TextView tvPhone; @BindView(R.id.tv_time_stamp) TextView favouriteTimeStamp; public FavouriteUserViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } public void setData(FavouriteVO favouriteVO) { Glide.with(userProfile.getContext()).load(favouriteVO.getActedUserVO().getProfileImage()) .into(userProfile); tvName.setText(favouriteVO.getActedUserVO().getUserName()); String originalTimeFormat = favouriteVO.getFavouriteDate(); //creating data format(SUN Dec 03 03:22:11 +GMT 2017) SimpleDateFormat simpleDateFormat = new SimpleDateFormat("E MMM dd hh:mm:ss Z yyyy"); try { Date date = simpleDateFormat.parse(originalTimeFormat); //to show in data layer SimpleDateFormat sdfPresentableFormat = new SimpleDateFormat("hh:mm a',' MMM dd yyyy"); String presentableTimeFormat = sdfPresentableFormat.format(date); favouriteTimeStamp.setText(presentableTimeFormat); } catch (ParseException e) { e.printStackTrace(); } } }
9231dcf689709797b07bb9c2cdd75c0f311155df
757
java
Java
yoo-master-dc2492330d5d46b48f1ceca891e0f9f7e1593fee/module/core/message/src/main/java/com/taobao/api/security/SecretData.java
wangsikai/learn
af85f7c7db5c38b5009ebdfb8c8985032eca565c
[ "Apache-2.0" ]
1
2019-01-20T06:19:53.000Z
2019-01-20T06:19:53.000Z
yoo-master-dc2492330d5d46b48f1ceca891e0f9f7e1593fee/module/core/message/src/main/java/com/taobao/api/security/SecretData.java
wangsikai/learn
af85f7c7db5c38b5009ebdfb8c8985032eca565c
[ "Apache-2.0" ]
null
null
null
yoo-master-dc2492330d5d46b48f1ceca891e0f9f7e1593fee/module/core/message/src/main/java/com/taobao/api/security/SecretData.java
wangsikai/learn
af85f7c7db5c38b5009ebdfb8c8985032eca565c
[ "Apache-2.0" ]
2
2019-01-20T06:19:54.000Z
2021-07-21T14:13:44.000Z
19.921053
65
0.762219
996,005
package com.taobao.api.security; /** * * @author changchun * @since 2016年3月4日 下午4:48:31 */ public class SecretData { private String prefixValue;// 前缀明文数据 private String originalBase64Value;// 原始base64加密之后的密文数据 private Long secretVersion;// 秘钥版本 public String getPrefixValue() { return prefixValue; } public void setPrefixValue(String prefixValue) { this.prefixValue = prefixValue; } public String getOriginalBase64Value() { return originalBase64Value; } public void setOriginalBase64Value(String originalBase64Value) { this.originalBase64Value = originalBase64Value; } public Long getSecretVersion() { return secretVersion; } public void setSecretVersion(Long secretVersion) { this.secretVersion = secretVersion; } }
9231dd995a872533401425c3661757b72e0b3f08
187
java
Java
src/main/java/org/broadinstitute/hellbender/utils/smithwaterman/SmithWatermanAlignment.java
falcon-computing/gatk4
eff34c69e0ee1557396c5ad7f94128a08c0ab2f3
[ "BSD-3-Clause" ]
1,273
2015-10-13T18:11:50.000Z
2022-03-28T09:25:13.000Z
src/main/java/org/broadinstitute/hellbender/utils/smithwaterman/SmithWatermanAlignment.java
falcon-computing/gatk4
eff34c69e0ee1557396c5ad7f94128a08c0ab2f3
[ "BSD-3-Clause" ]
6,471
2015-10-08T02:31:06.000Z
2022-03-31T17:55:25.000Z
src/main/java/org/broadinstitute/hellbender/utils/smithwaterman/SmithWatermanAlignment.java
falcon-computing/gatk4
eff34c69e0ee1557396c5ad7f94128a08c0ab2f3
[ "BSD-3-Clause" ]
598
2015-10-14T19:16:14.000Z
2022-03-29T10:03:03.000Z
20.777778
58
0.791444
996,006
package org.broadinstitute.hellbender.utils.smithwaterman; import htsjdk.samtools.Cigar; public interface SmithWatermanAlignment { Cigar getCigar(); int getAlignmentOffset(); }
9231de1c1c3b6d2f31229aa1e1c1d9c29f535fd4
828
java
Java
src/main/java/net/worldline/training/angular/AngularClientResourcesConstants.java
ffacon/BookCat
e56ff6d6e0951885fc8a392aaaa74588f872bc6b
[ "Apache-2.0" ]
2
2015-03-03T11:50:57.000Z
2015-08-13T03:48:10.000Z
src/main/java/net/worldline/training/angular/AngularClientResourcesConstants.java
ffacon/BookCat
e56ff6d6e0951885fc8a392aaaa74588f872bc6b
[ "Apache-2.0" ]
null
null
null
src/main/java/net/worldline/training/angular/AngularClientResourcesConstants.java
ffacon/BookCat
e56ff6d6e0951885fc8a392aaaa74588f872bc6b
[ "Apache-2.0" ]
null
null
null
31.846154
75
0.753623
996,007
// // Copyright 2015 Worldline // // 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 net.worldline.training.angular; public interface AngularClientResourcesConstants { public static final String JAVASCRIPT_STACK_ANGULAR = "js-angular"; public static final String CSS_STACK_ANGULAR = "css-angular"; }
9231dee8c4fbee61e7d0c8e84f6a759e9c7b3ca1
890
java
Java
src/main/java/com/sharelinks/ShareLinksConfig.java
kashmoneygt/share-media
a33e1df447f85b8c5dd920c747a549669a716bac
[ "BSD-2-Clause" ]
null
null
null
src/main/java/com/sharelinks/ShareLinksConfig.java
kashmoneygt/share-media
a33e1df447f85b8c5dd920c747a549669a716bac
[ "BSD-2-Clause" ]
null
null
null
src/main/java/com/sharelinks/ShareLinksConfig.java
kashmoneygt/share-media
a33e1df447f85b8c5dd920c747a549669a716bac
[ "BSD-2-Clause" ]
null
null
null
29.666667
86
0.665169
996,008
package com.sharelinks; import com.sharelinks.models.spotify.SpotifyLinkType; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @ConfigGroup("sharelinks") public interface ShareLinksConfig extends Config { @ConfigItem( position = 0, keyName = "enableSpotifyLinks", name = "Enable Spotify Links", description = "Configures whether sharing Spotify links is enabled" ) default boolean enableSpotifyLinks() { return true; } @ConfigItem( position = 1, keyName = "spotifyLinkType", name = "Spotify Links Type", description = "Configures whether to open Spotify links in Web or Desktop" ) default SpotifyLinkType spotifyLinkType() { return SpotifyLinkType.WEB; } }
9231def6125bed2739e185e6a6b38e42503bd906
2,582
java
Java
TestAkariViewer.java
Harper-Wu/Akari
b1878db5fd221b4cacedc57cd06e72016bd3d28f
[ "MIT" ]
null
null
null
TestAkariViewer.java
Harper-Wu/Akari
b1878db5fd221b4cacedc57cd06e72016bd3d28f
[ "MIT" ]
null
null
null
TestAkariViewer.java
Harper-Wu/Akari
b1878db5fd221b4cacedc57cd06e72016bd3d28f
[ "MIT" ]
null
null
null
35.369863
69
0.544539
996,009
import static org.junit.Assert.*; import org.junit.Test; /** * TestAkariViewer tests the class AkariViewer. * * @author Lyndon While * @version 2021 v1 */ public class TestAkariViewer { String f7 = "Puzzles/p7-e7.txt"; AkariViewer av7 = new AkariViewer(); @Test public void testAkariViewer() { assertTrue ("", av7 != null); assertTrue ("", av7.getCanvas() != null); Akari a7 = av7.getPuzzle(); assertTrue("", a7 != null); assertTrue("", a7.getFilename().equals(f7)); assertEquals("", 7, a7.getSize()); for (int c : new int[] {0,1,2,4,5,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(0,c)); assertEquals("", Space.BLACK, a7.getBoard(0,3)); for (int c : new int[] {0,1,2,3,5,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(1,c)); assertEquals("", Space.FOUR, a7.getBoard(1,4)); for (int c : new int[] {0,2,4,5,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(2,c)); for (int c : new int[] {1,3}) assertEquals(c + "", Space.BLACK, a7.getBoard(2,c)); assertEquals("", Space.ZERO, a7.getBoard(3,0)); assertEquals("", Space.EMPTY, a7.getBoard(3,1)); assertEquals("", Space.ONE, a7.getBoard(3,2)); assertEquals("", Space.BLACK, a7.getBoard(3,3)); assertEquals("", Space.TWO, a7.getBoard(3,4)); assertEquals("", Space.EMPTY, a7.getBoard(3,5)); assertEquals("", Space.ONE, a7.getBoard(3,6)); for (int c : new int[] {0,1,2,4,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(4,c)); for (int c : new int[] {3,5}) assertEquals(c + "", Space.BLACK, a7.getBoard(4,c)); for (int c : new int[] {0,1,3,4,5,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(5,c)); assertEquals("", Space.TWO, a7.getBoard(5,2)); for (int c : new int[] {0,1,2,4,5,6}) assertEquals(c + "", Space.EMPTY, a7.getBoard(6,c)); assertEquals("", Space.BLACK, a7.getBoard(6,3)); } @Test public void testDisplayAndMouseMethods() { assert false : "display and mouse methods are not tested"; } @Test public void testleftClick() { testAkariViewer(); av7.leftClick(0,1); assertEquals("", Space.BULB, av7.getPuzzle().getBoard(0,1)); av7.leftClick(0,1); testAkariViewer(); av7.leftClick(2,1); testAkariViewer(); av7.leftClick(7,1); testAkariViewer(); } }
9231df71bd8ee83842a84c1642c39b8270295c06
25,356
java
Java
src/main/java/edu/drexel/se577/grouptwo/viz/Routing.java
Francisobiagwu/Dataset-Visualization-Software
d9c6df38f8aa28bdfa23e860aececedabd408deb
[ "MIT" ]
null
null
null
src/main/java/edu/drexel/se577/grouptwo/viz/Routing.java
Francisobiagwu/Dataset-Visualization-Software
d9c6df38f8aa28bdfa23e860aececedabd408deb
[ "MIT" ]
null
null
null
src/main/java/edu/drexel/se577/grouptwo/viz/Routing.java
Francisobiagwu/Dataset-Visualization-Software
d9c6df38f8aa28bdfa23e860aececedabd408deb
[ "MIT" ]
null
null
null
41.567213
131
0.593903
996,010
package edu.drexel.se577.grouptwo.viz; import java.net.URI; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; import java.util.stream.StreamSupport; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonIOException; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import edu.drexel.se577.grouptwo.viz.dataset.Attribute; import edu.drexel.se577.grouptwo.viz.dataset.Definition; import edu.drexel.se577.grouptwo.viz.dataset.Sample; import edu.drexel.se577.grouptwo.viz.dataset.Value; import edu.drexel.se577.grouptwo.viz.filetypes.FileContents; import edu.drexel.se577.grouptwo.viz.filetypes.FileInputHandler; import edu.drexel.se577.grouptwo.viz.storage.Dataset; import edu.drexel.se577.grouptwo.viz.visualization.Visualization; import spark.Route; import spark.Spark; public abstract class Routing { private static final String INTEGER = "integer"; private static final String FLOAT = "floating-point"; private static final String ENUMERATED = "enumerated"; private static final String ARBITRARY = "arbitrary"; private static final URI DATASETS_PATH = URI.create("/api/datasets/"); private static final URI VISUALIZATION_PATH = URI.create("/api/visualizations/"); private static final String STYLE_SERIES = "series"; private static final String STYLE_HISTOGRAM = "histogram"; private static final String STYLE_SCATTERPLOT = "scatterplot"; private static final Gson gson = new GsonBuilder() .registerTypeAdapter(Visualization.class,new VisualizationGsonAdapter()) .registerTypeAdapter(Definition.class, new DefinitionGsonAdapter()) .registerTypeAdapter(Attribute.class, new AttributeGsonAdapter()) .registerTypeAdapter(Sample.class, new SampleGsonAdapter()) .registerTypeAdapter(Value.class, new ValueGsonAdapter()) .create(); abstract Collection<? extends Dataset> listDatasets(); abstract Optional<? extends Dataset> getDataset(String id); abstract Optional<? extends Visualization> getVisualization(String id); abstract URI storeVisualization(Visualization def); abstract URI storeDataset(Definition def); abstract Dataset createDataset(Definition def); abstract Optional<? extends FileInputHandler> getFileHandler(String contentType); abstract Collection<? extends Visualization> listVisualizations(); final String allDatasets() { Collection<? extends Dataset> datasets = listDatasets(); Ref[] refs = datasets.stream() .map(dataset -> { Ref ref = new Ref(); URI id = URI.create(dataset.getId()); ref.name = dataset.getName(); ref.location = DATASETS_PATH.resolve(id); return ref; }).toArray(Ref[]::new); return gson.toJson(refs); } final String selectDataset(String id) { return getDataset(id).map(Routing::serializeDataset).orElse(null); }; final static String serializeDataset(Dataset dataset) { DatasetRep rep = new DatasetRep(); rep.definition = dataset.getDefinition(); rep.samples = dataset.getSamples(); return gson.toJson(rep); } final String appendSample(String id, String body) { final Sample sample = gson.fromJson(body, Sample.class); return getDataset(id).map(dataset -> { dataset.addSample(sample); return serializeDataset(dataset); }).orElse(null); } final Visualization selectVisualization(String id) { return getVisualization(id).orElseThrow(() -> new RuntimeException("No such Visualization")); } final String allVisualizations() { Ref[] refs = listVisualizations().stream().map(vis -> { Ref ref = new Ref(); URI id = URI.create(vis.getId()); ref.name = vis.getName(); ref.location = VISUALIZATION_PATH.resolve(id); return ref; }).toArray(Ref[]::new); return gson.toJson(refs); } final URI instanciateVisualization(String body) { try { Visualization viz = gson.fromJson(body, Visualization.class); return VISUALIZATION_PATH.resolve(storeVisualization(viz)); } catch (RuntimeException re) { System.err.println(body); System.err.println(re.toString()); Stream.of(re.getStackTrace()) .map(Object::toString) .reduce((a,b) -> a + "\n" + b) .ifPresent(System.err::println); throw re; } } final URI instanciateDefinition(String body) { Definition def = gson.fromJson(body, Definition.class); return DATASETS_PATH.resolve(storeDataset(def)); } final URI processFile(String contentType, String name, byte[] body) { return getFileHandler(contentType).map(handler -> { FileContents contents = handler.parseFile(name, body) .orElseThrow(() -> new RuntimeException("Parsing Failed")); final Dataset created = createDataset(contents.getDefinition()); contents.getSamples().stream().forEach(sample -> { created.addSample(sample); }); URI id = URI.create(created.getId()); return DATASETS_PATH.resolve(id); }).orElseThrow(() -> new RuntimeException("Bad File Type")); } static class DatasetRep { Definition definition; List<Sample> samples; // This is probably serialize only } private static final class VisualizationGsonAdapter implements JsonDeserializer<Visualization>, JsonSerializer<Visualization> { private static class ElementCreator implements Visualization.Visitor { Optional<JsonObject> object = Optional.empty(); private final JsonSerializationContext context; ElementCreator(JsonSerializationContext context) { this.context = context; } @Override public void visit(Visualization.Histogram hist) { JsonObject obj = new JsonObject(); final JsonArray attributes = new JsonArray(); final JsonArray data = new JsonArray(); hist.data().stream() .forEach(point -> { JsonObject pt = new JsonObject(); pt.add("bin", context.serialize(point.bin, Value.class)); pt.addProperty("count", Long.valueOf(point.count)); data.add(pt); }); obj.add("attributes", attributes); obj.add("data", data); obj.addProperty("name", hist.getName()); obj.addProperty("style", STYLE_HISTOGRAM); obj.addProperty("dataset", DATASETS_PATH.resolve( URI.create(hist.getId())).toString()); attributes.add(context.serialize(hist.attribute,Attribute.class)); object = Optional.of(obj); } @Override public void visit(Visualization.Scatter scatter) { JsonObject obj = new JsonObject(); obj.addProperty("name", scatter.getName()); obj.addProperty("style", STYLE_SCATTERPLOT); obj.addProperty("dataset", DATASETS_PATH.resolve( URI.create(scatter.getId())).toString()); final JsonArray attributes = new JsonArray(); final JsonArray data = new JsonArray(); attributes.add(context.serialize(scatter.xAxis, Attribute.class)); attributes.add(context.serialize(scatter.yAxis, Attribute.class)); obj.add("attributes", attributes); scatter.data().stream() .forEach(point -> { JsonObject pt = new JsonObject(); pt.add("x", context.serialize(point.x, Value.class)); pt.add("y", context.serialize(point.y, Value.class)); data.add(pt); }); obj.add("data", data); object = Optional.of(obj); } @Override public void visit(Visualization.Series series) { JsonObject obj = new JsonObject(); obj.addProperty("name", series.getName()); obj.addProperty("style", STYLE_SERIES); obj.addProperty("dataset", DATASETS_PATH.resolve( URI.create(series.getId())).toString()); final JsonArray attributes = new JsonArray(); final JsonArray data = new JsonArray(); attributes.add(context.serialize(series.attribute, Attribute.class)); obj.add("attributes",attributes); series.data().stream() .forEach(point -> { data.add(context.serialize(point, Value.class)); }); obj.add("data", data); object = Optional.of(obj); } } @Override public JsonElement serialize( Visualization elem, java.lang.reflect.Type typeOfT, final JsonSerializationContext context) { ElementCreator creator = new ElementCreator(context); elem.accept(creator); return creator.object .orElseThrow(() -> new RuntimeException("Unknown Visualization Type")); } @Override public Visualization deserialize( JsonElement elem, java.lang.reflect.Type typeOfT, final JsonDeserializationContext context) { final JsonObject obj = elem.getAsJsonObject(); final String name = obj.getAsJsonPrimitive("name").getAsString(); final String style = obj.getAsJsonPrimitive("style").getAsString(); final URI datasetURI = DATASETS_PATH.relativize(URI.create( obj.getAsJsonPrimitive("dataset").getAsString())); Iterator<JsonElement> attrIterator = obj.getAsJsonArray("attributes").iterator(); Iterable<JsonElement> attrIterable = () -> attrIterator; Attribute[] attributes = StreamSupport .stream(attrIterable.spliterator(), false) .map(e -> context.deserialize(e, Attribute.class)) .toArray(Attribute[]::new); switch (style) { case STYLE_SERIES: return new StubVisualization.Series( name, datasetURI.toString(), StubVisualization.asArithmetic(attributes[0])); case STYLE_HISTOGRAM: return new StubVisualization.Histogram( name, datasetURI.toString(), StubVisualization.asCountable(attributes[0])); case STYLE_SCATTERPLOT: return new StubVisualization.Scatter( name, datasetURI.toString(), StubVisualization.asArithmetic(attributes[0]), StubVisualization.asArithmetic(attributes[1])); } throw new RuntimeException("Unknown Visualization Type"); } } private static final class AttributeGsonAdapter implements JsonSerializer<Attribute>, JsonDeserializer<Attribute> { private static final class Visitor implements Attribute.Visitor { private final JsonObject obj; Visitor(JsonObject obj) { this.obj = obj; } @Override public void visit(Attribute.Mapping mapping) { throw new JsonIOException("Serializing mapping attributes not currently supported"); } @Override public void visit(Attribute.Int attr) { JsonObject bounds = new JsonObject(); obj.addProperty("type", INTEGER); bounds.addProperty("max", Integer.valueOf(attr.max)); bounds.addProperty("min", Integer.valueOf(attr.min)); obj.add("bounds", bounds); } @Override public void visit(Attribute.FloatingPoint attr) { JsonObject bounds = new JsonObject(); obj.addProperty("type", FLOAT); bounds.addProperty("max", Double.valueOf(attr.max)); bounds.addProperty("min", Double.valueOf(attr.min)); obj.add("bounds", bounds); } @Override public void visit(Attribute.Enumerated attr) { JsonArray choices = new JsonArray(); obj.addProperty("type", ENUMERATED); attr.choices.stream().forEach(choice -> choices.add(choice)); obj.add("values", choices); } @Override public void visit(Attribute.Arbitrary attr) { obj.addProperty("type", ARBITRARY); } } @Override public JsonElement serialize(final Attribute attribute, java.lang.reflect.Type typeOfT, final JsonSerializationContext context) { final JsonObject obj = new JsonObject(); obj.addProperty("name", attribute.name()); attribute.accept(new Visitor(obj)); return obj; } @Override public Attribute deserialize(JsonElement elem, java.lang.reflect.Type typeOfT, final JsonDeserializationContext context) { final JsonObject obj = elem.getAsJsonObject(); final String name = obj.getAsJsonPrimitive("name").getAsString(); final String type = obj.getAsJsonPrimitive("type").getAsString(); switch (type) { case INTEGER: return emitInteger(name, obj); case FLOAT: return emitFloat(name, obj); case ENUMERATED: return emitEnum(name, obj); case ARBITRARY: return emitArb(name, obj); } throw new JsonParseException("Unknown Attribute Type"); } private static Attribute.Int emitInteger(String name, JsonObject obj) { JsonObject bounds = obj.getAsJsonObject("bounds"); int max = bounds.getAsJsonPrimitive("max").getAsInt(); int min = bounds.getAsJsonPrimitive("min").getAsInt(); return new Attribute.Int(name, max, min); } private static Attribute.FloatingPoint emitFloat(String name, JsonObject obj) { JsonObject bounds = obj.getAsJsonObject("bounds"); double max = bounds.getAsJsonPrimitive("max").getAsDouble(); double min = bounds.getAsJsonPrimitive("min").getAsDouble(); return new Attribute.FloatingPoint(name, max, min); } private static Attribute.Enumerated emitEnum(String name, JsonObject obj) { final Set<String> valueSet = new HashSet<>(); JsonArray values = obj.getAsJsonArray("values"); values.iterator().forEachRemaining(elem -> { valueSet.add(elem.getAsJsonPrimitive().getAsString()); }); return new Attribute.Enumerated(name, valueSet); } private static Attribute.Arbitrary emitArb(String name, JsonObject obj) { return new Attribute.Arbitrary(name); } } private static final class DefinitionGsonAdapter implements JsonSerializer<Definition>, JsonDeserializer<Definition> { @Override public JsonElement serialize(final Definition definition, java.lang.reflect.Type typeOfT, final JsonSerializationContext context) { final JsonObject obj = new JsonObject(); final JsonArray attributes = new JsonArray(); obj.addProperty("name", definition.name); definition.getKeys().stream().forEach(name -> { definition.get(name).ifPresent(attr -> { attributes.add(context.serialize(attr, Attribute.class)); }); }); obj.add("attributes", attributes); return obj; } @Override public Definition deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) { if (!json.isJsonObject()) throw new JsonParseException("Sample not formatted correctly"); final JsonObject asObject = json.getAsJsonObject(); final Definition definition = new Definition(asObject.getAsJsonPrimitive("name").getAsString()); JsonArray attributes = asObject.getAsJsonArray("attributes"); attributes.iterator().forEachRemaining(elem -> { definition.put(context.deserialize(elem, Attribute.class)); }); return definition; } } private static final class SampleGsonAdapter implements JsonSerializer<Sample>, JsonDeserializer<Sample> { @Override public JsonElement serialize(final Sample sample, java.lang.reflect.Type typeOfT, final JsonSerializationContext context) { final JsonObject obj = new JsonObject(); sample.getKeys().stream().forEach(name -> { sample.get(name).ifPresent(value -> { obj.add(name, context.serialize(value, Value.class)); }); }); return obj; } @Override public Sample deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) { final Sample sample = new Sample(); if (!json.isJsonObject()) throw new JsonParseException("Sample not formatted correctly"); final JsonObject asObject = json.getAsJsonObject(); asObject.keySet().stream().forEach(key -> { sample.put(key, context.deserialize(asObject.get(key), Value.class)); }); return sample; } } private static final class ValueGsonAdapter implements JsonDeserializer<Value>, JsonSerializer<Value> { static class ValueSerializer implements Value.Visitor { Optional<? extends JsonElement> elem = Optional.empty(); @Override public void visit(Value.Int value) { JsonObject obj = new JsonObject(); obj.addProperty("type", INTEGER); obj.addProperty("value", Integer.valueOf(value.value)); elem = Optional.of(obj); } @Override public void visit(Value.FloatingPoint value) { JsonObject obj = new JsonObject(); obj.addProperty("type", FLOAT); obj.addProperty("value", Double.valueOf(value.value)); elem = Optional.of(obj); } @Override public void visit(Value.Enumerated value) { JsonObject obj = new JsonObject(); obj.addProperty("type", ENUMERATED); obj.addProperty("value", value.value); elem = Optional.of(obj); } @Override public void visit(Value.Arbitrary value) { JsonObject obj = new JsonObject(); obj.addProperty("type", ARBITRARY); obj.addProperty("value", value.value); elem = Optional.of(obj); } @Override public void visit(Value.Mapping mapping) { // NOOP for this version } } @Override public JsonElement serialize(Value value, java.lang.reflect.Type typeOfT, JsonSerializationContext context) { ValueSerializer ser = new ValueSerializer(); value.accept(ser); return ser.elem.orElse(null); } @Override public Value deserialize(JsonElement json, java.lang.reflect.Type typeOfT, JsonDeserializationContext context) { if (!json.isJsonObject()) throw new JsonParseException("Sample value formatted incorrectly"); JsonObject asObject = json.getAsJsonObject(); if (!asObject.has("type")) throw new JsonParseException("Missing type attribute"); String type = asObject.getAsJsonPrimitive("type").getAsString(); switch (type) { case INTEGER: return new Value.Int(asObject.getAsJsonPrimitive("value").getAsInt()); case FLOAT: return new Value.FloatingPoint(asObject.getAsJsonPrimitive("value").getAsDouble()); case ENUMERATED: return new Value.Enumerated(asObject.getAsJsonPrimitive("value").getAsString()); case ARBITRARY: return new Value.Arbitrary(asObject.getAsJsonPrimitive("value").getAsString()); default: throw new JsonParseException("Unknown type attribute"); } } } static class Ref { String name; URI location; } private static Route getDefinitions = (request, reply) -> { reply.type("application/json"); return getInstance().allDatasets(); }; private static Route postVisualization = (request, reply) -> { URI location = getInstance().instanciateVisualization(request.body()); reply.header("Location", location.toString()); reply.status(201); return ""; }; private static Route postDefinition = (request, reply) -> { Optional<String> contentType = Optional.ofNullable(request.headers("Content-Type")); boolean isJson = contentType.map(content -> content.startsWith("application/json")).orElse(false); if (isJson) { URI location = getInstance().instanciateDefinition(request.body()); reply.header("Location", location.toString()); reply.status(201); return ""; } else if (contentType.isPresent()) { String name = Optional.ofNullable(request.queryParams("name")) .orElseThrow(() -> new RuntimeException("Must specify dataset name for file input")); URI location = getInstance().processFile(contentType.get(), name, request.bodyAsBytes()); reply.header("Location", location.toString()); reply.status(201); return ""; } else { reply.status(400); return "Unrecognized content type"; } }; private static Route getDataset = (request, reply) -> { String id = request.params(":id"); reply.type("application/json"); return getInstance().selectDataset(id); }; private static Route postSample = (request, reply) -> { String id = request.params(":id"); return getInstance().appendSample(id, request.body()); }; private static Route getVisualizations = (request, reply) -> { return getInstance().allVisualizations(); }; private static Route getJsonVisualization = (request, reply) -> { String id = request.params(":id"); Visualization viz = getInstance().selectVisualization(id); return gson.toJson(viz, Visualization.class); }; private static Route getOtherVisualization = (request, reply) -> { String id = request.params(":id"); Visualization viz = getInstance().selectVisualization(id); Visualization.Image image = viz.render(); reply.type(image.mimeType()); return image.data(); }; private static Routing instance = null; static Routing getInstance() { // instance = Optional.ofNullable(instance).orElseGet(DemoRouting::new); instance = Optional.ofNullable(instance).orElseGet(RealRouting::new); return instance; } public static void main(String[] args) { Spark.staticFileLocation("/public"); Spark.path("/api", () -> { Spark.path("/datasets", () -> { Spark.get("", Routing.getDefinitions); Spark.post("", Routing.postDefinition); Spark.get("/:id", Routing.getDataset); Spark.post("/:id", Routing.postSample); }); Spark.path("/visualizations",() -> { Spark.get("", Routing.getVisualizations); Spark.post("", Routing.postVisualization); Spark.get("/:id","application/json",Routing.getJsonVisualization); Spark.get("/:id",Routing.getOtherVisualization); }); }); Spark.init(); } }
9231dfd7ed23950bc5124eb47e85bd829dda7c4d
2,189
java
Java
streams/src/main/java/org/apache/kafka/streams/state/internals/WrappingStoreProvider.java
nicolasguyomar/kafka
9672fef8e0f772cbb4abd3eec78ba033573e2275
[ "Apache-2.0" ]
null
null
null
streams/src/main/java/org/apache/kafka/streams/state/internals/WrappingStoreProvider.java
nicolasguyomar/kafka
9672fef8e0f772cbb4abd3eec78ba033573e2275
[ "Apache-2.0" ]
null
null
null
streams/src/main/java/org/apache/kafka/streams/state/internals/WrappingStoreProvider.java
nicolasguyomar/kafka
9672fef8e0f772cbb4abd3eec78ba033573e2275
[ "Apache-2.0" ]
1
2018-03-06T17:32:32.000Z
2018-03-06T17:32:32.000Z
41.301887
127
0.725902
996,011
/* * 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.kafka.streams.state.internals; import org.apache.kafka.streams.errors.InvalidStateStoreException; import org.apache.kafka.streams.state.QueryableStoreType; import java.util.ArrayList; import java.util.List; /** * Provides a wrapper over multiple underlying {@link StateStoreProvider}s */ public class WrappingStoreProvider implements StateStoreProvider { private final List<StreamThreadStateStoreProvider> storeProviders; private final boolean includeStaleStores; WrappingStoreProvider(final List<StreamThreadStateStoreProvider> storeProviders, final boolean includeStaleStores) { this.storeProviders = storeProviders; this.includeStaleStores = includeStaleStores; } @Override public <T> List<T> stores(final String storeName, final QueryableStoreType<T> queryableStoreType) { final List<T> allStores = new ArrayList<>(); for (final StreamThreadStateStoreProvider provider : storeProviders) { final List<T> stores = provider.stores(storeName, queryableStoreType, includeStaleStores); allStores.addAll(stores); } if (allStores.isEmpty()) { throw new InvalidStateStoreException("The state store, " + storeName + ", may have migrated to another instance."); } return allStores; } }
9231dffc1be2843a8903f88d530b9773d7f86ddd
149
java
Java
PatientPublisher/src/sa/assignment1/patientpublisher/PatientPublish.java
tenusha/sa-assignment-1
dd3a95a6050263743d04869d52f53dc4fd340652
[ "Apache-2.0" ]
null
null
null
PatientPublisher/src/sa/assignment1/patientpublisher/PatientPublish.java
tenusha/sa-assignment-1
dd3a95a6050263743d04869d52f53dc4fd340652
[ "Apache-2.0" ]
null
null
null
PatientPublisher/src/sa/assignment1/patientpublisher/PatientPublish.java
tenusha/sa-assignment-1
dd3a95a6050263743d04869d52f53dc4fd340652
[ "Apache-2.0" ]
1
2021-04-04T13:45:51.000Z
2021-04-04T13:45:51.000Z
12.416667
40
0.744966
996,012
package sa.assignment1.patientpublisher; public interface PatientPublish { public void add(); public void get(); public void deleteById(); }
9231e05c6da29227f70da1fa90471b09632b9b87
1,950
java
Java
DMOPC/dmopc20c2p1.java
crackersamdjam/DMOJ-Solutions
97992566595e2c7bf41b5da9217d8ef61bdd1d71
[ "MIT" ]
null
null
null
DMOPC/dmopc20c2p1.java
crackersamdjam/DMOJ-Solutions
97992566595e2c7bf41b5da9217d8ef61bdd1d71
[ "MIT" ]
null
null
null
DMOPC/dmopc20c2p1.java
crackersamdjam/DMOJ-Solutions
97992566595e2c7bf41b5da9217d8ef61bdd1d71
[ "MIT" ]
null
null
null
29.104478
85
0.458462
996,013
import java.io.*; import java.util.*; public class test { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st; public static void main (String [] args) throws IOException{ int n = nextInt(); String inst = nextLine(); char[][] grid = new char[2*n + 1][n]; for(int i = 0;i < 2*n + 1;i++){ for(int j = 0;j < n;j++){ grid[i][j] = '.'; } } int lowest = 0; int highest = 9999; int y = n; for(int i = 0;i < inst.length();i++){ if(inst.charAt(i) == '>'){ grid[y][i] = '_'; if(y > lowest)lowest = y; if(y < highest)highest = y; }else if(inst.charAt(i) == 'v'){ y++; grid[y][i] = '\\'; if(y > lowest)lowest = y; if(y < highest)highest = y; }else if(inst.charAt(i) == '^'){ grid[y][i] = '/'; if(y > lowest)lowest = y; if(y < highest)highest = y; y--; } } for(int i = highest; i <= lowest;i++){ for(int j = 0;j < n;j++){ System.out.print(grid[i][j]); } System.out.println(); } } static String next() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(in.readLine().trim()); return st.nextToken(); } static int nextInt() throws IOException { return Integer.parseInt(next()); } static long nextLong() throws IOException { return Long.parseLong(next()); } static double nextDouble() throws IOException { return Double.parseDouble(next()); } static String nextLine() throws IOException { return in.readLine().trim(); } }
9231e0cbe54776f20d28564d6142fa5a7201b414
763
java
Java
src/main/java/org/opendatakit/aggregate/submission/SubmissionVisitor.java
ukanga/aggregate
e39199464e6c16f8e6bd9af177c6495334b9eec9
[ "Apache-2.0" ]
60
2015-09-18T04:29:50.000Z
2020-04-10T17:17:58.000Z
src/main/java/org/opendatakit/aggregate/submission/SubmissionVisitor.java
ukanga/aggregate
e39199464e6c16f8e6bd9af177c6495334b9eec9
[ "Apache-2.0" ]
408
2016-04-06T01:14:13.000Z
2020-03-16T13:34:58.000Z
src/main/java/org/opendatakit/aggregate/submission/SubmissionVisitor.java
ukanga/aggregate
e39199464e6c16f8e6bd9af177c6495334b9eec9
[ "Apache-2.0" ]
228
2015-07-05T21:34:49.000Z
2020-04-06T15:56:05.000Z
34.681818
81
0.737877
996,014
/* * Copyright (C) 2011 University of Washington * * 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.opendatakit.aggregate.submission; public interface SubmissionVisitor { boolean traverse(SubmissionElement element); }
9231e11476ef739082d56731fe3326b2b32f61e2
1,009
java
Java
backend/src/main/java/com/teapink/joke/backend/MyEndpoint.java
DevipriyaSarkar/BuildItBigger
340114eccf04947cc4d2ede59d4735c9805e8b36
[ "MIT" ]
null
null
null
backend/src/main/java/com/teapink/joke/backend/MyEndpoint.java
DevipriyaSarkar/BuildItBigger
340114eccf04947cc4d2ede59d4735c9805e8b36
[ "MIT" ]
null
null
null
backend/src/main/java/com/teapink/joke/backend/MyEndpoint.java
DevipriyaSarkar/BuildItBigger
340114eccf04947cc4d2ede59d4735c9805e8b36
[ "MIT" ]
null
null
null
27.27027
95
0.712587
996,015
/* For step-by-step instructions on connecting your Android application to this backend module, see "App Engine Java Endpoints Module" template documentation at https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints */ package com.teapink.joke.backend; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import javax.inject.Named; /** An endpoint class we are exposing */ @Api( name = "jokeApi", version = "v1", namespace = @ApiNamespace( ownerDomain = "backend.joke.teapink.com", ownerName = "backend.joke.teapink.com", packagePath="" ) ) public class MyEndpoint { /** A simple endpoint method that takes a joke and returns it back */ @ApiMethod(name = "tellJoke") public MyBean tellJoke(@Named("joke") String joke) { MyBean response = new MyBean(); response.setData(joke); return response; } }
9231e148cf4e7c1de6f265f2116ff5c83944a14e
8,898
java
Java
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/UnitTest.java
ftc14564/SkyStone-master
1df1914eaa5386e5a3995a903929ae3dcb465ce4
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/UnitTest.java
ftc14564/SkyStone-master
1df1914eaa5386e5a3995a903929ae3dcb465ce4
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/UnitTest.java
ftc14564/SkyStone-master
1df1914eaa5386e5a3995a903929ae3dcb465ce4
[ "MIT" ]
1
2020-12-23T15:35:38.000Z
2020-12-23T15:35:38.000Z
43.617647
148
0.622837
996,016
package org.firstinspires.ftc.teamcode; import com.qualcomm.hardware.bosch.BNO055IMU; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DcMotorSimple; import com.qualcomm.robotcore.hardware.Servo; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import java.util.Locale; import static com.qualcomm.robotcore.hardware.DcMotor.RunMode.RUN_WITHOUT_ENCODER; import static com.qualcomm.robotcore.hardware.DcMotor.RunMode.STOP_AND_RESET_ENCODER; import org.opencv.android.BaseLoaderCallback; import org.opencv.android.CameraBridgeViewBase.CvCameraViewFrame; import org.opencv.android.LoaderCallbackInterface; import org.opencv.android.OpenCVLoader; import org.opencv.core.Core; import org.opencv.core.CvType; import org.opencv.core.Mat; import org.opencv.core.MatOfPoint; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.android.CameraBridgeViewBase; import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener2; import org.opencv.imgproc.Imgproc; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.View.OnTouchListener; import android.view.SurfaceView; @TeleOp (name = "UnitTest") public class UnitTest extends Autonomous2020 { //final double TICKS_PER_INCH_STRAIGHT = 89.1; //final double TICKS_PER_INCH_STRAFE = 115.00; //orignal ticks per inch strafe was 126 @Override public void runOpMode() { initFn(); int relativeLayoutId = hardwareMap.appContext.getResources().getIdentifier("RelativeLayout", "id", hardwareMap.appContext.getPackageName()); final View relativeLayout = ((Activity) hardwareMap.appContext).findViewById(relativeLayoutId); waitForStart(); // run until the end of the match (driver presses STOP) while (opModeIsActive() && !isStopRequested()) { // telemetry.addData(" rf", distanceSensor_rf.getDistance(DistanceUnit.CM)); // telemetry.addData(" rb", distanceSensor_rb.getDistance(DistanceUnit.CM)); telemetry.addData("rf:", motorRightFront.getCurrentPosition()); telemetry.addData("lf:", motorLeftFront.getCurrentPosition()); telemetry.addData("rb:", motorRightBack.getCurrentPosition()); telemetry.addData("lb:", motorLeftBack.getCurrentPosition()); telemetry.update(); if (gamepad2.x) { // armExtended(10); grabCollection(); straight_inch(1, 1, 10); closeGrabber(); } if (gamepad1.right_bumper){ // armExtended(5); } if (gamepad1.x) { liftInch(5.5); } if (gamepad1.y) { liftInch(11); } if(gamepad2.right_bumper){ gyroTurnREV(1, 45); } if(gamepad2.left_bumper){ gyroTurnREV(1, -45); } if(gamepad2.dpad_up){ gyroTurnREV(1, 90); } if(gamepad2.dpad_down){ gyroTurnREV(1, -90); } if(gamepad2.dpad_right){ makeParallelRight(4); } if(gamepad2.dpad_left) { makeParallelLeft(27); } if(gamepad1.dpad_up){ EncoderMoveDist(1,10,false); } if(gamepad1.dpad_down){ EncoderMoveDist(1,-10,false); } if(gamepad1.dpad_right){ EncoderMoveDist(1,20,true); } if(gamepad1.dpad_left){ EncoderMoveDist(1,-20,true); } // if(gamepad1.dpad_down){ // strafe_inch(0.8,1,12); // telemetry.addData("Encoder value LB", motorLeftBack.getCurrentPosition()); // telemetry.addData("Encoder value RB", motorRightBack.getCurrentPosition()); // telemetry.addData("Encoder value LF", motorLeftFront.getCurrentPosition()); // telemetry.addData("Encoder value RF", motorRightFront.getCurrentPosition()); // System.out.println( "LEFT BACK" + motorLeftBack.getCurrentPosition()); // System.out.println("RIGHT BACK" + motorRightBack.getCurrentPosition()); // System.out.println("RIGHT FRONT" + motorRightFront.getCurrentPosition()); // System.out.println("LEFT FRONT" + motorLeftFront.getCurrentPosition()); // } // if(gamepad1.dpad_up){ // strafe_inch(0.8,1,24); // telemetry.addData("Encoder value LB", motorLeftBack.getCurrentPosition()); // telemetry.addData("Encoder value RB", motorRightBack.getCurrentPosition()); // telemetry.addData("Encoder value LF", motorLeftFront.getCurrentPosition()); // telemetry.addData("Encoder value RF", motorRightFront.getCurrentPosition()); // System.out.println( "LEFT BACK" + motorLeftBack.getCurrentPosition()); // System.out.println("RIGHT BACK" + motorRightBack.getCurrentPosition()); // System.out.println("RIGHT FRONT" + motorRightFront.getCurrentPosition()); // System.out.println("LEFT FRONT" + motorLeftFront.getCurrentPosition()); // } // if(gamepad1.dpad_right){ // strafe_inch(0.8,-1,12); // telemetry.addData("Encoder value LB", motorLeftBack.getCurrentPosition()); // telemetry.addData("Encoder value RB", motorRightBack.getCurrentPosition()); // telemetry.addData("Encoder value LF", motorLeftFront.getCurrentPosition()); // telemetry.addData("Encoder value RF", motorRightFront.getCurrentPosition()); // System.out.println( "LEFT BACK" + motorLeftBack.getCurrentPosition()); // System.out.println("RIGHT BACK" + motorRightBack.getCurrentPosition()); // System.out.println("RIGHT FRONT" + motorRightFront.getCurrentPosition()); // System.out.println("LEFT FRONT" + motorLeftFront.getCurrentPosition()); // } // if(gamepad1.dpad_left){ // strafe_inch(0.8,-1,24); // telemetry.addData("Encoder value LB", motorLeftBack.getCurrentPosition()); // telemetry.addData("Encoder value RB", motorRightBack.getCurrentPosition()); // telemetry.addData("Encoder value LF", motorLeftFront.getCurrentPosition()); // telemetry.addData("Encoder value RF", motorRightFront.getCurrentPosition()); // System.out.println( "LEFT BACK" + motorLeftBack.getCurrentPosition()); // System.out.println("RIGHT BACK" + motorRightBack.getCurrentPosition()); // System.out.println("RIGHT FRONT" + motorRightFront.getCurrentPosition()); // System.out.println("LEFT FRONT" + motorLeftFront.getCurrentPosition()); // } // convert the RGB values to HSV values. // multiply by the SCALE_FACTOR. // then cast it back to int (SCALE_FACTOR is a double) Color.RGBToHSV((int) (sensorColor.red() * SCALE_FACTOR), (int) (sensorColor.green() * SCALE_FACTOR), (int) (sensorColor.blue() * SCALE_FACTOR), hsvValues); // send the info back to driver station using telemetry function. telemetry.addData("Distance (cm)", String.format(Locale.US, "%.02f", sensorDistance.getDistance(DistanceUnit.CM))); telemetry.addData("Alpha", sensorColor.alpha()); telemetry.addData("Red ", sensorColor.red()); telemetry.addData("Green", sensorColor.green()); telemetry.addData("Blue ", sensorColor.blue()); telemetry.addData("Hue", hsvValues[0]); // change the background color to match the color detected by the RGB sensor. // pass a reference to the hue, saturation, and value array as an argument // to the HSVToColor method. relativeLayout.post(new Runnable() { public void run() { relativeLayout.setBackgroundColor(Color.HSVToColor(0xff, values)); } }); telemetry.update(); } } }
9231e1914877e49e13980564bb445a6da09e154c
1,527
java
Java
common/src/com/smartbear/collab/common/model/impl/ChangeList.java
SmartBear/idea-collaborator-plugin
3e67fb2d437ffeadf07751b7979f4e35dbc282a2
[ "Apache-2.0" ]
3
2015-05-28T17:11:28.000Z
2016-03-14T06:14:50.000Z
common/src/com/smartbear/collab/common/model/impl/ChangeList.java
SmartBear/idea-collaborator-plugin
3e67fb2d437ffeadf07751b7979f4e35dbc282a2
[ "Apache-2.0" ]
65
2016-02-05T21:31:55.000Z
2020-12-22T20:54:39.000Z
common/src/com/smartbear/collab/common/model/impl/ChangeList.java
SmartBear/idea-collaborator-plugin
3e67fb2d437ffeadf07751b7979f4e35dbc282a2
[ "Apache-2.0" ]
10
2015-06-04T07:51:19.000Z
2018-03-07T08:39:49.000Z
26.789474
127
0.691552
996,017
package com.smartbear.collab.common.model.impl; import java.util.List; /** * Created by mzumbado on 2/26/15. */ public class ChangeList { private ScmToken scmToken; private List<String> scmConnectionParameters; // private String zipName; private CommitInfo commitInfo; private List<Version> versions; public ChangeList(ScmToken scmToken, List<String> scmConnectionParameters, CommitInfo commitInfo, List<Version> versions) { this.scmToken = scmToken; this.scmConnectionParameters = scmConnectionParameters; // this.zipName = zipName; this.commitInfo = commitInfo; this.versions = versions; } // though unused in plugin code, these methods are leveraged by Jackson to make JSON serializations: public ScmToken getScmToken() { return scmToken; } public void setScmToken(ScmToken scmToken) { this.scmToken = scmToken; } public List<String> getScmConnectionParameters() { return scmConnectionParameters; } public void setScmConnectionParameters(List<String> scmConnectionParameters) { this.scmConnectionParameters = scmConnectionParameters; } public CommitInfo getCommitInfo() { return commitInfo; } public void setCommitInfo(CommitInfo commitInfo) { this.commitInfo = commitInfo; } public List<Version> getVersions() { return versions; } public void setVersions(List<Version> versions) { this.versions = versions; } }
9231e1feec2adbce2f6afda98969855810a5113a
1,368
java
Java
slowen/src/main/java/de/tmosebach/slowen/buchhaltung/model/KontoService.java
TMosebach/slowen
8a54340ffc6322b1d2c318d9ca8e4cb904eaf135
[ "MIT" ]
null
null
null
slowen/src/main/java/de/tmosebach/slowen/buchhaltung/model/KontoService.java
TMosebach/slowen
8a54340ffc6322b1d2c318d9ca8e4cb904eaf135
[ "MIT" ]
3
2022-02-09T15:00:30.000Z
2022-02-17T08:07:57.000Z
slowen/src/main/java/de/tmosebach/slowen/buchhaltung/model/KontoService.java
TMosebach/slowen
8a54340ffc6322b1d2c318d9ca8e4cb904eaf135
[ "MIT" ]
null
null
null
22.064516
62
0.763889
996,018
package de.tmosebach.slowen.buchhaltung.model; import java.util.ArrayList; import java.util.List; import java.util.Optional; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class KontoService { public static final String KONTO_KURSGEWINN = "Kursgewinn"; public static final String KONTO_KURSVERLUST = "Kursverlust"; @Autowired private KontoRepository kontoRepository; @Autowired private DepotRepository depotRepository; public List<Konto> findAll() { List<Konto> result = new ArrayList<>(); kontoRepository.findAll().forEach( k -> result.add(k)); return result; } public Optional<Konto> findById(Long kontoId) { return kontoRepository.findById(kontoId); } public Optional<Konto> findByName(String kontoName) { return kontoRepository.findByName(kontoName); } @Transactional public Konto createKonto(Konto konto) { kontoRepository.save(konto); return konto; } @Transactional public Depot createDepot(Depot depot) { depotRepository.save(depot); return depot; } public void update(Konto konto) { kontoRepository.save(konto); } public Konto getKursgewinn() { return findByName(KONTO_KURSGEWINN).get(); } public Konto getKursverlust() { return findByName(KONTO_KURSVERLUST).get(); } }
9231e263e0783b6aee4c0b980f8a08f96069c52b
9,939
java
Java
test/java/edu/illinois/quicksel/basic/SyntheticDataGenerator.java
Hap-Hugh/quicksel
10eee90b759638d5c54ba19994ae8e36e90e12b8
[ "Apache-2.0" ]
15
2020-07-07T16:32:53.000Z
2022-03-16T14:23:23.000Z
test/java/edu/illinois/quicksel/basic/SyntheticDataGenerator.java
Hap-Hugh/quicksel
10eee90b759638d5c54ba19994ae8e36e90e12b8
[ "Apache-2.0" ]
2
2020-09-02T15:25:39.000Z
2020-09-24T08:37:18.000Z
test/java/edu/illinois/quicksel/basic/SyntheticDataGenerator.java
Hap-Hugh/quicksel
10eee90b759638d5c54ba19994ae8e36e90e12b8
[ "Apache-2.0" ]
6
2020-08-14T22:02:07.000Z
2021-03-31T07:08:29.000Z
34.751748
116
0.626019
996,019
package edu.illinois.quicksel.basic; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Random; import java.util.Vector; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.math3.distribution.MultivariateNormalDistribution; import edu.illinois.quicksel.Assertion; import edu.illinois.quicksel.Query; import org.apache.commons.math3.distribution.NormalDistribution; public class SyntheticDataGenerator { public static List<List<Double>> twoDimGaussianDataset(int size) { List<List<Double>> dataset = new ArrayList<>(); MultivariateNormalDistribution normal = new MultivariateNormalDistribution( new double[]{0.5, 0.5}, new double[][]{new double[]{0.09, 0.04}, new double[]{0.04, 0.09}}); for (int i = 0; i < size; i++) { dataset.add(new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(normal.sample())))); } return dataset; } public static List<Assertion> workflowAssertion(List<List<Double>> dataset) { /** * cc = linspace(0.1, 0.9, 1000) * For c in cc: * # cr is the center of 2D rectangle. * # randn() generaets a random variables from a standard normal * cr = [c+randn()*0.1 c+randn()*0.1] * create a rectangle R whose width is 0.2 and height 0.2; its center is cr. * new_assertion = (R, selectivity(R)) */ Vector<Assertion> queryset = new Vector<Assertion>(); List<Double> cc = new ArrayList<>(); for (double i=0.1;i<=0.9;i+=0.0008) { cc.add(i); } Random rand = new Random(); for (double c:cc) { double r = rand.nextDouble(); Pair<Double, Double> cr = new ImmutablePair<>(c-r*0.1, c+r*0.1); HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<>(); Double x1 = (cr.getLeft() - 0.1)<0? 0:cr.getLeft()-0.1; Double x2 = (cr.getLeft() + 0.1)>=1? 1:cr.getLeft()+0.1; Double y1 = (cr.getRight() - 0.1)<0? 0:cr.getRight()-0.1; Double y2 = (cr.getRight() + 0.1)>=1? 1:cr.getRight()+0.1; r1.put(0, Pair.of(x1, x2)); r1.put(1, Pair.of(y1, y2)); Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } public static List<List<Double>> twoDimGaussianDataset(double correlation, int size) { List<List<Double>> dataset = new ArrayList<>(); // double[] standardDeviation = new double[]{1.0, 1.0}; // double[][] correlationMatrix = new double[][]{new double[]{1.0, correlation}, new double[]{correlation, 1.0}}; // Coveriance Matrix = Diag(std)*correlation*Diag(std), so in this case, correlationMatrix=covarianceMatrix double stddev = 0.3; double cov = correlation * stddev * stddev; double var = stddev * stddev; double[][] covarianceMatrix = new double[][] {new double[] {var, cov}, new double[] {cov, var}}; MultivariateNormalDistribution normal = new MultivariateNormalDistribution( new double[]{0.5, 0.5}, covarianceMatrix); for (int i = 0; i < size; i++) { dataset.add(new ArrayList<Double>(Arrays.asList(ArrayUtils.toObject(normal.sample())))); } return dataset; } public static List<List<Double>> nDimGaussianDataset(int n, int size) { List<List<Double>> dataset = new ArrayList<>(); double stddev = 0.2; //variance =0.04 double mean=0.5; NormalDistribution normal = new NormalDistribution(mean, stddev); for (int i = 0; i < size; i++) { // values in each dimension are generated independently List<Double> data = new ArrayList<>(); for (int j=0;j<n;j++) { data.add(normal.sample()); } dataset.add(data); } return dataset; } // queries highly overlap public static List<Assertion> twoDimGaussianDatasetRandomAssertions(int size, List<List<Double>> dataset) { Vector<Assertion> queryset = new Vector<Assertion>(); Random rand = new Random(0); for (int i = 0; i < size; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); r1.put(0, Pair.of(rand.nextDouble() * 0.5, rand.nextDouble() * 0.5 + 0.5)); r1.put(1, Pair.of(rand.nextDouble() * 0.5, rand.nextDouble() * 0.5 + 0.5)); Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } public static List<Assertion> nDimRandomAssertions(int size, List<List<Double>> dataset) { Vector<Assertion> queryset = new Vector<Assertion>(); int dim = dataset.get(0).size(); Random rand = new Random(0); for (int i = 0; i < size; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); // for each dim, the interval size is (0.1)^(1/d) for (int j=0;j<dim;j++) { double left = rand.nextDouble() * 0.5; double right = left + 0.5; r1.put(j, Pair.of(left, right)); } Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } public static List<Assertion> nDimRandomAssertionsSelectivityFixed(int size, List<List<Double>> dataset) { Vector<Assertion> queryset = new Vector<Assertion>(); int dim = dataset.get(0).size(); Random rand = new Random(0); for (int i = 0; i < size; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); // for each dim, the interval size is (0.1)^(1/d) for (int j=0;j<dim;j++) { double left = -1; while (left<0) { left = rand.nextDouble()*(1-Math.pow(0.1, 1.0/(double) dim)); } double right = left+Math.pow(0.1, 1.0/(double) dim); r1.put(j, Pair.of(left, right)); } Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } // queries less overlap public static List<Assertion> twoDimGaussianDatasetRandomAssertions2(int size, List<List<Double>> dataset) { Vector<Assertion> queryset = new Vector<Assertion>(); Random rand = new Random(0); for (int i = 0; i < size; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); double d1 = rand.nextDouble()*0.9; double d2 = rand.nextDouble()*0.9; r1.put(0, Pair.of(d1, d1+0.1)); r1.put(1, Pair.of(d2, d2+0.1)); Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } public static List<Query> twoDimGaussianDatasetRandomTestQueries(int size) { Vector<Query> queryset = new Vector<Query>(); Random rand = new Random(1); for (int i = 0; i < size; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); r1.put(0, Pair.of(rand.nextDouble() * 0.5, rand.nextDouble() * 0.5 + 0.5)); r1.put(1, Pair.of(rand.nextDouble() * 0.5, rand.nextDouble() * 0.5 + 0.5)); queryset.add(new Query(r1)); } return queryset; } public static List<Assertion> twoDimDefaultAssertion(List<List<Double>> dataset) { List<Assertion> assertions = new ArrayList<Assertion>(); HashMap<Integer, Pair<Double, Double>> constraints = new HashMap<>(); constraints.put(0, Pair.of(0.0, 1.0)); Query q = new Query(constraints); assertions.add(new Assertion(q, 1.0)); return assertions; } public static List<Assertion> nDimDefaultAssertion(int n, List<List<Double>> dataset) { List<Assertion> assertions = new ArrayList<Assertion>(); HashMap<Integer, Pair<Double, Double>> constraints = new HashMap<>(); for (int i=0;i<n;i++) { constraints.put(i, Pair.of(0.0, 1.0)); } Query q = new Query(constraints); assertions.add(new Assertion(q, 1.0)); return assertions; } public static List<Assertion> twoDimPermanentAssertions(int gridNum, List<List<Double>> dataset) { List<Assertion> queryset = new Vector<Assertion>(); double step = 1.0 / ((double) gridNum); for (int i = 0; i < gridNum; i++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); r1.put(0, Pair.of(step*i, step*(i+1))); Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } for (int j = 0; j < gridNum; j++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); r1.put(1, Pair.of(step*j, step*(j+1))); Query q1 = new Query(r1); queryset.add(new Assertion(q1, countSatisfyingItems(dataset, q1) / ((double) dataset.size()))); } return queryset; } public static List<List<Query>> twoDimGaussianDatasetGridTestQueries(int gridNum) { List<List<Query>> queryset = new ArrayList<>(); double step = 1.0 / ((double) gridNum); for (int i = 0; i < gridNum; i++) { Vector<Query> vq = new Vector<Query>(); for (int j = 0; j < gridNum; j++) { HashMap<Integer, Pair<Double, Double>> r1 = new HashMap<Integer, Pair<Double, Double>>(); r1.put(0, Pair.of(step*i, step*(i+1))); r1.put(1, Pair.of(step*j, step*(j+1))); vq.add(new Query(r1)); } queryset.add(vq); } return queryset; } public static int countSatisfyingItems(List<List<Double>> dataset, Query query) { int count = 0; for (int i = 0; i < dataset.size(); i++) { if (query.doesSatisfy(dataset.get(i))) { count += 1; } } return count; } }
9231e491f8e9a44c043bc8200c6f303d87edabc3
12,586
java
Java
src/dao/DAOTablaFunciones.java
ravelinx22/Iteracion2Sistrans
73051fda403cc49980dfc949c45b2a1e061e3e54
[ "MIT" ]
null
null
null
src/dao/DAOTablaFunciones.java
ravelinx22/Iteracion2Sistrans
73051fda403cc49980dfc949c45b2a1e061e3e54
[ "MIT" ]
null
null
null
src/dao/DAOTablaFunciones.java
ravelinx22/Iteracion2Sistrans
73051fda403cc49980dfc949c45b2a1e061e3e54
[ "MIT" ]
null
null
null
36.481159
329
0.733275
996,020
package dao; import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import vos.Boleta; import vos.Funcion; import vos.Localidad; import vos.Reserva; import vos.Silla; public class DAOTablaFunciones { /** * Arraylist de recursos que se usan para la ejecución de sentencias SQL */ private ArrayList<Object> recursos; /** * Atributo que genera la conexión a la base de datos */ private Connection conn; /** * Constructor DAO espectaculos. */ public DAOTablaFunciones() { recursos = new ArrayList<Object>(); } /** * Cierra todos los recursos que estan guardados en el arreglo. */ public void cerrarRecursos(){ for(Object ob : recursos) { if(ob instanceof PreparedStatement) { try { ((PreparedStatement) ob).close(); } catch(Exception e) { e.printStackTrace(); } } } } /** * Modifica la conexion de la base datos. * @param conn Nueva conexion a la base de datos. */ public void setConnection(Connection conn) { this.conn = conn; } // Transacciones /** * Da una lista de funciones que estan en la base de datos * @return Lista de funciones que esta en la base de datos. * @throws SQLException Si hay un error conectandose con la base de datos * @throws Exception Si hay un error conviertiendo de dato a funcion */ public ArrayList<Funcion> darFunciones() throws SQLException, Exception { ArrayList<Funcion> funciones = new ArrayList<Funcion>(); String sql = "SELECT * FROM ISIS2304B221710.FUNCIONES WHERE ID < 30"; PreparedStatement prepStmt = conn.prepareStatement(sql); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); while (rs.next()) { int id = Integer.parseInt(rs.getString("ID")); Date fecha = rs.getDate("FECHA"); int horaInicio = Integer.parseInt(rs.getString("HORA_INICIO")); int boletasTotales = Integer.parseInt(rs.getString("BOLETAS_TOTALES")); int idReserva = Integer.parseInt(rs.getString("ID_RESERVA")); int idEspectaculo = Integer.parseInt(rs.getString("ID_ESPECTACULO")); int idFestival = Integer.parseInt(rs.getString("ID_FESTIVAL")); funciones.add(new Funcion(id, fecha, horaInicio, boletasTotales, idReserva, idEspectaculo, idFestival)); } return funciones; } /** * Busca una funcion por id. * @param id Id de la funcion a buscar * @return Funcion que tiene el id igual al parametro, null de lo contrario. * @throws SQLException Si hay error conectandose con la base de datos. * @throws Exception Si hay error al convertir de datos a silla. */ public Funcion darFuncion(int id) throws SQLException, Exception { String sql = "SELECT * FROM ISIS2304B221710.FUNCIONES WHERE ID = ?"; PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setInt(1, id); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); if(!rs.next()) return null; Date fecha = rs.getDate("FECHA"); int horaInicio = Integer.parseInt(rs.getString("HORA_INICIO")); int boletasTotales = Integer.parseInt(rs.getString("BOLETAS_TOTALES")); int idReserva = Integer.parseInt(rs.getString("ID_RESERVA")); int idEspectaculo = Integer.parseInt(rs.getString("ID_ESPECTACULO")); int idFestival = Integer.parseInt(rs.getString("ID_FESTIVAL")); Funcion fnc = new Funcion(id, fecha, horaInicio, boletasTotales, idReserva, idEspectaculo, idFestival); return fnc; } /** * Agrega una funcion a la base de datos * @param funcion Funcion a agregar * @throws SQLException Si hay un error conectandose con la base de datos. * @throws Exception Si hay un error conviertiendo de dato a funcion. */ public void addFuncion(Funcion funcion) throws SQLException, Exception { String sql = "INSERT INTO ISIS2304B221710.FUNCIONES VALUES (?,?,?,?,?,?,?)"; PreparedStatement prepStmt = conn.prepareStatement(sql); DAOTablaSitios daoSitio = new DAOTablaSitios(); daoSitio.setConnection(conn); DAOTablaReserva daoReserva = new DAOTablaReserva(); daoReserva.setConnection(conn); DAOTablaEspectaculos daoEspectaculo = new DAOTablaEspectaculos(); daoEspectaculo.setConnection(conn); if(!daoSitio.darSitio(daoReserva.darReserva(funcion.getIdReserva()).getIdSitio()).cumpleRequerimientos(daoEspectaculo.darEspectaculo(funcion.getIdEspectaculo()).getRequerimientos())) throw new Exception("El sitio no cumple con los requerimientos de la funcion"); prepStmt.setInt(1, funcion.getId()); prepStmt.setDate(2, funcion.getFecha()); prepStmt.setInt(3, funcion.getHoraInicio()); prepStmt.setInt(4, funcion.getBoletasTotales()); prepStmt.setInt(5, funcion.getIdReserva()); prepStmt.setInt(6, funcion.getIdEspectaculo()); prepStmt.setInt(7, funcion.getIdFestival()); System.out.println("SQL stmt:" + sql); recursos.add(prepStmt); prepStmt.executeQuery(); } /** * Actualiza una funcion de la base de datos. * @param funcion Funcion con los nuevos datos * @throws SQLException Si hay un error al connectarse con la base de datos. * @throws Exception Si hay un error al convertir un dato a funcion */ public void updateFuncion(Funcion funcion) throws SQLException, Exception { String sql = "UPDATE ISIS2304B221710.FUNCIONES SET fecha = ?, hora_inicio = ?, boletas_totales = ?, id_reserva = ?, id_espectaculo = ?, id_festival = ? WHERE id = ?"; PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setDate(1, funcion.getFecha()); prepStmt.setInt(2, funcion.getHoraInicio()); prepStmt.setInt(3, funcion.getBoletasTotales()); prepStmt.setInt(4, funcion.getIdReserva()); prepStmt.setInt(5, funcion.getIdEspectaculo()); prepStmt.setInt(6, funcion.getIdFestival()); prepStmt.setInt(7, funcion.getId()); System.out.println("SQL stmt:" + sql); recursos.add(prepStmt); prepStmt.executeQuery(); } /** * Elimina una funcion de la base de datos. * @param funcion Funcion a eliminar * @throws SQLException Si hay un error al conectarse con la base de datos. * @throws Exception Si hay un error al convertir un dato a funcion. */ public void deleteFuncion(Funcion funcion) throws SQLException, Exception { String sql = "DELETE FROM ISIS2304B221710.FUNCIONES"; sql += " WHERE id = " + funcion.getId(); System.out.println("SQL stmt:" + sql); PreparedStatement prepStmt = conn.prepareStatement(sql); recursos.add(prepStmt); prepStmt.executeQuery(); } //TODO RFC3 public void generaReporte(int pid) throws SQLException, Exception { String sql = "SELECT reservaISIS2304B221710.LOCALIDAD.nombre as nombre, (COUNT(reservaISIS2304B221710.LOCALIDAD.id))* reservaISIS2304B221710.LOCALIDAD.precio FROM ((ISIS2304B221710.FUNCIONES FULL OUTER JOIN ISIS2304B221710.RESERVA on ISIS2304B221710.FUNCIONES.reserva_id = reservaISIS2304B221710.RESERVA.id) FULL OUTER JOIN " + "reservaISIS2304B221710.RESERVA.SITIO on " + "reservaISIS2304B221710.RESERVA.sitio_id = reservaISIS2304B221710.SITIO.id) FULL OUTER JOIN " + "reservaISIS2304B221710.LOCALIDAD on reservaISIS2304B221710.SITIO.id = reservaISIS2304B221710.LOCALIDAD.sitio_id "; sql += " WHERE ISIS2304B221710.FUNCIONES.id = " + pid + " GROUP BY ( reservaISIS2304B221710.LOCALIDAD.nombre) "; System.out.println("SQL stmt:" + sql); PreparedStatement prepStmt = conn.prepareStatement(sql); recursos.add(prepStmt); prepStmt.executeQuery(); } /** * Da las funciones de un cliente * @param id Id del cliente * @return Lista con las funciones del cliente * @throws SQLException Si hay un error al connectarse con la base de datos. * @throws Exception Si hay un error al convertir un dato a funcion */ public ArrayList<Funcion> darFuncionesCliente(int id_usuario) throws SQLException, Exception { ArrayList<Funcion> funciones = new ArrayList<>(); String sql = "SELECT y.* FROM (SELECT * FROM BOLETAS WHERE ID_USUARIO = ?) x INNER JOIN FUNCIONES y ON x.ID_FUNCION = y.ID"; System.out.println("SQL stmt:" + sql); PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setInt(1, id_usuario); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); while(rs.next()) { int id = Integer.parseInt(rs.getString("ID")); Date fecha = rs.getDate("FECHA"); int horaInicio = Integer.parseInt(rs.getString("HORA_INICIO")); int boletasTotales = Integer.parseInt(rs.getString("BOLETAS_TOTALES")); int idReserva = Integer.parseInt(rs.getString("ID_RESERVA")); int idEspectaculo = Integer.parseInt(rs.getString("ID_ESPECTACULO")); int idFestival = Integer.parseInt(rs.getString("ID_FESTIVAL")); funciones.add(new Funcion(id, fecha, horaInicio, boletasTotales, idReserva, idEspectaculo, idFestival)); } return funciones; } /** * Da las funciones canceladas de un cliente * @param id Id del cliente * @return Lista con las funciones canceladas del cliente * @throws SQLException * @throws Exception */ public ArrayList<Funcion> darFuncionesCanceladasCliente(int id_usuario) throws SQLException, Exception { ArrayList<Funcion> funciones = new ArrayList<>(); String sql = "SELECT y.* FROM (SELECT * FROM BOLETACANCELADA WHERE ID_USUARIO = ?) x INNER JOIN FUNCIONES y ON x.ID_FUNCION = y.ID"; System.out.println("SQL stmt:" + sql); PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setInt(1, id_usuario); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); while(rs.next()) { int id = Integer.parseInt(rs.getString("ID")); Date fecha = rs.getDate("FECHA"); int horaInicio = Integer.parseInt(rs.getString("HORA_INICIO")); int boletasTotales = Integer.parseInt(rs.getString("BOLETAS_TOTALES")); int idReserva = Integer.parseInt(rs.getString("ID_RESERVA")); int idEspectaculo = Integer.parseInt(rs.getString("ID_ESPECTACULO")); int idFestival = Integer.parseInt(rs.getString("ID_FESTIVAL")); funciones.add(new Funcion(id, fecha, horaInicio, boletasTotales, idReserva, idEspectaculo, idFestival)); } return funciones; } // ITERACION 5 /** * Da las funciones de una compañia en especifico. * @param id_compañia Id de la compañia * @throws SQLException Si hay un error conectandose a la base de datos. * @throws Exception Si hay un error convirtiendo de dato a funcion. */ public ArrayList<Funcion> darFuncionesDeCompañia(int id_compañia) throws SQLException, Exception { String sql = "SELECT y.* FROM (SELECT * FROM COMPAÑIAS x INNER JOIN CONTRIBUIDORES y ON x.ID = y.ID_COMPAÑIA WHERE x.ID = ?) x INNER JOIN FUNCIONES y ON x.ID_ESPECTACULO = y.ID_ESPECTACULO"; PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setInt(1, id_compañia); recursos.add(prepStmt); ResultSet rs = prepStmt.executeQuery(); ArrayList<Funcion> funciones = new ArrayList<Funcion>(); while(rs.next()) { int id = Integer.parseInt(rs.getString("ID")); Date fecha = rs.getDate("FECHA"); int horaInicio = Integer.parseInt(rs.getString("HORA_INICIO")); int boletasTotales = Integer.parseInt(rs.getString("BOLETAS_TOTALES")); int idReserva = Integer.parseInt(rs.getString("ID_RESERVA")); int idEspectaculo = Integer.parseInt(rs.getString("ID_ESPECTACULO")); int idFestival = Integer.parseInt(rs.getString("ID_FESTIVAL")); funciones.add(new Funcion(id, fecha, horaInicio, boletasTotales, idReserva, idEspectaculo, idFestival)); } return funciones; } /** * Elimina una funcion en especifico. * @param id_funcion Id de la funcion a eliminar. * @throws SQLException Si hay un error conectandose a la base de datos. * @throws Exception Si hay un error convirtiendo de dato a funcion. */ public void deleteFuncion(int id_funcion) throws SQLException, Exception { Funcion funcion = darFuncion(id_funcion); if(funcion == null) throw new Exception("La funcion que esta intentando eliminar no existe"); String sql = "DELETE FROM ISIS2304B221710.FUNCIONES WHERE id = ?"; PreparedStatement prepStmt = conn.prepareStatement(sql); prepStmt.setInt(1, id_funcion); recursos.add(prepStmt); prepStmt.executeQuery(); } /** * Elimina las funciones de una compañia. * @param id_compañia Id de la compañia a eliminar. * @throws SQLException Si hay un error conectandose a la base de datos. * @throws Exception Si hay un error convirtiendo de dato a funcion. */ public void deleteFuncionesDeCompañia(int id_compañia) throws SQLException, Exception { ArrayList<Funcion> funciones = darFuncionesDeCompañia(id_compañia); for(Funcion f : funciones) { deleteFuncion(f.getId()); } } }
9231e4a3d3ddb071ef419bc42bf68b09eac7575c
2,784
java
Java
google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/enums/CustomizerAttributeTypeProto.java
giger85/google-ads-java
e91f6aba2638d172baf302dbc3ff1dceb80c70fe
[ "Apache-2.0" ]
1
2019-11-30T23:41:47.000Z
2019-11-30T23:41:47.000Z
google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/enums/CustomizerAttributeTypeProto.java
giger85/google-ads-java
e91f6aba2638d172baf302dbc3ff1dceb80c70fe
[ "Apache-2.0" ]
null
null
null
google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/enums/CustomizerAttributeTypeProto.java
giger85/google-ads-java
e91f6aba2638d172baf302dbc3ff1dceb80c70fe
[ "Apache-2.0" ]
null
null
null
45.639344
104
0.759339
996,021
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/ads/googleads/v9/enums/customizer_attribute_type.proto package com.google.ads.googleads.v9.enums; public final class CustomizerAttributeTypeProto { private CustomizerAttributeTypeProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistryLite registry) { } public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { registerAllExtensions( (com.google.protobuf.ExtensionRegistryLite) registry); } static final com.google.protobuf.Descriptors.Descriptor internal_static_google_ads_googleads_v9_enums_CustomizerAttributeTypeEnum_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_ads_googleads_v9_enums_CustomizerAttributeTypeEnum_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n=google/ads/googleads/v9/enums/customiz" + "er_attribute_type.proto\022\035google.ads.goog" + "leads.v9.enums\032\034google/api/annotations.p" + "roto\"\204\001\n\033CustomizerAttributeTypeEnum\"e\n\027" + "CustomizerAttributeType\022\017\n\013UNSPECIFIED\020\000" + "\022\013\n\007UNKNOWN\020\001\022\010\n\004TEXT\020\002\022\n\n\006NUMBER\020\003\022\t\n\005P" + "RICE\020\004\022\013\n\007PERCENT\020\005B\361\001\n!com.google.ads.g" + "oogleads.v9.enumsB\034CustomizerAttributeTy" + "peProtoP\001ZBgoogle.golang.org/genproto/go" + "ogleapis/ads/googleads/v9/enums;enums\242\002\003" + "GAA\252\002\035Google.Ads.GoogleAds.V9.Enums\312\002\035Go" + "ogle\\Ads\\GoogleAds\\V9\\Enums\352\002!Google::Ad" + "s::GoogleAds::V9::Enumsb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.api.AnnotationsProto.getDescriptor(), }); internal_static_google_ads_googleads_v9_enums_CustomizerAttributeTypeEnum_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_google_ads_googleads_v9_enums_CustomizerAttributeTypeEnum_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_ads_googleads_v9_enums_CustomizerAttributeTypeEnum_descriptor, new java.lang.String[] { }); com.google.api.AnnotationsProto.getDescriptor(); } // @@protoc_insertion_point(outer_class_scope) }
9231e6324c552928692589d44ff421bf7c18d4e6
99
java
Java
Interfaces/Paintable.java
carys1797-cmis/APCS-carys1797-cmis
11045b00b5bf05e3b3f67c2e7ab1d17be45c95ed
[ "MIT" ]
null
null
null
Interfaces/Paintable.java
carys1797-cmis/APCS-carys1797-cmis
11045b00b5bf05e3b3f67c2e7ab1d17be45c95ed
[ "MIT" ]
null
null
null
Interfaces/Paintable.java
carys1797-cmis/APCS-carys1797-cmis
11045b00b5bf05e3b3f67c2e7ab1d17be45c95ed
[ "MIT" ]
null
null
null
14.142857
35
0.707071
996,022
public interface Paintable { public String getColour(); public void paint(String newC); }
9231e653691b2994381199ad5d620c94cf60f1db
3,853
java
Java
src/main/java/org/consultjr/mvc/core/config/security/ApplicationSecurityConfig.java
rguimaraens/EventsManagement
7666633b3c3a0a58641945adf528c074d383b8de
[ "MIT" ]
null
null
null
src/main/java/org/consultjr/mvc/core/config/security/ApplicationSecurityConfig.java
rguimaraens/EventsManagement
7666633b3c3a0a58641945adf528c074d383b8de
[ "MIT" ]
null
null
null
src/main/java/org/consultjr/mvc/core/config/security/ApplicationSecurityConfig.java
rguimaraens/EventsManagement
7666633b3c3a0a58641945adf528c074d383b8de
[ "MIT" ]
null
null
null
37.407767
107
0.649105
996,023
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.consultjr.mvc.core.config.security; import javax.sql.DataSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; 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.context.annotation.PropertySource; import org.springframework.core.env.Environment; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity; import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; /** * * @author Rafael */ @Configuration @EnableWebMvcSecurity @PropertySource("classpath:application.properties") @EnableGlobalMethodSecurity(securedEnabled = true, prePostEnabled = true) public class ApplicationSecurityConfig extends WebSecurityConfigurerAdapter { private Logger logger = LoggerFactory .getLogger(ApplicationSecurityConfig.class); @Autowired private Environment environment; @Autowired private DataSource dataSource; @Autowired @Qualifier("UDService") private UserDetailsService userDetailsService; @Bean public PasswordEncoder passwordEncoder() { PasswordEncoder encoder = new BCryptPasswordEncoder(); return encoder; } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth .userDetailsService(userDetailsService) .passwordEncoder(passwordEncoder()); } @Override public void configure(WebSecurity web) throws Exception { web .ignoring() .antMatchers("/resources/**"); } @Override protected void configure(HttpSecurity http) throws Exception { http .formLogin().loginPage("/login").failureUrl("/login?error") .usernameParameter("username") .passwordParameter("password") .and() .logout() .logoutSuccessUrl("/login?logout") .and() .csrf() .and() .exceptionHandling().accessDeniedPage("/403") .and() .authorizeRequests() .antMatchers( "/", "/login/**", "/signup/**", "/about/**", "/support/**", "/contact/**", "/Public/**", // for public content... CMS, Ajax, etc "/System/install/**", "/User/edit/**", "/User/panel/**").permitAll() .antMatchers("/Client/**").hasAuthority("client") .antMatchers( "/Admin/**", "/User/**").hasAuthority("admin") .anyRequest().authenticated(); } }
9231e6556741f10537e6c2d25b40c7e606442978
3,146
java
Java
BchainEnabledOLYMPUS/core/src/main/java/eu/olympus/model/AttributeDefinitionDate.java
rafaeltm/OLChainEnabled
85c9d571e116bb751532107fa22b8614cb5dac8a
[ "Apache-2.0" ]
null
null
null
BchainEnabledOLYMPUS/core/src/main/java/eu/olympus/model/AttributeDefinitionDate.java
rafaeltm/OLChainEnabled
85c9d571e116bb751532107fa22b8614cb5dac8a
[ "Apache-2.0" ]
null
null
null
BchainEnabledOLYMPUS/core/src/main/java/eu/olympus/model/AttributeDefinitionDate.java
rafaeltm/OLChainEnabled
85c9d571e116bb751532107fa22b8614cb5dac8a
[ "Apache-2.0" ]
1
2022-01-25T04:39:30.000Z
2022-01-25T04:39:30.000Z
36.16092
249
0.714558
996,024
package eu.olympus.model; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import eu.olympus.util.Util; import java.math.BigInteger; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.Date; @JsonInclude(JsonInclude.Include.NON_NULL) public class AttributeDefinitionDate extends AttributeDefinition { @JsonProperty("type") //Needed because of issue in Jackson with serialization of collections private final String type= "Date"; private static final AttributeType TYPE= AttributeType.DATE; private static final DateGranularity DEFAULT_GRANULARITY= DateGranularity.SECONDS; @JsonProperty("minDate") private final String minDate; @JsonProperty("maxDate") private final String maxDate; @JsonProperty("granularity") private final DateGranularity granularity; private final Date parsedMinDate; private final Date parsedMaxDate; public AttributeDefinitionDate(@JsonProperty("id") String id,@JsonProperty("shortName") String shortName,@JsonProperty("minDate") String minDate,@JsonProperty("maxDate") String maxDate, @JsonProperty("granularity") DateGranularity granularity) { super(id, shortName); this.minDate = minDate; this.maxDate = maxDate; parsedMinDate= Util.fromRFC3339UTC(minDate); parsedMaxDate= Util.fromRFC3339UTC(maxDate); if(granularity==null) this.granularity=DEFAULT_GRANULARITY; else this.granularity=granularity; } public AttributeDefinitionDate(String id,String shortName,String minDate,String maxDate) { this(id,shortName,minDate,maxDate,null); } @JsonIgnore public Date getMinDate() { return parsedMinDate; } @JsonIgnore public Date getMaxDate() { return parsedMaxDate; } @JsonIgnore public DateGranularity getGranularity() { return granularity; } @Override public BigInteger toBigIntegerRepresentation(Attribute attribute) { //We assume that the range minDate-maxDate is small enough to be represented within [0,p] for ZpElement if (!checkValidValue(attribute)) throw new IllegalArgumentException("Invalid attribute"); Date val= (Date) attribute.getAttr(); long unitFromEpoch=dateToTimeUnitFromEpoch(val); BigInteger res=BigInteger.valueOf(unitFromEpoch); res=res.add(new BigInteger("1")); res=res.subtract(BigInteger.valueOf(dateToTimeUnitFromEpoch(parsedMinDate))); return res; } @Override public boolean checkValidValue(Attribute value) { if (value.getType() != TYPE || !(value.getAttr() instanceof Date)) return false; Date val= (Date) value.getAttr(); if(val.equals(parsedMaxDate)|| val.equals(parsedMinDate)) return true; return val.after(parsedMinDate) && val.before(parsedMaxDate); } private long dateToTimeUnitFromEpoch(Date date){ return granularity.between(Instant.EPOCH,date.toInstant()); } }
9231e6fe6c714df59a8f3131f9fe3155c2e6e668
486
java
Java
app/src/main/java/com/moemoe/lalala/di/modules/SevenDayLoginModule.java
zhangyanzy/Kira
95497149e2e0a5721c91a582105c6558287f692c
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/moemoe/lalala/di/modules/SevenDayLoginModule.java
zhangyanzy/Kira
95497149e2e0a5721c91a582105c6558287f692c
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/moemoe/lalala/di/modules/SevenDayLoginModule.java
zhangyanzy/Kira
95497149e2e0a5721c91a582105c6558287f692c
[ "Apache-2.0" ]
2
2020-07-12T07:00:23.000Z
2021-08-24T09:16:37.000Z
19.44
66
0.728395
996,025
package com.moemoe.lalala.di.modules; import com.moemoe.lalala.presenter.SevenDayLoginContract; import dagger.Module; import dagger.Provides; /** * Created by Administrator on 2018/7/12. */ @Module public class SevenDayLoginModule { private SevenDayLoginContract.View mView; public SevenDayLoginModule(SevenDayLoginContract.View mView) { this.mView = mView; } @Provides public SevenDayLoginContract.View provideView() { return mView; } }
9231e730da9637ca20cc19516d541e2370c3e4f4
2,470
java
Java
src/main/java/shadows/apotheosis/deadly/gen/SpawnerItem.java
PixVoxel/Apotheosis
c232545ee132660b83f0f2bf650749c24ec4202e
[ "MIT" ]
85
2019-02-08T23:20:08.000Z
2022-03-17T00:56:56.000Z
src/main/java/shadows/apotheosis/deadly/gen/SpawnerItem.java
PixVoxel/Apotheosis
c232545ee132660b83f0f2bf650749c24ec4202e
[ "MIT" ]
517
2019-02-14T21:13:25.000Z
2022-03-31T18:05:51.000Z
src/main/java/shadows/apotheosis/deadly/gen/SpawnerItem.java
PixVoxel/Apotheosis
c232545ee132660b83f0f2bf650749c24ec4202e
[ "MIT" ]
57
2019-04-20T09:10:24.000Z
2022-03-26T17:16:58.000Z
43.333333
183
0.797166
996,026
package shadows.apotheosis.deadly.gen; import java.util.List; import java.util.Random; import com.google.gson.annotations.SerializedName; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.state.BooleanProperty; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Plane; import net.minecraft.util.ResourceLocation; import net.minecraft.util.WeightedRandom; import net.minecraft.util.WeightedSpawnerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IServerWorld; import shadows.apotheosis.deadly.DeadlyLoot; import shadows.apotheosis.deadly.config.DeadlyConfig; import shadows.apotheosis.util.SpawnerStats; import shadows.placebo.util.ChestBuilder; import shadows.placebo.util.SpawnerEditor; public class SpawnerItem extends WeightedRandom.Item { public static final Block[] FILLER_BLOCKS = new Block[] { Blocks.CRACKED_STONE_BRICKS, Blocks.MOSSY_COBBLESTONE, Blocks.CRYING_OBSIDIAN, Blocks.LODESTONE }; protected final SpawnerStats stats; @SerializedName("spawn_potentials") protected final List<WeightedSpawnerEntity> spawnPotentials; @SerializedName("loot_table") protected final ResourceLocation lootTable; public SpawnerItem(SpawnerStats stats, ResourceLocation lootTable, List<WeightedSpawnerEntity> potentials, int weight) { super(weight); this.stats = stats; this.lootTable = lootTable; this.spawnPotentials = potentials; } @SuppressWarnings("deprecation") public void place(IServerWorld world, BlockPos pos, Random rand) { world.setBlock(pos, Blocks.SPAWNER.defaultBlockState(), 2); SpawnerEditor editor = new SpawnerEditor(world, pos); this.stats.apply(editor).setSpawnData(this.spawnPotentials.get(rand.nextInt(this.spawnPotentials.size()))).setPotentials(this.spawnPotentials.toArray(new WeightedSpawnerEntity[0])); int chance = DeadlyConfig.spawnerValueChance; ChestBuilder.place(world, rand, pos.below(), chance > 0 && rand.nextInt(chance) == 0 ? DeadlyLoot.VALUABLE : this.lootTable); world.setBlock(pos.above(), FILLER_BLOCKS[rand.nextInt(FILLER_BLOCKS.length)].defaultBlockState(), 2); for (Direction f : Plane.HORIZONTAL) { if (world.getBlockState(pos.relative(f)).isAir(world, pos.relative(f))) { BooleanProperty side = (BooleanProperty) Blocks.VINE.getStateDefinition().getProperty(f.getOpposite().getName()); world.setBlock(pos.relative(f), Blocks.VINE.defaultBlockState().setValue(side, true), 2); } } } }
9231e87eb10c5cde8ea945c1c428fb9730932059
194,371
java
Java
platform/main/server-4q/com/cyc/cycjava/cycl/inference/harness/inference_worker_removal.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
10
2016-09-03T18:41:14.000Z
2020-01-17T16:29:19.000Z
platform/main/server-4q/com/cyc/cycjava/cycl/inference/harness/inference_worker_removal.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
3
2016-09-01T19:15:27.000Z
2016-10-12T16:28:48.000Z
platform/main/server-4q/com/cyc/cycjava/cycl/inference/harness/inference_worker_removal.java
TeamSPoon/CYC_JRTL_with_CommonLisp_OLD
31ce724b21468bee0693dfc1d0ca4bc861c58e2b
[ "Apache-2.0" ]
1
2017-11-21T13:29:31.000Z
2017-11-21T13:29:31.000Z
63.916804
543
0.699358
996,027
package com.cyc.cycjava.cycl.inference.harness; import static com.cyc.cycjava.cycl.control_vars.$external_inference_enabled$; import static com.cyc.cycjava.cycl.control_vars.$maximum_hl_module_check_cost$; import static com.cyc.cycjava.cycl.control_vars.inference_warn; import static com.cyc.cycjava.cycl.el_utilities.asent_and_sense_to_literal; import static com.cyc.cycjava.cycl.id_index.id_index_dense_objects; import static com.cyc.cycjava.cycl.id_index.id_index_dense_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_next_id; import static com.cyc.cycjava.cycl.id_index.id_index_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_skip_tombstones_p; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_id_threshold; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_objects; import static com.cyc.cycjava.cycl.id_index.id_index_sparse_objects_empty_p; import static com.cyc.cycjava.cycl.id_index.id_index_tombstone_p; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.append; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.cons; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.list; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.listS; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.nconc; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.ConsesLow.nth; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Equality.identity; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Functions.funcall; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntryKey; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntrySetIterator; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.getEntryValue; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.gethash_without_values; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.iteratorHasNext; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.iteratorNextEntry; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Hashtables.releaseEntrySetIterator; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Numbers.add; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Numbers.subtract; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.find; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.length; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sequences.nreverse; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.def_csetf; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.makeStructDeclNative; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Structures.register_method; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Symbols.symbol_function; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Threads.$is_thread_performing_cleanupP$; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.arg2; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.getValuesAsVector; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.multiple_value_list; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Values.restoreValuesFromVector; import static com.cyc.tool.subl.jrtl.nativeCode.subLisp.Vectors.aref; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeBoolean; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeKeyword; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeString; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeSymbol; import static com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObjectFactory.makeUninternedSymbol; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.cdestructuring_bind.cdestructuring_bind_error; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.cdestructuring_bind.destructuring_bind_must_consp; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.cdestructuring_bind.destructuring_bind_must_listp; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.cadr; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.cddr; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.member; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.conses_high.second; import static com.cyc.tool.subl.jrtl.translatedCode.sublisp.print_high.$print_object_method_table$; import static com.cyc.tool.subl.util.SubLFiles.declareFunction; import static com.cyc.tool.subl.util.SubLFiles.declareMacro; import static com.cyc.tool.subl.util.SubLFiles.defconstant; import static com.cyc.tool.subl.util.SubLFiles.defparameter; import java.util.Iterator; import java.util.Map; import org.armedbear.lisp.Lisp; import com.cyc.cycjava.cycl.arguments; import com.cyc.cycjava.cycl.backward; import com.cyc.cycjava.cycl.bindings; import com.cyc.cycjava.cycl.clause_utilities; import com.cyc.cycjava.cycl.clauses; import com.cyc.cycjava.cycl.cycl_utilities; import com.cyc.cycjava.cycl.enumeration_types; import com.cyc.cycjava.cycl.eval_in_api; import com.cyc.cycjava.cycl.formula_pattern_match; import com.cyc.cycjava.cycl.forts; import com.cyc.cycjava.cycl.hl_macros; import com.cyc.cycjava.cycl.iteration; import com.cyc.cycjava.cycl.list_utilities; import com.cyc.cycjava.cycl.memoization_state; import com.cyc.cycjava.cycl.mt_relevance_macros; import com.cyc.cycjava.cycl.pattern_match; import com.cyc.cycjava.cycl.set; import com.cyc.cycjava.cycl.set_contents; import com.cyc.cycjava.cycl.subl_macros; import com.cyc.cycjava.cycl.subl_promotions; import com.cyc.cycjava.cycl.unification_utilities; import com.cyc.cycjava.cycl.variables; import com.cyc.cycjava.cycl.inference.inference_trampolines; import com.cyc.cycjava.cycl.inference.modules.simplification_modules; import com.cyc.cycjava.cycl.inference.modules.removal.meta_removal_modules; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_abduction; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_asserted_formula; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_conjunctive_pruning; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_evaluate; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_evaluation; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_function_corresponding_predicate; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_isa; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_natfunction; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_reflexive_on; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_termofunit; import com.cyc.cycjava.cycl.inference.modules.removal.removal_modules_tva_lookup; import com.cyc.cycjava.cycl.sksi.sksi_infrastructure.sksi_macros; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.BinaryFunction; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.Errors; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.Sort; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLSpecialOperatorDeclarations; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLStructDecl; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLStructDeclNative; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.SubLThread; import com.cyc.tool.subl.jrtl.nativeCode.subLisp.UnaryFunction; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLList; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLObject; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLProcess; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLString; import com.cyc.tool.subl.jrtl.nativeCode.type.core.SubLStructNative; import com.cyc.tool.subl.jrtl.nativeCode.type.symbol.SubLSymbol; import com.cyc.tool.subl.jrtl.translatedCode.sublisp.compatibility; import com.cyc.tool.subl.jrtl.translatedCode.sublisp.visitation; import com.cyc.tool.subl.util.SubLFile; import com.cyc.tool.subl.util.SubLTranslatedFile; public final class inference_worker_removal extends SubLTranslatedFile { public static final SubLFile me = new inference_worker_removal(); public static final String myName = "com.cyc.cycjava.cycl.inference.harness.inference_worker_removal"; public static final String myFingerPrint = "1c41b8ebe528cf780646364a11ff99bd687f290e3192801352d3dff9709a21a2"; // defconstant public static final SubLSymbol $dtp_removal_link_data$ = makeSymbol("*DTP-REMOVAL-LINK-DATA*"); // defparameter private static final SubLSymbol $conjunctive_removal_tactic_expand_results_queue$ = makeSymbol("*CONJUNCTIVE-REMOVAL-TACTIC-EXPAND-RESULTS-QUEUE*"); // defparameter /** * Suppress the creation of a split link and child problems for conjunctive * removals. This can vastly reduce the number of problems and proofs for * queries with excessive amounts of conjunctive removal. */ private static final SubLSymbol $conjunctive_removal_suppress_split_justificationP$ = makeSymbol("*CONJUNCTIVE-REMOVAL-SUPPRESS-SPLIT-JUSTIFICATION?*"); // defparameter /** * Temporary control variable, eventually should stay T. When non-nil, we skip * the restriction/closed problem indirection for answers when we aren't * computing justifications. */ public static final SubLSymbol $conjunctive_removal_optimize_when_no_justificationsP$ = makeSymbol("*CONJUNCTIVE-REMOVAL-OPTIMIZE-WHEN-NO-JUSTIFICATIONS?*"); // defparameter /** * The number of expected removal tactic results at which we generate them * iteratively. */ private static final SubLSymbol $removal_tactic_iteration_threshold$ = makeSymbol("*REMOVAL-TACTIC-ITERATION-THRESHOLD*"); // defparameter private static final SubLSymbol $removal_tactic_expand_results_queue$ = makeSymbol("*REMOVAL-TACTIC-EXPAND-RESULTS-QUEUE*"); // Internal Constants public static final SubLSymbol REMOVAL_LINK_DATA = makeSymbol("REMOVAL-LINK-DATA"); public static final SubLSymbol REMOVAL_LINK_DATA_P = makeSymbol("REMOVAL-LINK-DATA-P"); public static final SubLList $list2 = list(makeSymbol("HL-MODULE"), makeSymbol("BINDINGS"), makeSymbol("SUPPORTS")); public static final SubLList $list3 = list(makeKeyword("HL-MODULE"), makeKeyword("BINDINGS"), makeKeyword("SUPPORTS")); public static final SubLList $list4 = list(makeSymbol("REMOV-LINK-DATA-HL-MODULE"), makeSymbol("REMOV-LINK-DATA-BINDINGS"), makeSymbol("REMOV-LINK-DATA-SUPPORTS")); public static final SubLList $list5 = list(makeSymbol("_CSETF-REMOV-LINK-DATA-HL-MODULE"), makeSymbol("_CSETF-REMOV-LINK-DATA-BINDINGS"), makeSymbol("_CSETF-REMOV-LINK-DATA-SUPPORTS")); public static final SubLSymbol REMOVAL_LINK_DATA_PRINT_FUNCTION_TRAMPOLINE = makeSymbol("REMOVAL-LINK-DATA-PRINT-FUNCTION-TRAMPOLINE"); private static final SubLList $list8 = list(makeSymbol("OPTIMIZE-FUNCALL"), makeSymbol("REMOVAL-LINK-DATA-P")); private static final SubLSymbol REMOV_LINK_DATA_HL_MODULE = makeSymbol("REMOV-LINK-DATA-HL-MODULE"); private static final SubLSymbol _CSETF_REMOV_LINK_DATA_HL_MODULE = makeSymbol("_CSETF-REMOV-LINK-DATA-HL-MODULE"); private static final SubLSymbol REMOV_LINK_DATA_BINDINGS = makeSymbol("REMOV-LINK-DATA-BINDINGS"); private static final SubLSymbol _CSETF_REMOV_LINK_DATA_BINDINGS = makeSymbol("_CSETF-REMOV-LINK-DATA-BINDINGS"); private static final SubLSymbol REMOV_LINK_DATA_SUPPORTS = makeSymbol("REMOV-LINK-DATA-SUPPORTS"); private static final SubLSymbol _CSETF_REMOV_LINK_DATA_SUPPORTS = makeSymbol("_CSETF-REMOV-LINK-DATA-SUPPORTS"); private static final SubLString $str18$Invalid_slot__S_for_construction_ = makeString("Invalid slot ~S for construction function"); private static final SubLSymbol MAKE_REMOVAL_LINK_DATA = makeSymbol("MAKE-REMOVAL-LINK-DATA"); private static final SubLSymbol VISIT_DEFSTRUCT_OBJECT_REMOVAL_LINK_DATA_METHOD = makeSymbol("VISIT-DEFSTRUCT-OBJECT-REMOVAL-LINK-DATA-METHOD"); private static final SubLSymbol REMOVAL_LINK_P = makeSymbol("REMOVAL-LINK-P"); private static final SubLSymbol BINDING_LIST_P = makeSymbol("BINDING-LIST-P"); private static final SubLList $list34 = list(makeSymbol("HL-MODULE"), makeSymbol("PRODUCTIVITY"), makeSymbol("COMPLETENESS")); private static final SubLSymbol $sym35$CONJUNCTIVE_REMOVAL_MODULE_PRIORITY_ = makeSymbol("CONJUNCTIVE-REMOVAL-MODULE-PRIORITY<"); private static final SubLString $str38$_s_stated_its_applicability_to_th = makeString("~s stated its applicability to the subclause spec ~s, which does not specify more than one literal.\nConjunctive removal modules must apply to more than one literal in the clause."); private static final SubLList $list41 = list(makeSymbol("REMOVAL-BINDINGS"), makeSymbol("JUSTIFICATIONS")); private static final SubLSymbol $CONJUNCTIVE_REMOVAL_EXPAND_ITERATIVE = makeKeyword("CONJUNCTIVE-REMOVAL-EXPAND-ITERATIVE"); private static final SubLSymbol $sym43$HL_VAR_ = makeSymbol("HL-VAR?"); private static final SubLSymbol $CONJUNCTIVE_REMOVAL_EXPAND = makeKeyword("CONJUNCTIVE-REMOVAL-EXPAND"); private static final SubLSymbol $INFERENCE_PROOF_SPEC = makeKeyword("INFERENCE-PROOF-SPEC"); private static final SubLString $str46$Problem_reuse_assumptions_were_vi = makeString("Problem reuse assumptions were violated: ~a did not equal ~a"); private static final SubLString $str47$Couldn_t_find_the_right_conjuncti = makeString("Couldn't find the right conjunctive removal justification for ~S"); private static final SubLList $list50 = list(makeUninternedSymbol("START"), makeUninternedSymbol("END"), makeUninternedSymbol("DELTA")); private static final SubLList $list52 = list(makeSymbol("STORE"), makeSymbol("&BODY"), makeSymbol("BODY")); private static final SubLSymbol $sym53$STORE_VAR = makeUninternedSymbol("STORE-VAR"); private static final SubLSymbol $negation_by_failure$ = makeSymbol("*NEGATION-BY-FAILURE*"); private static final SubLSymbol $sym56$PROBLEM_STORE_NEGATION_BY_FAILURE_ = makeSymbol("PROBLEM-STORE-NEGATION-BY-FAILURE?"); private static final SubLSymbol META_REMOVAL_COMPLETELY_DECIDABLE_POS_REQUIRED = makeSymbol("META-REMOVAL-COMPLETELY-DECIDABLE-POS-REQUIRED"); private static final SubLSymbol $sym59$_EXIT = makeSymbol("%EXIT"); private static final SubLSymbol META_REMOVAL_COMPLETELY_ENUMERABLE_POS_REQUIRED = makeSymbol("META-REMOVAL-COMPLETELY-ENUMERABLE-POS-REQUIRED"); private static final SubLSymbol REMOVAL_ABDUCTION_POS_REQUIRED = makeSymbol("REMOVAL-ABDUCTION-POS-REQUIRED"); private static final SubLSymbol REMOVAL_EVALUATABLE_FCP_UNIFY_REQUIRED = makeSymbol("REMOVAL-EVALUATABLE-FCP-UNIFY-REQUIRED"); private static final SubLSymbol REMOVAL_FCP_CHECK_REQUIRED = makeSymbol("REMOVAL-FCP-CHECK-REQUIRED"); private static final SubLSymbol REMOVAL_ISA_DEFN_POS_REQUIRED = makeSymbol("REMOVAL-ISA-DEFN-POS-REQUIRED"); private static final SubLSymbol REMOVAL_TVA_CHECK_REQUIRED = makeSymbol("REMOVAL-TVA-CHECK-REQUIRED"); private static final SubLSymbol REMOVAL_TVA_UNIFY_REQUIRED = makeSymbol("REMOVAL-TVA-UNIFY-REQUIRED"); private static final SubLSymbol REMOVAL_ASSERTED_TERM_SENTENCES_ARG_INDEX_UNIFY_EXPAND = makeSymbol("REMOVAL-ASSERTED-TERM-SENTENCES-ARG-INDEX-UNIFY-EXPAND"); private static final SubLSymbol REMOVAL_EVAL_EXPAND = makeSymbol("REMOVAL-EVAL-EXPAND"); private static final SubLSymbol REMOVAL_EVALUATE_BIND_EXPAND = makeSymbol("REMOVAL-EVALUATE-BIND-EXPAND"); private static final SubLSymbol REMOVAL_ISA_COLLECTION_CHECK_NEG_EXPAND = makeSymbol("REMOVAL-ISA-COLLECTION-CHECK-NEG-EXPAND"); private static final SubLSymbol REMOVAL_ISA_COLLECTION_CHECK_POS_EXPAND = makeSymbol("REMOVAL-ISA-COLLECTION-CHECK-POS-EXPAND"); private static final SubLSymbol REMOVAL_NAT_ARGUMENT_LOOKUP_EXPAND = makeSymbol("REMOVAL-NAT-ARGUMENT-LOOKUP-EXPAND"); private static final SubLSymbol REMOVAL_NAT_FORMULA_EXPAND = makeSymbol("REMOVAL-NAT-FORMULA-EXPAND"); private static final SubLSymbol REMOVAL_NAT_FUNCTION_LOOKUP_EXPAND = makeSymbol("REMOVAL-NAT-FUNCTION-LOOKUP-EXPAND"); private static final SubLSymbol REMOVAL_NAT_LOOKUP_EXPAND = makeSymbol("REMOVAL-NAT-LOOKUP-EXPAND"); private static final SubLSymbol REMOVAL_REFLEXIVE_ON_EXPAND = makeSymbol("REMOVAL-REFLEXIVE-ON-EXPAND"); private static final SubLSymbol REMOVAL_TVA_CHECK_EXPAND = makeSymbol("REMOVAL-TVA-CHECK-EXPAND"); private static final SubLSymbol $DETERMINE_NEW_REMOVAL_TACTIC_SPECS_FROM_HL_MODULES = makeKeyword("DETERMINE-NEW-REMOVAL-TACTIC-SPECS-FROM-HL-MODULES"); private static final SubLString $str82$For_sentence_____S__Maximum_HL_Mo = makeString("For sentence :~%~S~%Maximum HL Module check cost exceeded by ~A (~A)."); private static final SubLSymbol LITERAL_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE_WITH_SENSE_INT = makeSymbol("LITERAL-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE-WITH-SENSE-INT"); private static final SubLSymbol LITERAL_META_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE = makeSymbol("LITERAL-META-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE"); private static final SubLList $list85 = list(list(makeSymbol("TACTIC"), makeSymbol("MT"), makeSymbol("SENSE")), makeSymbol("&BODY"), makeSymbol("BODY")); private static final SubLSymbol $sym86$TACTIC_VAR = makeUninternedSymbol("TACTIC-VAR"); private static final SubLSymbol $inference_expand_hl_module$ = makeSymbol("*INFERENCE-EXPAND-HL-MODULE*"); private static final SubLSymbol TACTIC_HL_MODULE = makeSymbol("TACTIC-HL-MODULE"); private static final SubLSymbol $inference_expand_sense$ = makeSymbol("*INFERENCE-EXPAND-SENSE*"); private static final SubLSymbol WITH_PROBLEM_STORE_REMOVAL_ASSUMPTIONS = makeSymbol("WITH-PROBLEM-STORE-REMOVAL-ASSUMPTIONS"); private static final SubLSymbol TACTIC_STORE = makeSymbol("TACTIC-STORE"); private static final SubLSymbol $REMOVAL_OUTPUT_GENERATE = makeKeyword("REMOVAL-OUTPUT-GENERATE"); private static final SubLSymbol HANDLE_REMOVAL_ADD_NODE_FOR_OUTPUT_GENERATE = makeSymbol("HANDLE-REMOVAL-ADD-NODE-FOR-OUTPUT-GENERATE"); private static final SubLSymbol $MAYBE_MAKE_REMOVAL_TACTIC_EXPAND_RESULTS_PROGRESS_ITERATOR = makeKeyword("MAYBE-MAKE-REMOVAL-TACTIC-EXPAND-RESULTS-PROGRESS-ITERATOR"); private static final SubLSymbol HANDLE_REMOVAL_ADD_NODE_FOR_EXPAND_RESULTS = makeSymbol("HANDLE-REMOVAL-ADD-NODE-FOR-EXPAND-RESULTS"); private static final SubLList $list98 = list(makeSymbol("REMOVAL-BINDINGS"), makeSymbol("SUPPORTS")); private static final SubLString $str99$Ignoring_result_from__S_due_to_op = makeString("Ignoring result from ~S due to open supports"); private static final SubLSymbol $sym100$PRODUCTIVITY__ = makeSymbol("PRODUCTIVITY-<"); private static final SubLSymbol TACTIC_PRODUCTIVITY = makeSymbol("TACTIC-PRODUCTIVITY"); private static final SubLList $list102 = list(list(makeSymbol("RAW-OUTPUT"), makeSymbol("RAW-OUTPUT-ITERATOR")), makeSymbol("&BODY"), makeSymbol("BODY")); private static final SubLSymbol $sym103$ITERATOR = makeUninternedSymbol("ITERATOR"); private static final SubLSymbol ITERATOR_P = makeSymbol("ITERATOR-P"); private static final SubLSymbol ITERATION_FINALIZE = makeSymbol("ITERATION-FINALIZE"); private static final SubLSymbol $MAYBE_MAKE_INFERENCE_OUTPUT_ITERATOR = makeKeyword("MAYBE-MAKE-INFERENCE-OUTPUT-ITERATOR"); private static final SubLSymbol $HANDLE_ONE_OUTPUT_GENERATE_RESULT = makeKeyword("HANDLE-ONE-OUTPUT-GENERATE-RESULT"); private static final SubLList $list112 = list(makeSymbol("&OPTIONAL"), makeSymbol("SUPPORT"), makeSymbol("&REST"), makeSymbol("MORE-SUPPORTS")); private static final SubLString $str114$unknown_thing_to_do_in_the_HL_mod = makeString("unknown thing to do in the HL module guts: ~s"); public static SubLObject removal_link_data_print_function_trampoline(final SubLObject v_object, final SubLObject stream) { compatibility.default_struct_print_function(v_object, stream, ZERO_INTEGER); return NIL; } public static SubLObject removal_link_data_p(final SubLObject v_object) { return v_object.getJavaClass() ==$removal_link_data_native.class ? T : NIL; } public static SubLObject remov_link_data_hl_module(final SubLObject v_object) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.getField2(); } public static SubLObject remov_link_data_bindings(final SubLObject v_object) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.getField3(); } public static SubLObject remov_link_data_supports(final SubLObject v_object) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.getField4(); } public static SubLObject _csetf_remov_link_data_hl_module(final SubLObject v_object, final SubLObject value) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.setField2(value); } public static SubLObject _csetf_remov_link_data_bindings(final SubLObject v_object, final SubLObject value) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.setField3(value); } public static SubLObject _csetf_remov_link_data_supports(final SubLObject v_object, final SubLObject value) { assert NIL != removal_link_data_p(v_object) : "inference_worker_removal.removal_link_data_p error :" + v_object; return v_object.setField4(value); } public static SubLObject make_removal_link_data(SubLObject arglist) { if (arglist == UNPROVIDED) { arglist = NIL; } final SubLObject v_new = new $removal_link_data_native(); SubLObject next; SubLObject current_arg; SubLObject current_value; SubLObject pcase_var; for (next = NIL, next = arglist; NIL != next; next = cddr(next)) { current_arg = next.first(); current_value = cadr(next); pcase_var = current_arg; if (pcase_var.eql($HL_MODULE)) { _csetf_remov_link_data_hl_module(v_new, current_value); } else if (pcase_var.eql($BINDINGS)) { _csetf_remov_link_data_bindings(v_new, current_value); } else if (pcase_var.eql($SUPPORTS)) { _csetf_remov_link_data_supports(v_new, current_value); } else { Errors.error($str18$Invalid_slot__S_for_construction_, current_arg); } } return v_new; } public static SubLObject visit_defstruct_removal_link_data(final SubLObject obj, final SubLObject visitor_fn) { funcall(visitor_fn, obj, $BEGIN, MAKE_REMOVAL_LINK_DATA, THREE_INTEGER); funcall(visitor_fn, obj, $SLOT, $HL_MODULE, remov_link_data_hl_module(obj)); funcall(visitor_fn, obj, $SLOT, $BINDINGS, remov_link_data_bindings(obj)); funcall(visitor_fn, obj, $SLOT, $SUPPORTS, remov_link_data_supports(obj)); funcall(visitor_fn, obj, $END, MAKE_REMOVAL_LINK_DATA, THREE_INTEGER); return obj; } public static SubLObject visit_defstruct_object_removal_link_data_method(final SubLObject obj, final SubLObject visitor_fn) { return visit_defstruct_removal_link_data(obj, visitor_fn); } public static SubLObject new_removal_link(final SubLObject problem, final SubLObject hl_module, final SubLObject removal_bindings, final SubLObject supports) { assert NIL != inference_datastructures_problem.problem_p(problem) : "inference_datastructures_problem.problem_p(problem) " + "CommonSymbols.NIL != inference_datastructures_problem.problem_p(problem) " + problem; final SubLObject removal_link = new_removal_link_int(problem, hl_module, removal_bindings, supports); inference_worker.propagate_problem_link(removal_link); return removal_link; } public static SubLObject new_removal_link_int(final SubLObject problem, final SubLObject hl_module, final SubLObject removal_bindings, final SubLObject supports) { final SubLObject removal_link = inference_datastructures_problem_link.new_problem_link($REMOVAL, problem); new_removal_link_data(removal_link); set_removal_link_hl_module(removal_link, hl_module); set_removal_link_bindings(removal_link, removal_bindings); set_removal_link_supports(removal_link, supports); inference_datastructures_problem.index_problem_argument_link(problem, removal_link); return removal_link; } public static SubLObject new_removal_link_data(final SubLObject removal_link) { final SubLObject data = make_removal_link_data(UNPROVIDED); inference_datastructures_problem_link.set_problem_link_data(removal_link, data); return removal_link; } public static SubLObject destroy_removal_link(final SubLObject removal_link) { inference_datastructures_problem.deindex_problem_argument_link(inference_datastructures_problem_link.problem_link_supported_problem(removal_link), removal_link); final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); _csetf_remov_link_data_hl_module(data, $FREE); _csetf_remov_link_data_bindings(data, $FREE); _csetf_remov_link_data_supports(data, $FREE); return removal_link; } public static SubLObject removal_link_hl_module(final SubLObject removal_link) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); return remov_link_data_hl_module(data); } public static SubLObject removal_link_bindings(final SubLObject removal_link) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); return remov_link_data_bindings(data); } public static SubLObject removal_link_supports(final SubLObject removal_link) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); return remov_link_data_supports(data); } public static SubLObject set_removal_link_hl_module(final SubLObject removal_link, final SubLObject hl_module) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; assert NIL != inference_modules.hl_module_p(hl_module) : "inference_modules.hl_module_p(hl_module) " + "CommonSymbols.NIL != inference_modules.hl_module_p(hl_module) " + hl_module; final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); _csetf_remov_link_data_hl_module(data, hl_module); return removal_link; } public static SubLObject set_removal_link_bindings(final SubLObject removal_link, final SubLObject v_bindings) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; assert NIL != bindings.binding_list_p(v_bindings) : "bindings.binding_list_p(v_bindings) " + "CommonSymbols.NIL != bindings.binding_list_p(v_bindings) " + v_bindings; final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); _csetf_remov_link_data_bindings(data, v_bindings); return removal_link; } public static SubLObject set_removal_link_supports(final SubLObject removal_link, final SubLObject supports) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; assert NIL != arguments.hl_justification_p(supports) : "arguments.hl_justification_p(supports) " + "CommonSymbols.NIL != arguments.hl_justification_p(supports) " + supports; if (NIL != inference_datastructures_problem_store.problem_store_compute_answer_justificationsP(inference_datastructures_problem_link.problem_link_store(removal_link))) { final SubLObject data = inference_datastructures_problem_link.problem_link_data(removal_link); _csetf_remov_link_data_supports(data, supports); } return removal_link; } public static SubLObject removal_link_tactic(final SubLObject removal_link) { assert NIL != removal_link_p(removal_link) : "inference_worker_removal.removal_link_p(removal_link) " + "CommonSymbols.NIL != inference_worker_removal.removal_link_p(removal_link) " + removal_link; final SubLObject hl_module = removal_link_hl_module(removal_link); final SubLObject problem = inference_datastructures_problem_link.problem_link_supported_problem(removal_link); final SubLObject store = inference_datastructures_problem_link.problem_link_store(removal_link); if (NIL != inference_modules.removal_module_p(hl_module)) { SubLObject cdolist_list_var = inference_datastructures_problem.problem_tactics(problem); SubLObject candidate_tactic = NIL; candidate_tactic = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if ((NIL != inference_datastructures_problem.do_problem_tactics_type_match(candidate_tactic, $REMOVAL)) && inference_datastructures_tactic.tactic_hl_module(candidate_tactic).eql(hl_module)) { return candidate_tactic; } cdolist_list_var = cdolist_list_var.rest(); candidate_tactic = cdolist_list_var.first(); } if ((NIL != inference_datastructures_problem_store.problem_store_add_restriction_layer_of_indirectionP(store)) && (NIL != inference_datastructures_problem.closed_problem_p(problem))) { final SubLObject set_contents_var = inference_datastructures_problem.problem_dependent_links(problem); SubLObject basis_object; SubLObject state; SubLObject restriction_link; SubLObject unrestricted_problem; SubLObject cdolist_list_var2; SubLObject candidate_tactic2; for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { restriction_link = set_contents.do_set_contents_next(basis_object, state); if ((NIL != set_contents.do_set_contents_element_validP(state, restriction_link)) && (NIL != inference_datastructures_problem_link.problem_link_has_typeP(restriction_link, $RESTRICTION))) { unrestricted_problem = inference_datastructures_problem_link.problem_link_supported_problem(restriction_link); cdolist_list_var2 = inference_datastructures_problem.problem_tactics(unrestricted_problem); candidate_tactic2 = NIL; candidate_tactic2 = cdolist_list_var2.first(); while (NIL != cdolist_list_var2) { if ((NIL != inference_datastructures_problem.do_problem_tactics_type_match(candidate_tactic2, $REMOVAL)) && inference_datastructures_tactic.tactic_hl_module(candidate_tactic2).eql(hl_module)) { return candidate_tactic2; } cdolist_list_var2 = cdolist_list_var2.rest(); candidate_tactic2 = cdolist_list_var2.first(); } } } } } else { final SubLObject set_contents_var = inference_datastructures_problem.problem_dependent_links(problem); SubLObject basis_object; SubLObject state; SubLObject cdolist_list_var2; SubLObject candidate_tactic2; SubLObject split_link; SubLObject split_problem; SubLObject set_contents_var_$1; SubLObject basis_object_$2; SubLObject state_$3; SubLObject restriction_link2; SubLObject unrestricted_problem2; SubLObject cdolist_list_var3; SubLObject candidate_tactic3; for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { split_link = set_contents.do_set_contents_next(basis_object, state); if ((NIL != set_contents.do_set_contents_element_validP(state, split_link)) && (NIL != inference_datastructures_problem_link.problem_link_has_typeP(split_link, $SPLIT))) { split_problem = inference_datastructures_problem_link.problem_link_supported_problem(split_link); cdolist_list_var2 = inference_datastructures_problem.problem_tactics(split_problem); candidate_tactic2 = NIL; candidate_tactic2 = cdolist_list_var2.first(); while (NIL != cdolist_list_var2) { if ((NIL != inference_datastructures_problem.do_problem_tactics_type_match(candidate_tactic2, $REMOVAL_CONJUNCTIVE)) && inference_datastructures_tactic.tactic_hl_module(candidate_tactic2).eql(hl_module)) { return candidate_tactic2; } cdolist_list_var2 = cdolist_list_var2.rest(); candidate_tactic2 = cdolist_list_var2.first(); } set_contents_var_$1 = inference_datastructures_problem.problem_dependent_links(split_problem); for (basis_object_$2 = set_contents.do_set_contents_basis_object(set_contents_var_$1), state_$3 = NIL, state_$3 = set_contents.do_set_contents_initial_state(basis_object_$2, set_contents_var_$1); NIL == set_contents.do_set_contents_doneP(basis_object_$2, state_$3); state_$3 = set_contents.do_set_contents_update_state(state_$3)) { restriction_link2 = set_contents.do_set_contents_next(basis_object_$2, state_$3); if ((NIL != set_contents.do_set_contents_element_validP(state_$3, restriction_link2)) && (NIL != inference_datastructures_problem_link.problem_link_has_typeP(restriction_link2, $RESTRICTION))) { unrestricted_problem2 = inference_datastructures_problem_link.problem_link_supported_problem(restriction_link2); cdolist_list_var3 = inference_datastructures_problem.problem_tactics(unrestricted_problem2); candidate_tactic3 = NIL; candidate_tactic3 = cdolist_list_var3.first(); while (NIL != cdolist_list_var3) { if ((NIL != inference_datastructures_problem.do_problem_tactics_type_match(candidate_tactic3, $REMOVAL_CONJUNCTIVE)) && inference_datastructures_tactic.tactic_hl_module(candidate_tactic3).eql(hl_module)) { return candidate_tactic3; } cdolist_list_var3 = cdolist_list_var3.rest(); candidate_tactic3 = cdolist_list_var3.first(); } } } } } } return NIL; } public static SubLObject removal_link_data_equals_specP(final SubLObject removal_link, final SubLObject removal_bindings, final SubLObject supports) { final SubLObject link_removal_bindings = removal_link_bindings(removal_link); final SubLObject link_supports = removal_link_supports(removal_link); return makeBoolean(removal_bindings.equal(link_removal_bindings) && (NIL != arguments.justification_equal(supports, link_supports))); } public static SubLObject generalized_removal_tactic_p(final SubLObject v_object) { return makeBoolean(((NIL != removal_tactic_p(v_object)) || (NIL != conjunctive_removal_tactic_p(v_object))) || (NIL != meta_removal_tactic_p(v_object))); } public static SubLObject conjunctive_removal_tactic_p(final SubLObject tactic) { return makeBoolean((NIL != inference_datastructures_tactic.tactic_p(tactic)) && ($REMOVAL_CONJUNCTIVE == inference_datastructures_tactic.tactic_type(tactic))); } public static SubLObject conjunctive_removal_link_p(final SubLObject link) { return makeBoolean((NIL != removal_link_p(link)) && (NIL != inference_modules.conjunctive_removal_module_p(removal_link_hl_module(link)))); } public static SubLObject conjunctive_removal_proof_p(final SubLObject proof) { return makeBoolean((NIL != inference_datastructures_proof.proof_p(proof)) && (NIL != conjunctive_removal_link_p(inference_datastructures_proof.proof_link(proof)))); } public static SubLObject determine_new_conjunctive_removal_tactics(final SubLObject problem, final SubLObject dnf_clause) { final SubLThread thread = SubLProcess.currentSubLThread(); if (NIL == inference_datastructures_problem_store.problem_store_removal_allowedP(inference_datastructures_problem.problem_store(problem))) { return NIL; } SubLObject supplanted_hl_modules = NIL; SubLObject tactic_specs = NIL; SubLObject exclusive_foundP = NIL; final SubLObject common_mt = inference_czer.contextualized_dnf_clause_common_mt(dnf_clause); final SubLObject mt_var = mt_relevance_macros.with_inference_mt_relevance_validate(common_mt); final SubLObject _prev_bind_0 = mt_relevance_macros.$mt$.currentBinding(thread); final SubLObject _prev_bind_2 = mt_relevance_macros.$relevant_mt_function$.currentBinding(thread); final SubLObject _prev_bind_3 = mt_relevance_macros.$relevant_mts$.currentBinding(thread); try { mt_relevance_macros.$mt$.bind(mt_relevance_macros.update_inference_mt_relevance_mt(mt_var), thread); mt_relevance_macros.$relevant_mt_function$.bind(mt_relevance_macros.update_inference_mt_relevance_function(mt_var), thread); mt_relevance_macros.$relevant_mts$.bind(mt_relevance_macros.update_inference_mt_relevance_mt_list(mt_var), thread); SubLObject hl_modules = determine_applicable_conjunctive_removal_modules(dnf_clause); hl_modules = sort_applicable_conjunctive_removal_modules_by_priority(hl_modules); if (NIL == exclusive_foundP) { SubLObject csome_list_var = hl_modules; SubLObject hl_module = NIL; hl_module = csome_list_var.first(); while ((NIL == exclusive_foundP) && (NIL != csome_list_var)) { if ((NIL == supplanted_hl_modules) || (NIL == member(hl_module, supplanted_hl_modules, UNPROVIDED, UNPROVIDED))) { final SubLObject exclusive_func = inference_modules.hl_module_exclusive_func(hl_module); if ((NIL == exclusive_func) || (exclusive_func.isFunctionSpec() && (NIL != funcall(exclusive_func, dnf_clause)))) { if (NIL != exclusive_func) { thread.resetMultipleValues(); final SubLObject exclusive_foundP_$4 = update_supplanted_modules_wrt_tactic_specs(hl_module, tactic_specs, supplanted_hl_modules); final SubLObject tactic_specs_$5 = thread.secondMultipleValue(); final SubLObject supplanted_hl_modules_$6 = thread.thirdMultipleValue(); thread.resetMultipleValues(); exclusive_foundP = exclusive_foundP_$4; tactic_specs = tactic_specs_$5; supplanted_hl_modules = supplanted_hl_modules_$6; } final SubLObject cost = inference_modules.hl_module_clause_cost(hl_module, dnf_clause); if (NIL != cost) { final SubLObject productivity = inference_datastructures_enumerated_types.productivity_for_number_of_children(cost); final SubLObject completeness = inference_modules.hl_module_clause_completeness(hl_module, dnf_clause); final SubLObject tactic_spec = list(hl_module, productivity, completeness); tactic_specs = cons(tactic_spec, tactic_specs); } } } csome_list_var = csome_list_var.rest(); hl_module = csome_list_var.first(); } } SubLObject cdolist_list_var = tactic_specs; SubLObject tactic_spec2 = NIL; tactic_spec2 = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject current; final SubLObject datum = current = tactic_spec2; SubLObject hl_module2 = NIL; SubLObject productivity2 = NIL; SubLObject completeness2 = NIL; destructuring_bind_must_consp(current, datum, $list34); hl_module2 = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list34); productivity2 = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list34); completeness2 = current.first(); current = current.rest(); if (NIL == current) { new_conjunctive_removal_tactic(problem, hl_module2, productivity2, completeness2); } else { cdestructuring_bind_error(datum, $list34); } cdolist_list_var = cdolist_list_var.rest(); tactic_spec2 = cdolist_list_var.first(); } } finally { mt_relevance_macros.$relevant_mts$.rebind(_prev_bind_3, thread); mt_relevance_macros.$relevant_mt_function$.rebind(_prev_bind_2, thread); mt_relevance_macros.$mt$.rebind(_prev_bind_0, thread); } return tactic_specs; } public static SubLObject sort_applicable_conjunctive_removal_modules_by_priority(final SubLObject hl_modules) { return Sort.sort(hl_modules, $sym35$CONJUNCTIVE_REMOVAL_MODULE_PRIORITY_, UNPROVIDED); } public static SubLObject conjunctive_removal_module_priorityL(final SubLObject hl_module1, final SubLObject hl_module2) { if ((NIL != removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module1)) && (NIL == removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module2))) { return T; } if ((NIL != removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module2)) && (NIL == removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module1))) { return NIL; } if ((NIL != simplification_modules.simplification_module_p(hl_module1)) && (NIL == simplification_modules.simplification_module_p(hl_module2))) { return T; } if ((NIL != simplification_modules.simplification_module_p(hl_module2)) && (NIL == simplification_modules.simplification_module_p(hl_module1))) { return NIL; } return T; } public static SubLObject determine_applicable_conjunctive_removal_modules(final SubLObject contextualized_dnf_clause) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject some_backchain_requiredP = inference_trampolines.inference_some_backchain_required_asent_in_clauseP(contextualized_dnf_clause); SubLObject applicable_modules = NIL; final SubLObject allowed_modules_spec = (NIL != inference_macros.current_controlling_inference()) ? inference_datastructures_inference.inference_allowed_modules(inference_macros.current_controlling_inference()) : $ALL; final SubLObject set_var = inference_modules.removal_modules_conjunctive(); final SubLObject set_contents_var = set.do_set_internal(set_var); SubLObject basis_object; SubLObject state; SubLObject hl_module; SubLObject _prev_bind_0; SubLObject cdolist_list_var; SubLObject new_subclause_specs; SubLObject subclause_spec; for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { hl_module = set_contents.do_set_contents_next(basis_object, state); if (((NIL != set_contents.do_set_contents_element_validP(state, hl_module)) && (((NIL == some_backchain_requiredP) || (NIL != removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module))) || ((NIL != inference_worker_restriction.$simplification_tactics_execute_early_and_pass_down_transformation_motivationP$.getDynamicValue(thread)) && (NIL != simplification_modules.simplification_module_p(hl_module))))) && (NIL != inference_modules.hl_module_allowed_by_allowed_modules_specP(hl_module, allowed_modules_spec))) { _prev_bind_0 = sksi_macros.$sksi_crm_only_total_subclause_specs_relevantP$.currentBinding(thread); try { sksi_macros.$sksi_crm_only_total_subclause_specs_relevantP$.bind(T, thread); if (NIL != inference_modules.hl_module_direction_relevantP(hl_module)) { new_subclause_specs = cdolist_list_var = hl_module_applicable_subclause_specs(hl_module, contextualized_dnf_clause); subclause_spec = NIL; subclause_spec = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (NIL != clause_utilities.total_subclause_specP(subclause_spec, contextualized_dnf_clause)) { applicable_modules = cons(hl_module, applicable_modules); } cdolist_list_var = cdolist_list_var.rest(); subclause_spec = cdolist_list_var.first(); } } } finally { sksi_macros.$sksi_crm_only_total_subclause_specs_relevantP$.rebind(_prev_bind_0, thread); } } } return applicable_modules; } public static SubLObject motivated_multi_literal_subclause_specs(final SubLObject contextualized_dnf_clause) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject subclause_specs = NIL; if (NIL == inference_trampolines.inference_some_backchain_required_asent_in_clauseP(contextualized_dnf_clause)) { final SubLObject mt_var; final SubLObject common_mt = mt_var = inference_czer.contextualized_dnf_clause_common_mt(contextualized_dnf_clause); final SubLObject _prev_bind_0 = mt_relevance_macros.$mt$.currentBinding(thread); final SubLObject _prev_bind_2 = mt_relevance_macros.$relevant_mt_function$.currentBinding(thread); final SubLObject _prev_bind_3 = mt_relevance_macros.$relevant_mts$.currentBinding(thread); try { mt_relevance_macros.$mt$.bind(mt_relevance_macros.update_inference_mt_relevance_mt(mt_var), thread); mt_relevance_macros.$relevant_mt_function$.bind(mt_relevance_macros.update_inference_mt_relevance_function(mt_var), thread); mt_relevance_macros.$relevant_mts$.bind(mt_relevance_macros.update_inference_mt_relevance_mt_list(mt_var), thread); final SubLObject set_var = inference_modules.removal_modules_conjunctive(); final SubLObject set_contents_var = set.do_set_internal(set_var); SubLObject basis_object; SubLObject state; SubLObject hl_module; SubLObject cdolist_list_var; SubLObject new_subclause_specs; SubLObject subclause_spec; SubLObject item_var; for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { hl_module = set_contents.do_set_contents_next(basis_object, state); if ((((NIL != set_contents.do_set_contents_element_validP(state, hl_module)) && (NIL == removal_modules_conjunctive_pruning.conjunctive_pruning_module_p(hl_module))) && (NIL == simplification_modules.simplification_module_p(hl_module))) && (NIL != inference_modules.hl_module_direction_relevantP(hl_module))) { new_subclause_specs = cdolist_list_var = hl_module_applicable_subclause_specs(hl_module, contextualized_dnf_clause); subclause_spec = NIL; subclause_spec = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (NIL == clause_utilities.total_subclause_specP(subclause_spec, contextualized_dnf_clause)) { item_var = subclause_spec; if (NIL == member(item_var, subclause_specs, symbol_function(EQUAL), symbol_function(IDENTITY))) { subclause_specs = cons(item_var, subclause_specs); } } cdolist_list_var = cdolist_list_var.rest(); subclause_spec = cdolist_list_var.first(); } } } } finally { mt_relevance_macros.$relevant_mts$.rebind(_prev_bind_3, thread); mt_relevance_macros.$relevant_mt_function$.rebind(_prev_bind_2, thread); mt_relevance_macros.$mt$.rebind(_prev_bind_0, thread); } } return nreverse(subclause_specs); } public static SubLObject hl_module_applicable_subclause_specs(final SubLObject hl_module, final SubLObject contextualized_dnf_clause) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject allowed_modules_spec = (NIL != inference_macros.current_controlling_inference()) ? inference_datastructures_inference.inference_allowed_modules(inference_macros.current_controlling_inference()) : $ALL; if (NIL == inference_modules.hl_module_allowed_by_allowed_modules_specP(hl_module, allowed_modules_spec)) { return NIL; } SubLObject cdolist_list_var; final SubLObject every_predicates = cdolist_list_var = inference_modules.hl_module_every_predicates(hl_module); SubLObject predicate = NIL; predicate = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (NIL == inference_datastructures_problem_query.contextualized_clause_has_literal_with_predicateP(contextualized_dnf_clause, predicate)) { return NIL; } cdolist_list_var = cdolist_list_var.rest(); predicate = cdolist_list_var.first(); } SubLObject subclause_specs = NIL; final SubLObject applicability_pattern = inference_modules.hl_module_applicability_pattern(hl_module); if (NIL != applicability_pattern) { subclause_specs = formula_pattern_match.pattern_transform_formula(applicability_pattern, contextualized_dnf_clause, UNPROVIDED); } else { final SubLObject applicability_method = inference_modules.hl_module_applicability_func(hl_module); if (applicability_method.isFunctionSpec()) { final SubLObject last_metric_type = hl_macros.$forward_inference_metric_last_metric_type$.getDynamicValue(thread); final SubLObject last_metric = hl_macros.$forward_inference_metric_last_metric$.getDynamicValue(thread); final SubLObject last_gaf = hl_macros.$forward_inference_metric_last_forward_inference_gaf$.getDynamicValue(thread); final SubLObject last_rule = hl_macros.$forward_inference_metric_last_forward_inference_rule$.getDynamicValue(thread); if ((NIL != last_metric_type) && (NIL != last_metric)) { inference_metrics.increment_forward_inference_metrics(last_metric_type, last_metric, last_gaf, last_rule, ZERO_INTEGER); } final SubLObject _prev_bind_0 = hl_macros.$forward_inference_metric_last_metric_type$.currentBinding(thread); final SubLObject _prev_bind_2 = hl_macros.$forward_inference_metric_last_metric$.currentBinding(thread); final SubLObject _prev_bind_3 = hl_macros.$forward_inference_metric_last_forward_inference_gaf$.currentBinding(thread); final SubLObject _prev_bind_4 = hl_macros.$forward_inference_metric_last_forward_inference_rule$.currentBinding(thread); try { hl_macros.$forward_inference_metric_last_metric_type$.bind($INFERENCE, thread); hl_macros.$forward_inference_metric_last_metric$.bind(applicability_method, thread); hl_macros.$forward_inference_metric_last_forward_inference_gaf$.bind(NIL, thread); hl_macros.$forward_inference_metric_last_forward_inference_rule$.bind(NIL, thread); try { subclause_specs = funcall(applicability_method, contextualized_dnf_clause); } finally { final SubLObject _prev_bind_0_$7 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); inference_metrics.increment_forward_inference_metrics($INFERENCE, applicability_method, NIL, NIL, NIL); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$7, thread); } } } finally { hl_macros.$forward_inference_metric_last_forward_inference_rule$.rebind(_prev_bind_4, thread); hl_macros.$forward_inference_metric_last_forward_inference_gaf$.rebind(_prev_bind_3, thread); hl_macros.$forward_inference_metric_last_metric$.rebind(_prev_bind_2, thread); hl_macros.$forward_inference_metric_last_metric_type$.rebind(_prev_bind_0, thread); } } } SubLObject cdolist_list_var2 = subclause_specs; SubLObject subclause_spec = NIL; subclause_spec = cdolist_list_var2.first(); while (NIL != cdolist_list_var2) { if ((NIL == Errors.$ignore_mustsP$.getDynamicValue(thread)) && (NIL == clause_utilities.multi_literal_subclause_specP(subclause_spec))) { Errors.error($str38$_s_stated_its_applicability_to_th, hl_module, subclause_spec); } cdolist_list_var2 = cdolist_list_var2.rest(); subclause_spec = cdolist_list_var2.first(); } return subclause_specs; } public static SubLObject new_conjunctive_removal_tactic(final SubLObject problem, final SubLObject hl_module, final SubLObject productivity, final SubLObject completeness) { final SubLObject tactic = inference_datastructures_tactic.new_tactic(problem, hl_module, UNPROVIDED); inference_datastructures_tactic.set_tactic_productivity(tactic, productivity, UNPROVIDED); inference_datastructures_tactic.set_tactic_completeness(tactic, completeness); final SubLObject store = inference_datastructures_problem.problem_store(problem); final SubLObject idx = inference_datastructures_problem_store.problem_store_inference_id_index(store); if (NIL == id_index_objects_empty_p(idx, $SKIP)) { final SubLObject idx_$8 = idx; if (NIL == id_index_dense_objects_empty_p(idx_$8, $SKIP)) { final SubLObject vector_var = id_index_dense_objects(idx_$8); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject id; SubLObject inference; SubLObject inference_var; SubLObject set_var; SubLObject set_contents_var; SubLObject basis_object; SubLObject state; SubLObject strategy; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { id = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; inference = aref(vector_var, id); if ((NIL == id_index_tombstone_p(inference)) || (NIL == id_index_skip_tombstones_p($SKIP))) { if (NIL != id_index_tombstone_p(inference)) { inference = $SKIP; } if (NIL != inference_datastructures_problem.problem_relevant_to_inferenceP(problem, inference)) { inference_var = inference; set_var = inference_datastructures_inference.inference_strategy_set(inference_var); set_contents_var = set.do_set_internal(set_var); for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { strategy = set_contents.do_set_contents_next(basis_object, state); if (NIL != set_contents.do_set_contents_element_validP(state, strategy)) { inference_tactician.strategy_note_new_tactic(strategy, tactic); } } } } } } final SubLObject idx_$9 = idx; if (NIL == id_index_sparse_objects_empty_p(idx_$9)) { final SubLObject cdohash_table = id_index_sparse_objects(idx_$9); SubLObject id2 = NIL; SubLObject inference2 = NIL; final Iterator cdohash_iterator = getEntrySetIterator(cdohash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); id2 = getEntryKey(cdohash_entry); inference2 = getEntryValue(cdohash_entry); if (NIL != inference_datastructures_problem.problem_relevant_to_inferenceP(problem, inference2)) { final SubLObject inference_var2 = inference2; final SubLObject set_var2 = inference_datastructures_inference.inference_strategy_set(inference_var2); final SubLObject set_contents_var2 = set.do_set_internal(set_var2); SubLObject basis_object2; SubLObject state2; SubLObject strategy2; for (basis_object2 = set_contents.do_set_contents_basis_object(set_contents_var2), state2 = NIL, state2 = set_contents.do_set_contents_initial_state(basis_object2, set_contents_var2); NIL == set_contents.do_set_contents_doneP(basis_object2, state2); state2 = set_contents.do_set_contents_update_state(state2)) { strategy2 = set_contents.do_set_contents_next(basis_object2, state2); if (NIL != set_contents.do_set_contents_element_validP(state2, strategy2)) { inference_tactician.strategy_note_new_tactic(strategy2, tactic); } } } } } finally { releaseEntrySetIterator(cdohash_iterator); } } } return tactic; } public static SubLObject compute_strategic_properties_of_conjunctive_removal_tactic(final SubLObject tactic, final SubLObject strategy) { return tactic; } public static SubLObject execute_conjunctive_removal_tactic(final SubLObject tactic) { if (NIL != inference_datastructures_tactic.tactic_in_progressP(tactic)) { inference_datastructures_tactic.tactic_in_progress_next(tactic); } else { final SubLObject progress_iterator = maybe_make_conjunctive_removal_tactic_progress_iterator(tactic); if ((NIL != inference_datastructures_tactic.valid_tactic_p(tactic)) && (NIL != inference_tactician_strategic_uninterestingness.tactic_completeP(tactic, $TACTICAL))) { inference_worker.possibly_discard_all_other_possible_structural_conjunctive_tactics(tactic); } if (NIL != progress_iterator) { if (progress_iterator.isList()) { SubLObject cdolist_list_var = progress_iterator; SubLObject execution_result = NIL; execution_result = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject current; final SubLObject datum = current = execution_result; SubLObject removal_bindings = NIL; SubLObject justifications = NIL; destructuring_bind_must_consp(current, datum, $list41); removal_bindings = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list41); justifications = current.first(); current = current.rest(); if (NIL == current) { handle_one_conjunctive_removal_tactic_result(tactic, removal_bindings, justifications); } else { cdestructuring_bind_error(datum, $list41); } cdolist_list_var = cdolist_list_var.rest(); execution_result = cdolist_list_var.first(); } } else { inference_datastructures_tactic.note_tactic_progress_iterator(tactic, progress_iterator); } } } return tactic; } public static SubLObject maybe_make_conjunctive_removal_tactic_progress_iterator(final SubLObject tactic) { return NIL != inference_modules.hl_module_expand_iterative_pattern(inference_datastructures_tactic.tactic_hl_module(tactic)) ? maybe_make_conjunctive_removal_tactic_progress_expand_iterative_iterator(tactic) : maybe_make_conjunctive_removal_tactic_progress_expand_iterator(tactic); } public static SubLObject maybe_make_conjunctive_removal_tactic_progress_expand_iterative_iterator(final SubLObject tactic) { final SubLObject contextualized_dnf_clause = inference_datastructures_tactic.tactic_problem_sole_clause(tactic); final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(tactic); final SubLObject pattern = inference_modules.hl_module_expand_iterative_pattern(hl_module); final SubLObject iterator = formula_pattern_match.pattern_transform_formula(pattern, contextualized_dnf_clause, UNPROVIDED); if (NIL != iterator) { inference_datastructures_tactic.possibly_update_tactic_productivity_from_iterator(tactic, iterator); return new_conjunctive_removal_tactic_progress_expand_iterative_iterator(tactic, iterator); } return NIL; } public static SubLObject new_conjunctive_removal_tactic_progress_expand_iterative_iterator(final SubLObject tactic, final SubLObject output_iterator) { return inference_datastructures_tactic.new_tactic_progress_iterator($CONJUNCTIVE_REMOVAL_EXPAND_ITERATIVE, tactic, output_iterator); } public static SubLObject handle_one_conjunctive_removal_tactic_expand_iterative_result(final SubLObject tactic, final SubLObject output_iterator) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject result = NIL; thread.resetMultipleValues(); final SubLObject raw_output = iteration.iteration_next(output_iterator); final SubLObject validP = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != validP) { SubLObject current; final SubLObject datum = current = raw_output; SubLObject removal_bindings = NIL; SubLObject justifications = NIL; destructuring_bind_must_consp(current, datum, $list41); removal_bindings = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list41); justifications = current.first(); current = current.rest(); if (NIL == current) { SubLObject cdolist_list_var = cycl_utilities.expression_gather(inference_datastructures_problem.problem_query(inference_datastructures_tactic.tactic_problem(tactic)), $sym43$HL_VAR_, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED); SubLObject var = NIL; var = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (NIL == bindings.variable_lookup(var, removal_bindings)) { removal_bindings = bindings.add_dont_care_variable_binding(var, removal_bindings); } cdolist_list_var = cdolist_list_var.rest(); var = cdolist_list_var.first(); } result = handle_one_conjunctive_removal_tactic_result(tactic, removal_bindings, justifications); } else { cdestructuring_bind_error(datum, $list41); } } return result; } public static SubLObject maybe_make_conjunctive_removal_tactic_progress_expand_iterator(final SubLObject tactic) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject contextualized_dnf_clause = inference_datastructures_tactic.tactic_problem_sole_clause(tactic); final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(tactic); final SubLObject expand_pattern = inference_modules.hl_module_expand_pattern(hl_module); final SubLObject expand_function = (NIL != expand_pattern) ? NIL : inference_modules.hl_module_expand_func(hl_module); SubLObject expand_results = NIL; final SubLObject _prev_bind_0 = $conjunctive_removal_tactic_expand_results_queue$.currentBinding(thread); try { $conjunctive_removal_tactic_expand_results_queue$.bind(NIL, thread); if (NIL != expand_pattern) { formula_pattern_match.pattern_transform_formula(expand_pattern, contextualized_dnf_clause, UNPROVIDED); } else if (expand_function.isFunctionSpec()) { funcall(expand_function, contextualized_dnf_clause); } if (NIL != $conjunctive_removal_tactic_expand_results_queue$.getDynamicValue(thread)) { expand_results = $conjunctive_removal_tactic_expand_results_queue$.getDynamicValue(thread); } } finally { $conjunctive_removal_tactic_expand_results_queue$.rebind(_prev_bind_0, thread); } final SubLObject new_productivity = inference_datastructures_enumerated_types.productivity_for_number_of_children(length(expand_results)); inference_datastructures_tactic.update_tactic_productivity(tactic, new_productivity); if (NIL != list_utilities.lengthGE(expand_results, $removal_tactic_iteration_threshold$.getDynamicValue(thread), UNPROVIDED)) { expand_results = new_conjunctive_removal_tactic_progress_expand_iterator(tactic, expand_results); } return expand_results; } public static SubLObject new_conjunctive_removal_tactic_progress_expand_iterator(final SubLObject tactic, final SubLObject results) { return inference_datastructures_tactic.new_tactic_progress_iterator($CONJUNCTIVE_REMOVAL_EXPAND, tactic, results); } public static SubLObject conjunctive_removal_callback(SubLObject removal_bindings, final SubLObject justifications) { final SubLThread thread = SubLProcess.currentSubLThread(); removal_bindings = bindings.inference_simplify_unification_bindings(removal_bindings); $conjunctive_removal_tactic_expand_results_queue$.setDynamicValue(cons(list(removal_bindings, justifications), $conjunctive_removal_tactic_expand_results_queue$.getDynamicValue(thread)), thread); return NIL; } public static SubLObject handle_one_conjunctive_removal_tactic_expand_result(final SubLObject tactic, final SubLObject expand_result) { SubLObject removal_bindings = NIL; SubLObject justifications = NIL; destructuring_bind_must_consp(expand_result, expand_result, $list41); removal_bindings = expand_result.first(); SubLObject current = expand_result.rest(); destructuring_bind_must_consp(current, expand_result, $list41); justifications = current.first(); current = current.rest(); if (NIL == current) { return handle_one_conjunctive_removal_tactic_result(tactic, removal_bindings, justifications); } cdestructuring_bind_error(expand_result, $list41); return NIL; } public static SubLObject conjunctive_removal_suppress_split_justificationP() { final SubLThread thread = SubLProcess.currentSubLThread(); if (NIL != $conjunctive_removal_suppress_split_justificationP$.getDynamicValue(thread)) { final SubLObject inf = inference_macros.current_controlling_inference(); final SubLObject metrics = inference_datastructures_inference.inference_metrics_template(inf); return makeBoolean(NIL == find($INFERENCE_PROOF_SPEC, metrics, UNPROVIDED, UNPROVIDED, UNPROVIDED, UNPROVIDED)); } return NIL; } public static SubLObject handle_one_conjunctive_removal_tactic_result(final SubLObject tactic, final SubLObject removal_bindings, final SubLObject justifications) { final SubLThread thread = SubLProcess.currentSubLThread(); inference_datastructures_tactic.decrement_tactic_productivity_for_number_of_children(tactic, ONE_INTEGER); final SubLObject problem = inference_datastructures_tactic.tactic_problem(tactic); final SubLObject compute_answersP = inference_datastructures_problem_store.problem_store_compute_answer_justificationsP(inference_datastructures_problem.problem_store(problem)); if (NIL == justifications) { return maybe_new_simplification_link(problem, tactic, removal_bindings); } if ((NIL != $conjunctive_removal_optimize_when_no_justificationsP$.getDynamicValue(thread)) && (NIL == compute_answersP)) { return maybe_new_removal_link(problem, tactic, removal_bindings, NIL); } if (NIL != conjunctive_removal_suppress_split_justificationP()) { SubLObject supports = NIL; if (justifications.isList()) { SubLObject cdolist_list_var = justifications; SubLObject justification = NIL; justification = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject cdolist_list_var_$10 = justification; SubLObject support = NIL; support = cdolist_list_var_$10.first(); while (NIL != cdolist_list_var_$10) { supports = cons(support, supports); cdolist_list_var_$10 = cdolist_list_var_$10.rest(); support = cdolist_list_var_$10.first(); } cdolist_list_var = cdolist_list_var.rest(); justification = cdolist_list_var.first(); } } if (NIL == removal_bindings) { return maybe_new_removal_link(problem, tactic, removal_bindings, supports); } return maybe_new_restriction_and_removal_link(problem, tactic, removal_bindings, supports); } else { if (NIL == removal_bindings) { return maybe_new_split_and_removal_links(problem, tactic, justifications); } return maybe_new_restriction_split_and_removal_links(problem, tactic, removal_bindings, justifications); } } public static SubLObject maybe_new_simplification_link(final SubLObject problem, final SubLObject tactic, final SubLObject removal_bindings) { final SubLObject restricted_mapped_problem = inference_worker_join_ordered.find_or_create_restricted_problem(problem, removal_bindings); return inference_worker_restriction.maybe_new_restriction_link(problem, restricted_mapped_problem, removal_bindings, NIL, tactic); } public static SubLObject maybe_new_restriction_split_and_removal_links(final SubLObject problem, final SubLObject tactic, final SubLObject removal_bindings, final SubLObject justifications) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject restricted_mapped_problem = inference_worker_join_ordered.find_or_create_restricted_problem(problem, removal_bindings); final SubLObject restricted_problem = inference_datastructures_problem_link.mapped_problem_problem(restricted_mapped_problem); final SubLObject reordered_justifications = reorder_conjunctive_removal_justifications(justifications, problem, removal_bindings, restricted_problem); maybe_new_split_and_removal_links(restricted_problem, tactic, reordered_justifications); final SubLObject restriction_link = inference_worker_restriction.maybe_new_restriction_link(problem, restricted_mapped_problem, removal_bindings, NIL, tactic); final SubLObject restricted_mapped_problem_from_link = inference_datastructures_problem_link.problem_link_sole_supporting_mapped_problem(restriction_link); if ((NIL == Errors.$ignore_mustsP$.getDynamicValue(thread)) && (NIL == inference_datastructures_problem_link.mapped_problem_equal(restricted_mapped_problem_from_link, restricted_mapped_problem))) { Errors.error($str46$Problem_reuse_assumptions_were_vi, restricted_mapped_problem_from_link, restricted_mapped_problem); } return restriction_link; } public static SubLObject reorder_conjunctive_removal_justifications(final SubLObject justifications, final SubLObject unrestricted_problem, final SubLObject restriction_bindings, final SubLObject restricted_problem) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject unrestricted_clause = inference_datastructures_problem.problem_sole_clause(unrestricted_problem); final SubLObject actual_restricted_clause = inference_datastructures_problem.problem_sole_clause(restricted_problem); final SubLObject expected_restricted_clause = bindings.apply_bindings(restriction_bindings, unrestricted_clause); if (actual_restricted_clause.equal(expected_restricted_clause)) { return justifications; } SubLObject reordered_justifications = NIL; SubLObject cdolist_list_var = clauses.neg_lits(actual_restricted_clause); SubLObject actual_asent = NIL; actual_asent = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject expected_clause_index = ZERO_INTEGER; SubLObject foundP; SubLObject rest; SubLObject expected_asent; SubLObject justification; for (foundP = NIL, rest = NIL, rest = clauses.neg_lits(expected_restricted_clause); (NIL == foundP) && (NIL != rest); rest = rest.rest()) { expected_asent = rest.first(); if (expected_asent.equal(actual_asent)) { justification = nth(expected_clause_index, justifications); reordered_justifications = cons(justification, reordered_justifications); foundP = T; } expected_clause_index = add(expected_clause_index, ONE_INTEGER); } for (rest = NIL, rest = clauses.pos_lits(expected_restricted_clause); (NIL == foundP) && (NIL != rest); rest = rest.rest()) { expected_asent = rest.first(); if (expected_asent.equal(actual_asent)) { justification = nth(expected_clause_index, justifications); reordered_justifications = cons(justification, reordered_justifications); foundP = T; } expected_clause_index = add(expected_clause_index, ONE_INTEGER); } if ((NIL == Errors.$ignore_mustsP$.getDynamicValue(thread)) && (NIL == foundP)) { Errors.error($str47$Couldn_t_find_the_right_conjuncti, actual_asent); } cdolist_list_var = cdolist_list_var.rest(); actual_asent = cdolist_list_var.first(); } cdolist_list_var = clauses.pos_lits(actual_restricted_clause); actual_asent = NIL; actual_asent = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject expected_clause_index = ZERO_INTEGER; SubLObject foundP; SubLObject rest; SubLObject expected_asent; SubLObject justification; for (foundP = NIL, rest = NIL, rest = clauses.neg_lits(expected_restricted_clause); (NIL == foundP) && (NIL != rest); rest = rest.rest()) { expected_asent = rest.first(); if (expected_asent.equal(actual_asent)) { justification = nth(expected_clause_index, justifications); reordered_justifications = cons(justification, reordered_justifications); foundP = T; } expected_clause_index = add(expected_clause_index, ONE_INTEGER); } for (rest = NIL, rest = clauses.pos_lits(expected_restricted_clause); (NIL == foundP) && (NIL != rest); rest = rest.rest()) { expected_asent = rest.first(); if (expected_asent.equal(actual_asent)) { justification = nth(expected_clause_index, justifications); reordered_justifications = cons(justification, reordered_justifications); foundP = T; } expected_clause_index = add(expected_clause_index, ONE_INTEGER); } if ((NIL == Errors.$ignore_mustsP$.getDynamicValue(thread)) && (NIL == foundP)) { Errors.error($str47$Couldn_t_find_the_right_conjuncti, actual_asent); } cdolist_list_var = cdolist_list_var.rest(); actual_asent = cdolist_list_var.first(); } reordered_justifications = nreverse(reordered_justifications); return reordered_justifications; } public static SubLObject maybe_new_split_and_removal_links(final SubLObject problem, final SubLObject tactic, SubLObject justifications) { final SubLObject dnf_clause = inference_datastructures_problem.problem_sole_clause(problem); if (NIL != clauses.atomic_clause_p(dnf_clause)) { maybe_new_removal_link(problem, tactic, NIL, justifications.first()); } else { final SubLObject split_link = inference_worker_split.maybe_new_split_link(problem, dnf_clause); inference_worker.problem_link_open_and_repropagate_all(split_link); SubLObject cdolist_list_var = clauses.neg_lits(dnf_clause); SubLObject contextualized_asent = NIL; contextualized_asent = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject literal_supports = justifications.first(); justifications = justifications.rest(); maybe_new_removal_link_for_split_link(split_link, tactic, contextualized_asent, $NEG, literal_supports); cdolist_list_var = cdolist_list_var.rest(); contextualized_asent = cdolist_list_var.first(); } cdolist_list_var = clauses.pos_lits(dnf_clause); contextualized_asent = NIL; contextualized_asent = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject literal_supports = justifications.first(); justifications = justifications.rest(); maybe_new_removal_link_for_split_link(split_link, tactic, contextualized_asent, $POS, literal_supports); cdolist_list_var = cdolist_list_var.rest(); contextualized_asent = cdolist_list_var.first(); } } return NIL; } public static SubLObject maybe_new_removal_link_for_split_link(final SubLObject split_link, final SubLObject tactic, final SubLObject contextualized_asent, final SubLObject sense, final SubLObject literal_supports) { final SubLObject query = inference_datastructures_problem_query.new_problem_query_from_contextualized_asent_sense(contextualized_asent, sense); final SubLObject literal_problem = inference_datastructures_problem_link.find_closed_supporting_problem_by_query(split_link, query); return maybe_new_removal_link(literal_problem, tactic, NIL, literal_supports); } public static SubLObject executed_conjunctive_removal_problems(final SubLObject store, SubLObject module_subtype) { if (module_subtype == UNPROVIDED) { module_subtype = NIL; } SubLObject problems = NIL; final SubLObject idx = inference_datastructures_problem_store.problem_store_problem_id_index(store); if (NIL == id_index_objects_empty_p(idx, $SKIP)) { final SubLObject idx_$11 = idx; if (NIL == id_index_dense_objects_empty_p(idx_$11, $SKIP)) { final SubLObject vector_var = id_index_dense_objects(idx_$11); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject id; SubLObject problem; SubLObject witness; SubLObject rest; SubLObject tactic; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { id = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; problem = aref(vector_var, id); if ((NIL == id_index_tombstone_p(problem)) || (NIL == id_index_skip_tombstones_p($SKIP))) { if (NIL != id_index_tombstone_p(problem)) { problem = $SKIP; } for (witness = NIL, rest = NIL, rest = inference_datastructures_problem.problem_tactics(problem); (NIL == witness) && (NIL != rest); rest = rest.rest()) { tactic = rest.first(); if ((NIL != executed_conjunctive_removal_tactic_p(tactic)) && ((NIL == module_subtype) || (NIL != list_utilities.member_eqP(module_subtype, inference_modules.hl_module_subtypes(inference_datastructures_tactic.tactic_hl_module(tactic)))))) { witness = tactic; } } if (NIL != witness) { problems = cons(problem, problems); } } } } final SubLObject idx_$12 = idx; if ((NIL == id_index_sparse_objects_empty_p(idx_$12)) || (NIL == id_index_skip_tombstones_p($SKIP))) { final SubLObject sparse = id_index_sparse_objects(idx_$12); SubLObject id2 = id_index_sparse_id_threshold(idx_$12); final SubLObject end_id = id_index_next_id(idx_$12); final SubLObject v_default = (NIL != id_index_skip_tombstones_p($SKIP)) ? NIL : $SKIP; while (id2.numL(end_id)) { final SubLObject problem2 = gethash_without_values(id2, sparse, v_default); if ((NIL == id_index_skip_tombstones_p($SKIP)) || (NIL == id_index_tombstone_p(problem2))) { SubLObject witness2; SubLObject rest2; SubLObject tactic2; for (witness2 = NIL, rest2 = NIL, rest2 = inference_datastructures_problem.problem_tactics(problem2); (NIL == witness2) && (NIL != rest2); rest2 = rest2.rest()) { tactic2 = rest2.first(); if ((NIL != executed_conjunctive_removal_tactic_p(tactic2)) && ((NIL == module_subtype) || (NIL != list_utilities.member_eqP(module_subtype, inference_modules.hl_module_subtypes(inference_datastructures_tactic.tactic_hl_module(tactic2)))))) { witness2 = tactic2; } } if (NIL != witness2) { problems = cons(problem2, problems); } } id2 = add(id2, ONE_INTEGER); } } } return nreverse(problems); } public static SubLObject problem_store_has_some_executed_sksi_conjunctive_removal_problemP(final SubLObject store) { SubLObject witness = NIL; final SubLObject idx = inference_datastructures_problem_store.problem_store_problem_id_index(store); if (NIL == id_index_objects_empty_p(idx, $SKIP)) { final SubLObject idx_$13 = idx; if (NIL == id_index_dense_objects_empty_p(idx_$13, $SKIP)) { final SubLObject vector_var = id_index_dense_objects(idx_$13); final SubLObject backwardP_var = NIL; final SubLObject length = length(vector_var); SubLObject current; final SubLObject datum = current = (NIL != backwardP_var) ? list(subtract(length, ONE_INTEGER), MINUS_ONE_INTEGER, MINUS_ONE_INTEGER) : list(ZERO_INTEGER, length, ONE_INTEGER); SubLObject start = NIL; SubLObject end = NIL; SubLObject delta = NIL; destructuring_bind_must_consp(current, datum, $list50); start = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list50); end = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list50); delta = current.first(); current = current.rest(); if (NIL == current) { if (NIL == witness) { SubLObject end_var; SubLObject id; SubLObject problem; SubLObject rest; SubLObject tactic; for (end_var = end, id = NIL, id = start; (NIL == witness) && (NIL == subl_macros.do_numbers_endtest(id, delta, end_var)); id = add(id, delta)) { problem = aref(vector_var, id); if ((NIL == id_index_tombstone_p(problem)) || (NIL == id_index_skip_tombstones_p($SKIP))) { if (NIL != id_index_tombstone_p(problem)) { problem = $SKIP; } for (rest = NIL, rest = inference_datastructures_problem.problem_tactics(problem); (NIL == witness) && (NIL != rest); rest = rest.rest()) { tactic = rest.first(); if ((NIL != executed_conjunctive_removal_tactic_p(tactic)) && (NIL != list_utilities.member_eqP($SKSI, inference_modules.hl_module_subtypes(inference_datastructures_tactic.tactic_hl_module(tactic))))) { witness = tactic; } } } } } } else { cdestructuring_bind_error(datum, $list50); } } final SubLObject idx_$14 = idx; if ((NIL == id_index_sparse_objects_empty_p(idx_$14)) || (NIL == id_index_skip_tombstones_p($SKIP))) { final SubLObject sparse = id_index_sparse_objects(idx_$14); SubLObject id2 = id_index_sparse_id_threshold(idx_$14); final SubLObject end_id = id_index_next_id(idx_$14); final SubLObject v_default = (NIL != id_index_skip_tombstones_p($SKIP)) ? NIL : $SKIP; while (id2.numL(end_id) && (NIL == witness)) { final SubLObject problem2 = gethash_without_values(id2, sparse, v_default); if ((NIL == id_index_skip_tombstones_p($SKIP)) || (NIL == id_index_tombstone_p(problem2))) { SubLObject rest2; SubLObject tactic2; for (rest2 = NIL, rest2 = inference_datastructures_problem.problem_tactics(problem2); (NIL == witness) && (NIL != rest2); rest2 = rest2.rest()) { tactic2 = rest2.first(); if ((NIL != executed_conjunctive_removal_tactic_p(tactic2)) && (NIL != list_utilities.member_eqP($SKSI, inference_modules.hl_module_subtypes(inference_datastructures_tactic.tactic_hl_module(tactic2))))) { witness = tactic2; } } } id2 = add(id2, ONE_INTEGER); } } } return witness; } public static SubLObject executed_conjunctive_removal_tactic_p(final SubLObject tactic) { return makeBoolean((((NIL != conjunctive_removal_tactic_p(tactic)) && ((NIL != inference_datastructures_tactic.tactic_in_progressP(tactic)) || (NIL != inference_datastructures_tactic.tactic_executedP(tactic)))) && (NIL == inference_worker_restriction.simplification_tactic_p(tactic))) && (NIL == removal_modules_conjunctive_pruning.conjunctive_pruning_tactic_p(tactic))); } public static SubLObject with_problem_store_removal_assumptions(final SubLObject macroform, final SubLObject environment) { SubLObject current; final SubLObject datum = current = macroform.rest(); SubLObject store = NIL; destructuring_bind_must_consp(current, datum, $list52); store = current.first(); final SubLObject body; current = body = current.rest(); final SubLObject store_var = $sym53$STORE_VAR; return listS(CLET, list(list(store_var, store), list($negation_by_failure$, list($sym56$PROBLEM_STORE_NEGATION_BY_FAILURE_, store_var))), append(body, NIL)); } public static SubLObject meta_removal_tactic_p(final SubLObject v_object) { return makeBoolean((NIL != inference_datastructures_tactic.tactic_p(v_object)) && ($META_REMOVAL == inference_datastructures_tactic.tactic_type(v_object))); } public static SubLObject compute_strategic_properties_of_meta_removal_tactic(final SubLObject tactic, final SubLObject strategy) { return compute_strategic_properties_of_removal_tactic(tactic, strategy); } public static SubLObject removal_link_p(final SubLObject v_object) { return makeBoolean((NIL != inference_datastructures_problem_link.problem_link_p(v_object)) && ($REMOVAL == inference_datastructures_problem_link.problem_link_type(v_object))); } public static SubLObject removal_tactic_p(final SubLObject v_object) { return makeBoolean((NIL != inference_datastructures_tactic.tactic_p(v_object)) && ($REMOVAL == inference_datastructures_tactic.tactic_type(v_object))); } public static SubLObject removal_proof_p(final SubLObject v_object) { return makeBoolean((NIL != inference_datastructures_proof.proof_p(v_object)) && (NIL != removal_link_p(inference_datastructures_proof.proof_link(v_object)))); } public static SubLObject removal_module_exclusive_func_funcall(final SubLObject func, final SubLObject asent, final SubLObject sense) { return eval_in_api.possibly_cyc_api_funcall_2(func, asent, sense); } public static SubLObject removal_module_required_func_funcall(final SubLObject func, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject last_metric_type = hl_macros.$forward_inference_metric_last_metric_type$.getDynamicValue(thread); final SubLObject last_metric = hl_macros.$forward_inference_metric_last_metric$.getDynamicValue(thread); final SubLObject last_gaf = hl_macros.$forward_inference_metric_last_forward_inference_gaf$.getDynamicValue(thread); final SubLObject last_rule = hl_macros.$forward_inference_metric_last_forward_inference_rule$.getDynamicValue(thread); if ((NIL != last_metric_type) && (NIL != last_metric)) { inference_metrics.increment_forward_inference_metrics(last_metric_type, last_metric, last_gaf, last_rule, ZERO_INTEGER); } final SubLObject _prev_bind_0 = hl_macros.$forward_inference_metric_last_metric_type$.currentBinding(thread); final SubLObject _prev_bind_2 = hl_macros.$forward_inference_metric_last_metric$.currentBinding(thread); final SubLObject _prev_bind_3 = hl_macros.$forward_inference_metric_last_forward_inference_gaf$.currentBinding(thread); final SubLObject _prev_bind_4 = hl_macros.$forward_inference_metric_last_forward_inference_rule$.currentBinding(thread); try { hl_macros.$forward_inference_metric_last_metric_type$.bind($INFERENCE, thread); hl_macros.$forward_inference_metric_last_metric$.bind(func, thread); hl_macros.$forward_inference_metric_last_forward_inference_gaf$.bind(NIL, thread); hl_macros.$forward_inference_metric_last_forward_inference_rule$.bind(NIL, thread); try { if (func.eql(META_REMOVAL_COMPLETELY_DECIDABLE_POS_REQUIRED)) { return meta_removal_modules.meta_removal_completely_decidable_pos_required(asent, sense); } if (func.eql(META_REMOVAL_COMPLETELY_ENUMERABLE_POS_REQUIRED)) { return meta_removal_modules.meta_removal_completely_enumerable_pos_required(asent, sense); } if (func.eql(REMOVAL_ABDUCTION_POS_REQUIRED)) { return removal_modules_abduction.removal_abduction_pos_required(asent, sense); } if (func.eql(REMOVAL_EVALUATABLE_FCP_UNIFY_REQUIRED)) { return removal_modules_function_corresponding_predicate.removal_evaluatable_fcp_unify_required(asent, sense); } if (func.eql(REMOVAL_FCP_CHECK_REQUIRED)) { return removal_modules_function_corresponding_predicate.removal_fcp_check_required(asent, sense); } if (func.eql(REMOVAL_ISA_DEFN_POS_REQUIRED)) { return removal_modules_isa.removal_isa_defn_pos_required(asent, sense); } if (func.eql(REMOVAL_TVA_CHECK_REQUIRED)) { return removal_modules_tva_lookup.removal_tva_check_required(asent, sense); } if (func.eql(REMOVAL_TVA_UNIFY_REQUIRED)) { return removal_modules_tva_lookup.removal_tva_unify_required(asent, sense); } return eval_in_api.possibly_cyc_api_funcall_2(func, asent, sense); } finally { final SubLObject _prev_bind_0_$15 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); inference_metrics.increment_forward_inference_metrics($INFERENCE, func, NIL, NIL, NIL); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0_$15, thread); } } } finally { hl_macros.$forward_inference_metric_last_forward_inference_rule$.rebind(_prev_bind_4, thread); hl_macros.$forward_inference_metric_last_forward_inference_gaf$.rebind(_prev_bind_3, thread); hl_macros.$forward_inference_metric_last_metric$.rebind(_prev_bind_2, thread); hl_macros.$forward_inference_metric_last_metric_type$.rebind(_prev_bind_0, thread); } } public static SubLObject removal_module_expand_func_funcall(final SubLObject func, final SubLObject asent, final SubLObject sense) { if (func.eql(REMOVAL_ASSERTED_TERM_SENTENCES_ARG_INDEX_UNIFY_EXPAND)) { return removal_modules_asserted_formula.removal_asserted_term_sentences_arg_index_unify_expand(asent, sense); } if (func.eql(REMOVAL_EVAL_EXPAND)) { return removal_modules_evaluation.removal_eval_expand(asent, sense); } if (func.eql(REMOVAL_EVALUATE_BIND_EXPAND)) { return removal_modules_evaluate.removal_evaluate_bind_expand(asent, sense); } if (func.eql(REMOVAL_ISA_COLLECTION_CHECK_NEG_EXPAND)) { return removal_modules_isa.removal_isa_collection_check_neg_expand(asent, sense); } if (func.eql(REMOVAL_ISA_COLLECTION_CHECK_POS_EXPAND)) { return removal_modules_isa.removal_isa_collection_check_pos_expand(asent, sense); } if (func.eql(REMOVAL_NAT_ARGUMENT_LOOKUP_EXPAND)) { return removal_modules_natfunction.removal_nat_argument_lookup_expand(asent, sense); } if (func.eql(REMOVAL_NAT_FORMULA_EXPAND)) { return removal_modules_termofunit.removal_nat_formula_expand(asent, sense); } if (func.eql(REMOVAL_NAT_FUNCTION_LOOKUP_EXPAND)) { return removal_modules_natfunction.removal_nat_function_lookup_expand(asent, sense); } if (func.eql(REMOVAL_NAT_LOOKUP_EXPAND)) { return removal_modules_termofunit.removal_nat_lookup_expand(asent, sense); } if (func.eql(REMOVAL_REFLEXIVE_ON_EXPAND)) { return removal_modules_reflexive_on.removal_reflexive_on_expand(asent, sense); } if (func.eql(REMOVAL_TVA_CHECK_EXPAND)) { return removal_modules_tva_lookup.removal_tva_check_expand(asent, sense); } return eval_in_api.possibly_cyc_api_funcall_2(func, asent, sense); } public static SubLObject determine_new_literal_removal_tactics(final SubLObject problem, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); if (NIL == inference_datastructures_problem_store.problem_store_removal_allowedP(inference_datastructures_problem.problem_store(problem))) { return NIL; } final SubLObject store = inference_datastructures_problem.problem_store(problem); final SubLObject tactics = NIL; final SubLObject store_var = store; final SubLObject _prev_bind_0 = $negation_by_failure$.currentBinding(thread); try { $negation_by_failure$.bind(inference_datastructures_problem_store.problem_store_negation_by_failureP(store_var), thread); determine_new_literal_simple_removal_tactics(problem, asent, sense); determine_new_literal_meta_removal_tactics(problem, asent, sense); } finally { $negation_by_failure$.rebind(_prev_bind_0, thread); } return tactics; } public static SubLObject determine_new_literal_meta_removal_tactics(final SubLObject problem, final SubLObject asent, final SubLObject sense) { final SubLObject hl_modules = literal_meta_removal_candidate_hl_modules(asent, sense); return determine_new_removal_tactics_from_hl_modules(hl_modules, problem, asent, sense); } public static SubLObject determine_new_literal_simple_removal_tactics(final SubLObject problem, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); if ((NIL != $external_inference_enabled$.getDynamicValue(thread)) && (NIL != inference_modules.some_external_removal_modulesP())) { final SubLObject external_tactics = determine_new_removal_tactics_from_hl_modules(inference_modules.removal_modules_external(), problem, asent, sense); if (NIL != external_tactics) { return external_tactics; } } final SubLObject hl_modules = literal_simple_removal_candidate_hl_modules(asent, sense); return determine_new_removal_tactics_from_hl_modules(hl_modules, problem, asent, sense); } public static SubLObject literal_removal_options(final SubLObject asent, final SubLObject sense, SubLObject allowed_modules_spec) { if (allowed_modules_spec == UNPROVIDED) { allowed_modules_spec = $ALL; } final SubLThread thread = SubLProcess.currentSubLThread(); if ((NIL != $external_inference_enabled$.getDynamicValue(thread)) && (NIL != inference_modules.some_external_removal_modulesP())) { final SubLObject external_tactic_specs = determine_new_removal_tactic_specs_from_hl_modules(inference_modules.removal_modules_external(), asent, sense); if (NIL != external_tactic_specs) { return external_tactic_specs; } } final SubLObject hl_modules = literal_removal_options_hl_modules(asent, sense, allowed_modules_spec); return determine_new_removal_tactic_specs_from_hl_modules(hl_modules, asent, sense); } public static SubLObject literal_removal_options_hl_modules(final SubLObject asent, final SubLObject sense, final SubLObject allowed_modules_spec) { final SubLObject candidate_hl_modules = literal_removal_options_candidate_hl_modules(asent, sense, allowed_modules_spec); return filter_modules_wrt_allowed_modules_spec(candidate_hl_modules, allowed_modules_spec); } public static SubLObject filter_modules_wrt_allowed_modules_spec(final SubLObject candidate_hl_modules, final SubLObject allowed_modules_spec) { SubLObject hl_modules = NIL; if (allowed_modules_spec == $ALL) { hl_modules = candidate_hl_modules; } else { SubLObject cdolist_list_var = candidate_hl_modules; SubLObject module = NIL; module = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if ((NIL != inference_modules.hl_module_allowed_by_allowed_modules_specP(module, allowed_modules_spec)) || (NIL != inference_modules.hl_module_exclusive_func(module))) { hl_modules = cons(module, hl_modules); } cdolist_list_var = cdolist_list_var.rest(); module = cdolist_list_var.first(); } hl_modules = nreverse(hl_modules); } return hl_modules; } public static SubLObject literal_removal_options_candidate_hl_modules(final SubLObject asent, final SubLObject sense, final SubLObject allowed_modules_spec) { if (allowed_modules_spec == $ALL) { return literal_simple_removal_candidate_hl_modules(asent, sense); } if (NIL != inference_modules.simple_allowed_modules_spec_p(allowed_modules_spec)) { return inference_modules.get_modules_from_simple_allowed_modules_spec(allowed_modules_spec); } return literal_simple_removal_candidate_hl_modules(asent, sense); } public static SubLObject hl_module_applicable_to_asentP(final SubLObject hl_module, final SubLObject asent) { return makeBoolean(((((NIL != inference_modules.hl_module_predicate_relevant_p(hl_module, cycl_utilities.atomic_sentence_predicate(asent))) && (NIL != inference_modules.hl_module_arity_relevant_p(hl_module, asent))) && (NIL != inference_modules.hl_module_required_pattern_matched_p(hl_module, asent))) && (NIL != inference_modules.hl_module_required_mt_relevantP(hl_module))) && (NIL != inference_modules.hl_module_direction_relevantP(hl_module))); } public static SubLObject determine_new_removal_tactics_from_hl_modules(final SubLObject hl_modules, final SubLObject problem, final SubLObject asent, final SubLObject sense) { SubLObject cdolist_list_var; final SubLObject tactic_specs = cdolist_list_var = determine_new_removal_tactic_specs_from_hl_modules(hl_modules, asent, sense); SubLObject tactic_spec = NIL; tactic_spec = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject current; final SubLObject datum = current = tactic_spec; SubLObject hl_module = NIL; SubLObject productivity = NIL; SubLObject completeness = NIL; destructuring_bind_must_consp(current, datum, $list34); hl_module = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list34); productivity = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list34); completeness = current.first(); current = current.rest(); if (NIL == current) { new_removal_tactic(problem, hl_module, productivity, completeness); } else { cdestructuring_bind_error(datum, $list34); } cdolist_list_var = cdolist_list_var.rest(); tactic_spec = cdolist_list_var.first(); } return tactic_specs; } public static SubLObject determine_new_removal_tactic_specs_from_hl_modules(final SubLObject hl_modules, final SubLObject asent, final SubLObject sense) { return hl_module_guts($DETERMINE_NEW_REMOVAL_TACTIC_SPECS_FROM_HL_MODULES, hl_modules, asent, sense, UNPROVIDED, UNPROVIDED); } public static SubLObject determine_new_removal_tactic_specs_from_hl_modules_guts(final SubLObject candidate_hl_modules, final SubLObject asent, final SubLObject sense) { final SubLObject applicable_hl_modules = determine_applicable_hl_modules_for_asent(candidate_hl_modules, asent, sense); final SubLObject tactic_specs = compute_tactic_specs_for_asent(applicable_hl_modules, asent, sense); return tactic_specs; } public static SubLObject determine_applicable_hl_modules_for_asent(final SubLObject candidate_hl_modules, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject supplanted_hl_modules = NIL; SubLObject applicable_hl_modules = NIL; SubLObject totally_exclusive_foundP = NIL; if (NIL == totally_exclusive_foundP) { SubLObject csome_list_var = candidate_hl_modules; SubLObject hl_module = NIL; hl_module = csome_list_var.first(); while ((NIL == totally_exclusive_foundP) && (NIL != csome_list_var)) { if (NIL == inference_modules.hl_module_exclusive_func(hl_module)) { thread.resetMultipleValues(); final SubLObject totally_exclusive_foundP_$16 = update_applicable_hl_modules(hl_module, asent, sense, applicable_hl_modules, supplanted_hl_modules); final SubLObject applicable_hl_modules_$17 = thread.secondMultipleValue(); final SubLObject supplanted_hl_modules_$18 = thread.thirdMultipleValue(); thread.resetMultipleValues(); totally_exclusive_foundP = totally_exclusive_foundP_$16; applicable_hl_modules = applicable_hl_modules_$17; supplanted_hl_modules = supplanted_hl_modules_$18; } csome_list_var = csome_list_var.rest(); hl_module = csome_list_var.first(); } } if (NIL == totally_exclusive_foundP) { SubLObject csome_list_var = candidate_hl_modules; SubLObject hl_module = NIL; hl_module = csome_list_var.first(); while ((NIL == totally_exclusive_foundP) && (NIL != csome_list_var)) { if (NIL != inference_modules.hl_module_exclusive_func(hl_module)) { thread.resetMultipleValues(); final SubLObject totally_exclusive_foundP_$17 = update_applicable_hl_modules(hl_module, asent, sense, applicable_hl_modules, supplanted_hl_modules); final SubLObject applicable_hl_modules_$18 = thread.secondMultipleValue(); final SubLObject supplanted_hl_modules_$19 = thread.thirdMultipleValue(); thread.resetMultipleValues(); totally_exclusive_foundP = totally_exclusive_foundP_$17; applicable_hl_modules = applicable_hl_modules_$18; supplanted_hl_modules = supplanted_hl_modules_$19; } csome_list_var = csome_list_var.rest(); hl_module = csome_list_var.first(); } } return applicable_hl_modules; } public static SubLObject update_applicable_hl_modules(final SubLObject hl_module, final SubLObject asent, final SubLObject sense, SubLObject applicable_hl_modules, SubLObject supplanted_hl_modules) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject totally_exclusive_foundP = NIL; if (((NIL == supplanted_hl_modules) || (NIL == list_utilities.member_eqP(hl_module, supplanted_hl_modules))) && (NIL != hl_module_applicable_to_asentP(hl_module, asent))) { final SubLObject exclusive_func = inference_modules.hl_module_exclusive_func(hl_module); if ((NIL == exclusive_func) || ((NIL != eval_in_api.possibly_cyc_api_function_spec_p(exclusive_func)) && (NIL != removal_module_exclusive_func_funcall(exclusive_func, asent, sense)))) { if (NIL != exclusive_func) { thread.resetMultipleValues(); final SubLObject totally_exclusive_foundP_$22 = update_supplanted_hl_modules(hl_module, applicable_hl_modules, supplanted_hl_modules); final SubLObject applicable_hl_modules_$23 = thread.secondMultipleValue(); final SubLObject supplanted_hl_modules_$24 = thread.thirdMultipleValue(); thread.resetMultipleValues(); totally_exclusive_foundP = totally_exclusive_foundP_$22; applicable_hl_modules = applicable_hl_modules_$23; supplanted_hl_modules = supplanted_hl_modules_$24; } final SubLObject required_func = inference_modules.hl_module_required_func(hl_module); if ((NIL == required_func) || ((NIL != eval_in_api.possibly_cyc_api_function_spec_p(required_func)) && (NIL != removal_module_required_func_funcall(required_func, asent, sense)))) { applicable_hl_modules = cons(hl_module, applicable_hl_modules); } } } return subl_promotions.values3(totally_exclusive_foundP, applicable_hl_modules, supplanted_hl_modules); } public static SubLObject update_supplanted_hl_modules(final SubLObject hl_module, SubLObject applicable_hl_modules, SubLObject supplanted_hl_modules) { final SubLObject supplants_info = inference_modules.hl_module_supplants_info(hl_module); SubLObject totally_exclusive_foundP = NIL; final SubLObject pcase_var = supplants_info; if (pcase_var.eql($ALL)) { applicable_hl_modules = NIL; totally_exclusive_foundP = T; } else { SubLObject cdolist_list_var; final SubLObject newly_supplanted_hl_module_patterns = cdolist_list_var = supplants_info; SubLObject supplanted_hl_module_pattern = NIL; supplanted_hl_module_pattern = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (supplanted_hl_module_pattern.isCons()) { SubLObject patterns = list(supplanted_hl_module_pattern); SubLObject negateP = NIL; SubLObject pattern = NIL; while (NIL != patterns) { pattern = patterns.first(); patterns = patterns.rest(); final SubLObject directive = pattern.first(); final SubLObject rest = pattern.rest(); final SubLObject pcase_var_$25 = directive; if (pcase_var_$25.eql($NOT)) { negateP = makeBoolean(NIL == negateP); patterns = cons(rest.first(), patterns); } else { if (!pcase_var_$25.eql($MODULE_SUBTYPE)) { continue; } final SubLObject subtype = rest.first(); SubLObject cdolist_list_var_$26; final SubLObject newly_supplanted_hl_modules = cdolist_list_var_$26 = applicable_hl_modules; SubLObject supplanted_hl_module = NIL; supplanted_hl_module = cdolist_list_var_$26.first(); while (NIL != cdolist_list_var_$26) { if (((NIL == negateP) && (NIL != list_utilities.member_eqP(subtype, inference_modules.hl_module_subtypes(supplanted_hl_module)))) || ((NIL != negateP) && (NIL == list_utilities.member_eqP(subtype, inference_modules.hl_module_subtypes(supplanted_hl_module))))) { applicable_hl_modules = list_utilities.delete_first(supplanted_hl_module, applicable_hl_modules, symbol_function(EQ)); } cdolist_list_var_$26 = cdolist_list_var_$26.rest(); supplanted_hl_module = cdolist_list_var_$26.first(); } } } } else { final SubLObject item_var; final SubLObject supplanted_hl_module2 = item_var = inference_modules.find_hl_module_by_name(supplanted_hl_module_pattern); if (NIL == member(item_var, supplanted_hl_modules, symbol_function(EQ), symbol_function(IDENTITY))) { supplanted_hl_modules = cons(item_var, supplanted_hl_modules); } if (NIL != list_utilities.member_eqP(supplanted_hl_module2, applicable_hl_modules)) { applicable_hl_modules = list_utilities.delete_first(supplanted_hl_module2, applicable_hl_modules, symbol_function(EQ)); } } cdolist_list_var = cdolist_list_var.rest(); supplanted_hl_module_pattern = cdolist_list_var.first(); } } return subl_promotions.values3(totally_exclusive_foundP, applicable_hl_modules, supplanted_hl_modules); } public static SubLObject update_supplanted_modules_wrt_tactic_specs(final SubLObject hl_module, SubLObject existing_tactic_specs, SubLObject supplanted_modules) { final SubLObject supplants_info = inference_modules.hl_module_supplants_info(hl_module); SubLObject totally_exclusive_foundP = NIL; final SubLObject pcase_var = supplants_info; if (pcase_var.eql($ALL)) { existing_tactic_specs = NIL; totally_exclusive_foundP = T; } else { SubLObject cdolist_list_var; final SubLObject newly_supplanted_module_names = cdolist_list_var = supplants_info; SubLObject supplanted_module_name = NIL; supplanted_module_name = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject supplanted_module = inference_modules.find_hl_module_by_name(supplanted_module_name); supplanted_modules = cons(supplanted_module, supplanted_modules); SubLObject supplanted_tactic_spec = find(supplanted_module, existing_tactic_specs, symbol_function(EQ), symbol_function(FIRST), UNPROVIDED, UNPROVIDED); if (NIL != supplanted_tactic_spec) { existing_tactic_specs = list_utilities.delete_first(supplanted_tactic_spec, existing_tactic_specs, symbol_function(EQUAL)); supplanted_tactic_spec = NIL; } cdolist_list_var = cdolist_list_var.rest(); supplanted_module_name = cdolist_list_var.first(); } } return subl_promotions.values3(totally_exclusive_foundP, existing_tactic_specs, supplanted_modules); } public static SubLObject compute_tactic_specs_for_asent(final SubLObject applicable_hl_modules, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject tactic_specs = NIL; SubLObject cdolist_list_var = applicable_hl_modules; SubLObject hl_module = NIL; hl_module = cdolist_list_var.first(); while (NIL != cdolist_list_var) { final SubLObject cost = inference_modules.hl_module_cost(hl_module, asent, sense); if (NIL != cost) { if (((NIL != $maximum_hl_module_check_cost$.getDynamicValue(thread)) && (NIL != variables.fully_bound_p(asent))) && cost.numG($maximum_hl_module_check_cost$.getDynamicValue(thread))) { Errors.error($str82$For_sentence_____S__Maximum_HL_Mo, asent, hl_module, cost); } final SubLObject productivity = inference_datastructures_enumerated_types.productivity_for_number_of_children(cost); final SubLObject completeness = inference_modules.hl_module_completeness(hl_module, asent, UNPROVIDED); final SubLObject tactic_spec = list(hl_module, productivity, completeness); tactic_specs = cons(tactic_spec, tactic_specs); } cdolist_list_var = cdolist_list_var.rest(); hl_module = cdolist_list_var.first(); } return tactic_specs; } public static SubLObject literal_simple_removal_candidate_hl_modules(final SubLObject asent, final SubLObject sense) { final SubLObject predicate = cycl_utilities.atomic_sentence_predicate(asent); if (NIL != forts.fort_p(predicate)) { return literal_removal_candidate_hl_modules_for_predicate_with_sense(predicate, sense); } return inference_modules.generic_removal_modules_for_sense(sense); } public static SubLObject literal_removal_candidate_hl_modules_for_predicate_with_sense(final SubLObject predicate, final SubLObject sense) { final SubLObject inference = inference_macros.current_controlling_inference(); if ((NIL != inference) && (NIL != inference_datastructures_inference.inference_problem_store_privateP(inference))) { final SubLObject allowed_modules_spec = inference_datastructures_inference.inference_allowed_modules(inference); return literal_removal_candidate_hl_modules_for_predicate_with_sense_int(predicate, sense, allowed_modules_spec); } return literal_removal_candidate_hl_modules_for_predicate_with_sense_int(predicate, sense, $ALL); } public static SubLObject literal_removal_candidate_hl_modules_for_predicate_with_sense_int_internal(final SubLObject predicate, final SubLObject sense, final SubLObject allowed_modules_spec) { final SubLObject predicate_specific_removal_modules = inference_modules.removal_modules_specific_for_sense(predicate, sense); final SubLObject universal_removal_modules = inference_modules.removal_modules_universal_for_predicate_and_sense(predicate, sense); SubLObject v_modules = NIL; if (NIL != inference_modules.solely_specific_removal_module_predicateP(predicate)) { v_modules = nconc(predicate_specific_removal_modules, universal_removal_modules); } else { v_modules = nconc(predicate_specific_removal_modules, inference_modules.generic_removal_modules_for_sense(sense), universal_removal_modules); } v_modules = filter_modules_wrt_allowed_modules_spec(v_modules, allowed_modules_spec); return v_modules; } public static SubLObject literal_removal_candidate_hl_modules_for_predicate_with_sense_int(final SubLObject predicate, final SubLObject sense, final SubLObject allowed_modules_spec) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject v_memoization_state = memoization_state.$memoization_state$.getDynamicValue(thread); SubLObject caching_state = NIL; if (NIL == v_memoization_state) { return literal_removal_candidate_hl_modules_for_predicate_with_sense_int_internal(predicate, sense, allowed_modules_spec); } caching_state = memoization_state.memoization_state_lookup(v_memoization_state, LITERAL_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE_WITH_SENSE_INT, UNPROVIDED); if (NIL == caching_state) { caching_state = memoization_state.create_caching_state(memoization_state.memoization_state_lock(v_memoization_state), LITERAL_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE_WITH_SENSE_INT, THREE_INTEGER, NIL, EQL, UNPROVIDED); memoization_state.memoization_state_put(v_memoization_state, LITERAL_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE_WITH_SENSE_INT, caching_state); } final SubLObject sxhash = memoization_state.sxhash_calc_3(predicate, sense, allowed_modules_spec); final SubLObject collisions = memoization_state.caching_state_lookup(caching_state, sxhash, UNPROVIDED); if (!collisions.eql(memoization_state.$memoized_item_not_found$.getGlobalValue())) { SubLObject cdolist_list_var = collisions; SubLObject collision = NIL; collision = cdolist_list_var.first(); while (NIL != cdolist_list_var) { SubLObject cached_args = collision.first(); final SubLObject results2 = second(collision); if (predicate.eql(cached_args.first())) { cached_args = cached_args.rest(); if (sense.eql(cached_args.first())) { cached_args = cached_args.rest(); if (((NIL != cached_args) && (NIL == cached_args.rest())) && allowed_modules_spec.eql(cached_args.first())) { return memoization_state.caching_results(results2); } } } cdolist_list_var = cdolist_list_var.rest(); collision = cdolist_list_var.first(); } } final SubLObject results3 = arg2(thread.resetMultipleValues(), multiple_value_list(literal_removal_candidate_hl_modules_for_predicate_with_sense_int_internal(predicate, sense, allowed_modules_spec))); memoization_state.caching_state_enter_multi_key_n(caching_state, sxhash, collisions, results3, list(predicate, sense, allowed_modules_spec)); return memoization_state.caching_results(results3); } public static SubLObject literal_meta_removal_candidate_hl_modules(final SubLObject asent, final SubLObject sense) { if (sense == $NEG) { return NIL; } final SubLObject predicate = cycl_utilities.atomic_sentence_predicate(asent); if (NIL != forts.fort_p(predicate)) { return literal_meta_removal_candidate_hl_modules_for_predicate(predicate); } return inference_modules.meta_removal_module_list(); } public static SubLObject literal_meta_removal_candidate_hl_modules_for_predicate_internal(final SubLObject predicate) { SubLObject v_meta_removal_modules = NIL; SubLObject cdolist_list_var = inference_modules.meta_removal_modules(); SubLObject meta_removal_module = NIL; meta_removal_module = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (NIL != inference_modules.predicate_uses_meta_removal_moduleP(predicate, meta_removal_module)) { v_meta_removal_modules = cons(meta_removal_module, v_meta_removal_modules); } cdolist_list_var = cdolist_list_var.rest(); meta_removal_module = cdolist_list_var.first(); } return nreverse(v_meta_removal_modules); } public static SubLObject literal_meta_removal_candidate_hl_modules_for_predicate(final SubLObject predicate) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject v_memoization_state = memoization_state.$memoization_state$.getDynamicValue(thread); SubLObject caching_state = NIL; if (NIL == v_memoization_state) { return literal_meta_removal_candidate_hl_modules_for_predicate_internal(predicate); } caching_state = memoization_state.memoization_state_lookup(v_memoization_state, LITERAL_META_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE, UNPROVIDED); if (NIL == caching_state) { caching_state = memoization_state.create_caching_state(memoization_state.memoization_state_lock(v_memoization_state), LITERAL_META_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE, ONE_INTEGER, NIL, EQUAL, UNPROVIDED); memoization_state.memoization_state_put(v_memoization_state, LITERAL_META_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE, caching_state); } SubLObject results = memoization_state.caching_state_lookup(caching_state, predicate, memoization_state.$memoized_item_not_found$.getGlobalValue()); if (results.eql(memoization_state.$memoized_item_not_found$.getGlobalValue())) { results = arg2(thread.resetMultipleValues(), multiple_value_list(literal_meta_removal_candidate_hl_modules_for_predicate_internal(predicate))); memoization_state.caching_state_put(caching_state, predicate, results, UNPROVIDED); } return memoization_state.caching_results(results); } public static SubLObject literal_level_removal_tactic_p(final SubLObject tactic) { return makeBoolean((NIL != removal_tactic_p(tactic)) && (NIL != inference_worker.literal_level_tactic_p(tactic))); } public static SubLObject literal_level_meta_removal_tactic_p(final SubLObject tactic) { return makeBoolean((NIL != meta_removal_tactic_p(tactic)) && (NIL != inference_worker.literal_level_tactic_p(tactic))); } public static SubLObject new_removal_tactic(final SubLObject problem, final SubLObject hl_module, final SubLObject productivity, final SubLObject completeness) { final SubLObject tactic = inference_datastructures_tactic.new_tactic(problem, hl_module, UNPROVIDED); inference_datastructures_tactic.set_tactic_productivity(tactic, productivity, UNPROVIDED); inference_datastructures_tactic.set_tactic_completeness(tactic, completeness); final SubLObject store = inference_datastructures_problem.problem_store(problem); final SubLObject idx = inference_datastructures_problem_store.problem_store_inference_id_index(store); if (NIL == id_index_objects_empty_p(idx, $SKIP)) { final SubLObject idx_$27 = idx; if (NIL == id_index_dense_objects_empty_p(idx_$27, $SKIP)) { final SubLObject vector_var = id_index_dense_objects(idx_$27); final SubLObject backwardP_var = NIL; SubLObject length; SubLObject v_iteration; SubLObject id; SubLObject inference; SubLObject inference_var; SubLObject set_var; SubLObject set_contents_var; SubLObject basis_object; SubLObject state; SubLObject strategy; for (length = length(vector_var), v_iteration = NIL, v_iteration = ZERO_INTEGER; v_iteration.numL(length); v_iteration = add(v_iteration, ONE_INTEGER)) { id = (NIL != backwardP_var) ? subtract(length, v_iteration, ONE_INTEGER) : v_iteration; inference = aref(vector_var, id); if ((NIL == id_index_tombstone_p(inference)) || (NIL == id_index_skip_tombstones_p($SKIP))) { if (NIL != id_index_tombstone_p(inference)) { inference = $SKIP; } if (NIL != inference_datastructures_problem.problem_relevant_to_inferenceP(problem, inference)) { inference_var = inference; set_var = inference_datastructures_inference.inference_strategy_set(inference_var); set_contents_var = set.do_set_internal(set_var); for (basis_object = set_contents.do_set_contents_basis_object(set_contents_var), state = NIL, state = set_contents.do_set_contents_initial_state(basis_object, set_contents_var); NIL == set_contents.do_set_contents_doneP(basis_object, state); state = set_contents.do_set_contents_update_state(state)) { strategy = set_contents.do_set_contents_next(basis_object, state); if (NIL != set_contents.do_set_contents_element_validP(state, strategy)) { inference_tactician.strategy_note_new_tactic(strategy, tactic); } } } } } } final SubLObject idx_$28 = idx; if (NIL == id_index_sparse_objects_empty_p(idx_$28)) { final SubLObject cdohash_table = id_index_sparse_objects(idx_$28); SubLObject id2 = NIL; SubLObject inference2 = NIL; final Iterator cdohash_iterator = getEntrySetIterator(cdohash_table); try { while (iteratorHasNext(cdohash_iterator)) { final Map.Entry cdohash_entry = iteratorNextEntry(cdohash_iterator); id2 = getEntryKey(cdohash_entry); inference2 = getEntryValue(cdohash_entry); if (NIL != inference_datastructures_problem.problem_relevant_to_inferenceP(problem, inference2)) { final SubLObject inference_var2 = inference2; final SubLObject set_var2 = inference_datastructures_inference.inference_strategy_set(inference_var2); final SubLObject set_contents_var2 = set.do_set_internal(set_var2); SubLObject basis_object2; SubLObject state2; SubLObject strategy2; for (basis_object2 = set_contents.do_set_contents_basis_object(set_contents_var2), state2 = NIL, state2 = set_contents.do_set_contents_initial_state(basis_object2, set_contents_var2); NIL == set_contents.do_set_contents_doneP(basis_object2, state2); state2 = set_contents.do_set_contents_update_state(state2)) { strategy2 = set_contents.do_set_contents_next(basis_object2, state2); if (NIL != set_contents.do_set_contents_element_validP(state2, strategy2)) { inference_tactician.strategy_note_new_tactic(strategy2, tactic); } } } } } finally { releaseEntrySetIterator(cdohash_iterator); } } } return tactic; } public static SubLObject compute_strategic_properties_of_removal_tactic(final SubLObject tactic, final SubLObject strategy) { return tactic; } public static SubLObject with_removal_tactic_execution_assumptions(final SubLObject macroform, final SubLObject environment) { SubLObject current; final SubLObject datum = current = macroform.rest(); destructuring_bind_must_consp(current, datum, $list85); final SubLObject temp = current.rest(); current = current.first(); SubLObject tactic = NIL; SubLObject mt = NIL; SubLObject sense = NIL; destructuring_bind_must_consp(current, datum, $list85); tactic = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list85); mt = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list85); sense = current.first(); current = current.rest(); if (NIL == current) { final SubLObject body; current = body = temp; final SubLObject tactic_var = $sym86$TACTIC_VAR; return list(CLET, list(list(tactic_var, tactic)), list(WITH_INFERENCE_MT_RELEVANCE, mt, list(CLET, list(list($inference_expand_hl_module$, list(TACTIC_HL_MODULE, tactic_var)), list($inference_expand_sense$, sense)), listS(WITH_PROBLEM_STORE_REMOVAL_ASSUMPTIONS, list(TACTIC_STORE, tactic_var), append(body, NIL))))); } cdestructuring_bind_error(datum, $list85); return NIL; } public static SubLObject execute_literal_level_removal_tactic(final SubLObject tactic, final SubLObject mt, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject mt_var = mt_relevance_macros.with_inference_mt_relevance_validate(mt); final SubLObject _prev_bind_0 = mt_relevance_macros.$mt$.currentBinding(thread); final SubLObject _prev_bind_2 = mt_relevance_macros.$relevant_mt_function$.currentBinding(thread); final SubLObject _prev_bind_3 = mt_relevance_macros.$relevant_mts$.currentBinding(thread); final SubLObject _prev_bind_4 = backward.$inference_expand_hl_module$.currentBinding(thread); final SubLObject _prev_bind_5 = backward.$inference_expand_sense$.currentBinding(thread); try { mt_relevance_macros.$mt$.bind(mt_relevance_macros.update_inference_mt_relevance_mt(mt_var), thread); mt_relevance_macros.$relevant_mt_function$.bind(mt_relevance_macros.update_inference_mt_relevance_function(mt_var), thread); mt_relevance_macros.$relevant_mts$.bind(mt_relevance_macros.update_inference_mt_relevance_mt_list(mt_var), thread); backward.$inference_expand_hl_module$.bind(inference_datastructures_tactic.tactic_hl_module(tactic), thread); backward.$inference_expand_sense$.bind(sense, thread); final SubLObject store_var = inference_datastructures_tactic.tactic_store(tactic); final SubLObject _prev_bind_0_$29 = $negation_by_failure$.currentBinding(thread); try { $negation_by_failure$.bind(inference_datastructures_problem_store.problem_store_negation_by_failureP(store_var), thread); if (NIL != inference_datastructures_tactic.tactic_in_progressP(tactic)) { inference_datastructures_tactic.tactic_in_progress_next(tactic); } else { final SubLObject progress_iterator = maybe_make_removal_tactic_progress_iterator(tactic, asent, sense); if (NIL != progress_iterator) { if (progress_iterator.isList()) { SubLObject cdolist_list_var = progress_iterator; SubLObject execution_result = NIL; execution_result = cdolist_list_var.first(); while (NIL != cdolist_list_var) { handle_one_removal_tactic_expand_result(tactic, execution_result); cdolist_list_var = cdolist_list_var.rest(); execution_result = cdolist_list_var.first(); } } else { inference_datastructures_tactic.note_tactic_progress_iterator(tactic, progress_iterator); } } } } finally { $negation_by_failure$.rebind(_prev_bind_0_$29, thread); } } finally { backward.$inference_expand_sense$.rebind(_prev_bind_5, thread); backward.$inference_expand_hl_module$.rebind(_prev_bind_4, thread); mt_relevance_macros.$relevant_mts$.rebind(_prev_bind_3, thread); mt_relevance_macros.$relevant_mt_function$.rebind(_prev_bind_2, thread); mt_relevance_macros.$mt$.rebind(_prev_bind_0, thread); } return tactic; } public static SubLObject maybe_make_removal_tactic_progress_iterator(final SubLObject tactic, final SubLObject asent, final SubLObject sense) { if (NIL != inference_modules.hl_module_output_generate_pattern(inference_datastructures_tactic.tactic_hl_module(tactic))) { return maybe_make_removal_tactic_output_generate_progress_iterator(tactic, asent); } return maybe_make_removal_tactic_expand_results_progress_iterator(tactic, asent, sense); } public static SubLObject maybe_make_removal_tactic_output_generate_progress_iterator(final SubLObject tactic, final SubLObject cycl_input_asent) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(tactic); thread.resetMultipleValues(); final SubLObject output_iterator = maybe_make_inference_output_iterator(hl_module, cycl_input_asent); final SubLObject encoded_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != output_iterator) { inference_datastructures_tactic.possibly_update_tactic_productivity_from_iterator(tactic, output_iterator); return new_removal_tactic_output_generate_progress_iterator(tactic, output_iterator, encoded_bindings); } return NIL; } public static SubLObject new_removal_tactic_output_generate_progress_iterator(final SubLObject tactic, final SubLObject output_iterator, final SubLObject encoded_bindings) { return inference_datastructures_tactic.new_tactic_progress_iterator($REMOVAL_OUTPUT_GENERATE, tactic, list(output_iterator, encoded_bindings)); } public static SubLObject handle_one_removal_tactic_output_generate_result(final SubLObject removal_tactic, final SubLObject output_iterator, final SubLObject encoded_bindings) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject result = NIL; final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(removal_tactic); final SubLObject problem = inference_datastructures_tactic.tactic_problem(removal_tactic); final SubLObject cycl_input_asent = inference_datastructures_problem.single_literal_problem_atomic_sentence(problem); thread.resetMultipleValues(); final SubLObject raw_output = iteration.iteration_next(output_iterator); final SubLObject validP = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != validP) { final SubLObject _prev_bind_0 = backward.$removal_add_node_method$.currentBinding(thread); try { backward.$removal_add_node_method$.bind(HANDLE_REMOVAL_ADD_NODE_FOR_OUTPUT_GENERATE, thread); inference_datastructures_tactic.decrement_tactic_productivity_for_number_of_children(removal_tactic, UNPROVIDED); result = handle_one_output_generate_result(cycl_input_asent, hl_module, raw_output, encoded_bindings); } finally { backward.$removal_add_node_method$.rebind(_prev_bind_0, thread); } } return result; } public static SubLObject handle_removal_add_node_for_output_generate(SubLObject removal_bindings, final SubLObject supports) { removal_bindings = bindings.inference_simplify_unification_bindings(removal_bindings); final SubLObject removal_tactic = inference_worker.currently_executing_tactic(); return handle_one_removal_tactic_result(removal_tactic, removal_bindings, supports); } public static SubLObject maybe_make_removal_tactic_expand_results_progress_iterator(final SubLObject tactic, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject expand_results = hl_module_guts($MAYBE_MAKE_REMOVAL_TACTIC_EXPAND_RESULTS_PROGRESS_ITERATOR, tactic, asent, sense, UNPROVIDED, UNPROVIDED); final SubLObject new_productivity = inference_datastructures_enumerated_types.productivity_for_number_of_children(length(expand_results)); inference_datastructures_tactic.update_tactic_productivity(tactic, new_productivity); if (NIL != list_utilities.lengthGE(expand_results, $removal_tactic_iteration_threshold$.getDynamicValue(thread), UNPROVIDED)) { expand_results = new_removal_tactic_expand_results_progress_iterator(tactic, expand_results); } return expand_results; } public static SubLObject maybe_make_removal_tactic_expand_results_progress_iterator_guts(final SubLObject tactic, final SubLObject asent, final SubLObject sense) { final SubLThread thread = SubLProcess.currentSubLThread(); SubLObject expand_results = NIL; final SubLObject _prev_bind_0 = $removal_tactic_expand_results_queue$.currentBinding(thread); try { $removal_tactic_expand_results_queue$.bind(NIL, thread); final SubLObject _prev_bind_0_$30 = backward.$removal_add_node_method$.currentBinding(thread); try { backward.$removal_add_node_method$.bind(HANDLE_REMOVAL_ADD_NODE_FOR_EXPAND_RESULTS, thread); final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(tactic); final SubLObject pattern = inference_modules.hl_module_expand_pattern(hl_module); if (NIL != pattern) { formula_pattern_match.pattern_transform_formula(pattern, asent, UNPROVIDED); } else { final SubLObject function = inference_modules.hl_module_expand_func(hl_module); if (NIL != eval_in_api.possibly_cyc_api_function_spec_p(function)) { removal_module_expand_func_funcall(function, asent, sense); } } } finally { backward.$removal_add_node_method$.rebind(_prev_bind_0_$30, thread); } if (NIL != $removal_tactic_expand_results_queue$.getDynamicValue(thread)) { expand_results = nreverse($removal_tactic_expand_results_queue$.getDynamicValue(thread)); } } finally { $removal_tactic_expand_results_queue$.rebind(_prev_bind_0, thread); } return expand_results; } public static SubLObject handle_removal_add_node_for_expand_results(SubLObject removal_bindings, final SubLObject supports) { final SubLThread thread = SubLProcess.currentSubLThread(); removal_bindings = bindings.inference_simplify_unification_bindings(removal_bindings); $removal_tactic_expand_results_queue$.setDynamicValue(cons(list(removal_bindings, supports), $removal_tactic_expand_results_queue$.getDynamicValue(thread)), thread); return NIL; } public static SubLObject new_removal_tactic_expand_results_progress_iterator(final SubLObject tactic, final SubLObject expand_results) { return inference_datastructures_tactic.new_tactic_progress_iterator($REMOVAL_EXPAND, tactic, expand_results); } public static SubLObject handle_one_removal_tactic_expand_result(final SubLObject removal_tactic, final SubLObject expand_result) { SubLObject removal_bindings = NIL; SubLObject supports = NIL; destructuring_bind_must_consp(expand_result, expand_result, $list98); removal_bindings = expand_result.first(); SubLObject current = expand_result.rest(); destructuring_bind_must_consp(current, expand_result, $list98); supports = current.first(); current = current.rest(); if (NIL == current) { inference_datastructures_tactic.decrement_tactic_productivity_for_number_of_children(removal_tactic, UNPROVIDED); return handle_one_removal_tactic_result(removal_tactic, removal_bindings, supports); } cdestructuring_bind_error(expand_result, $list98); return NIL; } public static SubLObject handle_one_removal_tactic_result(final SubLObject removal_tactic, final SubLObject removal_bindings, final SubLObject supports) { final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject problem = inference_datastructures_tactic.tactic_problem(removal_tactic); final SubLObject store = inference_datastructures_problem.problem_store(problem); SubLObject result = NIL; if (NIL == variables.fully_bound_p(supports)) { inference_warn($str99$Ignoring_result_from__S_due_to_op, inference_datastructures_tactic.tactic_hl_module(removal_tactic), UNPROVIDED); } else { thread.resetMultipleValues(); final SubLObject mt = inference_datastructures_problem.mt_asent_sense_from_single_literal_problem(problem); final SubLObject asent = thread.secondMultipleValue(); final SubLObject sense = thread.thirdMultipleValue(); thread.resetMultipleValues(); final SubLObject mt_var = mt_relevance_macros.with_inference_mt_relevance_validate(mt); final SubLObject _prev_bind_0 = mt_relevance_macros.$mt$.currentBinding(thread); final SubLObject _prev_bind_2 = mt_relevance_macros.$relevant_mt_function$.currentBinding(thread); final SubLObject _prev_bind_3 = mt_relevance_macros.$relevant_mts$.currentBinding(thread); final SubLObject _prev_bind_4 = backward.$inference_expand_hl_module$.currentBinding(thread); final SubLObject _prev_bind_5 = backward.$inference_expand_sense$.currentBinding(thread); try { mt_relevance_macros.$mt$.bind(mt_relevance_macros.update_inference_mt_relevance_mt(mt_var), thread); mt_relevance_macros.$relevant_mt_function$.bind(mt_relevance_macros.update_inference_mt_relevance_function(mt_var), thread); mt_relevance_macros.$relevant_mts$.bind(mt_relevance_macros.update_inference_mt_relevance_mt_list(mt_var), thread); backward.$inference_expand_hl_module$.bind(inference_datastructures_tactic.tactic_hl_module(removal_tactic), thread); backward.$inference_expand_sense$.bind(sense, thread); final SubLObject store_var = inference_datastructures_tactic.tactic_store(removal_tactic); final SubLObject _prev_bind_0_$31 = $negation_by_failure$.currentBinding(thread); try { $negation_by_failure$.bind(inference_datastructures_problem_store.problem_store_negation_by_failureP(store_var), thread); if ((NIL != removal_bindings) && (NIL != inference_datastructures_problem_store.problem_store_add_restriction_layer_of_indirectionP(store))) { result = maybe_new_restriction_and_removal_link(problem, removal_tactic, removal_bindings, supports); } else { result = maybe_new_removal_link(problem, removal_tactic, removal_bindings, supports); } } finally { $negation_by_failure$.rebind(_prev_bind_0_$31, thread); } } finally { backward.$inference_expand_sense$.rebind(_prev_bind_5, thread); backward.$inference_expand_hl_module$.rebind(_prev_bind_4, thread); mt_relevance_macros.$relevant_mts$.rebind(_prev_bind_3, thread); mt_relevance_macros.$relevant_mt_function$.rebind(_prev_bind_2, thread); mt_relevance_macros.$mt$.rebind(_prev_bind_0, thread); } } return result; } public static SubLObject maybe_new_restriction_and_removal_link(final SubLObject problem, final SubLObject tactic, final SubLObject removal_bindings, final SubLObject supports) { final SubLObject restricted_mapped_problem = inference_worker_join_ordered.find_or_create_restricted_problem(problem, removal_bindings); maybe_new_removal_link(inference_datastructures_problem_link.mapped_problem_problem(restricted_mapped_problem), tactic, NIL, supports); return inference_worker_restriction.maybe_new_restriction_link(problem, restricted_mapped_problem, removal_bindings, NIL, tactic); } public static SubLObject maybe_new_removal_link(final SubLObject problem, final SubLObject tactic, final SubLObject removal_bindings, final SubLObject supports) { assert NIL != inference_datastructures_problem.problem_p(problem) : "inference_datastructures_problem.problem_p(problem) " + "CommonSymbols.NIL != inference_datastructures_problem.problem_p(problem) " + problem; final SubLObject hl_module = inference_datastructures_tactic.tactic_hl_module(tactic); if (NIL == inference_datastructures_problem.tactically_good_problem_p(problem)) { return new_removal_link(problem, hl_module, removal_bindings, supports); } if ((NIL != removal_tactic_p(tactic)) && (NIL == inference_datastructures_problem_store.problem_store_add_restriction_layer_of_indirectionP(inference_datastructures_problem.problem_store(problem)))) { return new_removal_link(problem, hl_module, removal_bindings, supports); } final SubLObject existing_link = find_removal_link(problem, tactic, removal_bindings, supports); if (NIL != inference_datastructures_problem_link.problem_link_p(existing_link)) { return existing_link; } return new_removal_link(problem, hl_module, removal_bindings, supports); } public static SubLObject find_removal_link(final SubLObject problem, final SubLObject tactic, final SubLObject v_bindings, final SubLObject supports) { final SubLObject candidate_argument_links = inference_datastructures_problem.problem_argument_links_lookup(problem, v_bindings); if (NIL != candidate_argument_links) { SubLObject cdolist_list_var = candidate_argument_links; SubLObject link = NIL; link = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if (((NIL != removal_link_p(link)) && tactic.eql(removal_link_tactic(link))) && (NIL != removal_link_data_equals_specP(link, v_bindings, supports))) { return link; } cdolist_list_var = cdolist_list_var.rest(); link = cdolist_list_var.first(); } } return NIL; } public static SubLObject new_removal_proof(final SubLObject removal_link) { final SubLObject removal_bindings = removal_link_bindings(removal_link); return inference_worker.propose_new_proof_with_bindings(removal_link, removal_bindings, NIL); } public static SubLObject execute_literal_level_meta_removal_tactic(final SubLObject tactic, final SubLObject mt, final SubLObject asent, final SubLObject sense) { final SubLObject strategy = inference_macros.current_controlling_strategy(); final SubLObject problem = inference_datastructures_tactic.tactic_problem(tactic); SubLObject removal_tactics = inference_datastructures_problem.problem_possible_removal_tactics(problem); SubLObject cdolist_list_var; removal_tactics = cdolist_list_var = Sort.sort(removal_tactics, symbol_function($sym100$PRODUCTIVITY__), symbol_function(TACTIC_PRODUCTIVITY)); SubLObject other_tactic = NIL; other_tactic = cdolist_list_var.first(); while (NIL != cdolist_list_var) { if ((!tactic.eql(other_tactic)) && (NIL == inference_datastructures_tactic.abductive_tacticP(other_tactic))) { while (NIL != inference_datastructures_tactic.tactic_possibleP(other_tactic)) { inference_tactician.strategy_execute_tactic(strategy, other_tactic); } } cdolist_list_var = cdolist_list_var.rest(); other_tactic = cdolist_list_var.first(); } return NIL; } public static SubLObject inference_remove_check_default(final SubLObject cycl_input_asent, SubLObject sense) { if (sense == UNPROVIDED) { sense = NIL; } final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject hl_module = inference_current_hl_module(); thread.resetMultipleValues(); final SubLObject cycl_input = inference_input_extractor(hl_module, cycl_input_asent, NIL); final SubLObject extracted_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != inference_input_verifier(hl_module, cycl_input)) { thread.resetMultipleValues(); final SubLObject raw_input = inference_input_encoder(hl_module, cycl_input, extracted_bindings); final SubLObject encoded_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != inference_output_checker(hl_module, raw_input, encoded_bindings)) { thread.resetMultipleValues(); final SubLObject support = inference_support_constructor(hl_module, cycl_input_asent, encoded_bindings); final SubLObject more_supports = thread.secondMultipleValue(); thread.resetMultipleValues(); backward.removal_add_node(support, NIL, more_supports); } } return NIL; } public static SubLObject do_all_legacy_inference_outputs(final SubLObject macroform, final SubLObject environment) { SubLObject current; final SubLObject datum = current = macroform.rest(); destructuring_bind_must_consp(current, datum, $list102); final SubLObject temp = current.rest(); current = current.first(); SubLObject raw_output = NIL; SubLObject raw_output_iterator = NIL; destructuring_bind_must_consp(current, datum, $list102); raw_output = current.first(); current = current.rest(); destructuring_bind_must_consp(current, datum, $list102); raw_output_iterator = current.first(); current = current.rest(); if (NIL == current) { final SubLObject body; current = body = temp; final SubLObject iterator = $sym103$ITERATOR; return list(CLET, list(list(iterator, raw_output_iterator)), list(PIF, list(ITERATOR_P, iterator), list(CUNWIND_PROTECT, listS(DO_ITERATOR, list(raw_output, iterator), append(body, NIL)), list(ITERATION_FINALIZE, iterator)), listS(DO_LIST, list(raw_output, iterator), append(body, NIL)))); } cdestructuring_bind_error(datum, $list102); return NIL; } public static SubLObject inference_remove_unify_default(final SubLObject cycl_input_asent, SubLObject sense) { if (sense == UNPROVIDED) { sense = NIL; } final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject hl_module = inference_current_hl_module(); thread.resetMultipleValues(); final SubLObject output_iterator = maybe_make_inference_output_iterator(hl_module, cycl_input_asent); final SubLObject encoded_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != output_iterator) { final SubLObject iterator = output_iterator; if (NIL != iteration.iterator_p(iterator)) { try { SubLObject valid; for (SubLObject done_var = NIL; NIL == done_var; done_var = makeBoolean(NIL == valid)) { thread.resetMultipleValues(); final SubLObject raw_output = iteration.iteration_next(iterator); valid = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != valid) { handle_one_output_generate_result(cycl_input_asent, hl_module, raw_output, encoded_bindings); } } } finally { final SubLObject _prev_bind_0 = $is_thread_performing_cleanupP$.currentBinding(thread); try { $is_thread_performing_cleanupP$.bind(T, thread); final SubLObject _values = getValuesAsVector(); iteration.iteration_finalize(iterator); restoreValuesFromVector(_values); } finally { $is_thread_performing_cleanupP$.rebind(_prev_bind_0, thread); } } } else { SubLObject cdolist_list_var = iterator; SubLObject raw_output = NIL; raw_output = cdolist_list_var.first(); while (NIL != cdolist_list_var) { handle_one_output_generate_result(cycl_input_asent, hl_module, raw_output, encoded_bindings); cdolist_list_var = cdolist_list_var.rest(); raw_output = cdolist_list_var.first(); } } } return NIL; } public static SubLObject maybe_make_inference_output_iterator(final SubLObject hl_module, final SubLObject cycl_input_asent) { return hl_module_guts($MAYBE_MAKE_INFERENCE_OUTPUT_ITERATOR, hl_module, cycl_input_asent, UNPROVIDED, UNPROVIDED, UNPROVIDED); } public static SubLObject maybe_make_inference_output_iterator_guts(final SubLObject hl_module, final SubLObject cycl_input_asent) { final SubLThread thread = SubLProcess.currentSubLThread(); thread.resetMultipleValues(); final SubLObject cycl_input = inference_input_extractor(hl_module, cycl_input_asent, NIL); final SubLObject extracted_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != inference_input_verifier(hl_module, cycl_input)) { thread.resetMultipleValues(); final SubLObject raw_input = inference_input_encoder(hl_module, cycl_input, extracted_bindings); final SubLObject encoded_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); final SubLObject output_iterator = inference_output_generator(hl_module, raw_input, encoded_bindings); return subl_promotions.values2(output_iterator, encoded_bindings); } return NIL; } public static SubLObject handle_one_output_generate_result(final SubLObject cycl_input_asent, final SubLObject hl_module, final SubLObject raw_output, final SubLObject encoded_bindings) { final SubLThread thread = SubLProcess.currentSubLThread(); thread.resetMultipleValues(); final SubLObject successP = hl_module_guts($HANDLE_ONE_OUTPUT_GENERATE_RESULT, cycl_input_asent, hl_module, raw_output, encoded_bindings, UNPROVIDED); final SubLObject support = thread.secondMultipleValue(); final SubLObject unify_bindings = thread.thirdMultipleValue(); final SubLObject more_supports = thread.fourthMultipleValue(); thread.resetMultipleValues(); if (NIL != successP) { return backward.removal_add_node(support, unify_bindings, more_supports); } return NIL; } public static SubLObject handle_one_output_generate_result_guts(final SubLObject cycl_input_asent, final SubLObject hl_module, final SubLObject raw_output, final SubLObject encoded_bindings) { final SubLThread thread = SubLProcess.currentSubLThread(); thread.resetMultipleValues(); final SubLObject cycl_output = inference_output_decoder(hl_module, raw_output, encoded_bindings); final SubLObject decoded_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != inference_output_verifier(hl_module, cycl_output)) { thread.resetMultipleValues(); final SubLObject cycl_output_asent = inference_output_constructor(hl_module, cycl_output, decoded_bindings); final SubLObject constructed_bindings = thread.secondMultipleValue(); thread.resetMultipleValues(); thread.resetMultipleValues(); final SubLObject unify_bindings = unification_utilities.term_unify(cycl_input_asent, cycl_output_asent, T, T); final SubLObject unify_justification = thread.secondMultipleValue(); thread.resetMultipleValues(); if (NIL != unify_bindings) { thread.resetMultipleValues(); final SubLObject support = inference_support_constructor(hl_module, cycl_output_asent, constructed_bindings); final SubLObject more_supports = thread.secondMultipleValue(); thread.resetMultipleValues(); return subl_promotions.values4(T, support, unify_bindings, append(more_supports, unify_justification)); } } return subl_promotions.values4(NIL, NIL, NIL, NIL); } public static SubLObject inference_current_hl_module() { return backward.inference_expand_hl_module(); } public static SubLObject inference_current_sense() { return backward.inference_expand_sense(); } public static SubLObject inference_input_extractor(final SubLObject hl_module, final SubLObject cycl_input_asent, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_input_extract_pattern(hl_module); return formula_pattern_match.pattern_transform_formula(pattern, cycl_input_asent, v_bindings); } public static SubLObject inference_input_verifier(final SubLObject hl_module, final SubLObject cycl_input) { final SubLObject pattern = inference_modules.hl_module_input_verify_pattern(hl_module); return formula_pattern_match.pattern_matches_formula_without_bindings(pattern, cycl_input); } public static SubLObject inference_input_encoder(final SubLObject hl_module, final SubLObject cycl_input, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_input_encode_pattern(hl_module); return pattern_match.pattern_transform_tree(pattern, cycl_input, v_bindings); } public static SubLObject inference_output_checker(final SubLObject hl_module, final SubLObject raw_input, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_output_check_pattern(hl_module); if (NIL == pattern) { return NIL; } final SubLObject output = pattern_match.pattern_transform_tree(pattern, raw_input, v_bindings); return list_utilities.sublisp_boolean(output); } public static SubLObject inference_output_generator(final SubLObject hl_module, final SubLObject raw_input, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_output_generate_pattern(hl_module); if (NIL == pattern) { return NIL; } final SubLObject output = pattern_match.pattern_transform_tree(pattern, raw_input, v_bindings); if (NIL != iteration.iterator_p(output)) { return output; } if (output.isList()) { return iteration.new_list_iterator(output); } return NIL; } public static SubLObject inference_output_decoder(final SubLObject hl_module, final SubLObject raw_output, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_output_decode_pattern(hl_module); return pattern_match.pattern_transform_tree(pattern, raw_output, v_bindings); } public static SubLObject inference_output_verifier(final SubLObject hl_module, final SubLObject cycl_output) { final SubLObject pattern = inference_modules.hl_module_output_verify_pattern(hl_module); return formula_pattern_match.pattern_matches_formula_without_bindings(pattern, cycl_output); } public static SubLObject inference_output_constructor(final SubLObject hl_module, final SubLObject cycl_output, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLObject pattern = inference_modules.hl_module_output_construct_pattern(hl_module); return pattern_match.pattern_transform_tree(pattern, cycl_output, v_bindings); } public static SubLObject inference_support_constructor(final SubLObject hl_module, final SubLObject cycl_output_asent, SubLObject v_bindings) { if (v_bindings == UNPROVIDED) { v_bindings = NIL; } final SubLThread thread = SubLProcess.currentSubLThread(); final SubLObject support_sense = inference_current_sense(); final SubLObject support_sentence = asent_and_sense_to_literal(cycl_output_asent, support_sense); final SubLObject support_mt = inference_modules.hl_module_support_mt_result(hl_module); final SubLObject pattern = inference_modules.hl_module_support_pattern(hl_module); if (NIL != pattern) { SubLObject current; final SubLObject datum = current = formula_pattern_match.pattern_transform_formula(pattern, cycl_output_asent, v_bindings); final SubLObject support = (current.isCons()) ? current.first() : NIL; destructuring_bind_must_listp(current, datum, $list112); final SubLObject more_supports; current = more_supports = current.rest(); return subl_promotions.values2(support, more_supports); } final SubLObject support_func = inference_modules.hl_module_support_func(hl_module); if (NIL != eval_in_api.possibly_cyc_api_function_spec_p(support_func)) { thread.resetMultipleValues(); final SubLObject support2 = eval_in_api.possibly_cyc_api_funcall_2(support_func, support_sentence, support_mt); final SubLObject more_supports2 = thread.secondMultipleValue(); thread.resetMultipleValues(); return subl_promotions.values2(support2, more_supports2); } final SubLObject support_module = inference_modules.hl_module_support_module(hl_module); final SubLObject support_strength = inference_modules.hl_module_support_strength(hl_module); final SubLObject support_tv = enumeration_types.tv_from_truth_strength($TRUE, support_strength); final SubLObject support3 = arguments.make_hl_support(support_module, support_sentence, support_mt, support_tv); final SubLObject more_supports3 = NIL; return subl_promotions.values2(support3, more_supports3); } public static SubLObject hl_module_guts(final SubLObject type, SubLObject arg1, SubLObject arg2, SubLObject arg3, SubLObject arg4, SubLObject arg5) { if (arg1 == UNPROVIDED) { arg1 = NIL; } if (arg2 == UNPROVIDED) { arg2 = NIL; } if (arg3 == UNPROVIDED) { arg3 = NIL; } if (arg4 == UNPROVIDED) { arg4 = NIL; } if (arg5 == UNPROVIDED) { arg5 = NIL; } if (type.eql($DETERMINE_NEW_REMOVAL_TACTIC_SPECS_FROM_HL_MODULES)) { return determine_new_removal_tactic_specs_from_hl_modules_guts(arg1, arg2, arg3); } if (type.eql($MAYBE_MAKE_REMOVAL_TACTIC_EXPAND_RESULTS_PROGRESS_ITERATOR)) { return maybe_make_removal_tactic_expand_results_progress_iterator_guts(arg1, arg2, arg3); } if (type.eql($HANDLE_ONE_OUTPUT_GENERATE_RESULT)) { return handle_one_output_generate_result_guts(arg1, arg2, arg3, arg4); } if (type.eql($MAYBE_MAKE_INFERENCE_OUTPUT_ITERATOR)) { return maybe_make_inference_output_iterator_guts(arg1, arg2); } Errors.error($str114$unknown_thing_to_do_in_the_HL_mod, type); return NIL; } public static SubLObject declare_inference_worker_removal_file() { declareFunction(me, "removal_link_data_print_function_trampoline", "REMOVAL-LINK-DATA-PRINT-FUNCTION-TRAMPOLINE", 2, 0, false); declareFunction(me, "removal_link_data_p", "REMOVAL-LINK-DATA-P", 1, 0, false); new inference_worker_removal.$removal_link_data_p$UnaryFunction(); declareFunction(me, "remov_link_data_hl_module", "REMOV-LINK-DATA-HL-MODULE", 1, 0, false); declareFunction(me, "remov_link_data_bindings", "REMOV-LINK-DATA-BINDINGS", 1, 0, false); declareFunction(me, "remov_link_data_supports", "REMOV-LINK-DATA-SUPPORTS", 1, 0, false); declareFunction(me, "_csetf_remov_link_data_hl_module", "_CSETF-REMOV-LINK-DATA-HL-MODULE", 2, 0, false); declareFunction(me, "_csetf_remov_link_data_bindings", "_CSETF-REMOV-LINK-DATA-BINDINGS", 2, 0, false); declareFunction(me, "_csetf_remov_link_data_supports", "_CSETF-REMOV-LINK-DATA-SUPPORTS", 2, 0, false); declareFunction(me, "make_removal_link_data", "MAKE-REMOVAL-LINK-DATA", 0, 1, false); declareFunction(me, "visit_defstruct_removal_link_data", "VISIT-DEFSTRUCT-REMOVAL-LINK-DATA", 2, 0, false); declareFunction(me, "visit_defstruct_object_removal_link_data_method", "VISIT-DEFSTRUCT-OBJECT-REMOVAL-LINK-DATA-METHOD", 2, 0, false); declareFunction(me, "new_removal_link", "NEW-REMOVAL-LINK", 4, 0, false); declareFunction(me, "new_removal_link_int", "NEW-REMOVAL-LINK-INT", 4, 0, false); declareFunction(me, "new_removal_link_data", "NEW-REMOVAL-LINK-DATA", 1, 0, false); declareFunction(me, "destroy_removal_link", "DESTROY-REMOVAL-LINK", 1, 0, false); declareFunction(me, "removal_link_hl_module", "REMOVAL-LINK-HL-MODULE", 1, 0, false); declareFunction(me, "removal_link_bindings", "REMOVAL-LINK-BINDINGS", 1, 0, false); declareFunction(me, "removal_link_supports", "REMOVAL-LINK-SUPPORTS", 1, 0, false); declareFunction(me, "set_removal_link_hl_module", "SET-REMOVAL-LINK-HL-MODULE", 2, 0, false); declareFunction(me, "set_removal_link_bindings", "SET-REMOVAL-LINK-BINDINGS", 2, 0, false); declareFunction(me, "set_removal_link_supports", "SET-REMOVAL-LINK-SUPPORTS", 2, 0, false); declareFunction(me, "removal_link_tactic", "REMOVAL-LINK-TACTIC", 1, 0, false); declareFunction(me, "removal_link_data_equals_specP", "REMOVAL-LINK-DATA-EQUALS-SPEC?", 3, 0, false); declareFunction(me, "generalized_removal_tactic_p", "GENERALIZED-REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "conjunctive_removal_tactic_p", "CONJUNCTIVE-REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "conjunctive_removal_link_p", "CONJUNCTIVE-REMOVAL-LINK-P", 1, 0, false); declareFunction(me, "conjunctive_removal_proof_p", "CONJUNCTIVE-REMOVAL-PROOF-P", 1, 0, false); declareFunction(me, "determine_new_conjunctive_removal_tactics", "DETERMINE-NEW-CONJUNCTIVE-REMOVAL-TACTICS", 2, 0, false); declareFunction(me, "sort_applicable_conjunctive_removal_modules_by_priority", "SORT-APPLICABLE-CONJUNCTIVE-REMOVAL-MODULES-BY-PRIORITY", 1, 0, false); declareFunction(me, "conjunctive_removal_module_priorityL", "CONJUNCTIVE-REMOVAL-MODULE-PRIORITY<", 2, 0, false); declareFunction(me, "determine_applicable_conjunctive_removal_modules", "DETERMINE-APPLICABLE-CONJUNCTIVE-REMOVAL-MODULES", 1, 0, false); declareFunction(me, "motivated_multi_literal_subclause_specs", "MOTIVATED-MULTI-LITERAL-SUBCLAUSE-SPECS", 1, 0, false); declareFunction(me, "hl_module_applicable_subclause_specs", "HL-MODULE-APPLICABLE-SUBCLAUSE-SPECS", 2, 0, false); declareFunction(me, "new_conjunctive_removal_tactic", "NEW-CONJUNCTIVE-REMOVAL-TACTIC", 4, 0, false); declareFunction(me, "compute_strategic_properties_of_conjunctive_removal_tactic", "COMPUTE-STRATEGIC-PROPERTIES-OF-CONJUNCTIVE-REMOVAL-TACTIC", 2, 0, false); declareFunction(me, "execute_conjunctive_removal_tactic", "EXECUTE-CONJUNCTIVE-REMOVAL-TACTIC", 1, 0, false); declareFunction(me, "maybe_make_conjunctive_removal_tactic_progress_iterator", "MAYBE-MAKE-CONJUNCTIVE-REMOVAL-TACTIC-PROGRESS-ITERATOR", 1, 0, false); declareFunction(me, "maybe_make_conjunctive_removal_tactic_progress_expand_iterative_iterator", "MAYBE-MAKE-CONJUNCTIVE-REMOVAL-TACTIC-PROGRESS-EXPAND-ITERATIVE-ITERATOR", 1, 0, false); declareFunction(me, "new_conjunctive_removal_tactic_progress_expand_iterative_iterator", "NEW-CONJUNCTIVE-REMOVAL-TACTIC-PROGRESS-EXPAND-ITERATIVE-ITERATOR", 2, 0, false); declareFunction(me, "handle_one_conjunctive_removal_tactic_expand_iterative_result", "HANDLE-ONE-CONJUNCTIVE-REMOVAL-TACTIC-EXPAND-ITERATIVE-RESULT", 2, 0, false); declareFunction(me, "maybe_make_conjunctive_removal_tactic_progress_expand_iterator", "MAYBE-MAKE-CONJUNCTIVE-REMOVAL-TACTIC-PROGRESS-EXPAND-ITERATOR", 1, 0, false); declareFunction(me, "new_conjunctive_removal_tactic_progress_expand_iterator", "NEW-CONJUNCTIVE-REMOVAL-TACTIC-PROGRESS-EXPAND-ITERATOR", 2, 0, false); declareFunction(me, "conjunctive_removal_callback", "CONJUNCTIVE-REMOVAL-CALLBACK", 2, 0, false); declareFunction(me, "handle_one_conjunctive_removal_tactic_expand_result", "HANDLE-ONE-CONJUNCTIVE-REMOVAL-TACTIC-EXPAND-RESULT", 2, 0, false); declareFunction(me, "conjunctive_removal_suppress_split_justificationP", "CONJUNCTIVE-REMOVAL-SUPPRESS-SPLIT-JUSTIFICATION?", 0, 0, false); declareFunction(me, "handle_one_conjunctive_removal_tactic_result", "HANDLE-ONE-CONJUNCTIVE-REMOVAL-TACTIC-RESULT", 3, 0, false); declareFunction(me, "maybe_new_simplification_link", "MAYBE-NEW-SIMPLIFICATION-LINK", 3, 0, false); declareFunction(me, "maybe_new_restriction_split_and_removal_links", "MAYBE-NEW-RESTRICTION-SPLIT-AND-REMOVAL-LINKS", 4, 0, false); declareFunction(me, "reorder_conjunctive_removal_justifications", "REORDER-CONJUNCTIVE-REMOVAL-JUSTIFICATIONS", 4, 0, false); declareFunction(me, "maybe_new_split_and_removal_links", "MAYBE-NEW-SPLIT-AND-REMOVAL-LINKS", 3, 0, false); declareFunction(me, "maybe_new_removal_link_for_split_link", "MAYBE-NEW-REMOVAL-LINK-FOR-SPLIT-LINK", 5, 0, false); declareFunction(me, "executed_conjunctive_removal_problems", "EXECUTED-CONJUNCTIVE-REMOVAL-PROBLEMS", 1, 1, false); declareFunction(me, "problem_store_has_some_executed_sksi_conjunctive_removal_problemP", "PROBLEM-STORE-HAS-SOME-EXECUTED-SKSI-CONJUNCTIVE-REMOVAL-PROBLEM?", 1, 0, false); declareFunction(me, "executed_conjunctive_removal_tactic_p", "EXECUTED-CONJUNCTIVE-REMOVAL-TACTIC-P", 1, 0, false); declareMacro(me, "with_problem_store_removal_assumptions", "WITH-PROBLEM-STORE-REMOVAL-ASSUMPTIONS"); declareFunction(me, "meta_removal_tactic_p", "META-REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "compute_strategic_properties_of_meta_removal_tactic", "COMPUTE-STRATEGIC-PROPERTIES-OF-META-REMOVAL-TACTIC", 2, 0, false); declareFunction(me, "removal_link_p", "REMOVAL-LINK-P", 1, 0, false); declareFunction(me, "removal_tactic_p", "REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "removal_proof_p", "REMOVAL-PROOF-P", 1, 0, false); declareFunction(me, "removal_module_exclusive_func_funcall", "REMOVAL-MODULE-EXCLUSIVE-FUNC-FUNCALL", 3, 0, false); declareFunction(me, "removal_module_required_func_funcall", "REMOVAL-MODULE-REQUIRED-FUNC-FUNCALL", 3, 0, false); declareFunction(me, "removal_module_expand_func_funcall", "REMOVAL-MODULE-EXPAND-FUNC-FUNCALL", 3, 0, false); declareFunction(me, "determine_new_literal_removal_tactics", "DETERMINE-NEW-LITERAL-REMOVAL-TACTICS", 3, 0, false); declareFunction(me, "determine_new_literal_meta_removal_tactics", "DETERMINE-NEW-LITERAL-META-REMOVAL-TACTICS", 3, 0, false); declareFunction(me, "determine_new_literal_simple_removal_tactics", "DETERMINE-NEW-LITERAL-SIMPLE-REMOVAL-TACTICS", 3, 0, false); declareFunction(me, "literal_removal_options", "LITERAL-REMOVAL-OPTIONS", 2, 1, false); declareFunction(me, "literal_removal_options_hl_modules", "LITERAL-REMOVAL-OPTIONS-HL-MODULES", 3, 0, false); declareFunction(me, "filter_modules_wrt_allowed_modules_spec", "FILTER-MODULES-WRT-ALLOWED-MODULES-SPEC", 2, 0, false); declareFunction(me, "literal_removal_options_candidate_hl_modules", "LITERAL-REMOVAL-OPTIONS-CANDIDATE-HL-MODULES", 3, 0, false); declareFunction(me, "hl_module_applicable_to_asentP", "HL-MODULE-APPLICABLE-TO-ASENT?", 2, 0, false); declareFunction(me, "determine_new_removal_tactics_from_hl_modules", "DETERMINE-NEW-REMOVAL-TACTICS-FROM-HL-MODULES", 4, 0, false); declareFunction(me, "determine_new_removal_tactic_specs_from_hl_modules", "DETERMINE-NEW-REMOVAL-TACTIC-SPECS-FROM-HL-MODULES", 3, 0, false); declareFunction(me, "determine_new_removal_tactic_specs_from_hl_modules_guts", "DETERMINE-NEW-REMOVAL-TACTIC-SPECS-FROM-HL-MODULES-GUTS", 3, 0, false); declareFunction(me, "determine_applicable_hl_modules_for_asent", "DETERMINE-APPLICABLE-HL-MODULES-FOR-ASENT", 3, 0, false); declareFunction(me, "update_applicable_hl_modules", "UPDATE-APPLICABLE-HL-MODULES", 5, 0, false); declareFunction(me, "update_supplanted_hl_modules", "UPDATE-SUPPLANTED-HL-MODULES", 3, 0, false); declareFunction(me, "update_supplanted_modules_wrt_tactic_specs", "UPDATE-SUPPLANTED-MODULES-WRT-TACTIC-SPECS", 3, 0, false); declareFunction(me, "compute_tactic_specs_for_asent", "COMPUTE-TACTIC-SPECS-FOR-ASENT", 3, 0, false); declareFunction(me, "literal_simple_removal_candidate_hl_modules", "LITERAL-SIMPLE-REMOVAL-CANDIDATE-HL-MODULES", 2, 0, false); declareFunction(me, "literal_removal_candidate_hl_modules_for_predicate_with_sense", "LITERAL-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE-WITH-SENSE", 2, 0, false); declareFunction(me, "literal_removal_candidate_hl_modules_for_predicate_with_sense_int_internal", "LITERAL-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE-WITH-SENSE-INT-INTERNAL", 3, 0, false); declareFunction(me, "literal_removal_candidate_hl_modules_for_predicate_with_sense_int", "LITERAL-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE-WITH-SENSE-INT", 3, 0, false); declareFunction(me, "literal_meta_removal_candidate_hl_modules", "LITERAL-META-REMOVAL-CANDIDATE-HL-MODULES", 2, 0, false); declareFunction(me, "literal_meta_removal_candidate_hl_modules_for_predicate_internal", "LITERAL-META-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE-INTERNAL", 1, 0, false); declareFunction(me, "literal_meta_removal_candidate_hl_modules_for_predicate", "LITERAL-META-REMOVAL-CANDIDATE-HL-MODULES-FOR-PREDICATE", 1, 0, false); declareFunction(me, "literal_level_removal_tactic_p", "LITERAL-LEVEL-REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "literal_level_meta_removal_tactic_p", "LITERAL-LEVEL-META-REMOVAL-TACTIC-P", 1, 0, false); declareFunction(me, "new_removal_tactic", "NEW-REMOVAL-TACTIC", 4, 0, false); declareFunction(me, "compute_strategic_properties_of_removal_tactic", "COMPUTE-STRATEGIC-PROPERTIES-OF-REMOVAL-TACTIC", 2, 0, false); declareMacro(me, "with_removal_tactic_execution_assumptions", "WITH-REMOVAL-TACTIC-EXECUTION-ASSUMPTIONS"); declareFunction(me, "execute_literal_level_removal_tactic", "EXECUTE-LITERAL-LEVEL-REMOVAL-TACTIC", 4, 0, false); declareFunction(me, "maybe_make_removal_tactic_progress_iterator", "MAYBE-MAKE-REMOVAL-TACTIC-PROGRESS-ITERATOR", 3, 0, false); declareFunction(me, "maybe_make_removal_tactic_output_generate_progress_iterator", "MAYBE-MAKE-REMOVAL-TACTIC-OUTPUT-GENERATE-PROGRESS-ITERATOR", 2, 0, false); declareFunction(me, "new_removal_tactic_output_generate_progress_iterator", "NEW-REMOVAL-TACTIC-OUTPUT-GENERATE-PROGRESS-ITERATOR", 3, 0, false); declareFunction(me, "handle_one_removal_tactic_output_generate_result", "HANDLE-ONE-REMOVAL-TACTIC-OUTPUT-GENERATE-RESULT", 3, 0, false); declareFunction(me, "handle_removal_add_node_for_output_generate", "HANDLE-REMOVAL-ADD-NODE-FOR-OUTPUT-GENERATE", 2, 0, false); declareFunction(me, "maybe_make_removal_tactic_expand_results_progress_iterator", "MAYBE-MAKE-REMOVAL-TACTIC-EXPAND-RESULTS-PROGRESS-ITERATOR", 3, 0, false); declareFunction(me, "maybe_make_removal_tactic_expand_results_progress_iterator_guts", "MAYBE-MAKE-REMOVAL-TACTIC-EXPAND-RESULTS-PROGRESS-ITERATOR-GUTS", 3, 0, false); declareFunction(me, "handle_removal_add_node_for_expand_results", "HANDLE-REMOVAL-ADD-NODE-FOR-EXPAND-RESULTS", 2, 0, false); declareFunction(me, "new_removal_tactic_expand_results_progress_iterator", "NEW-REMOVAL-TACTIC-EXPAND-RESULTS-PROGRESS-ITERATOR", 2, 0, false); declareFunction(me, "handle_one_removal_tactic_expand_result", "HANDLE-ONE-REMOVAL-TACTIC-EXPAND-RESULT", 2, 0, false); declareFunction(me, "handle_one_removal_tactic_result", "HANDLE-ONE-REMOVAL-TACTIC-RESULT", 3, 0, false); declareFunction(me, "maybe_new_restriction_and_removal_link", "MAYBE-NEW-RESTRICTION-AND-REMOVAL-LINK", 4, 0, false); declareFunction(me, "maybe_new_removal_link", "MAYBE-NEW-REMOVAL-LINK", 4, 0, false); declareFunction(me, "find_removal_link", "FIND-REMOVAL-LINK", 4, 0, false); declareFunction(me, "new_removal_proof", "NEW-REMOVAL-PROOF", 1, 0, false); declareFunction(me, "execute_literal_level_meta_removal_tactic", "EXECUTE-LITERAL-LEVEL-META-REMOVAL-TACTIC", 4, 0, false); declareFunction(me, "inference_remove_check_default", "INFERENCE-REMOVE-CHECK-DEFAULT", 1, 1, false); declareMacro(me, "do_all_legacy_inference_outputs", "DO-ALL-LEGACY-INFERENCE-OUTPUTS"); declareFunction(me, "inference_remove_unify_default", "INFERENCE-REMOVE-UNIFY-DEFAULT", 1, 1, false); new inference_worker_removal.$inference_remove_unify_default$UnaryFunction(); new inference_worker_removal.$inference_remove_unify_default$BinaryFunction(); declareFunction(me, "maybe_make_inference_output_iterator", "MAYBE-MAKE-INFERENCE-OUTPUT-ITERATOR", 2, 0, false); declareFunction(me, "maybe_make_inference_output_iterator_guts", "MAYBE-MAKE-INFERENCE-OUTPUT-ITERATOR-GUTS", 2, 0, false); declareFunction(me, "handle_one_output_generate_result", "HANDLE-ONE-OUTPUT-GENERATE-RESULT", 4, 0, false); declareFunction(me, "handle_one_output_generate_result_guts", "HANDLE-ONE-OUTPUT-GENERATE-RESULT-GUTS", 4, 0, false); declareFunction(me, "inference_current_hl_module", "INFERENCE-CURRENT-HL-MODULE", 0, 0, false); declareFunction(me, "inference_current_sense", "INFERENCE-CURRENT-SENSE", 0, 0, false); declareFunction(me, "inference_input_extractor", "INFERENCE-INPUT-EXTRACTOR", 2, 1, false); declareFunction(me, "inference_input_verifier", "INFERENCE-INPUT-VERIFIER", 2, 0, false); declareFunction(me, "inference_input_encoder", "INFERENCE-INPUT-ENCODER", 2, 1, false); declareFunction(me, "inference_output_checker", "INFERENCE-OUTPUT-CHECKER", 2, 1, false); declareFunction(me, "inference_output_generator", "INFERENCE-OUTPUT-GENERATOR", 2, 1, false); declareFunction(me, "inference_output_decoder", "INFERENCE-OUTPUT-DECODER", 2, 1, false); declareFunction(me, "inference_output_verifier", "INFERENCE-OUTPUT-VERIFIER", 2, 0, false); declareFunction(me, "inference_output_constructor", "INFERENCE-OUTPUT-CONSTRUCTOR", 2, 1, false); declareFunction(me, "inference_support_constructor", "INFERENCE-SUPPORT-CONSTRUCTOR", 2, 1, false); declareFunction(me, "hl_module_guts", "HL-MODULE-GUTS", 1, 5, false); return NIL; } public static SubLObject init_inference_worker_removal_file() { defconstant("*DTP-REMOVAL-LINK-DATA*", REMOVAL_LINK_DATA); defparameter("*CONJUNCTIVE-REMOVAL-TACTIC-EXPAND-RESULTS-QUEUE*", NIL); defparameter("*CONJUNCTIVE-REMOVAL-SUPPRESS-SPLIT-JUSTIFICATION?*", T); defparameter("*CONJUNCTIVE-REMOVAL-OPTIMIZE-WHEN-NO-JUSTIFICATIONS?*", T); defparameter("*REMOVAL-TACTIC-ITERATION-THRESHOLD*", TWO_INTEGER); defparameter("*REMOVAL-TACTIC-EXPAND-RESULTS-QUEUE*", NIL); return NIL; } public static SubLObject setup_inference_worker_removal_file() { register_method($print_object_method_table$.getGlobalValue(), $dtp_removal_link_data$.getGlobalValue(), symbol_function(REMOVAL_LINK_DATA_PRINT_FUNCTION_TRAMPOLINE)); SubLSpecialOperatorDeclarations.proclaim($list8); def_csetf(REMOV_LINK_DATA_HL_MODULE, _CSETF_REMOV_LINK_DATA_HL_MODULE); def_csetf(REMOV_LINK_DATA_BINDINGS, _CSETF_REMOV_LINK_DATA_BINDINGS); def_csetf(REMOV_LINK_DATA_SUPPORTS, _CSETF_REMOV_LINK_DATA_SUPPORTS); identity(REMOVAL_LINK_DATA); register_method(visitation.$visit_defstruct_object_method_table$.getGlobalValue(), $dtp_removal_link_data$.getGlobalValue(), symbol_function(VISIT_DEFSTRUCT_OBJECT_REMOVAL_LINK_DATA_METHOD)); memoization_state.note_memoized_function(LITERAL_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE_WITH_SENSE_INT); memoization_state.note_memoized_function(LITERAL_META_REMOVAL_CANDIDATE_HL_MODULES_FOR_PREDICATE); return NIL; } @Override public void declareFunctions() { declare_inference_worker_removal_file(); } @Override public void initializeVariables() { init_inference_worker_removal_file(); } @Override public void runTopLevelForms() { setup_inference_worker_removal_file(); } public static final class $removal_link_data_native extends SubLStructNative { public SubLObject $hl_module; public SubLObject $bindings; public SubLObject $supports; private static final SubLStructDeclNative structDecl; private $removal_link_data_native() { this.$hl_module = Lisp.NIL; this.$bindings = Lisp.NIL; this.$supports = Lisp.NIL; } @Override public SubLStructDecl getStructDecl() { return structDecl; } @Override public SubLObject getField2() { return this.$hl_module; } @Override public SubLObject getField3() { return this.$bindings; } @Override public SubLObject getField4() { return this.$supports; } @Override public SubLObject setField2(final SubLObject value) { return this.$hl_module = value; } @Override public SubLObject setField3(final SubLObject value) { return this.$bindings = value; } @Override public SubLObject setField4(final SubLObject value) { return this.$supports = value; } static { structDecl = makeStructDeclNative($removal_link_data_native.class, REMOVAL_LINK_DATA, REMOVAL_LINK_DATA_P, $list2, $list3, new String[]{ "$hl_module", "$bindings", "$supports" }, $list4, $list5, DEFAULT_STRUCT_PRINT_FUNCTION); } } public static final class $removal_link_data_p$UnaryFunction extends UnaryFunction { public $removal_link_data_p$UnaryFunction() { super(extractFunctionNamed("REMOVAL-LINK-DATA-P")); } @Override public SubLObject processItem(final SubLObject arg1) { return removal_link_data_p(arg1); } } public static final class $inference_remove_unify_default$UnaryFunction extends UnaryFunction { public $inference_remove_unify_default$UnaryFunction() { super(extractFunctionNamed("INFERENCE-REMOVE-UNIFY-DEFAULT")); } @Override public SubLObject processItem(final SubLObject arg1) { return inference_remove_unify_default(arg1, inference_worker_removal.$inference_remove_unify_default$UnaryFunction.UNPROVIDED); } } public static final class $inference_remove_unify_default$BinaryFunction extends BinaryFunction { public $inference_remove_unify_default$BinaryFunction() { super(extractFunctionNamed("INFERENCE-REMOVE-UNIFY-DEFAULT")); } @Override public SubLObject processItem(final SubLObject arg1, final SubLObject arg2) { return inference_remove_unify_default(arg1, arg2); } } } /** * Total time: 693 ms */
9231e8e17e4f2dbc3066b56b555d78e43185d4aa
6,833
java
Java
coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/contacts/InstitutionalProposalPersonAuditRule.java
sonamuthu/kc
3b8beb0dd656df32e155ace4711083be42ddd4fd
[ "ECL-2.0" ]
null
null
null
coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/contacts/InstitutionalProposalPersonAuditRule.java
sonamuthu/kc
3b8beb0dd656df32e155ace4711083be42ddd4fd
[ "ECL-2.0" ]
null
null
null
coeus-impl/src/main/java/org/kuali/kra/institutionalproposal/contacts/InstitutionalProposalPersonAuditRule.java
sonamuthu/kc
3b8beb0dd656df32e155ace4711083be42ddd4fd
[ "ECL-2.0" ]
null
null
null
49.514493
157
0.698083
996,028
/* * Copyright 2005-2014 The Kuali Foundation * * Licensed under the Educational Community 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.opensource.org/licenses/ecl1.php * * 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.kuali.kra.institutionalproposal.contacts; import org.kuali.kra.infrastructure.Constants; import org.kuali.kra.institutionalproposal.document.InstitutionalProposalDocument; import org.kuali.rice.krad.util.AuditCluster; import org.kuali.rice.krad.util.AuditError; import org.kuali.rice.krad.util.GlobalVariables; import org.kuali.rice.krad.document.Document; import org.kuali.rice.krad.rules.rule.DocumentAuditRule; import java.util.ArrayList; import java.util.List; public class InstitutionalProposalPersonAuditRule implements DocumentAuditRule { private static final String CONTACTS_AUDIT_ERRORS = "contactsAuditErrors"; private List<AuditError> auditErrors; public static final String PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY = "document.institutionalProposalList[0].projectPerson.auditErrors"; public static final String ERROR_PROPOSAL_PROJECT_PERSON_NO_PI = "error.awardProjectPerson.no.pi.exists"; public static final String ERROR_PROPOSAL_PROJECT_PERSON_MULTIPLE_PI_EXISTS = "error.awardProjectPerson.pi.exists"; public static final String ERROR_PROPOSAL_PROJECT_PERSON_UNIT_DETAILS_REQUIRED = "error.awardProjectPerson.unit.details.required"; public static final String ERROR_PROPOSAL_PROJECT_PERSON_LEAD_UNIT_REQUIRED = "error.awardProjectPerson.lead.unit.required"; /** * * Constructs a InstitutionalProposalContactAuditRule.java. Added so unit test would not * need to call processRunAuditBusinessRules and therefore declare a document. */ public InstitutionalProposalPersonAuditRule() { auditErrors = new ArrayList<AuditError>(); } @Override public boolean processRunAuditBusinessRules(Document document) { boolean valid = true; InstitutionalProposalDocument institutionalProposalDocument = (InstitutionalProposalDocument)document; auditErrors = new ArrayList<AuditError>(); valid &= checkPrincipalInvestigators(institutionalProposalDocument.getInstitutionalProposal().getProjectPersons()); valid &= checkUnits(institutionalProposalDocument.getInstitutionalProposal().getProjectPersons()); valid &= checkLeadUnits(institutionalProposalDocument.getInstitutionalProposal().getProjectPersons()); reportAndCreateAuditCluster(); return valid; } /** * This method creates and adds the AuditCluster to the Global AuditErrorMap. */ @SuppressWarnings("unchecked") protected void reportAndCreateAuditCluster() { if (auditErrors.size() > 0) { GlobalVariables.getAuditErrorMap().put(CONTACTS_AUDIT_ERRORS, new AuditCluster(Constants.CONTACTS_PANEL_NAME, auditErrors, Constants.AUDIT_ERRORS)); } } protected boolean checkPrincipalInvestigators(List<InstitutionalProposalPerson> institutionalProposalPersons) { boolean valid = true; List<InstitutionalProposalPerson> principalInvestigators = getPrincipalInvestigators(institutionalProposalPersons); int piCount = principalInvestigators.size(); if ( piCount == 0 ) { valid = false; auditErrors.add(new AuditError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_NO_PI, Constants.MAPPING_INSTITUTIONAL_PROPOSAL_CONTACTS_PAGE + "." + Constants.CONTACTS_PANEL_ANCHOR)); } else if ( piCount > 1 ) { valid = false; auditErrors.add(new AuditError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_MULTIPLE_PI_EXISTS, Constants.MAPPING_INSTITUTIONAL_PROPOSAL_CONTACTS_PAGE + "." + Constants.CONTACTS_PANEL_ANCHOR)); } return valid; } protected boolean checkUnits(List<InstitutionalProposalPerson> institutionalProposalPersons) { boolean valid = true; for ( InstitutionalProposalPerson person : institutionalProposalPersons) { if ( (person.isPrincipalInvestigator() || person.isCoInvestigator()) && person.getUnits() != null && person.getUnits().size() == 0 ) { valid = false; auditErrors.add(new AuditError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_UNIT_DETAILS_REQUIRED, Constants.MAPPING_INSTITUTIONAL_PROPOSAL_CONTACTS_PAGE + "." + Constants.CONTACTS_PANEL_ANCHOR, new String[]{person.getFullName()})); } } return valid; } protected boolean checkLeadUnits(List<InstitutionalProposalPerson> institutionalProposalPersons) { boolean valid = true; List<InstitutionalProposalPerson> principalInvestigators = getPrincipalInvestigators(institutionalProposalPersons); if ( principalInvestigators != null && principalInvestigators.size() == 1 ) { List<InstitutionalProposalPersonUnit> piUnits = principalInvestigators.get(0).getUnits(); int leadUnits = 0; for ( InstitutionalProposalPersonUnit unit : piUnits ) { if ( unit.isLeadUnit() ) { leadUnits++; } } if ( leadUnits != 1 ) { valid = false; auditErrors.add(new AuditError(PROPOSAL_PROJECT_PERSON_LIST_ERROR_KEY, ERROR_PROPOSAL_PROJECT_PERSON_LEAD_UNIT_REQUIRED, Constants.MAPPING_INSTITUTIONAL_PROPOSAL_CONTACTS_PAGE + "." + Constants.CONTACTS_PANEL_ANCHOR)); } } return valid; } protected List<InstitutionalProposalPerson> getPrincipalInvestigators(List<InstitutionalProposalPerson> projectPersons) { List<InstitutionalProposalPerson> principalInvestigators = new ArrayList<InstitutionalProposalPerson>(); for(InstitutionalProposalPerson p: projectPersons) { if(p.isPrincipalInvestigator()) { principalInvestigators.add(p); } } return principalInvestigators; } }
9231e97da798953ba7d36eadf80d6284467861a6
479
java
Java
src/main/java/gawari/_himanshu/JokeApp/JokeAppApplication.java
himanshugawari/Joke-App
291047e86617b6d616630ddc0aff72679a490506
[ "Apache-2.0" ]
null
null
null
src/main/java/gawari/_himanshu/JokeApp/JokeAppApplication.java
himanshugawari/Joke-App
291047e86617b6d616630ddc0aff72679a490506
[ "Apache-2.0" ]
7
2019-10-17T17:56:55.000Z
2019-10-18T07:29:44.000Z
src/main/java/gawari/_himanshu/JokeApp/JokeAppApplication.java
himanshugawari/Joke-App
291047e86617b6d616630ddc0aff72679a490506
[ "Apache-2.0" ]
null
null
null
28.176471
68
0.830898
996,029
package gawari._himanshu.JokeApp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ImportResource; @SpringBootApplication //Added @ImportResource for xml based configuration @ImportResource("classpath:chuck-config.xml") public class JokeAppApplication { public static void main(String[] args) { SpringApplication.run(JokeAppApplication.class, args); } }
9231eb575e7e7cae090a1906c86bedc0c375cf5c
1,427
java
Java
src/main/java/com/github/dkellenb/formulaevaluator/term/function/bigdecimal/BigDecimalRoundFunctionTerm.java
dkellenb/formula-evaluator
6b5290da07c10227c328367db43d237727a4e188
[ "Apache-2.0" ]
11
2016-09-07T12:37:27.000Z
2020-12-02T16:25:44.000Z
src/main/java/com/github/dkellenb/formulaevaluator/term/function/bigdecimal/BigDecimalRoundFunctionTerm.java
dkellenb/formula-evaluator
6b5290da07c10227c328367db43d237727a4e188
[ "Apache-2.0" ]
7
2016-09-16T06:47:26.000Z
2016-10-25T18:23:30.000Z
src/main/java/com/github/dkellenb/formulaevaluator/term/function/bigdecimal/BigDecimalRoundFunctionTerm.java
dkellenb/formula-evaluator
6b5290da07c10227c328367db43d237727a4e188
[ "Apache-2.0" ]
1
2020-04-04T07:10:23.000Z
2020-04-04T07:10:23.000Z
27.980392
103
0.762439
996,030
package com.github.dkellenb.formulaevaluator.term.function.bigdecimal; import java.math.BigDecimal; import java.util.List; import com.github.dkellenb.formulaevaluator.FormulaEvaluatorConfiguration; import com.github.dkellenb.formulaevaluator.definition.Function; import com.github.dkellenb.formulaevaluator.term.Term; import com.github.dkellenb.formulaevaluator.term.function.GenericFunctionTerm; /** * BigDecimal ROUND Function. */ public class BigDecimalRoundFunctionTerm extends GenericFunctionTerm<BigDecimal> implements BigDecimalFunction { /** * C'tor. This one should be used for external usage * * @param value the value * @param precision the precision */ public BigDecimalRoundFunctionTerm(Term<BigDecimal> value, Term<BigDecimal> precision) { super(value, precision); } /** * C'tor. * * @param parameters parameter terms */ BigDecimalRoundFunctionTerm(List<Term<BigDecimal>> parameters) { super(parameters); } @Override protected Function getFunction() { return Function.ROUND; } @Override public BigDecimal calculateDefault(FormulaEvaluatorConfiguration conf, List<BigDecimal> parameters) { BigDecimal toRound = parameters.get(0); BigDecimal precisionAsDecimal = parameters.get(1); int precision = precisionAsDecimal.intValue(); return toRound.setScale(precision, conf.getCalculationMathContext().getRoundingMode()); } }
9231eb7acb503ce959ed0239073b8a8d7b5dba12
1,108
java
Java
modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/StreamException.java
antvale/tcpmon
79e4a9038f8e047e6fba0264e9d7a29b33d12cc5
[ "Apache-2.0" ]
null
null
null
modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/StreamException.java
antvale/tcpmon
79e4a9038f8e047e6fba0264e9d7a29b33d12cc5
[ "Apache-2.0" ]
null
null
null
modules/tcpmon-core/src/main/java/org/apache/ws/commons/tcpmon/core/filter/StreamException.java
antvale/tcpmon
79e4a9038f8e047e6fba0264e9d7a29b33d12cc5
[ "Apache-2.0" ]
null
null
null
29.157895
75
0.712996
996,031
/* * Copyright 2004,2005 The Apache Software Foundation. * * 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.apache.ws.commons.tcpmon.core.filter; public class StreamException extends RuntimeException { private static final long serialVersionUID = 3318471666512565646L; public StreamException() { super(); } public StreamException(String message, Throwable cause) { super(message, cause); } public StreamException(String message) { super(message); } public StreamException(Throwable cause) { super(cause); } }
9231eb7d391c720fc22fb3021226560be79d220d
951
java
Java
core-customize/hybris/bin/custom/demoext/acceleratoraddon/web/src/org/training/controllers/ExtendedCustomersController.java
gepe-connectors/cloud-commerce-sample-setup
bb6aac3290040b6cd828233e4dbdc5a03aab8676
[ "Apache-2.0" ]
null
null
null
core-customize/hybris/bin/custom/demoext/acceleratoraddon/web/src/org/training/controllers/ExtendedCustomersController.java
gepe-connectors/cloud-commerce-sample-setup
bb6aac3290040b6cd828233e4dbdc5a03aab8676
[ "Apache-2.0" ]
null
null
null
core-customize/hybris/bin/custom/demoext/acceleratoraddon/web/src/org/training/controllers/ExtendedCustomersController.java
gepe-connectors/cloud-commerce-sample-setup
bb6aac3290040b6cd828233e4dbdc5a03aab8676
[ "Apache-2.0" ]
null
null
null
32.793103
107
0.767613
996,032
package org.training.controllers; /** * Controller which extends Customer Resources */ @Controller("sampleExtendedCustomerController") @RequestMapping(value = "/{baseSiteId}/customers") public class ExtendedCustomersController { @Secured("ROLE_CUSTOMERGROUP") @RequestMapping(value = "/current/nickname", method = RequestMethod.GET) @ResponseBody public String getCustomerNickname() { final String name = getCustomerFacade().getCurrentCustomer().getNickname(); return name; } @Secured("ROLE_CUSTOMERGROUP") @RequestMapping(value = "/current/nickname", method = RequestMethod.PUT) @ResponseBody public CustomerData setCustomerNickname(@RequestParam final String nickname) throws DuplicateUidException { final CustomerData customer = customerFacade.getCurrentCustomer(); customer.setNickname(nickname); customerFacade.updateFullProfile(customer); return customerFacade.getCurrentCustomer(); } }
9231ebbd63e700b3f4de2a0e73a47a8b323494cf
10,078
java
Java
src/main/java/com/InfinityRaider/AgriCraft/renderers/RenderTank.java
Mazdallier/AgriCraft
96e3505cc4b9352609d58f0ea4842f261970597f
[ "MIT" ]
null
null
null
src/main/java/com/InfinityRaider/AgriCraft/renderers/RenderTank.java
Mazdallier/AgriCraft
96e3505cc4b9352609d58f0ea4842f261970597f
[ "MIT" ]
null
null
null
src/main/java/com/InfinityRaider/AgriCraft/renderers/RenderTank.java
Mazdallier/AgriCraft
96e3505cc4b9352609d58f0ea4842f261970597f
[ "MIT" ]
null
null
null
52.764398
218
0.585731
996,033
package com.InfinityRaider.AgriCraft.renderers; import com.InfinityRaider.AgriCraft.reference.Constants; import com.InfinityRaider.AgriCraft.reference.Reference; import com.InfinityRaider.AgriCraft.tileentity.TileEntityTank; import com.sun.prism.util.tess.Tess; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.init.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.IBlockAccess; import org.lwjgl.opengl.GL11; public class RenderTank extends TileEntitySpecialRenderer{ private ResourceLocation[] baseTexture = {new ResourceLocation(Reference.MOD_ID.toLowerCase()+":textures/blocks/tankWood.png"), new ResourceLocation(Reference.MOD_ID.toLowerCase()+":textures/blocks/tankIron.png")}; private ResourceLocation waterTexture = new ResourceLocation("minecraft:textures/blocks/water_still.png"); @Override public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f) { TileEntityTank tank= (TileEntityTank) tileEntity; Tessellator tessellator = Tessellator.instance; //render the model GL11.glPushMatrix(); //translate the matrix to the right spot GL11.glTranslated(x,y,z); //draw the tank if(tank.getBlockMetadata()==0) { this.drawWoodTank(tank, tessellator); } else if(tank.getBlockMetadata()==1) { this.drawIronTank(tank, tessellator); } //draw the waterTexture if(tank.getFluidLevel()>0) { this.drawWater(tank, tessellator); } GL11.glPopMatrix(); } private void drawWoodTank(TileEntityTank tank, Tessellator tessellator) { double unit = Constants.unit; //bind the texture Minecraft.getMinecraft().renderEngine.bindTexture(baseTexture[tank.getBlockMetadata()]); //disable lighting GL11.glDisable(GL11.GL_LIGHTING); //tell the tessellator to start drawing tessellator.startDrawingQuads(); if(!tank.isMultiBlockPartner(tank.getWorldObj().getTileEntity(tank.xCoord, tank.yCoord, tank.zCoord+1))) { //draw first plane front tessellator.addVertexWithUV(0, 1, 1, 0, 0); tessellator.addVertexWithUV(0, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 0); //draw first plane back tessellator.addVertexWithUV(0, 1, 1 - unit*2, 0, 0); tessellator.addVertexWithUV(1, 1, 1 - unit*2, 1, 0); tessellator.addVertexWithUV(1, 0, 1 - unit*2, 1, 1); tessellator.addVertexWithUV(0, 0, 1 - unit*2, 0, 1); //draw first plane top tessellator.addVertexWithUV(0, 1, 1-unit*2, 0, 1-unit*2); tessellator.addVertexWithUV(0, 1, 1, 0, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 1 - unit*2, 1, 1-unit*2); } if(!tank.isMultiBlockPartner(tank.getWorldObj().getTileEntity(tank.xCoord+1, tank.yCoord, tank.zCoord))) { //draw second plane front tessellator.addVertexWithUV(1, 1, 1, 0, 0); tessellator.addVertexWithUV(1, 0, 1, 0, 1); tessellator.addVertexWithUV(1, 0, 0, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); //draw second plane back tessellator.addVertexWithUV(1 - unit*2, 1, 1, 0, 0); tessellator.addVertexWithUV(1 - unit*2, 1, 0, 1, 0); tessellator.addVertexWithUV(1 - unit*2, 0, 0, 1, 1); tessellator.addVertexWithUV(1 - unit*2, 0, 1, 0, 1); //draw second plane top tessellator.addVertexWithUV(1 - unit*2, 1, 0, 1-unit*2, 0); tessellator.addVertexWithUV(1 - unit*2, 1, 1, 1-unit*2, 1); tessellator.addVertexWithUV(1, 1, 1, 1, 1); tessellator.addVertexWithUV(1, 1, 0, 1, 0); } if(!tank.isMultiBlockPartner(tank.getWorldObj().getTileEntity(tank.xCoord, tank.yCoord, tank.zCoord-1))) { //draw third plane front tessellator.addVertexWithUV(1, 1, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 0, 0, 1, 1); tessellator.addVertexWithUV(0, 1, 0, 1, 0); //draw third plane back tessellator.addVertexWithUV(1, 1, unit*2, 0, 0); tessellator.addVertexWithUV(0, 1, unit*2, 1, 0); tessellator.addVertexWithUV(0, 0, unit*2, 1, 1); tessellator.addVertexWithUV(1, 0, unit*2, 0, 1); //draw third plane top tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 1, unit*2, 0, unit*2); tessellator.addVertexWithUV(1, 1, unit*2, 1, unit*2); tessellator.addVertexWithUV(1, 1, 0, 1, 0); } if(!tank.isMultiBlockPartner(tank.getWorldObj().getTileEntity(tank.xCoord-1, tank.yCoord, tank.zCoord))) { //draw fourth plane front tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 0, 0, 0, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 1, 1, 1, 0); //draw fourth plane back tessellator.addVertexWithUV(unit*2, 1, 0, 0, 0); tessellator.addVertexWithUV(unit*2, 1, 1, 1, 0); tessellator.addVertexWithUV(unit*2, 0, 1, 1, 1); tessellator.addVertexWithUV(unit*2, 0, 0, 0, 1); //draw fourth plane top tessellator.addVertexWithUV(0, 1, 0, 0, 0); tessellator.addVertexWithUV(0, 1, 1, 0, 1); tessellator.addVertexWithUV(unit*2, 1, 1, unit*2, 1); tessellator.addVertexWithUV(unit*2, 1, 0, unit*2, 0); } if(!tank.isMultiBlockPartner(tank.getWorldObj().getTileEntity(tank.xCoord, tank.yCoord-1, tank.zCoord))) { //draw bottom plane front tessellator.addVertexWithUV(0, 0, 0, 0, 0); tessellator.addVertexWithUV(1, 0, 0, 0, 1); tessellator.addVertexWithUV(1, 0, 1, 1, 1); tessellator.addVertexWithUV(0, 0, 1, 1, 0); //draw bottom plane back tessellator.addVertexWithUV(0, unit, 0, 0, 0); tessellator.addVertexWithUV(0, unit, 1, 1, 0); tessellator.addVertexWithUV(1, unit, 1, 1, 1); tessellator.addVertexWithUV(1, unit, 0, 0, 1); } tessellator.draw(); //enable lighting GL11.glEnable(GL11.GL_LIGHTING); } private void drawIronTank(TileEntityTank tank, Tessellator tessellator) { double unit = Constants.unit; //bind the texture Minecraft.getMinecraft().renderEngine.bindTexture(baseTexture[tank.getBlockMetadata()]); //disable lighting GL11.glDisable(GL11.GL_LIGHTING); //tell the tessellator to start drawing tessellator.startDrawingQuads(); tessellator.draw(); //enable lighting GL11.glEnable(GL11.GL_LIGHTING); } private void drawWater(TileEntityTank tank, Tessellator tessellator) { float unit = Constants.unit; int layer = tank.getYPosition(); int area = tank.getXSize()*tank.getZSize(); int waterLevel = (int) Math.floor(((float)tank.getFluidLevel()-0.1F)/((float)(tank.getSingleCapacity()*area))); //only render water on the relevant layer if(layer==waterLevel) { int yLevel = (tank.getFluidLevel()/area)-waterLevel*tank.getSingleCapacity(); float y = ((float) yLevel)/((float) tank.getSingleCapacity()); //bind the texture Minecraft.getMinecraft().renderEngine.bindTexture(this.waterTexture); //stolen from Vanilla code int l = Blocks.water.colorMultiplier(tank.getWorldObj(), tank.xCoord, tank.yCoord, tank.zCoord); float f = (float)(l >> 16 & 255) / 255.0F; float f1 = (float)(l >> 8 & 255) / 255.0F; float f2 = (float)(l & 255) / 255.0F; float f4 = 1.0F; //draw the water if(layer==0) { tessellator.startDrawingQuads(); tessellator.setBrightness(Blocks.water.getMixedBrightnessForBlock(tank.getWorldObj(), tank.xCoord, tank.yCoord, tank.zCoord)); tessellator.setColorRGBA_F(f4 * f, f4 * f1, f4 * f2, 0.8F); tessellator.addVertexWithUV(0, unit + (1.0000F-unit)*y - 0.0001F, 0, 0, 0); tessellator.addVertexWithUV(0, unit + (1.0000F-unit)*y - 0.0001F, 1, 0, 1); tessellator.addVertexWithUV(1, unit + (1.0000F-unit)*y - 0.0001F, 1, 1, 1); tessellator.addVertexWithUV(1, unit + (1.0000F-unit)*y - 0.0001F, 0, 1, 0); tessellator.draw(); } else { tessellator.startDrawingQuads(); tessellator.setBrightness(Blocks.water.getMixedBrightnessForBlock(tank.getWorldObj(), tank.xCoord, tank.yCoord, tank.zCoord)); tessellator.setColorOpaque_F(f4 * f, f4 * f1, f4 * f2); tessellator.addVertexWithUV(0, y - 0.001, 0, 0, 0); tessellator.addVertexWithUV(0, y - 0.001, 1, 0, 1); tessellator.addVertexWithUV(1, y - 0.001, 1, 1, 1); tessellator.addVertexWithUV(1, y - 0.001, 0, 1, 0); tessellator.draw(); } } } }
9231ec2e236cb419c0c77818ea688ee3b404f4b6
1,838
java
Java
test/jdepend/framework/PropertyConfiguratorTest.java
BrentShikoski/jdepend
d2811b8a3b57e8e487164ce45074d3ae485ec5a5
[ "MIT" ]
459
2015-01-30T21:51:40.000Z
2022-03-29T01:44:13.000Z
test/jdepend/framework/PropertyConfiguratorTest.java
BrentShikoski/jdepend
d2811b8a3b57e8e487164ce45074d3ae485ec5a5
[ "MIT" ]
11
2015-06-16T12:17:01.000Z
2022-03-19T22:27:39.000Z
test/jdepend/framework/PropertyConfiguratorTest.java
BrentShikoski/jdepend
d2811b8a3b57e8e487164ce45074d3ae485ec5a5
[ "MIT" ]
135
2015-01-20T15:50:19.000Z
2022-03-19T10:17:44.000Z
27.432836
74
0.651251
996,034
package jdepend.framework; import java.io.File; import java.io.IOException; import java.util.Collection; /** * @author <b>Mike Clark</b> * @author Clarkware Consulting, Inc. */ public class PropertyConfiguratorTest extends JDependTestCase { public PropertyConfiguratorTest(String name) { super(name); } protected void setUp() { super.setUp(); System.setProperty("user.home", getTestDataDir()); } protected void tearDown() { super.tearDown(); } public void testDefaultFilters() { PropertyConfigurator c = new PropertyConfigurator(); assertFiltersExist(c.getFilteredPackages()); assertFalse(c.getAnalyzeInnerClasses()); } public void testFiltersFromFile() throws IOException { String file = getTestDataDir() + "jdepend.properties"; PropertyConfigurator c = new PropertyConfigurator(new File(file)); assertFiltersExist(c.getFilteredPackages()); assertFalse(c.getAnalyzeInnerClasses()); } private void assertFiltersExist(Collection filters) { assertEquals(5, filters.size()); assertTrue(filters.contains("java.*")); assertTrue(filters.contains("javax.*")); assertTrue(filters.contains("sun.*")); assertTrue(filters.contains("com.sun.*")); assertTrue(filters.contains("com.xyz.tests.*")); } public void testDefaultPackages() throws IOException { JDepend j = new JDepend(); JavaPackage pkg = j.getPackage("com.xyz.a.neverchanges"); assertNotNull(pkg); assertEquals(0, pkg.getVolatility()); pkg = j.getPackage("com.xyz.b.neverchanges"); assertNotNull(pkg); assertEquals(0, pkg.getVolatility()); pkg = j.getPackage("com.xyz.c.neverchanges"); assertNull(pkg); } }
9231ecbd7424f3e3580365a6f5998ac28eb44a82
1,875
java
Java
mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableString.java
ssimons0814/incubator-mnemonic
8b0db1f9cbca33d330b483341cf9457d622b236a
[ "Apache-2.0" ]
61
2017-12-06T17:02:13.000Z
2022-03-08T01:10:55.000Z
mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableString.java
ssimons0814/incubator-mnemonic
8b0db1f9cbca33d330b483341cf9457d622b236a
[ "Apache-2.0" ]
48
2017-12-18T17:36:44.000Z
2022-03-24T06:15:08.000Z
mnemonic-collections/src/main/java/org/apache/mnemonic/collections/DurableString.java
ssimons0814/incubator-mnemonic
8b0db1f9cbca33d330b483341cf9457d622b236a
[ "Apache-2.0" ]
29
2017-12-17T04:02:39.000Z
2021-11-21T21:06:45.000Z
32.327586
87
0.778667
996,035
/* * 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.mnemonic.collections; import org.apache.mnemonic.Durable; import org.apache.mnemonic.DurableEntity; import org.apache.mnemonic.DurableGetter; import org.apache.mnemonic.DurableSetter; import org.apache.mnemonic.DurableType; import org.apache.mnemonic.EntityFactoryProxy; import org.apache.mnemonic.OutOfHybridMemory; import org.apache.mnemonic.RetrieveDurableEntityError; @DurableEntity public abstract class DurableString implements Durable, Comparable<DurableString> { @Override public void initializeAfterCreate() { } @Override public void initializeAfterRestore() { } @Override public void setupGenericInfo(EntityFactoryProxy[] efproxies, DurableType[] gftypes) { } public int compareTo(DurableString anotherString) { int ret = getStr().compareTo(anotherString.getStr()); return ret; } @DurableGetter public abstract String getStr() throws RetrieveDurableEntityError; @DurableSetter public abstract void setStr(String str, boolean destroy) throws OutOfHybridMemory, RetrieveDurableEntityError; }
9231ed46e20b37fa075d2e95379691044a1adbaf
3,878
java
Java
processor/src/test/java/org/mapstruct/ap/test/nestedbeans/MultipleForgedMethodsTest.java
incaseoftrouble/mapstruct
7064e0bc977dc88222ff8fe8d23f9e36cc76fcdf
[ "Apache-2.0" ]
5,133
2015-01-05T11:16:22.000Z
2022-03-31T18:56:15.000Z
processor/src/test/java/org/mapstruct/ap/test/nestedbeans/MultipleForgedMethodsTest.java
incaseoftrouble/mapstruct
7064e0bc977dc88222ff8fe8d23f9e36cc76fcdf
[ "Apache-2.0" ]
2,322
2015-01-01T19:20:49.000Z
2022-03-29T16:31:25.000Z
processor/src/test/java/org/mapstruct/ap/test/nestedbeans/MultipleForgedMethodsTest.java
incaseoftrouble/mapstruct
7064e0bc977dc88222ff8fe8d23f9e36cc76fcdf
[ "Apache-2.0" ]
820
2015-01-03T15:55:11.000Z
2022-03-30T20:58:07.000Z
36.933333
115
0.615008
996,036
/* * Copyright MapStruct Authors. * * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.ap.test.nestedbeans; import java.util.Arrays; import java.util.HashMap; import org.mapstruct.ap.test.nestedbeans.maps.AntonymsDictionary; import org.mapstruct.ap.test.nestedbeans.maps.AntonymsDictionaryDto; import org.mapstruct.ap.test.nestedbeans.maps.AutoMapMapper; import org.mapstruct.ap.test.nestedbeans.maps.Word; import org.mapstruct.ap.test.nestedbeans.maps.WordDto; import org.mapstruct.ap.test.nestedbeans.multiplecollections.Garage; import org.mapstruct.ap.test.nestedbeans.multiplecollections.GarageDto; import org.mapstruct.ap.test.nestedbeans.multiplecollections.MultipleListMapper; import org.mapstruct.ap.testutil.ProcessorTest; import org.mapstruct.ap.testutil.WithClasses; import static org.junit.jupiter.api.Assertions.assertEquals; /** * This test is for a case when several identical methods could be generated, what is an easy edge case to miss. */ public class MultipleForgedMethodsTest { @WithClasses({ Word.class, WordDto.class, AntonymsDictionaryDto.class, AntonymsDictionary.class, AutoMapMapper.class }) @ProcessorTest public void testNestedMapsAutoMap() { HashMap<WordDto, WordDto> dtoAntonyms = new HashMap<>(); HashMap<Word, Word> entityAntonyms = new HashMap<>(); String[] words = { "black", "good", "up", "left", "fast" }; String[] antonyms = { "white", "bad", "down", "right", "slow" }; assert words.length == antonyms.length : "Words length and antonyms length differ, please fix test data"; for ( int i = 0; i < words.length; i++ ) { String word = words[i]; String antonym = antonyms[i]; dtoAntonyms.put( new WordDto( word ), new WordDto( antonym ) ); entityAntonyms.put( new Word( word ), new Word( antonym ) ); } AntonymsDictionary mappedAntonymsDictionary = AutoMapMapper.INSTANCE.entityToDto( new AntonymsDictionaryDto( dtoAntonyms ) ); assertEquals( new AntonymsDictionary( entityAntonyms ), mappedAntonymsDictionary, "Mapper did not map dto to entity correctly" ); } @WithClasses({ MultipleListMapper.class, Garage.class, GarageDto.class, Car.class, CarDto.class, Wheel.class, WheelDto.class }) @ProcessorTest public void testMultipleCollections() { GarageDto dto = new GarageDto( Arrays.asList( new CarDto( "New car", 2017, Arrays.asList( new WheelDto( true, false ), new WheelDto( true, true ) ) ) ), Arrays.asList( new CarDto( "Old car-1", 1978, Arrays.asList( new WheelDto( false, false ), new WheelDto( false, true ) ) ), new CarDto( "Old car-2", 1934, Arrays.asList( new WheelDto( false, true ), new WheelDto( false, false ) ) ) ) ); Garage entity = new Garage( Arrays.asList( new Car( "New car", 2017, Arrays.asList( new Wheel( true, false ), new Wheel( true, true ) ) ) ), Arrays.asList( new Car( "Old car-1", 1978, Arrays.asList( new Wheel( false, false ), new Wheel( false, true ) ) ), new Car( "Old car-2", 1934, Arrays.asList( new Wheel( false, true ), new Wheel( false, false ) ) ) ) ); GarageDto mappedDto = MultipleListMapper.INSTANCE.convert( entity ); assertEquals( dto, mappedDto, "Mapper did not map entity to dto correctly" ); } }
9231ed684bcd481fa89cb5479152061eefff6c93
16,490
java
Java
src/com/dyo/d3quests/QuestsActivitySwipe.java
dyouyang/D3Quests
961e6034aac3596fd78fd09ebc1762d3f5d80a51
[ "MIT" ]
1
2015-02-24T22:48:55.000Z
2015-02-24T22:48:55.000Z
src/com/dyo/d3quests/QuestsActivitySwipe.java
dyouyang/D3Quests
961e6034aac3596fd78fd09ebc1762d3f5d80a51
[ "MIT" ]
null
null
null
src/com/dyo/d3quests/QuestsActivitySwipe.java
dyouyang/D3Quests
961e6034aac3596fd78fd09ebc1762d3f5d80a51
[ "MIT" ]
null
null
null
35.538793
118
0.710431
996,037
package com.dyo.d3quests; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Random; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.FragmentTransaction; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.NavUtils; import android.support.v4.view.ViewPager; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.dyo.d3quests.model.CompletedQuests; import com.dyo.d3quests.model.Quest; import com.flurry.android.FlurryAgent; public class QuestsActivitySwipe extends FragmentActivity implements ActionBar.TabListener, D3TaskListener { public static final int NUM_ACTS = 5; /** * The {@link android.support.v4.view.PagerAdapter} that will provide * fragments for each of the sections. We use a * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which * will keep every loaded fragment in memory. If this becomes too memory * intensive, it may be best to switch to a * {@link android.support.v4.app.FragmentStatePagerAdapter}. */ SectionsPagerAdapter mSectionsPagerAdapter; /** * The {@link ViewPager} that will host the section contents. */ ViewPager mViewPager; // Currently viewed hero. private static String heroId; private String name; private static String region; private static String battleTagFull; private static CompletedQuests completedQuests; private static final int numQuests[] = {10, 10, 7, 4, 8}; private static boolean fullActCompleted[] = new boolean[5]; private static List<D3ModelUpdateListener> modelUpdateListeners; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); setContentView(R.layout.activity_quests_activity_swipe); getWindow().setBackgroundDrawableResource(R.drawable.background_tyrael); heroId = getIntent().getExtras().getString("heroId"); name = getIntent().getExtras().getString("heroName"); battleTagFull = getIntent().getExtras().getString("battleTagFull"); region = getIntent().getExtras().getString("region"); completedQuests = new CompletedQuests(); modelUpdateListeners = new ArrayList<D3ModelUpdateListener>(); setTitle(name); final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter( getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager .setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. Tab tab = actionBar.newTab() .setCustomView(R.layout.tab_layout) .setTabListener(this); TextView tabText = (TextView) tab.getCustomView().findViewById(R.id.textview_act); tabText.setText(mSectionsPagerAdapter.getPageTitle(i)); actionBar.addTab(tab); } // Gets the URL from the UI's text field. String stringUrl = String.format("http://%s.battle.net/api/d3/profile/%s/hero/%s", region, battleTagFull, heroId); ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); if (networkInfo != null && networkInfo.isConnected()) { new GetD3DataTask(this, this).execute(stringUrl); } else { Toast.makeText(this, "No network connection.", Toast.LENGTH_LONG).show(); } } @Override protected void onStart() { super.onStart(); FlurryAgent.onStartSession(this, getString(R.string.flurry_api_key)); } @Override protected void onStop() { super.onStop(); FlurryAgent.onEndSession(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.quests_activity_swipe, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; case R.id.action_feedback: Intent Email = new Intent(Intent.ACTION_SEND); Email.setType("text/email"); Email.putExtra(Intent.EXTRA_EMAIL, new String[] { "kenaa@example.com" }); Email.putExtra(Intent.EXTRA_SUBJECT, "Feedback"); startActivity(Intent.createChooser(Email, "Send Feedback:")); return true; } return super.onOptionsItemSelected(item); } @Override public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { // When the given tab is selected, switch to the corresponding page in // the ViewPager. mViewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } @Override public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) { } /** * A {@link FragmentPagerAdapter} that returns a fragment corresponding to * one of the sections/tabs/pages. */ public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. // Return a SectionFragment (defined as a static inner class // below) with the page number as its lone argument. Fragment fragment = new SectionFragment(); Bundle args = new Bundle(); args.putInt(SectionFragment.ARG_SECTION_NUMBER, position + 1); fragment.setArguments(args); return fragment; } @Override public int getCount() { // Show 5 total pages. return NUM_ACTS; } @Override public CharSequence getPageTitle(int position) { Locale l = Locale.getDefault(); switch (position) { case 0: return getString(R.string.title_section1).toUpperCase(l); case 1: return getString(R.string.title_section2).toUpperCase(l); case 2: return getString(R.string.title_section3).toUpperCase(l); case 3: return getString(R.string.title_section4).toUpperCase(l); case 4: return getString(R.string.title_section5).toUpperCase(l); } return null; } } /** * Each fragment corresponds to one act, and display the act's quests and * total completion. * @param <T> */ public static class SectionFragment extends Fragment implements D3ModelUpdateListener { /** * The fragment argument representing the section number for this * fragment. */ public static final String ARG_SECTION_NUMBER = "section_number"; private int currentAct; private final ArrayList<Quest> actList = new ArrayList<Quest>(); QuestArrayAdapter questAdapter; ListView questListView; TextView fullCompleted; String fractionComplete; TextView tip; public SectionFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate( R.layout.fragment_quests_activity_swipe, container, false); currentAct = getArguments().getInt(ARG_SECTION_NUMBER); initAllQuests(currentAct); fullCompleted = (TextView) rootView.findViewById(R.id.section_label); questListView = (ListView) rootView.findViewById(R.id.quest_list); questAdapter = new QuestArrayAdapter(this.getActivity(), android.R.layout.simple_list_item_checked, actList); questListView.setAdapter(questAdapter); // Random tip at bottom of quest list. tip = (TextView) rootView.findViewById(R.id.quests_tip); Random r = new Random(); int randomTip = r.nextInt(2); if (randomTip == 0) { tip.setText(getString(R.string.quest_tip_reset)); } else if (randomTip == 1) { tip.setText(getString(R.string.quest_tip_delay)); } // Calculate quest completion on initialize of this fragment. updateQuests(); modelUpdateListeners.add(this); return rootView; } private void initAllQuests(int act) { actList.clear(); if (act == 1) { actList.add(new Quest("the-fallen-star", "The Fallen Star")); actList.add(new Quest("the-legacy-of-cain", "The Legacy of Cain")); actList.add(new Quest("a-shattered-crown", "A Shattered Crown")); actList.add(new Quest("reign-of-the-black-king", "Reign of the Black King")); actList.add(new Quest("sword-of-the-stranger", "Sword of the Stranger")); actList.add(new Quest("the-broken-blade", "The Broken Blade")); actList.add(new Quest("the-doom-in-wortham", "The Doom in Wortham")); actList.add(new Quest("trailing-the-coven", "Trailing the Coven")); actList.add(new Quest("the-imprisoned-angel", "The Imprisoned Angel")); actList.add(new Quest("return-to-new-tristram", "Return to New Tristram")); } if (act == 2) { actList.add(new Quest("shadows-in-the-desert", "Shadows in the Desert")); actList.add(new Quest("the-road-to-alcarnus", "The Road to Alcarnus")); actList.add(new Quest("city-of-blood", "City of Blood")); actList.add(new Quest("a-royal-audience", "A Royal Audience")); actList.add(new Quest("unexpected-allies", "Unexpected Allies")); actList.add(new Quest("betrayer-of-the-horadrim", "Betrayer of the Horadrim")); actList.add(new Quest("blood-and-sand", "Blood and Sand")); actList.add(new Quest("the-black-soulstone", "The Black Soulstone")); actList.add(new Quest("the-scouring-of-caldeum", "The Scouring of Caldeum")); actList.add(new Quest("lord-of-lies", "Lord of Lies")); } if (act == 3) { actList.add(new Quest("the-siege-of-bastions-keep", "The Siege of Bastion's Keep")); actList.add(new Quest("turning-the-tide", "Turning the Tide")); actList.add(new Quest("the-breached-keep", "The Breached Keep")); actList.add(new Quest("tremors-in-the-stone", "Tremors in the Stone")); actList.add(new Quest("machines-of-war", "Machines of War")); actList.add(new Quest("siegebreaker", "Siegebreaker")); actList.add(new Quest("heart-of-sin", "Heart of Sin")); } if (act == 4) { actList.add(new Quest("fall-of-the-high-heavens", "Fall of the High Heavens")); actList.add(new Quest("the-light-of-hope", "The Light of Hope")); actList.add(new Quest("beneath-the-spire", "Beneath the Spire")); actList.add(new Quest("prime-evil", "Prime Evil")); } if (act == 5) { actList.add(new Quest("the-fall-of-westmarch", "The Fall of Westmarch")); actList.add(new Quest("souls-of-the-dead", "Souls of the Dead")); actList.add(new Quest("the-harbinger", "The Harbinger")); actList.add(new Quest("the-witch", "The Witch")); actList.add(new Quest("the-pandemonium-gate", "The Pandemonium Gate")); actList.add(new Quest("the-battlefields-of-eternity", "The Battlefields of Eternity")); actList.add(new Quest("breaching-the-fortress", "Breaching the Fortress")); actList.add(new Quest("angel-of-death", "Angel of Death")); } } public void updateQuests() { // If the model isn't updated yet, wait for listener // callback later to take care of it. This usually occurs on the // first two acts due to ViewPager instantiating them on load. if (!completedQuests.isUpdated()) return; // Compare static all quests list with completed quests // returned from API. List<Quest> completed = completedQuests.getProgression().get("act"+currentAct); for (int i = 0; i < completed.size(); i++) { Quest thisQuest = completed.get(i); if (actList.contains(thisQuest)) { actList.get(actList.indexOf(thisQuest)).setComplete(true); } } // Calculate completed over total quests. if (completed.size() == actList.size()) { fullActCompleted[currentAct-1] = true; } else { fullActCompleted[currentAct-1] = false; } fractionComplete = completed.size() + "/" + actList.size(); // Update quest list and completion summary at top. questAdapter.notifyDataSetChanged(); if (fullActCompleted[currentAct-1]) { fullCompleted.setText(String.format("Act completed (%s)", fractionComplete)); } else { if (fractionComplete != null) { fullCompleted.setText(String.format("Act not complete (%s)", fractionComplete)); } else { fullCompleted.setText(getString(R.string.d3_api_maintenance)); } fullCompleted.setTextColor(Color.RED); } } @Override public void onUpdateFinished() { // Callback when the completedQuests model is finished updating from API. updateQuests(); } } @Override public void onTaskFinished(String result) { // Callback when JSON data from API has been retrieved, so we go ahead and populate // the model. Send callbacks to the fragments when we're finished. try { JSONObject hero = new JSONObject(result); JSONObject progression = hero.getJSONObject("progression"); Iterator<String> actsIter = progression.keys(); while (actsIter.hasNext()) { String key = actsIter.next(); JSONObject act = progression.getJSONObject(key); JSONArray quests = act.getJSONArray("completedQuests"); ArrayList<Quest> questsList = new ArrayList<Quest>(); for (int i = 0; i < quests.length(); i++) { JSONObject quest = quests.getJSONObject(i); String slug = quest.getString("slug"); String name = quest.getString("name"); Quest thisQuest = new Quest(slug, name); questsList.add(thisQuest); } completedQuests.getProgression().put(key, questsList); } completedQuests.setUpdated(true); // Calculate if each act is complete. for (int i = 1; i <= 5; i++) { List<Quest> completed = completedQuests.getProgression().get( "act" + i); if (completed.size() == numQuests[i-1]) { fullActCompleted[i - 1] = true; } else { // If not complete, set an icon in the tab view. fullActCompleted[i - 1] = false; ImageView notComplete = (ImageView) getActionBar().getTabAt(i-1).getCustomView().findViewById(R.id.not_complete); notComplete.setVisibility(View.VISIBLE); } } for (D3ModelUpdateListener listener : modelUpdateListeners) { listener.onUpdateFinished(); } } catch (JSONException e) { e.printStackTrace(); Toast.makeText(getApplicationContext(), "Diablo 3 API error occurred.", Toast.LENGTH_SHORT).show(); } } }
9231ee791a58c2d75907d1d137f501bfdc53da92
73
java
Java
src_orc/main/java/frc/robot/commands/Control_Commands/Auto.java
steel-mustangs-2017/test-2022-2946-master
d56c656fe6773084414f33b0825eeb12cafbbbad
[ "BSD-3-Clause" ]
null
null
null
src_orc/main/java/frc/robot/commands/Control_Commands/Auto.java
steel-mustangs-2017/test-2022-2946-master
d56c656fe6773084414f33b0825eeb12cafbbbad
[ "BSD-3-Clause" ]
null
null
null
src_orc/main/java/frc/robot/commands/Control_Commands/Auto.java
steel-mustangs-2017/test-2022-2946-master
d56c656fe6773084414f33b0825eeb12cafbbbad
[ "BSD-3-Clause" ]
null
null
null
12.166667
44
0.739726
996,038
package frc.robot.commands.Control_Commands; public class Auto { }
9231eeb069beb92f5d01a10080980d3f2d2fda9c
1,883
java
Java
AppManagerProject/src/com/tcl/manager/view/RadarViewLayout.java
zoozooll/MyExercise
1be14e0252babb28e32951fa1e35fc867a6ac070
[ "Apache-2.0" ]
2
2019-07-03T00:38:50.000Z
2020-08-06T06:24:06.000Z
AppManagerProject/src/com/tcl/manager/view/RadarViewLayout.java
zoozooll/MyExercise
1be14e0252babb28e32951fa1e35fc867a6ac070
[ "Apache-2.0" ]
null
null
null
AppManagerProject/src/com/tcl/manager/view/RadarViewLayout.java
zoozooll/MyExercise
1be14e0252babb28e32951fa1e35fc867a6ac070
[ "Apache-2.0" ]
null
null
null
25.106667
197
0.58683
996,039
package com.tcl.manager.view; import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; /** * 雷达波位置控制布局 * * @author jiaquan.huang * */ public class RadarViewLayout extends ViewGroup { Context mContext; public RadarViewLayout(Context context) { super(context); mContext = context; } public RadarViewLayout(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; init(mContext); } RadarWaveView radarView; private void init(Context context) { radarView = new RadarWaveView(context); this.addView(radarView); } int left = 0; int top = 0; int right = 0; int bottom = 0; @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { int childCount = getChildCount(); if (childCount > 0) { View child = getChildAt(0); int tempLeft = left - l; int tempTop = top - t; int tempRight = right - l; int tempBottom = bottom - t; if (child instanceof RadarWaveView) { RadarWaveView radarWaveView = (RadarWaveView) child; radarWaveView.layout(tempLeft - radarWaveView.radarWidth / 2, tempTop - radarWaveView.radarWidth / 2, tempRight + radarWaveView.radarWidth / 2, tempBottom + radarWaveView.radarWidth / 2); } } } public void setLocation(int l, int t, int r, int b, int radarSize) { left = l; top = t; right = r; bottom = b; radarView.radarWidth = radarSize; radarView.callLayout(); this.requestLayout(); } public void start() { radarView.start(); } public void end() { radarView.stop(); } }
9231eed48cc6b9fe2606a241953bdeab46892334
46,165
java
Java
phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
wwjiang007/phoenix
6ea9dec20f1302c10d7831f544cf9615eba633f5
[ "Apache-2.0" ]
984
2015-01-04T20:25:27.000Z
2022-03-22T08:06:36.000Z
phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
wwjiang007/phoenix
6ea9dec20f1302c10d7831f544cf9615eba633f5
[ "Apache-2.0" ]
953
2015-01-15T07:08:52.000Z
2022-03-25T09:07:56.000Z
phoenix-core/src/it/java/org/apache/phoenix/end2end/DefaultColumnValueIT.java
wwjiang007/phoenix
6ea9dec20f1302c10d7831f544cf9615eba633f5
[ "Apache-2.0" ]
1,077
2015-01-05T13:00:26.000Z
2022-03-31T08:40:59.000Z
42.824675
115
0.555442
996,040
/* * 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.phoenix.end2end; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.math.BigDecimal; import java.sql.Array; import java.sql.Connection; import java.sql.Date; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Time; import java.sql.Timestamp; import java.text.DecimalFormatSymbols; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.util.ByteUtil; import org.apache.phoenix.util.DateUtil; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; @Category(ParallelStatsDisabledTest.class) public class DefaultColumnValueIT extends ParallelStatsDisabledIT { private String sharedTable1; private String sharedTable2; private String DEFAULT_CURRENCY_SYMBOL = DecimalFormatSymbols.getInstance().getCurrencySymbol(); @Before public void init() { sharedTable1 = generateUniqueName(); sharedTable2 = generateUniqueName(); } @Test public void testDefaultColumnValue() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable1 + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.createStatement().execute("ALTER TABLE " + sharedTable1 + " ADD test2 INTEGER DEFAULT 5, est3 INTEGER"); String dml = "UPSERT INTO " + sharedTable1 + " VALUES (1, 2)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + sharedTable1 + " VALUES (11, 12, 13, 14, null, 16)"; conn.createStatement().execute(dml); conn.commit(); String projection = "*"; ResultSet rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(2, rs.getInt(2)); assertEquals(10, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertEquals(5, rs.getInt(5)); assertEquals(0, rs.getInt(6)); assertTrue(rs.wasNull()); assertFalse(rs.next()); rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(12, rs.getInt(2)); assertEquals(13, rs.getInt(3)); assertEquals(14, rs.getInt(4)); assertEquals(0, rs.getInt(5)); assertTrue(rs.wasNull()); assertEquals(16, rs.getInt(6)); assertFalse(rs.next()); } @Test public void testDefaultColumnValueOnView() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable1 + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "test2 INTEGER DEFAULT 5, " + "test3 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.createStatement().execute("CREATE VIEW " + sharedTable2 + "(pk4 INTEGER NOT NULL DEFAULT 20 PRIMARY KEY, test4 VARCHAR DEFAULT 'foo') " + "AS SELECT * FROM " + sharedTable1 + " WHERE pk1 = 1"); String dml = "UPSERT INTO " + sharedTable2 + "(pk2) VALUES (2)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT pk1,pk2,pk3,pk4,test2,test4 FROM " + sharedTable2); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(2, rs.getInt(2)); assertEquals(10, rs.getInt(3)); assertEquals(20, rs.getInt(4)); assertEquals(5, rs.getInt(5)); assertEquals("foo", rs.getString(6)); assertFalse(rs.next()); } @Test public void testDefaultColumnValueProjected() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable1 + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "test2 INTEGER DEFAULT 5, " + "test3 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + sharedTable1 + " VALUES (1, 2)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + sharedTable1 + " VALUES (11, 12, 13, 14, null, 16)"; conn.createStatement().execute(dml); conn.commit(); String projection = "pk1, pk2, pk3, test1, test2, test3"; ResultSet rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(2, rs.getInt(2)); assertEquals(10, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertEquals(5, rs.getInt(5)); assertEquals(0, rs.getInt(6)); assertTrue(rs.wasNull()); assertFalse(rs.next()); rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(12, rs.getInt(2)); assertEquals(13, rs.getInt(3)); assertEquals(14, rs.getInt(4)); assertEquals(0, rs.getInt(5)); assertTrue(rs.wasNull()); assertEquals(16, rs.getInt(6)); assertFalse(rs.next()); projection = "pk1, pk3, pk2, test1, test3, test2"; rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertEquals(2, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertEquals(0, rs.getInt(5)); assertTrue(rs.wasNull()); assertEquals(5, rs.getInt(6)); assertFalse(rs.next()); rs = conn.createStatement() .executeQuery("SELECT " + projection + " FROM " + sharedTable1 + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(13, rs.getInt(2)); assertEquals(12, rs.getInt(3)); assertEquals(14, rs.getInt(4)); assertEquals(16, rs.getInt(5)); assertEquals(0, rs.getInt(6)); assertTrue(rs.wasNull()); assertFalse(rs.next()); } @Test public void testMultipleDefaults() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL DEFAULT 5, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "test2 INTEGER DEFAULT 50, " + "test3 INTEGER DEFAULT 100, " + "test4 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + table + " VALUES (11, 12, 13, 21, null, null, 24)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(5, rs.getInt(2)); assertEquals(10, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertEquals(50, rs.getInt(5)); assertEquals(100, rs.getInt(6)); assertEquals(0, rs.getInt(7)); assertTrue(rs.wasNull()); assertFalse(rs.next()); rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(12, rs.getInt(2)); assertEquals(13, rs.getInt(3)); assertEquals(21, rs.getInt(4)); assertEquals(0, rs.getInt(5)); assertTrue(rs.wasNull()); assertEquals(0, rs.getInt(6)); assertTrue(rs.wasNull()); assertEquals(24, rs.getInt(7)); assertFalse(rs.next()); } @Test public void testDefaultImmutableRows() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL DEFAULT 5, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "test2 INTEGER DEFAULT 50, " + "test3 INTEGER DEFAULT 100, " + "test4 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))" + "IMMUTABLE_ROWS=true"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + table + " VALUES (11, 12, 13, 21, null, null, 24)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(5, rs.getInt(2)); assertEquals(10, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertEquals(50, rs.getInt(5)); assertEquals(100, rs.getInt(6)); assertEquals(0, rs.getInt(7)); assertTrue(rs.wasNull()); assertFalse(rs.next()); rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(12, rs.getInt(2)); assertEquals(13, rs.getInt(3)); assertEquals(21, rs.getInt(4)); assertEquals(0, rs.getInt(5)); assertTrue(rs.wasNull()); assertEquals(0, rs.getInt(6)); assertTrue(rs.wasNull()); assertEquals(24, rs.getInt(7)); assertFalse(rs.next()); } @Test public void testTrailingNullOverwritingDefault() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (" + "pk INTEGER PRIMARY KEY, " + "mid INTEGER, " + "def INTEGER DEFAULT 10)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1, 10, null)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertEquals(0, rs.getInt(3)); assertTrue(rs.wasNull()); assertFalse(rs.next()); } @Test public void testDefaultReinit() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable1 + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL, " + "pk3 INTEGER NOT NULL DEFAULT 10, " + "test1 INTEGER, " + "test2 INTEGER DEFAULT 5, " + "test3 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + sharedTable1 + " VALUES (1, 2)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + sharedTable1 + " VALUES (11, 12, 13, 14, null, 16)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT pk3, test2 FROM " + sharedTable1 + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); assertEquals(5, rs.getInt(2)); assertFalse(rs.next()); conn.close(); Connection conn2 = DriverManager.getConnection(getUrl()); rs = conn2.createStatement() .executeQuery("SELECT pk3, test2 FROM " + sharedTable1 + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); assertEquals(5, rs.getInt(2)); assertFalse(rs.next()); } @Test public void testDefaultMiddlePrimaryKey() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL DEFAULT 100, " + "pk3 INTEGER NOT NULL, " + "test1 INTEGER, " + "CONSTRAINT NAME_PK PRIMARY KEY (pk1, pk2, pk3))"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; try { conn.createStatement().execute(dml); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode()); assertTrue(e.getMessage().contains(table)); } dml = "UPSERT INTO " + table + " VALUES (1, 2)"; try { conn.createStatement().execute(dml); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.CONSTRAINT_VIOLATION.getErrorCode(), e.getErrorCode()); assertTrue(e.getMessage().contains(table)); } dml = "UPSERT INTO " + table + " VALUES (1, 2, 3)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + table + " (pk1, pk3) VALUES (11, 13)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk1 = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(2, rs.getInt(2)); assertEquals(3, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertFalse(rs.next()); rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " WHERE pk1 = 11"); assertTrue(rs.next()); assertEquals(11, rs.getInt(1)); assertEquals(100, rs.getInt(2)); assertEquals(13, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); assertFalse(rs.next()); } @Test public void testDefaultMiddleKeyValueCol() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER," + "c2 INTEGER DEFAULT 50," + "c3 INTEGER)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + table + " (pk, c3) VALUES (10, 100)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(0, rs.getInt(2)); assertTrue(rs.wasNull()); assertEquals(50, rs.getInt(3)); assertEquals(0, rs.getInt(4)); assertTrue(rs.wasNull()); rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " WHERE pk = 10"); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); assertEquals(0, rs.getInt(2)); assertTrue(rs.wasNull()); assertEquals(50, rs.getInt(3)); assertEquals(100, rs.getInt(4)); } @Test public void testDefaultAllDataTypesKeyValueCol() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER PRIMARY KEY," + "int INTEGER DEFAULT -100," + "uint UNSIGNED_INT DEFAULT 100, " + "bint BIGINT DEFAULT -200," + "ubint UNSIGNED_LONG DEFAULT 200," + "tint TINYINT DEFAULT -50," + "utint UNSIGNED_TINYINT DEFAULT 50," + "sint SMALLINT DEFAULT -10," + "usint UNSIGNED_SMALLINT DEFAULT 10," + "flo FLOAT DEFAULT -100.8," + "uflo UNSIGNED_FLOAT DEFAULT 100.9," + "doub DOUBLE DEFAULT -200.5," + "udoubl UNSIGNED_DOUBLE DEFAULT 200.8," + "dec DECIMAL DEFAULT -654624562.3462642362," + "bool BOOLEAN DEFAULT true," + "tim TIME DEFAULT time '1900-10-01 14:03:22.559'," + "dat DATE DEFAULT date '1900-10-01 14:03:22.559'," + "timest TIMESTAMP DEFAULT timestamp '1900-10-01 14:03:22.559'," + "utim UNSIGNED_TIME DEFAULT time '2005-10-01 14:03:22.559'," + "udat UNSIGNED_DATE DEFAULT date '2005-10-01 14:03:22.559'," + "utimest UNSIGNED_TIMESTAMP DEFAULT timestamp '2005-10-01 14:03:22.559'," + "vc VARCHAR DEFAULT 'ABCD'," + "c CHAR(5) DEFAULT 'EF'," + "bin BINARY(5) DEFAULT 'MNOP'," + "varbin VARBINARY DEFAULT 'QR'" + ")"; testDefaultAllDataTypes(table, ddl); } @Test public void testDefaultAllDataTypesPrimaryKey() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER NOT NULL," + "int INTEGER NOT NULL DEFAULT -100," + "uint UNSIGNED_INT NOT NULL DEFAULT 100, " + "bint BIGINT NOT NULL DEFAULT -200," + "ubint UNSIGNED_LONG NOT NULL DEFAULT 200," + "tint TINYINT NOT NULL DEFAULT -50," + "utint UNSIGNED_TINYINT NOT NULL DEFAULT 50," + "sint SMALLINT NOT NULL DEFAULT -10," + "usint UNSIGNED_SMALLINT NOT NULL DEFAULT 10," + "flo FLOAT NOT NULL DEFAULT -100.8," + "uflo UNSIGNED_FLOAT NOT NULL DEFAULT 100.9," + "doub DOUBLE NOT NULL DEFAULT -200.5," + "udoub UNSIGNED_DOUBLE NOT NULL DEFAULT 200.8," + "dec DECIMAL NOT NULL DEFAULT -654624562.3462642362," + "bool BOOLEAN NOT NULL DEFAULT true," + "tim TIME NOT NULL DEFAULT time '1900-10-01 14:03:22.559'," + "dat DATE NOT NULL DEFAULT date '1900-10-01 14:03:22.559'," + "timest TIMESTAMP NOT NULL DEFAULT timestamp '1900-10-01 14:03:22.559'," + "utim UNSIGNED_TIME NOT NULL DEFAULT time '2005-10-01 14:03:22.559'," + "udat UNSIGNED_DATE NOT NULL DEFAULT date '2005-10-01 14:03:22.559'," + "utimest UNSIGNED_TIMESTAMP NOT NULL DEFAULT timestamp '2005-10-01 14:03:22.559'," + "vc VARCHAR NOT NULL DEFAULT 'ABCD'," + "c CHAR(5) NOT NULL DEFAULT 'EF'," + "bin BINARY(5) NOT NULL DEFAULT 'MNOP'," + "varbin VARBINARY NOT NULL DEFAULT 'QR'" + "CONSTRAINT pk_final PRIMARY KEY (pk, int, uint, bint, ubint, tint, utint," + "sint, usint, flo, uflo, doub, udoub, dec, bool," + "tim, dat, timest, utim, udat, utimest," + "vc, c, bin, varbin)" + ")"; testDefaultAllDataTypes(table, ddl); } private void testDefaultAllDataTypes(String table, String ddl) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(-100, rs.getInt(2)); assertEquals(100, rs.getInt(3)); assertEquals(-200, rs.getLong(4)); assertEquals(200, rs.getLong(5)); assertEquals(-50, rs.getByte(6)); assertEquals(50, rs.getByte(7)); assertEquals(-10, rs.getShort(8)); assertEquals(10, rs.getShort(9)); assertEquals(new Float(-100.8), rs.getFloat(10), 0); assertEquals(new Float(100.9), rs.getFloat(11), 0); assertEquals(-200.5, rs.getDouble(12), 0); assertEquals(200.8, rs.getDouble(13), 0); assertEquals(new BigDecimal("-654624562.3462642362"), rs.getBigDecimal(14)); assertEquals(true, rs.getBoolean(15)); assertEquals(DateUtil.parseTime("1900-10-01 14:03:22.559"), rs.getTime(16)); assertEquals(DateUtil.parseDate("1900-10-01 14:03:22.559"), rs.getDate(17)); assertEquals(DateUtil.parseTimestamp("1900-10-01 14:03:22.559"), rs.getTimestamp(18)); assertEquals(DateUtil.parseTime("2005-10-01 14:03:22.559"), rs.getTime(19)); assertEquals(DateUtil.parseDate("2005-10-01 14:03:22.559"), rs.getDate(20)); assertEquals(DateUtil.parseTimestamp("2005-10-01 14:03:22.559"), rs.getTimestamp(21)); assertEquals("ABCD", rs.getString(22)); assertEquals("EF", rs.getString(23)); assertArrayEquals( ByteUtil.fillKey(new byte[] {'M', 'N', 'O', 'P'}, rs.getBytes(24).length), rs.getBytes(24)); assertArrayEquals(new byte[] {'Q', 'R'}, rs.getBytes(25)); } @Test public void testDefaultExpression() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable2 + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER DEFAULT 1 + 9," + "c2 DOUBLE DEFAULT SQRT(91506.25)," + "c3 DECIMAL DEFAULT TO_NUMBER('" + DEFAULT_CURRENCY_SYMBOL + "123.33', '\u00A4###.##')," + "c4 VARCHAR DEFAULT 'AB' || 'CD'," + "c5 CHAR(5) DEFAULT 'E' || 'F'," + "c6 INTEGER DEFAULT \"MONTH\"(TO_TIMESTAMP('2015-6-05'))" + ")"; verifyDefaultExpression(sharedTable2, ddl); } @Test public void testDefaultExpressionPrimaryKey() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk INTEGER NOT NULL," + "c1 INTEGER NOT NULL DEFAULT 1 + 9," + "c2 DOUBLE NOT NULL DEFAULT SQRT(91506.25)," + "c3 DECIMAL NOT NULL DEFAULT TO_NUMBER('" + DEFAULT_CURRENCY_SYMBOL + "123.33', '\u00A4###.##')," + "c4 VARCHAR NOT NULL DEFAULT 'AB' || 'CD'," + "c5 CHAR(5) NOT NULL DEFAULT 'E' || 'F'," + "c6 INTEGER NOT NULL DEFAULT \"MONTH\"(TO_TIMESTAMP('2015-6-05'))," + "CONSTRAINT pk_key PRIMARY KEY (pk,c1,c2,c3,c4,c5,c6)" + ")"; verifyDefaultExpression(table, ddl); } private void verifyDefaultExpression(String table, String ddl) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertEquals(302.5, rs.getDouble(3), 0); assertEquals(new BigDecimal("123.33"), rs.getBigDecimal(4)); assertEquals("ABCD", rs.getString(5)); assertEquals("EF", rs.getString(6)); assertEquals(6, rs.getInt(7)); assertFalse(rs.next()); } @Test public void testDefaultUpsertSelectPrimaryKey() throws Exception { Connection conn = DriverManager.getConnection(getUrl()); String selectTable = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + selectTable + " (" + "pk INTEGER PRIMARY KEY)"; conn.createStatement().execute(ddl); String table = generateUniqueName(); ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk1 INTEGER NOT NULL, " + "pk2 INTEGER NOT NULL DEFAULT 100," + "CONSTRAINT pk_key PRIMARY KEY(pk1, pk2))"; conn.createStatement().execute(ddl); conn.commit(); String dml = "UPSERT INTO " + selectTable + " VALUES (1)"; conn.createStatement().execute(dml); dml = "UPSERT INTO " + selectTable + " VALUES (2)"; conn.createStatement().execute(dml); conn.commit(); dml = "UPSERT INTO " + table + " (pk1) SELECT pk FROM " + selectTable; conn.createStatement().executeUpdate(dml); dml = "UPSERT INTO " + table + " SELECT pk,pk FROM " + selectTable; conn.createStatement().executeUpdate(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + selectTable); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertTrue(rs.next()); assertEquals(2, rs.getInt(1)); rs =conn.createStatement().executeQuery("SELECT * FROM " + table); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(1, rs.getInt(2)); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(100, rs.getInt(2)); assertTrue(rs.next()); assertEquals(2, rs.getInt(1)); assertEquals(2, rs.getInt(2)); assertTrue(rs.next()); assertEquals(2, rs.getInt(1)); assertEquals(100, rs.getInt(2)); } @Test public void testDefaultArrays() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER PRIMARY KEY," + "int INTEGER[5] DEFAULT ARRAY[-100, 50]," + "uint UNSIGNED_INT[5] DEFAULT ARRAY[100, 50], " + "bint BIGINT[5] DEFAULT ARRAY[-200, 100]," + "ubint UNSIGNED_LONG[5] DEFAULT ARRAY[200, 100]," + "tint TINYINT[5] DEFAULT ARRAY[-50, 25]," + "utint UNSIGNED_TINYINT[5] DEFAULT ARRAY[50, 25]," + "sint SMALLINT[5] DEFAULT ARRAY[-10, 5]," + "usint UNSIGNED_SMALLINT[5] DEFAULT ARRAY[10, 5]," + "flo FLOAT[5] DEFAULT ARRAY[-100.8, 50.4]," + "uflo UNSIGNED_FLOAT[5] DEFAULT ARRAY[100.9, 50.45]," + "doub DOUBLE[5] DEFAULT ARRAY[-200.5, 100.25]," + "udoubl UNSIGNED_DOUBLE[5] DEFAULT ARRAY[200.8, 100.4]," + "dec DECIMAL[5] DEFAULT ARRAY[-654624562.3462642362, 3462642362.654624562]," + "bool BOOLEAN[5] DEFAULT ARRAY[true, false]," + "tim TIME[5] DEFAULT ARRAY[" + "time '1900-10-01 14:03:22.559'," + "time '1990-10-01 14:03:22.559']," + "dat DATE[5] DEFAULT ARRAY[" + "date '1900-10-01 14:03:22.559'," + "date '1990-10-01 14:03:22.559']," + "timest TIMESTAMP[5] DEFAULT ARRAY[" + "timestamp '1900-10-01 14:03:22.559'," + "timestamp '1990-10-01 14:03:22.559']," + "utim UNSIGNED_TIME[5] DEFAULT ARRAY[" + "time '2005-10-01 14:03:22.559'," + "time '2006-10-01 14:03:22.559']," + "udat UNSIGNED_DATE[5] DEFAULT ARRAY[" + "date '2005-10-01 14:03:22.559'," + "date '2006-10-01 14:03:22.559']," + "utimest UNSIGNED_TIMESTAMP[5] DEFAULT ARRAY[" + "timestamp '2005-10-01 14:03:22.559'," + "timestamp '2006-10-01 14:03:22.559']," + "vc VARCHAR[5] DEFAULT ARRAY['ABCD', 'XY']," + "c CHAR(5)[5] DEFAULT ARRAY['EF', 'Z']," + "bin BINARY(5)[5] DEFAULT ARRAY ['MNOP', 'mnop']" + ")"; verifyArrays(table, ddl); } @Test public void testDefaultArraysPrimaryKey() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER NOT NULL," + "int INTEGER[5] DEFAULT ARRAY[-100, 50]," + "uint UNSIGNED_INT[5] DEFAULT ARRAY[100, 50], " + "bint BIGINT[5] DEFAULT ARRAY[-200, 100]," + "ubint UNSIGNED_LONG[5] DEFAULT ARRAY[200, 100]," + "tint TINYINT[5] DEFAULT ARRAY[-50, 25]," + "utint UNSIGNED_TINYINT[5] DEFAULT ARRAY[50, 25]," + "sint SMALLINT[5] DEFAULT ARRAY[-10, 5]," + "usint UNSIGNED_SMALLINT[5] DEFAULT ARRAY[10, 5]," + "flo FLOAT[5] DEFAULT ARRAY[-100.8, 50.4]," + "uflo UNSIGNED_FLOAT[5] DEFAULT ARRAY[100.9, 50.45]," + "doub DOUBLE[5] DEFAULT ARRAY[-200.5, 100.25]," + "udoubl UNSIGNED_DOUBLE[5] DEFAULT ARRAY[200.8, 100.4]," + "dec DECIMAL[5] DEFAULT ARRAY[-654624562.3462642362, 3462642362.654624562]," + "bool BOOLEAN[5] DEFAULT ARRAY[true, false]," + "tim TIME[5] DEFAULT ARRAY[" + "time '1900-10-01 14:03:22.559'," + "time '1990-10-01 14:03:22.559']," + "dat DATE[5] DEFAULT ARRAY[" + "date '1900-10-01 14:03:22.559'," + "date '1990-10-01 14:03:22.559']," + "timest TIMESTAMP[5] DEFAULT ARRAY[" + "timestamp '1900-10-01 14:03:22.559'," + "timestamp '1990-10-01 14:03:22.559']," + "utim UNSIGNED_TIME[5] DEFAULT ARRAY[" + "time '2005-10-01 14:03:22.559'," + "time '2006-10-01 14:03:22.559']," + "udat UNSIGNED_DATE[5] DEFAULT ARRAY[" + "date '2005-10-01 14:03:22.559'," + "date '2006-10-01 14:03:22.559']," + "utimest UNSIGNED_TIMESTAMP[5] DEFAULT ARRAY[" + "timestamp '2005-10-01 14:03:22.559'," + "timestamp '2006-10-01 14:03:22.559']," + "vc VARCHAR[5] DEFAULT ARRAY['ABCD', 'XY']," + "c CHAR(5)[5] DEFAULT ARRAY['EF', 'Z']," + "bin BINARY(5)[5] NOT NULL DEFAULT ARRAY ['MNOP', 'mnop']," + "CONSTRAINT pk_key PRIMARY KEY (pk, bin)" + ")"; verifyArrays(table, ddl); } private void verifyArrays(String table, String ddl) throws SQLException { Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertArrayEquals(new int[]{-100, 50}, (int[])(rs.getArray(2).getArray())); assertArrayEquals(new int[]{100, 50}, (int[])(rs.getArray(3).getArray())); assertArrayEquals(new long[]{-200, 100}, (long[])(rs.getArray(4).getArray())); assertArrayEquals(new long[]{200, 100}, (long[])(rs.getArray(5).getArray())); assertArrayEquals(new byte[]{-50, 25}, (byte[])(rs.getArray(6).getArray())); assertArrayEquals(new byte[]{50, 25}, (byte[])(rs.getArray(7).getArray())); assertArrayEquals(new short[]{-10, 5}, (short[])(rs.getArray(8).getArray())); assertArrayEquals(new short[]{10, 5}, (short[])(rs.getArray(9).getArray())); assertArrayEquals( new float[]{new Float(-100.8), new Float(50.4)}, (float[])(rs.getArray(10).getArray()), 0); assertArrayEquals( new float[]{new Float(100.9), new Float(50.45)}, (float[])(rs.getArray(11).getArray()), 0); assertArrayEquals(new double[]{-200.5, 100.25}, (double[])(rs.getArray(12).getArray()), 0); assertArrayEquals(new double[]{200.8, 100.4}, (double[])(rs.getArray(13).getArray()), 0); assertArrayEquals( new BigDecimal[]{ new BigDecimal("-654624562.3462642362"), new BigDecimal("3462642362.654624562")}, (BigDecimal[])(rs.getArray(14).getArray())); assertArrayEquals(new boolean[]{true, false}, (boolean[])(rs.getArray(15).getArray())); assertArrayEquals( new Time[]{ DateUtil.parseTime("1900-10-01 14:03:22.559"), DateUtil.parseTime("1990-10-01 14:03:22.559")}, (Time[])(rs.getArray(16).getArray())); assertArrayEquals( new Date[]{ DateUtil.parseDate("1900-10-01 14:03:22.559"), DateUtil.parseDate("1990-10-01 14:03:22.559")}, (Date[])(rs.getArray(17).getArray())); assertArrayEquals( new Timestamp[]{ DateUtil.parseTimestamp("1900-10-01 14:03:22.559"), DateUtil.parseTimestamp("1990-10-01 14:03:22.559")}, (Timestamp[])(rs.getArray(18).getArray())); assertArrayEquals( new Time[]{ DateUtil.parseTime("2005-10-01 14:03:22.559"), DateUtil.parseTime("2006-10-01 14:03:22.559")}, (Time[])(rs.getArray(19).getArray())); assertArrayEquals( new Date[]{ DateUtil.parseDate("2005-10-01 14:03:22.559"), DateUtil.parseDate("2006-10-01 14:03:22.559")}, (Date[])(rs.getArray(20).getArray())); assertArrayEquals( new Timestamp[]{ DateUtil.parseTimestamp("2005-10-01 14:03:22.559"), DateUtil.parseTimestamp("2006-10-01 14:03:22.559")}, (Timestamp[])(rs.getArray(21).getArray())); assertArrayEquals(new String[]{"ABCD", "XY"}, (String[])(rs.getArray(22).getArray())); String[] expected = new String[] {"EF","Z"}; Array array = conn.createArrayOf("CHAR", expected); assertTrue(rs.getArray(23).equals(array)); byte[][] expectedByteArray = new byte[][] { ByteUtil.fillKey(new byte[] {'M', 'N', 'O', 'P'}, 5), ByteUtil.fillKey(new byte[] {'m', 'n', 'o', 'p'}, 5) }; assertArrayEquals(expectedByteArray, (byte[][])rs.getArray(24).getArray()); } @Test public void testDefaultArrayWithNull() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER PRIMARY KEY," + "c1 VARCHAR[5] DEFAULT ARRAY[NULL, 'ABCD', 'XY']," + "c2 VARCHAR[5] DEFAULT ARRAY['ABCD', NULL, 'XY']," + "c3 VARCHAR[5] DEFAULT ARRAY['ABCD', 'XY', NULL]" + ")"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertArrayEquals(new String[]{null, "ABCD", "XY"}, (String[])(rs.getArray(2).getArray())); assertArrayEquals(new String[]{"ABCD", null, "XY"}, (String[])(rs.getArray(3).getArray())); assertArrayEquals(new String[]{"ABCD", "XY", null}, (String[])(rs.getArray(4).getArray())); assertFalse(rs.next()); } @Test public void testDefaultArrayWithFixedWidthNull() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + "(" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER[5] DEFAULT ARRAY[NULL, 2, 3]," + "c2 INTEGER[5] DEFAULT ARRAY[1, NULL, 3]," + "c3 INTEGER[5] DEFAULT ARRAY[1, 2, NULL]" + ")"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertArrayEquals(new int[]{0, 2, 3}, (int[])(rs.getArray(2).getArray())); assertArrayEquals(new int[]{1, 0, 3}, (int[])(rs.getArray(3).getArray())); assertArrayEquals(new int[]{1, 2, 0}, (int[])(rs.getArray(4).getArray())); assertFalse(rs.next()); } @Test public void testDefaultNull() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE " + table + " (" + "pk INTEGER PRIMARY KEY, " + "def INTEGER DEFAULT NULL)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + table + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + table + " WHERE pk = 1"); assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(0, rs.getInt(2)); assertTrue(rs.wasNull()); assertFalse(rs.next()); } @Test public void testDefaultCoveredColumn() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER," + "c2 INTEGER DEFAULT 100)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.commit(); String idx = generateUniqueName(); ddl = "CREATE INDEX " + idx + " on " + table + " (c1) INCLUDE (c2)"; conn.createStatement().execute(ddl); conn.commit(); String dml = "UPSERT INTO " + table + " VALUES (1, 2)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT c2 FROM " + table + " WHERE c1 = 2"); assertTrue(rs.next()); assertEquals(100, rs.getInt(1)); assertFalse(rs.next()); } @Test public void testDefaultIndexed() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER," + "c2 INTEGER DEFAULT 100)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.commit(); String idx = generateUniqueName(); ddl = "CREATE INDEX " + idx + " on " + table + " (c2)"; conn.createStatement().execute(ddl); conn.commit(); String dml = "UPSERT INTO " + table + " VALUES (1, 2)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT c2 FROM " + table + " WHERE c2 = 100"); assertTrue(rs.next()); assertEquals(100, rs.getInt(1)); assertFalse(rs.next()); rs = conn.createStatement().executeQuery("SELECT c2 FROM " + table + " WHERE c2 = 5"); assertFalse(rs.next()); } @Test public void testDefaultLocalIndexed() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER," + "c2 INTEGER DEFAULT 100)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.commit(); String idx = generateUniqueName(); ddl = "CREATE LOCAL INDEX " + idx + " on " + table + " (c2)"; conn.createStatement().execute(ddl); conn.commit(); String dml = "UPSERT INTO " + table + " VALUES (1, 2)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT c2 FROM " + table + " WHERE c2 = 100"); assertTrue(rs.next()); assertEquals(100, rs.getInt(1)); assertFalse(rs.next()); rs = conn.createStatement().executeQuery("SELECT c2 FROM " + table + " WHERE c2 = 5"); assertFalse(rs.next()); } @Test public void testDefaultFunctionalIndexed() throws Exception { String table = generateUniqueName(); String ddl = "CREATE TABLE IF NOT EXISTS " + table + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER," + "c2 INTEGER DEFAULT 100)"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); conn.commit(); String idx = generateUniqueName(); ddl = "CREATE INDEX " + idx + " on " + table + " (c1 + c2)"; conn.createStatement().execute(ddl); conn.commit(); String dml = "UPSERT INTO " + table + " VALUES (1, 2)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement() .executeQuery("SELECT c2 FROM " + table + " WHERE c1 + c2 = 102"); assertTrue(rs.next()); assertEquals(100, rs.getInt(1)); assertFalse(rs.next()); } @Test public void testDefaultSelectWhere() throws Exception { String ddl = "CREATE TABLE IF NOT EXISTS " + sharedTable2 + " (" + "pk INTEGER PRIMARY KEY," + "c1 INTEGER DEFAULT 1 + 9," + "c2 DOUBLE DEFAULT SQRT(91506.25)," + "c3 DECIMAL DEFAULT TO_NUMBER('" + DEFAULT_CURRENCY_SYMBOL + "123.33', '\u00A4###.##')," + "c4 VARCHAR DEFAULT 'AB' || 'CD'," + "c5 CHAR(5) DEFAULT 'E' || 'F'," + "c6 INTEGER DEFAULT \"MONTH\"(TO_TIMESTAMP('2015-6-05'))" + ")"; Connection conn = DriverManager.getConnection(getUrl()); conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + sharedTable2 + " VALUES (1)"; conn.createStatement().execute(dml); conn.commit(); ResultSet rs = conn.createStatement().executeQuery("SELECT c1 FROM " + sharedTable2 + " WHERE c1 = 10"); assertTrue(rs.next()); assertEquals(10, rs.getInt(1)); rs = conn.createStatement().executeQuery("SELECT c4 FROM " + sharedTable2 + " WHERE c4 = 'ABCD'"); assertTrue(rs.next()); assertEquals("ABCD", rs.getString(1)); } }
9231efcb0ab99185e4cca496ef0e7166434b6a60
521
java
Java
src/main/java/com/maddogs/repo/TagProjection.java
mad-dogs/roughly
021d1772a30a1faa9a4b2450d380545aec9ee05c
[ "MIT" ]
null
null
null
src/main/java/com/maddogs/repo/TagProjection.java
mad-dogs/roughly
021d1772a30a1faa9a4b2450d380545aec9ee05c
[ "MIT" ]
null
null
null
src/main/java/com/maddogs/repo/TagProjection.java
mad-dogs/roughly
021d1772a30a1faa9a4b2450d380545aec9ee05c
[ "MIT" ]
null
null
null
20.038462
61
0.698656
996,041
package com.maddogs.repo; import com.maddogs.domain.*; import org.springframework.data.rest.core.config.Projection; import java.time.LocalDateTime; import java.util.List; @Projection(name = "tagProjection", types = { Tag.class }) public interface TagProjection { int getNumberOfPeople(); int getNumberOfDogs(); LocalDateTime getCreatedDateTime(); LocalDateTime getExpiredDateTime(); Location getPosition(); TagType getTagType(); List<Item> getNeedItems(); }
9231eff9e0a6d25899faf9bd204126192324694e
1,633
java
Java
src/main/java/com/github/tobiasstadler/opentracing/jdbc/OpenTracingXAConnection.java
tobiasstadler/opentracing-jdbc
72933bb84951c31e0e8bb0a1bb4697ff99718504
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/tobiasstadler/opentracing/jdbc/OpenTracingXAConnection.java
tobiasstadler/opentracing-jdbc
72933bb84951c31e0e8bb0a1bb4697ff99718504
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/tobiasstadler/opentracing/jdbc/OpenTracingXAConnection.java
tobiasstadler/opentracing-jdbc
72933bb84951c31e0e8bb0a1bb4697ff99718504
[ "Apache-2.0" ]
null
null
null
28.155172
82
0.752603
996,042
package com.github.tobiasstadler.opentracing.jdbc; import com.github.tobiasstadler.opentracing.jdbc.util.JDBCTracer; import javax.sql.ConnectionEventListener; import javax.sql.StatementEventListener; import javax.sql.XAConnection; import javax.transaction.xa.XAResource; import java.sql.Connection; import java.sql.SQLException; public class OpenTracingXAConnection implements XAConnection { private final XAConnection delegate; private final JDBCTracer tracer; public OpenTracingXAConnection(XAConnection xaConnection, JDBCTracer tracer) { this.delegate = xaConnection; this.tracer = tracer; } @Override public XAResource getXAResource() throws SQLException { return delegate.getXAResource(); } @Override public Connection getConnection() throws SQLException { return new OpenTracingConnection(delegate.getConnection(), tracer); } @Override public void close() throws SQLException { delegate.close(); } @Override public void addConnectionEventListener(ConnectionEventListener listener) { delegate.addConnectionEventListener(listener); } @Override public void removeConnectionEventListener(ConnectionEventListener listener) { delegate.removeConnectionEventListener(listener); } @Override public void addStatementEventListener(StatementEventListener listener) { delegate.addStatementEventListener(listener); } @Override public void removeStatementEventListener(StatementEventListener listener) { delegate.removeStatementEventListener(listener); } }
9231f003e0d3294c72049b554daf8b26ca85c91b
2,328
java
Java
android/src/main/java/com/odinvt/portavailable/PortAvailableModule.java
Odinvt/react-native-portavailable
882d80c230192b19d92e2fba49e12f198ad69682
[ "MIT" ]
1
2016-06-09T20:51:59.000Z
2016-06-09T20:51:59.000Z
android/src/main/java/com/odinvt/portavailable/PortAvailableModule.java
Odinvt/react-native-portavailable
882d80c230192b19d92e2fba49e12f198ad69682
[ "MIT" ]
null
null
null
android/src/main/java/com/odinvt/portavailable/PortAvailableModule.java
Odinvt/react-native-portavailable
882d80c230192b19d92e2fba49e12f198ad69682
[ "MIT" ]
null
null
null
27.069767
78
0.575601
996,043
package com.odinvt.portavailable; 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.WritableArray; import com.facebook.react.bridge.WritableNativeArray; import java.io.IOException; import java.net.DatagramSocket; import java.net.ServerSocket; public class PortAvailableModule extends ReactContextBaseJavaModule { private static final int MIN_PORT_NUMBER = 0; private static final int MAX_PORT_NUMBER = 0xFFFF; public PortAvailableModule(ReactApplicationContext reactContext) { super(reactContext); } @Override public String getName() { return "RNPortAvailable"; } @ReactMethod public void available(int port, Promise promise) { boolean available; available = check(port); promise.resolve(available); } @ReactMethod public void range(int min_port, int max_port, int stop, Promise promise) { WritableArray ports = new WritableNativeArray(); int found = 0; for(int i = min_port; i <= max_port; i++) { if(stop > 0 && found == stop) { break; } if(check(i)) { ports.pushInt(i); found++; } } promise.resolve(ports); } public boolean check(int port) { if (port < MIN_PORT_NUMBER || port > MAX_PORT_NUMBER) { return false; } ServerSocket ss = null; DatagramSocket ds = null; boolean result = false; try { ss = new ServerSocket(port); ss.setReuseAddress(true); ds = new DatagramSocket(port); ds.setReuseAddress(true); result = true; } catch (IOException e) { /*goes to the return false statement after closing the sockets*/ } finally { if (ds != null) { ds.close(); } if (ss != null) { try { ss.close(); } catch (IOException e) { /* should not be thrown */ } } } return result; } }
9231f12e56842a8618c3d0e94fdc613ccd2e8d5b
4,480
java
Java
app/src/test/java/io/apicurio/registry/auth/AuthTestBasicClientCredentials.java
goldmann/apicurio-registry
0c6dbfa19c5f9d2e4b764051d9651acadff15c53
[ "Apache-2.0" ]
null
null
null
app/src/test/java/io/apicurio/registry/auth/AuthTestBasicClientCredentials.java
goldmann/apicurio-registry
0c6dbfa19c5f9d2e4b764051d9651acadff15c53
[ "Apache-2.0" ]
55
2021-07-22T05:14:22.000Z
2022-03-31T05:22:02.000Z
app/src/test/java/io/apicurio/registry/auth/AuthTestBasicClientCredentials.java
famarting/apicurio-registry
5b5320dbfa81c99187d9c761060d61d3a012ec8f
[ "Apache-2.0" ]
null
null
null
38.956522
117
0.74375
996,044
/* * Copyright 2021 Red Hat * * 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 io.apicurio.registry.auth; import io.apicurio.registry.AbstractResourceTestBase; import io.apicurio.registry.rest.client.RegistryClient; import io.apicurio.registry.rest.client.RegistryClientFactory; import io.apicurio.registry.rest.v2.beans.Rule; import io.apicurio.registry.rules.validity.ValidityLevel; import io.apicurio.registry.types.ArtifactType; import io.apicurio.registry.types.RuleType; import io.apicurio.registry.utils.tests.ApicurioTestTags; import io.apicurio.registry.utils.tests.AuthTestProfileBasicClientCredentials; import io.apicurio.registry.utils.tests.TestUtils; import io.apicurio.rest.client.auth.Auth; import io.apicurio.rest.client.auth.BasicAuth; import io.apicurio.rest.client.auth.OidcAuth; import io.apicurio.rest.client.auth.exception.AuthErrorHandler; import io.apicurio.rest.client.auth.exception.NotAuthorizedException; import io.apicurio.rest.client.spi.ApicurioHttpClient; import io.apicurio.rest.client.spi.ApicurioHttpClientFactory; import io.quarkus.test.junit.QuarkusTest; import io.quarkus.test.junit.TestProfile; import org.eclipse.microprofile.config.inject.ConfigProperty; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Tag; import org.junit.jupiter.api.Test; import java.io.ByteArrayInputStream; import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertNotNull; @QuarkusTest @TestProfile(AuthTestProfileBasicClientCredentials.class) @Tag(ApicurioTestTags.DOCKER) public class AuthTestBasicClientCredentials extends AbstractResourceTestBase { @ConfigProperty(name = "registry.auth.token.endpoint") String authServerUrl; String noRoleClientId = "registry-api-no-role"; final String groupId = "authTestGroupId"; ApicurioHttpClient httpClient; private RegistryClient createClient(Auth auth) { return RegistryClientFactory.create(registryV2ApiUrl, Collections.emptyMap(), auth); } /** * @see io.apicurio.registry.AbstractResourceTestBase#createRestClientV2() */ @Override protected RegistryClient createRestClientV2() { httpClient = ApicurioHttpClientFactory.create(authServerUrl, new AuthErrorHandler()); Auth auth = new OidcAuth(httpClient, noRoleClientId, "test1"); return this.createClient(auth); } @Test public void testWrongCreds() throws Exception { Auth auth = new BasicAuth(noRoleClientId, "test55"); RegistryClient client = createClient(auth); Assertions.assertThrows(NotAuthorizedException.class, () -> { client.listArtifactsInGroup(groupId); }); } @Test public void testBasicAuthClientCredentials() throws Exception { Auth auth = new BasicAuth(noRoleClientId, "test1"); RegistryClient client = createClient(auth); String artifactId = TestUtils.generateArtifactId(); try { client.listArtifactsInGroup(groupId); client.createArtifact(groupId, artifactId, ArtifactType.JSON, new ByteArrayInputStream("{}".getBytes())); TestUtils.retry(() -> client.getArtifactMetaData(groupId, artifactId)); assertNotNull(client.getLatestArtifact(groupId, artifactId)); Rule ruleConfig = new Rule(); ruleConfig.setType(RuleType.VALIDITY); ruleConfig.setConfig(ValidityLevel.NONE.name()); client.createArtifactRule(groupId, artifactId, ruleConfig); client.createGlobalRule(ruleConfig); } finally { client.deleteArtifact(groupId, artifactId); } } @Test public void testNoCredentials() throws Exception { RegistryClient client = RegistryClientFactory.create(registryV2ApiUrl, Collections.emptyMap(), null); Assertions.assertThrows(NotAuthorizedException.class, () -> { client.listArtifactsInGroup(groupId); }); } }
9231f15bdde32a7cc8044a9249ba713dec057e8a
1,939
java
Java
corpus/class/eclipse.jdt.ui/3075.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/eclipse.jdt.ui/3075.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/eclipse.jdt.ui/3075.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
25.973333
89
0.581622
996,045
/******************************************************************************* * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Jesper Kamstrup Linnet (kenaa@example.com) - initial API and implementation * (report 36180: Callers/Callees view) *******************************************************************************/ package org.eclipse.jdt.internal.corext.callhierarchy; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.eclipse.jdt.core.IMember; public class MethodCall { private IMember fMember; private List<CallLocation> fCallLocations; /** * @param enclosingElement */ public MethodCall(IMember enclosingElement) { this.fMember = enclosingElement; } /** * */ public Collection<CallLocation> getCallLocations() { return fCallLocations; } public CallLocation getFirstCallLocation() { if ((fCallLocations != null) && !fCallLocations.isEmpty()) { return fCallLocations.get(0); } else { return null; } } public boolean hasCallLocations() { return fCallLocations != null && fCallLocations.size() > 0; } /** * @return Object */ public String getKey() { return getMember().getHandleIdentifier(); } /** * */ public IMember getMember() { return fMember; } /** * @param location */ public void addCallLocation(CallLocation location) { if (fCallLocations == null) { fCallLocations = new ArrayList(); } fCallLocations.add(location); } }
9231f21d061ef1c93853b6b1cd625c2202d051ca
9,686
java
Java
cloudsim-3.0.3/sources/org/cloudbus/cloudsim/CloudletSchedulerDynamicWorkload.java
talk2bryan/cloud-computing-class
9f4664f950e21b9c261fe0086a14de49b01de0e0
[ "MIT" ]
16
2015-05-20T07:26:39.000Z
2020-12-30T03:05:38.000Z
cloudsim-3.0.3/sources/org/cloudbus/cloudsim/CloudletSchedulerDynamicWorkload.java
talk2bryan/cloud-computing-class
9f4664f950e21b9c261fe0086a14de49b01de0e0
[ "MIT" ]
null
null
null
cloudsim-3.0.3/sources/org/cloudbus/cloudsim/CloudletSchedulerDynamicWorkload.java
talk2bryan/cloud-computing-class
9f4664f950e21b9c261fe0086a14de49b01de0e0
[ "MIT" ]
15
2015-01-16T06:25:04.000Z
2021-03-21T08:24:38.000Z
24.459596
105
0.706587
996,046
/* * Title: CloudSim Toolkit Description: CloudSim (Cloud Simulation) Toolkit for Modeling and * Simulation of Clouds Licence: GPL - http://www.gnu.org/copyleft/gpl.html * * Copyright (c) 2009-2012, The University of Melbourne, Australia */ package org.cloudbus.cloudsim; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.cloudbus.cloudsim.core.CloudSim; /** * CloudletSchedulerDynamicWorkload implements a policy of scheduling performed by a virtual machine * assuming that there is just one cloudlet which is working as an online service. * * @author Anton Beloglazov * @since CloudSim Toolkit 2.0 */ public class CloudletSchedulerDynamicWorkload extends CloudletSchedulerTimeShared { /** The mips. */ private double mips; /** The number of PEs. */ private int numberOfPes; /** The total mips. */ private double totalMips; /** The under allocated mips. */ private Map<String, Double> underAllocatedMips; /** The cache previous time. */ private double cachePreviousTime; /** The cache current requested mips. */ private List<Double> cacheCurrentRequestedMips; /** * Instantiates a new vM scheduler time shared. * * @param mips the mips * @param numberOfPes the pes number */ public CloudletSchedulerDynamicWorkload(double mips, int numberOfPes) { super(); setMips(mips); setNumberOfPes(numberOfPes); setTotalMips(getNumberOfPes() * getMips()); setUnderAllocatedMips(new HashMap<String, Double>()); setCachePreviousTime(-1); } /** * Updates the processing of cloudlets running under management of this scheduler. * * @param currentTime current simulation time * @param mipsShare array with MIPS share of each Pe available to the scheduler * @return time predicted completion time of the earliest finishing cloudlet, or 0 if there is * no next events * @pre currentTime >= 0 * @post $none */ @Override public double updateVmProcessing(double currentTime, List<Double> mipsShare) { setCurrentMipsShare(mipsShare); double timeSpan = currentTime - getPreviousTime(); double nextEvent = Double.MAX_VALUE; List<ResCloudlet> cloudletsToFinish = new ArrayList<ResCloudlet>(); for (ResCloudlet rcl : getCloudletExecList()) { rcl.updateCloudletFinishedSoFar((long) (timeSpan * getTotalCurrentAllocatedMipsForCloudlet(rcl, getPreviousTime()) * Consts.MILLION)); if (rcl.getRemainingCloudletLength() == 0) { // finished: remove from the list cloudletsToFinish.add(rcl); continue; } else { // not finish: estimate the finish time double estimatedFinishTime = getEstimatedFinishTime(rcl, currentTime); if (estimatedFinishTime - currentTime < CloudSim.getMinTimeBetweenEvents()) { estimatedFinishTime = currentTime + CloudSim.getMinTimeBetweenEvents(); } if (estimatedFinishTime < nextEvent) { nextEvent = estimatedFinishTime; } } } for (ResCloudlet rgl : cloudletsToFinish) { getCloudletExecList().remove(rgl); cloudletFinish(rgl); } setPreviousTime(currentTime); if (getCloudletExecList().isEmpty()) { return 0; } return nextEvent; } /** * Receives an cloudlet to be executed in the VM managed by this scheduler. * * @param cl the cl * @return predicted completion time * @pre _gl != null * @post $none */ @Override public double cloudletSubmit(Cloudlet cl) { return cloudletSubmit(cl, 0); } /** * Receives an cloudlet to be executed in the VM managed by this scheduler. * * @param cl the cl * @param fileTransferTime the file transfer time * @return predicted completion time * @pre _gl != null * @post $none */ @Override public double cloudletSubmit(Cloudlet cl, double fileTransferTime) { ResCloudlet rcl = new ResCloudlet(cl); rcl.setCloudletStatus(Cloudlet.INEXEC); for (int i = 0; i < cl.getNumberOfPes(); i++) { rcl.setMachineAndPeId(0, i); } getCloudletExecList().add(rcl); return getEstimatedFinishTime(rcl, getPreviousTime()); } /** * Processes a finished cloudlet. * * @param rcl finished cloudlet * @pre rgl != $null * @post $none */ @Override public void cloudletFinish(ResCloudlet rcl) { rcl.setCloudletStatus(Cloudlet.SUCCESS); rcl.finalizeCloudlet(); getCloudletFinishedList().add(rcl); } /** * Get utilization created by all cloudlets. * * @param time the time * @return total utilization */ @Override public double getTotalUtilizationOfCpu(double time) { double totalUtilization = 0; for (ResCloudlet rcl : getCloudletExecList()) { totalUtilization += rcl.getCloudlet().getUtilizationOfCpu(time); } return totalUtilization; } /** * Gets the current mips. * * @return the current mips */ @Override public List<Double> getCurrentRequestedMips() { if (getCachePreviousTime() == getPreviousTime()) { return getCacheCurrentRequestedMips(); } List<Double> currentMips = new ArrayList<Double>(); double totalMips = getTotalUtilizationOfCpu(getPreviousTime()) * getTotalMips(); double mipsForPe = totalMips / getNumberOfPes(); for (int i = 0; i < getNumberOfPes(); i++) { currentMips.add(mipsForPe); } setCachePreviousTime(getPreviousTime()); setCacheCurrentRequestedMips(currentMips); return currentMips; } /** * Gets the current mips. * * @param rcl the rcl * @param time the time * @return the current mips */ @Override public double getTotalCurrentRequestedMipsForCloudlet(ResCloudlet rcl, double time) { return rcl.getCloudlet().getUtilizationOfCpu(time) * getTotalMips(); } /** * Gets the total current mips for the clouddlet. * * @param rcl the rcl * @param mipsShare the mips share * @return the total current mips */ @Override public double getTotalCurrentAvailableMipsForCloudlet(ResCloudlet rcl, List<Double> mipsShare) { double totalCurrentMips = 0.0; if (mipsShare != null) { int neededPEs = rcl.getNumberOfPes(); for (double mips : mipsShare) { totalCurrentMips += mips; neededPEs--; if (neededPEs <= 0) { break; } } } return totalCurrentMips; } /** * Gets the current mips. * * @param rcl the rcl * @param time the time * @return the current mips */ @Override public double getTotalCurrentAllocatedMipsForCloudlet(ResCloudlet rcl, double time) { double totalCurrentRequestedMips = getTotalCurrentRequestedMipsForCloudlet(rcl, time); double totalCurrentAvailableMips = getTotalCurrentAvailableMipsForCloudlet(rcl, getCurrentMipsShare()); if (totalCurrentRequestedMips > totalCurrentAvailableMips) { return totalCurrentAvailableMips; } return totalCurrentRequestedMips; } /** * Update under allocated mips for cloudlet. * * @param rcl the rgl * @param mips the mips */ public void updateUnderAllocatedMipsForCloudlet(ResCloudlet rcl, double mips) { if (getUnderAllocatedMips().containsKey(rcl.getUid())) { mips += getUnderAllocatedMips().get(rcl.getUid()); } getUnderAllocatedMips().put(rcl.getUid(), mips); } /** * Get estimated cloudlet completion time. * * @param rcl the rcl * @param time the time * @return the estimated finish time */ public double getEstimatedFinishTime(ResCloudlet rcl, double time) { return time + ((rcl.getRemainingCloudletLength()) / getTotalCurrentAllocatedMipsForCloudlet(rcl, time)); } /** * Gets the total current mips. * * @return the total current mips */ public int getTotalCurrentMips() { int totalCurrentMips = 0; for (double mips : getCurrentMipsShare()) { totalCurrentMips += mips; } return totalCurrentMips; } /** * Sets the total mips. * * @param mips the new total mips */ public void setTotalMips(double mips) { totalMips = mips; } /** * Gets the total mips. * * @return the total mips */ public double getTotalMips() { return totalMips; } /** * Sets the pes number. * * @param pesNumber the new pes number */ public void setNumberOfPes(int pesNumber) { numberOfPes = pesNumber; } /** * Gets the pes number. * * @return the pes number */ public int getNumberOfPes() { return numberOfPes; } /** * Sets the mips. * * @param mips the new mips */ public void setMips(double mips) { this.mips = mips; } /** * Gets the mips. * * @return the mips */ public double getMips() { return mips; } /** * Sets the under allocated mips. * * @param underAllocatedMips the under allocated mips */ public void setUnderAllocatedMips(Map<String, Double> underAllocatedMips) { this.underAllocatedMips = underAllocatedMips; } /** * Gets the under allocated mips. * * @return the under allocated mips */ public Map<String, Double> getUnderAllocatedMips() { return underAllocatedMips; } /** * Gets the cache previous time. * * @return the cache previous time */ protected double getCachePreviousTime() { return cachePreviousTime; } /** * Sets the cache previous time. * * @param cachePreviousTime the new cache previous time */ protected void setCachePreviousTime(double cachePreviousTime) { this.cachePreviousTime = cachePreviousTime; } /** * Gets the cache current requested mips. * * @return the cache current requested mips */ protected List<Double> getCacheCurrentRequestedMips() { return cacheCurrentRequestedMips; } /** * Sets the cache current requested mips. * * @param cacheCurrentRequestedMips the new cache current requested mips */ protected void setCacheCurrentRequestedMips(List<Double> cacheCurrentRequestedMips) { this.cacheCurrentRequestedMips = cacheCurrentRequestedMips; } }
9231f2b993c874ad8ab30d4b1b33720633f355fc
2,348
java
Java
ezalor/src/main/java/com/wellerv/ezalor/util/Utils.java
WellerV/Ezalor
c921adef38954ea25d092ed56fc2d4def8fb84ec
[ "Apache-2.0" ]
134
2018-02-07T06:25:02.000Z
2021-06-16T07:25:42.000Z
ezalor/src/main/java/com/wellerv/ezalor/util/Utils.java
verehu/Ezalor
c921adef38954ea25d092ed56fc2d4def8fb84ec
[ "Apache-2.0" ]
null
null
null
ezalor/src/main/java/com/wellerv/ezalor/util/Utils.java
verehu/Ezalor
c921adef38954ea25d092ed56fc2d4def8fb84ec
[ "Apache-2.0" ]
8
2018-03-01T08:39:10.000Z
2021-02-11T02:40:57.000Z
27.302326
127
0.605196
996,047
package com.wellerv.ezalor.util; import android.os.Build; import android.os.Process; import android.system.Os; import com.wellerv.ezalor.AppContextHolder; import java.io.Closeable; import java.io.FileDescriptor; import java.io.IOException; import java.lang.reflect.Method; /** * Created by huwei on 17-12-20. */ public class Utils { private static String sProcessName; static { System.loadLibrary("ioutils-lib"); } public static String getPathByFD(int fd) { try { if (Build.VERSION.SDK_INT >= 21) { return Os.readlink(String.format("/proc/%d/fd/%d", android.os.Process.myPid(), fd)); } return readlink(fd); } catch (Exception e) { e.printStackTrace(); } return null; } public static int getFD(FileDescriptor fileDescriptor) { return ReflectUtils.getObjectByFieldName(fileDescriptor, "descriptor", Integer.class); } public static String getProcessName() { if (sProcessName == null) { try { Class cl = Class.forName("android.app.ActivityThread"); Method method = ReflectUtils.getMethod(cl, "currentActivityThread"); Method getProcessNameMethod = ReflectUtils.getMethod(cl, "getProcessName"); sProcessName = (String) ReflectUtils.invokeMethod(getProcessNameMethod, ReflectUtils.invokeMethod(method, cl)); } catch (Exception e) { e.printStackTrace(); } } return sProcessName; } public static String getPackageName() { return AppContextHolder.getAppContext().getPackageName(); } /** * 关闭io流 * * @param closeable */ public static void closeIOStream(Closeable closeable) { if (closeable != null) { try { closeable.close(); } catch (IOException e) { LogUtils.logeForce(e); } } } public static boolean isAppProcess() { int uid = Process.myUid(); return uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID; } public static String getDBNameByProcess(String process) { return "ezalor_" + process + ".db"; } public static native String readlink(int fd); }
9231f2c2d6d2f70527fa6f87c64785636b595060
2,039
java
Java
src/main/java/digital/b2w/ri/rest/resources/PlanetResource.java
LeonardoMendoncaDev/desafio-backend
12f625c8b119e487b8fbc2b08ca237a44801db91
[ "MIT" ]
null
null
null
src/main/java/digital/b2w/ri/rest/resources/PlanetResource.java
LeonardoMendoncaDev/desafio-backend
12f625c8b119e487b8fbc2b08ca237a44801db91
[ "MIT" ]
null
null
null
src/main/java/digital/b2w/ri/rest/resources/PlanetResource.java
LeonardoMendoncaDev/desafio-backend
12f625c8b119e487b8fbc2b08ca237a44801db91
[ "MIT" ]
null
null
null
26.828947
76
0.641491
996,048
package digital.b2w.ri.rest.resources; import digital.b2w.ri.rest.client.SwapiClient; import digital.b2w.ri.rest.exception.EmptyPlanet; import digital.b2w.ri.rest.models.Planet; import digital.b2w.ri.rest.services.PlanetService; import io.vertx.core.json.JsonObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.inject.Inject; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletionStage; @Path("/api/v1/planets") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public class PlanetResource { private Logger logger = LoggerFactory.getLogger(PlanetResource.class); @Inject PlanetService planetService; @Inject SwapiClient swapiClient; @GET public Response getAll() { Set<Planet> planets = planetService.getAll(); return Response .ok(planets) .entity(planets) .build(); } @GET @Path("/name/{name}") public Response getByName(@PathParam("name") String name) { Set<Planet> planets = planetService.getByName(name); return Response .ok(planets) .header("status", Response.Status.OK) .build(); } @GET @Path("/{id}") public Response getById(@PathParam("id") String id) { Set<Planet> planets = planetService.getById(id); return Response.ok(planets) .header("status", Response.Status.OK) .build(); } @POST public Response add(Planet planet) { Optional.ofNullable(planet.getName()).orElseThrow(EmptyPlanet::new); planetService.add(planet); return Response .status(Response.Status.CREATED) .build(); } @DELETE @Path("/{id}") public Response remove(@PathParam("id") String id) { planetService.remove(id); return getAll(); } }
9231f370953569831ee3aafc4b9c4e4906ca6bba
5,115
java
Java
xap-core/xap-datagrid/src/main/java/com/gigaspaces/internal/lease/LeaseUtils.java
dm-tro/xap
9ab2cf43861bcc0ba759db1c9805e82e0b77a02c
[ "Apache-2.0" ]
90
2016-08-09T16:37:44.000Z
2022-03-30T10:33:17.000Z
xap-core/xap-datagrid/src/main/java/com/gigaspaces/internal/lease/LeaseUtils.java
dm-tro/xap
9ab2cf43861bcc0ba759db1c9805e82e0b77a02c
[ "Apache-2.0" ]
33
2016-10-10T17:29:11.000Z
2022-03-17T07:27:48.000Z
xap-core/xap-datagrid/src/main/java/com/gigaspaces/internal/lease/LeaseUtils.java
dm-tro/xap
9ab2cf43861bcc0ba759db1c9805e82e0b77a02c
[ "Apache-2.0" ]
48
2016-08-09T15:55:20.000Z
2022-03-31T12:21:50.000Z
44.094828
153
0.677028
996,049
/* * Copyright (c) 2008-2016, GigaSpaces Technologies, Inc. All Rights Reserved. * * 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.gigaspaces.internal.lease; import com.gigaspaces.async.AsyncFutureListener; import com.gigaspaces.async.AsyncResult; import com.gigaspaces.async.internal.DefaultAsyncResult; import com.gigaspaces.internal.client.spaceproxy.IDirectSpaceProxy; import com.gigaspaces.internal.client.spaceproxy.operations.UpdateLeasesSpaceOperationRequest; import com.gigaspaces.time.SystemTime; import com.j_spaces.core.exception.internal.InterruptedSpaceException; import java.util.HashMap; import java.util.Map; /** * @author Niv Ingberg * @since 9.0.0 */ @com.gigaspaces.api.InternalApi public class LeaseUtils { public static final long DISCARD_LEASE = -1; private static final long DUMMY_TTL_FOR_EXPIRED_ENTRIES = 1; public static long toExpiration(long duration) { long expiration = duration + SystemTime.timeMillis(); return expiration < 0 ? Long.MAX_VALUE : expiration; } public static long safeAdd(long x, long y) { // Safe way to express: x + y > Long.MAX_VALUE ? Long.MAX_VALUE : x + y; return x > Long.MAX_VALUE - y ? Long.MAX_VALUE : x + y; } public static long getTimeToLive(long expirationTime, boolean useDummyIfRelevant) { final long timeToLive = expirationTime != Long.MAX_VALUE ? (expirationTime - SystemTime.timeMillis()) : expirationTime; return (useDummyIfRelevant && timeToLive <= 0 && expirationTime != Long.MAX_VALUE) ? DUMMY_TTL_FOR_EXPIRED_ENTRIES : timeToLive; } public static Map<SpaceLease, Throwable> updateBatch(IDirectSpaceProxy spaceProxy, LeaseUpdateBatch batch) { UpdateLeasesSpaceOperationRequest request = new UpdateLeasesSpaceOperationRequest(batch.getLeasesUpdateDetails(), batch.isRenew()); final long updateTime = batch.isRenew() ? SystemTime.timeMillis() : 0; try { spaceProxy.getProxyRouter().execute(request); } catch (InterruptedException e) { throw new InterruptedSpaceException(e); } Exception[] errors = request.getFinalResult(); return processResult(errors, batch, updateTime); } public static void updateBatchAsync(IDirectSpaceProxy spaceProxy, LeaseUpdateBatch batch, AsyncFutureListener<Map<SpaceLease, Throwable>> listener) { UpdateLeasesSpaceOperationRequest request = new UpdateLeasesSpaceOperationRequest( batch.getLeasesUpdateDetails(), batch.isRenew()); spaceProxy.getProxyRouter().executeAsync(request, new ListenerWrapper(batch, listener)); } private static Map<SpaceLease, Throwable> processResult(Exception[] errors, LeaseUpdateBatch batch, long updateTime) { Map<SpaceLease, Throwable> result = errors == null ? null : new HashMap<SpaceLease, Throwable>(errors.length); if (errors == null) { if (batch.isRenew()) for (int i = 0; i < batch.getSize(); i++) batch.getLeases()[i]._expirationTime = safeAdd(updateTime, batch.getLeasesUpdateDetails()[i].getRenewDuration()); } else { for (int i = 0; i < batch.getSize(); i++) { if (errors[i] != null) result.put(batch.getLeases()[i], errors[i]); else if (batch.isRenew()) batch.getLeases()[i]._expirationTime = safeAdd(updateTime, batch.getLeasesUpdateDetails()[i].getRenewDuration()); } } return result; } private static class ListenerWrapper implements AsyncFutureListener<Object> { private final LeaseUpdateBatch batch; private final long updateTime; private final AsyncFutureListener<Map<SpaceLease, Throwable>> listener; public ListenerWrapper(LeaseUpdateBatch batch, AsyncFutureListener<Map<SpaceLease, Throwable>> listener) { this.batch = batch; this.updateTime = batch.isRenew() ? SystemTime.timeMillis() : 0; this.listener = listener; } @Override public void onResult(AsyncResult<Object> result) { Exception error = result.getException(); Map<SpaceLease, Throwable> map = null; if (error == null) map = processResult((Exception[]) result.getResult(), batch, updateTime); if (listener != null) listener.onResult(new DefaultAsyncResult<Map<SpaceLease, Throwable>>(map, error)); } } }
9231f3ca8878eed6355c9cd45137be4d31655afc
2,588
java
Java
discovery-client/src/main/java/io/micronaut/discovery/vault/config/v1/VaultConfigHttpClientV1.java
newink/micronaut-discovery-client
8798e2c866605621ed052862bbd3b0b51851cc3e
[ "Apache-2.0" ]
12
2020-07-07T04:30:30.000Z
2022-03-23T01:36:34.000Z
discovery-client/src/main/java/io/micronaut/discovery/vault/config/v1/VaultConfigHttpClientV1.java
newink/micronaut-discovery-client
8798e2c866605621ed052862bbd3b0b51851cc3e
[ "Apache-2.0" ]
172
2020-07-15T10:16:56.000Z
2022-03-23T12:11:02.000Z
discovery-client/src/main/java/io/micronaut/discovery/vault/config/v1/VaultConfigHttpClientV1.java
newink/micronaut-discovery-client
8798e2c866605621ed052862bbd3b0b51851cc3e
[ "Apache-2.0" ]
13
2020-07-26T12:04:37.000Z
2022-03-16T17:31:37.000Z
37.507246
121
0.727202
996,050
/* * Copyright 2017-2020 original authors * * 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 * * https://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 io.micronaut.discovery.vault.config.v1; import io.micronaut.context.annotation.BootstrapContextCompatible; import io.micronaut.core.annotation.NonNull; import io.micronaut.discovery.vault.config.VaultClientConfiguration; import io.micronaut.discovery.vault.config.VaultConfigHttpClient; import io.micronaut.http.annotation.Get; import io.micronaut.http.annotation.Header; import io.micronaut.http.annotation.Produces; import io.micronaut.http.client.annotation.Client; import io.micronaut.retry.annotation.Retryable; import org.reactivestreams.Publisher; /** * A non-blocking HTTP client for Vault - KV v2. * * @author thiagolocatelli * @since 1.2.0 */ @Client(value = VaultClientConfiguration.VAULT_CLIENT_CONFIG_ENDPOINT, configuration = VaultClientConfiguration.class) @BootstrapContextCompatible public interface VaultConfigHttpClientV1 extends VaultConfigHttpClient<VaultResponseV1> { /** * Vault Http Client description. */ String CLIENT_DESCRIPTION = "vault-config-client-v1"; /** * Reads an application configuration from Vault. * * @param token Vault authentication token * @param backend The name of the secret engine in Vault * @param vaultKey The vault key * @return A {@link Publisher} that emits a list of {@link VaultResponseV1} */ @Get("/v1/{backend}/{vaultKey}") @Produces(single = true) @Retryable( attempts = "${" + VaultClientConfiguration.VaultClientConnectionPoolConfiguration.PREFIX + ".retry-count:3}", delay = "${" + VaultClientConfiguration.VaultClientConnectionPoolConfiguration.PREFIX + ".retry-delay:1s}" ) @Override Publisher<VaultResponseV1> readConfigurationValues( @NonNull @Header("X-Vault-Token") String token, @NonNull String backend, @NonNull String vaultKey); @Override default String getDescription() { return CLIENT_DESCRIPTION; } }