method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d621820e-59c5-4435-88d2-92ba3354404f | 6 | @Override
public String toString() {
String result = "";
int prefixLength = SIDE_LENGTH - 1;
boolean reachedMiddleLine = false;
for (int r = 0; r < DIAMETER; r++) {
for (int i = 0; i < prefixLength; i++) {
result += " ";
}
if (!reachedMiddleLine) {
prefixLength--;
if (prefixLength == 0) {
... |
4adf9f9d-b4e4-4c96-a1fe-4244e4eff3a4 | 2 | public void closeConnection() {
if (this.connection != null)
try {
this.connection.close();
} catch (SQLException ex) {
this.core.writeError("Error on Connection close: " + ex, true);
}
} |
de4c68b9-1912-4fe5-b6df-2ee52fb117a0 | 7 | @Override
public boolean skipTo(int target) throws IOException {
if (firstTime) {
firstTime = false;
for (int i = 0; i < subSpans.length; i++) {
if (! subSpans[i].skipTo(target)) {
more = false;
return false;
}
}
more = true;
} else if (more && (subS... |
fbffd593-00a0-463f-aa84-1a957b4acd6b | 5 | public void clearLightnings()
{
Thread t = new Thread(new Runnable()
{
@Override
public void run()
{
boolean allLightningsWereAnimated = true;
while (!allLightningsWereAnimated)
{
for (Lightning l : lightnings)
{
if (!l.isDone())
{
allLightningsWereAnimated = fal... |
2cbc2f00-7392-4d1b-a6f3-971d8c91ed01 | 0 | public SQLPermissionConsole() {
super("console");
} |
5d194770-403d-49aa-ba6e-a90e0f81310c | 2 | private int indexOfMax(int[] values) {
int max = 0;
for (int i=0; i<values.length; i++) {
if (values[i] > max) {
max = i;
}
}
return max;
} |
8aa45f21-4e76-4236-895f-0432b07061d3 | 7 | public final void invalidate() {
if (!displaying) {
return;
}
// TODO: This is sketchy. This attempts to prevent a View from invalidating until after its root has been invalidated, this cutting down on unnecessary and bug-creating
// calls to canvas.invalidate().
if ... |
1902bf9e-7588-4ecd-bd5a-a2069785762a | 5 | public boolean storeXML(final File target) throws IOException {
boolean result = false;
try {
if (!target.exists() && !target.createNewFile()) {
throw new IOException("Could not create target file " + target.getAbsolutePath());
}
final DocumentBuilde... |
5cbd857f-fa6a-4e43-980a-5c411813724d | 9 | public void runCalculations(
JRadioButton radioButtonRectangle,
JRadioButton radioButtonCircle,
JRadioButton radioButtonSquare,
JRadioButton radioButtonParallelogram,
JRadioButton radioButtonEllipse,
JRadioButton radioButtonSector,
JRadioButton radioButtonTriangle,
JRadioButton radioButton... |
9e34cf3a-e5e9-4dc8-90e6-e1dce151c89b | 6 | public static String tempban(String muter, String mutedPlayerName, double days){
// Initial message
String regex = RPSystem.chatConfig.getString("format.ban");
int realDays = 0;
// Token replacement
regex = regex.replaceAll("%t", Timestamp.NOW());
regex = regex.replaceAll("%banner", muter);
if(days >= ... |
3b104917-fe26-4240-ba07-7d7467bdf7d8 | 8 | protected Value findValue(String str, boolean sign) throws ParseException
{
try
{
Number number = new Number(str, sign);
length += number.length();
return number;
}
catch (ParseException e)
{
try
{
Br... |
41680ce8-d594-4260-a938-c969866127e9 | 0 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jMenu1 = new javax.swing.JMenu();
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new jav... |
baa46cb5-a47a-466d-a46b-fe58e0330ae3 | 6 | private static void mergeWithoutCopy(int[] from, int[] to, int lo, int mid, int hi)
{
// DK: cannot just return if mid >= a.length, but must still copy remaining elements!
// DK: add two tests to first verify "mid" and "hi" are in range
if (mid > from.length) mid = from.length;
if (hi > from.... |
7fa7b994-b95a-4a9b-be5e-3b866931da53 | 2 | private void dumpVar(int dumpVarIndex) {
StringBuffer sb = new StringBuffer();
sb.append("dump(x"+ dumpVarIndex +"): \n");
for(int i: sitesHasVar(dumpVarIndex).keySet()) {
Site tmpsite = sitesHasVar(dumpVarIndex).get(i);
if(tmpsite.isVarWritten(dumpVarIndex)) {
sb.append("x"+dumpVarIndex+"."+tmpsite.get... |
7425f344-74f5-499b-a688-752fc4895d96 | 1 | public void run()
{
try
{
boolean done = false;
while (!done)
{
File file = queue.take();
if (file == FileEnumerationTask.DUMMY)
{
queue.put(file);
done = true;
}
else search(file);
... |
906985a4-e91c-43f0-b334-66fe1cd7195c | 4 | public static int javaLoadLib(int luaState, String className, String methodName)
throws LuaException
{
LuaState L = LuaStateFactory.getExistingState(luaState);
synchronized (L)
{
Class clazz;
try
{
clazz = Class.forName(className);
}
catch (ClassNotFoundExcept... |
a655d75e-bc46-488e-bddf-8aaf5e39a9e8 | 3 | public void setItem( ItemObject itemObject ) {
ImageIcon itemIcon;
String itemName, toolTip;
_itemObject = itemObject;
itemIcon = itemObject.getItemImage();
itemName = itemObject.getItemName();
if ( itemName == null || itemName.equals( Data.NO_ITEM_NAME ) ) {
itemName = "";
... |
5071f21d-6926-4fee-8f12-a869b51bbaf4 | 5 | public static ChessmenEntity getMyChessmen(final ChessBoardEntity aBoard, final PositionEntity p) {
ChessmenEntity result = null;
if (null != p) {
List<ChessmenEntity> chessmens = aBoard.getChessmens();
for (ChessmenEntity c : chessmens) {
if (c.isPlayer()) {
if (p.getX() == c.getPosition().getX() &&... |
e6e7d238-62b8-4956-b64f-e7126226a799 | 3 | public void setSSType(String arg) {
if(arg.equals("H") || arg.equals("S") || arg.equals("T")) {
sstype = arg;
}
else {
sstype = ""; //throw an exception
}
} |
b68bb76e-8580-401c-98da-a5f8ecad8d90 | 0 | static public void printOutGameStateTransition(String moveFilePath, String graphFilePath) {
} |
014c5295-56fc-4385-80bd-9bc1dd40ff5e | 0 | public Integer getId() {
return id;
} |
14dbad71-3b4f-4d76-9c47-f46adc0d82ec | 1 | @Override
public String toString() {
try {
return new MyObjectMapper().writeValueAsString(this);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
} |
cc34c25a-3eea-4a7b-a1a3-368622565dc2 | 0 | public Image getFlippedImage(Image image) {
return getScaledImage(image, 1, -1);
} |
9c6bcf40-f20b-4b13-a1d5-843ac596ba00 | 3 | private NetworkClient(INetwork network) {
PropertyConfigurator.configure("log4j.properties");
loggerNetworkClient.addAppender(GUI.customAppender.getFileAppender());
//PropertyConfigurator.configure("log4j.properties");
// set network IF NOT ALREADY SET
if (NetworkClient.network == null) {
NetworkClient.... |
937c54f3-848b-4257-a901-f84449d6555f | 0 | public void setQuantity(int quantity) {
this.quantity = quantity;
} |
27141507-0928-479e-9f64-eb2b5a866524 | 0 | public String getCaptchaError() {
return captchaError;
} |
6269b6a7-0a2f-46d0-be1e-ac5517c1db3d | 1 | public Set getDeclarables() {
Set used = new SimpleSet();
if (object != null)
object.fillDeclarables(used);
else
used.add(local);
return used;
} |
718736e4-6202-4b8a-a341-51860094f71d | 4 | public boolean validPosition(Position position) {
return position == null
|| (position.xCoordinate >= 0 && position.yCoordinate >= 0
&& position.xCoordinate < this.width && position.yCoordinate < this.height);
} |
18d75248-8b8a-417b-800c-f01f3ec4473c | 1 | private void loadError() {
try {
this.texture = load("error");
} catch (IOException e2) {
e2.printStackTrace();
System.err.println("Resources folder may be missing.");
}
} |
66bc9797-5189-4116-8855-cfec4344de15 | 3 | public int getID_Controleur(){
int val = 0;
int nb = ID_controleur.length;
boolean t = true;
for (int i = 0; i < nb && t; i++) {
if(ID_controleur[i]==false){
val=i;
ID_controleur[i]=true;
t=false;
break;
}
}
return val;
} |
ee8585a7-7b94-4b1e-bd6e-8143961425b2 | 7 | public boolean runDataLoading() {
long ctime = 0;
System.out.println("-----------------------------");
System.out.println("----- DATA LOADING TEST -----");
System.out.println("-----------------------------");
if (!this.createDB("dbtest")) {
System.out.println("Creati... |
4edd25e9-0d84-4823-8dbc-e63eecbafcdf | 2 | @Override
public void run() {
try {
InputStream is = socket.getInputStream();
while(true)
{
System.out.println("ServerInputThread 1");
BufferedReader buff = new BufferedReader(new InputStreamReader(is));
System.out.println("ServerInputThread 2");
//如果读取的内容没有的话,程序一直在readLine处等待
... |
0d924055-3148-4b56-85c1-74217f866fd0 | 3 | private boolean isMultipart(final List<Header> headers) {
for (final Header header : headers) {
if (header.getName().equals("Content-Type") && header.getValue().startsWith("multipart/form-data")) {
return true;
}
}
return false;
} |
8c25f440-0ad5-415f-a4cf-79560ef3ac2e | 0 | public void testIsNumberType() {
assertTrue(NumberUtils.isNumberType(int.class));
assertTrue(NumberUtils.isNumberType(Integer.class));
assertFalse(NumberUtils.isNumberType(String.class));
assertFalse(NumberUtils.isNumberType(boolean.class));
assertFalse(NumberUtils.isNumberType(char.class));
assertFalse(Num... |
88cd96c6-54e8-48df-9d4e-75ceeb2c990f | 5 | public static String getHash (String hashThis)
{
String hashType = "MD5";
String encodingType = "UTF-8";
StringBuffer hexString = new StringBuffer ();
MessageDigest digester = null;
byte[] byteDigest = null;
byte[] bytesOfInput = null;
/** Set our digester type to MD5 */
try
{
digester = Messag... |
85bdf8ce-a45f-4fe1-b693-78183bdc3184 | 2 | private void btnOpenLogoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenLogoActionPerformed
JFileChooser fl = new JFileChooser("C:/");
fl.setMultiSelectionEnabled(false);
fl.showOpenDialog(null);
if (fl.getSelectedFile() != null) {
txtLogo.setText(fl... |
7119d916-3145-4a8d-b74a-bf4a245d1bb5 | 7 | public float useLevel(Trait type) {
final Level TL = levels.get(type) ;
float level = TL == null ? 0 : (TL.value + TL.bonus) ;
if (type.type == PHYSICAL) {
return level * actor.health.ageMultiple() ;
}
if (type.type == SKILL) {
final Skill skill = (Skill) type ;
if (skill... |
cd13898b-e718-4841-b9ce-64159cf308e7 | 6 | public void drawButton(Minecraft var1, int var2, int var3) {
if(this.enabled2) {
FontRenderer var4 = var1.fontRenderer;
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, var1.renderEngine.getTexture("/assets/gui/gui.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
boolean var5 = var2 >... |
83c35e96-e2bb-4d1e-9a34-28db0c72a35e | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n=in.nextInt();
int s = in.nextInt();
int max = 0;
int sum = 0;
while(n-->0){
int a = in.nextInt();
sum+=a;
max=Math.max(max, a);
}
System.out.println(sum-max > s?"NO":"YES");
} |
b55c2e65-de61-49ed-826a-00a06530ad4e | 6 | public LinkedList<String[]> callProc(String procname, LinkedList<String> args) {
LinkedList<String[]> r = new LinkedList<String[]>();
System.out.println(procname);
try {
CallableStatement stmt = (CallableStatement) conn.prepareCall(procname);
// Step-4: register output parameters ...
if (args != n... |
98a22fef-8251-4031-8b23-5342f68e9c7d | 0 | public Product locateProductByCode(Character codeToSearch) {
return this.products.get(codeToSearch);
} |
d66395ed-95b9-4914-8299-20a17e1ad1cf | 8 | private static Set<String> listAllFiles(Collection<String> paths) {
Set<String> set = new TreeSet<String>();
for (String path : paths) {
File file = new File(path);
if (!file.exists()) {
log.warn("File or directory does not exist: " + path);
continue;
}
if (!file.canRead()) {
log.warn("Cann... |
8d0ac65a-6189-4e2e-a7e9-fcd95929d2c5 | 6 | public static void Edit(){
FileReader pl=null;
String sCurrentLine="";
System.out.println("Input file:\n");
try{
//pl = new FileReader(f);
pl = new FileReader("src/data");
} catch (FileNotFoundException e) {
System.out.println("Opening file error!");
System.exit(1);
}
BufferedReader ... |
33c0b8ef-68ff-49a9-abae-bd83780e1877 | 9 | private static ApplianceDescriptor parseVS(Node n, ApplianceDescriptor parent) throws XPathExpressionException, MalformedOVFException
{
XPath xpath = XPathFactory.newInstance().newXPath();
// id
Node id = n.getAttributes().getNamedItem("ovf:id");
if (id == null)
{
throw new RuntimeException("id was not s... |
2bf5795b-a426-40c0-8be6-617b9de104be | 6 | public static ArrayList getRepresentativeTags(Map imagesTags, int percentage) {
ArrayList representativeTags = new ArrayList<String>();
/*
1. Create Map "tagpool" tag => count (0)
2. Count all occurrences and add to tag pool
3. Choose "int count" REFERENCE_TAG_PERCE... |
8ec569d9-5837-4cf6-9591-89294c0a2aa3 | 2 | public List<Location> getLocationsEnCours(){
System.out.println("ModeleLocations::getLocationsEnCours()") ;
List<Location> locationsEnCours = new ArrayList<Location>() ;
for(Location location : this.locations){
if(location.estEnCours()){
locationsEnCours.add(location) ;
}
}
return locationsEnCours ;... |
e194a980-fc8a-46e6-981d-8e60766936b7 | 5 | static final boolean method1581(int i, char c) {
anInt2838++;
if (i >= -18)
return false;
if (((c ^ 0xffffffff) > -66 || c > 90)
&& (c < 97 || (c ^ 0xffffffff) < -123))
return false;
return true;
} |
f709b8cb-f834-4dcb-a9b2-eca070bc01a5 | 7 | private void getOldMods(){
Patch_Controller.delete(new File(Strings.TEMPORARY_DATA_LOCATION_B));
UnZip.unZipIt(Strings.MODDEDZIP_LOCATION, Strings.TEMPORARY_DATA_LOCATION_B);
ArrayList<Integer> rows = new ArrayList<Integer>();
ArrayList<Integer> rows1 = new ArrayList<Integer>();
try {
ArrayList<String[]> ... |
ac4641be-b6ba-4820-bb20-14a8c6b0c017 | 2 | public Player getCurrentPlayer(int currentTurnNumber) {
Player current;
if (currentTurnNumber > this.numPlayers) {
int mod = currentTurnNumber % this.numPlayers;
if (mod == 0) {
current = this.playerList[this.numPlayers - 1];
} else {
current = this.playerList[mod - 1];
}
} else {
current =... |
90f79e61-f3ed-49c7-a1fc-0f510c4d5271 | 6 | private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 2; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2()... |
ffe95b86-6c7f-4991-83fd-1a055e1eb977 | 7 | protected void create() throws DBException
{
File medium = getMedium();
File mpath = getMpath();
String path = null == mpath ? Manager.DB_NAMES[0] : mpath.getPath();
if (!medium.exists() && medium.mkdir())
log().info("Created directory \"" + medium + "\" to store the new bag.");
File location = new File(m... |
e12a55b2-1879-4e3a-91b0-da6f82a92f9e | 6 | public void draw(Graphics g) {
Font f = new Font("SansSerif", Font.BOLD, 20);
g.setFont(f);
//g.setColor(needsHighlight() ? selectColor : lightGrayColor);
g.setColor(lightGrayColor);
String s = (volts[0] < threshold) ? "L" : "H";
if (isTernary()) {
if (volts[0... |
3bb714ff-b4d2-4798-8537-2cbea79ac963 | 6 | public GamePanel(){
super();
try{
handler = new FileHandler("Logging.txt");
} catch (IOException e){
handler = new ConsoleHandler();
}
log.addHandler(handler);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
this.setTitle("Legue of Numbers");
this.setDefaultCloseOperation(... |
b08bacc3-d1d8-4612-bb02-6025271f08b4 | 2 | public static boolean hasMultipleCharacterLabels(Automaton automaton) {
Transition[] transitions = automaton.getTransitions();
for (int k = 0; k < transitions.length; k++) {
FSATransition transition = (FSATransition) transitions[k];
String label = transition.getLabel();
if (label.length() > 1)
return t... |
4a99563b-fe40-4256-b561-d2c99a7cfcca | 1 | public boolean InsertarPropiedad(Propiedad p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
c799bfc7-fc78-44de-bd63-fa071e0fab59 | 8 | private void loadFile(String fileName) throws CWRCException {
childrenFound = false;
file = new File(fileName);
if (file.exists()) {
} else {
try {
FileOutputStream fileOut = new FileOutputStream(file);
XMLStreamWriter out = XMLOutputFactory.n... |
751c3eff-ad7d-435a-ac02-a2db4ef0056c | 0 | public void setT1(teacher t1) {
this.t1 = t1;
} |
3d272b32-4491-40ec-a6b7-c4ea6ef5cbcf | 7 | public void run()
{
while ((this.Running) && (this.CurrentIndex < this.Indexes.length))
{
if (nextImage()) {
this.Running = false;
}
if (!this.Running) {
break;
}
if (this.Delays != null) {
try
{
Thread.currentThread(); Thread.sleep(this.... |
45207a06-9680-4a04-8c7e-b2cff0c3deb4 | 9 | public LinkedList<interval> extractRelevantIntervals (Patient pat, SearchInterval searchint)
{
//System.out.println("Extrayendo Intervalos Relevantes Paciente " + pat.id);
LinkedList<interval> list = new LinkedList<interval>();
//System.out.println("Paciente " + pat.id + " tamaño intervals2: " ... |
b32225ae-b014-43c2-9b0d-5a717ba722a4 | 4 | public Klas getKlas(long klas_id) {
Klas klas = null;
try {
PreparedStatement klasStatement = manager
.prepareStatement("SELECT * FROM klassen WHERE id = ?");
klasStatement.setLong(1, klas_id);
ResultSet klasResult = klasStatement.executeQuery();
if (klasResult.next()) {
klas = new Klas(klasRe... |
5163b2c5-2b0e-4dbc-83fc-ebeacf47d56e | 0 | public void setName(String value) {
this._name = value;
} |
de550ac0-65e5-4c32-be1a-126021b486b4 | 3 | public void setAAte(TNumeroInt node)
{
if(this._aAte_ != null)
{
this._aAte_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
... |
b92a5549-8ea9-4f87-9d9c-b29d56415098 | 7 | public void run() {
// FIXME: Do not allow other players to be added.
/*
* [[ INITIALIZE GAME ]]
*/
map = MapImporter.getMap(); // get default map
setPlayerCredentials();
map.assignPlayersToBases(players.values(), getInitialShips()); // set bases
setGameConstants();
viz = new BCViz(players.values... |
dc18ea24-0223-4b09-98a4-9c70fae7dc7a | 7 | public ScreenBuilder buildCritterScreen(){
setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
JLabel total = new JLabel("Total Points: ");
constraints.gridx = 0;
constraints.gridy = 0;
add(total,constraints);
text = new JTextArea(pool.toString());
constr... |
b6019b60-ea0d-417e-8250-9285a80061f3 | 0 | public void countFinished()
{
countsValid = true;
} |
e657aeb6-23e6-42cb-9446-cb7166b964b0 | 7 | public void delete(Node treeNode, int value) {
Node target = findNode(treeNode, value);
if(target == null){
// node is not in the tree
return;
}
// target has middleChild, so we delete the last of the middle child
if(target.middleChild != null){
while (target.middleChild != null){
target = ... |
34530320-4b1c-4cc6-b1f1-03ce4d48b731 | 4 | public void move(long delta) {
// if we have reached the left hand side of the screen and
// are moving left then request a logic update
if ((dx < 0) && (x < 10)) {
game.updateLogic();
}
// and vice vesa, if we have reached the right hand side of
// the screen and are moving right, request a logic upda... |
c3362306-edbc-4a95-a448-0e5d766885ec | 3 | public void setState(int state) {
this.state=state;
if (state==0) theApp.setStatusLabel("Setup");
else if (state==1) theApp.setStatusLabel("Signal Hunt");
else if (state==2) theApp.setStatusLabel("Msg Hunt");
} |
6e7475ba-3864-4536-8b1d-ecaafcca93fc | 3 | private JPanel createControlPanel() {
JPanel controlPanel = new JPanel();
controlPanel.setBorder(new EmptyBorder(4, 4, 4, 4));
controlPanel.setLayout(new BoxLayout(controlPanel, BoxLayout.X_AXIS));
btnPause = new JButton("Pause");
btnPause.addActionListener(new ActionListener() {
@Override
public void... |
7fac77d0-827a-48c2-81fa-146ba3979245 | 1 | public boolean equalsExpr(final Expr other) {
return (other instanceof RCExpr) && super.equalsExpr(other);
} |
1392a10d-0cd1-49e7-b4ce-6fbc906631e4 | 8 | private void climbWall(Player p)
{
Block b1 = p.getLocation().getBlock();
if (b1.getType() != Material.AIR)
return;
Block b2 = b1.getRelative(BlockFace.UP);
Location l = p.getLocation();
if (p.isSneaking() && (b1.getRelative(BlockFace.NORTH).getType() != Material.AIR
|| b1.getRelative(BlockFace.EA... |
e81b1a50-d020-4a1d-8b35-0a5a636958c0 | 5 | public String codeToText(short code) throws AssemblerException {
StringBuffer command = new StringBuffer();
if (code != AssemblyTranslator.NOP) {
if ((code & 0x8000) == 0) {
command.append('@');
command.append(code);
}
else {
short exp = (short)(code & 0xffc0);
short dest = (short)(code & ... |
54133833-5eb4-4055-9bec-884f6ba792a9 | 2 | @Override
public void process(List<ProgressData> data)
{
if (isCancelled()) return;
StringBuilder b = new StringBuilder();
statusLine.setText("" + data.get(data.size() - 1).number);
for (ProgressData d : data)
{
b.append(d.line);
b.append(... |
acae1745-5924-4258-b5db-8f2252ad8949 | 9 | public void spawnFruit() {
TileColor tile = null;
while(tile == null) {
int i = Util.getRandom(tiles.length -1);
TileColor newFruit = tiles[i];
if(newFruit != TileColor.SPACE)
continue;
tiles[i] = TileColor.ORANGE;
break;
}
tile = null;
while(tile == null) {
int i = Util.getRandom(tiles.... |
b676aa8c-36ea-42ec-808b-8e17ad16215b | 9 | public static Stella_Object coerceIncompatibleValue(Stella_Object value, Surrogate type) {
{ Stella_Object substituteValue = null;
if (Logic.relationrefSpecializesRelationrefP(type, Logic.SGT_PL_KERNEL_KB_QUANTITY)) {
return (Logic.coerceQuantity(value, type));
}
else if (Logic.relationre... |
4be95f5c-97e5-4468-b7df-a4f9bc0d5222 | 9 | public CellElement getPointerWithPolicy(int policy) {
if (m_pointers.size() == 0) {
return null;
}
CellElement retCell = null;
switch (policy) {
case POINTER_POLICY_ANY:
retCell = (CellElement) m_pointers.firstElement();
break;
case POINTER... |
bb380a99-0116-4d48-8bf2-be2f8ec14fbb | 3 | public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
int numOfCases = sc.nextInt();
for(int i = 0; i < numOfCases;i++)
{
// The first int on the line is the current highest polynomial
int highestDegree = sc.nextInt();
//It is easier to print while you are calculating
// in... |
831bc641-d9ca-4a96-a7ce-07daf7860a27 | 0 | private void swap(int[] array, int left, int right){
int temp = array[left];
array[left] = array[right];
array[right] = temp;
} |
a5e895fa-df04-475e-897e-a7db18de82c6 | 2 | public boolean hasStore() {
int headPointer = head;
while (headPointer <= tail) {
// check if not typo
if (tuples[headPointer].getType().equals("SW"))
return true;
headPointer = (headPointer + 1) % size;
}
return false;
} |
043e5c3b-0e20-4455-a2cb-ece6ccb7ee36 | 4 | public void WriteToSocket(String s)
{
try {
writer.write(s);
writer.flush();
try {
if(!currentMessage.equals(oldMessage) && !currentMessage.equals(""))
{
DatabaseDataObjectUtilities.addMessageToBlackBox(listener.getCurre... |
d0f3628d-fbff-4b27-8140-25bc6380022e | 3 | private void loadPlattformar() {
ArrayList<String> altemp = new ArrayList<>();
ArrayList<Plattform> al = new ArrayList<>();
try {
String query = "select pid from plattform";
altemp = DB.fetchColumn(query);
} catch (InfException e) {
e.getMessage();
... |
19be8bf3-92f4-48c1-9251-8589c418ffdb | 9 | public boolean beginGame (boolean force) {
boolean allPlayersReady = true;
if(!playing) {
for(Player t : players) {
if(!t.isReady()) {
allPlayersReady = false;
break;
}
}
if(allPlayersReady || force) { // end game
for(Bo... |
5edd977f-7c0c-4d83-9e19-b2cee59c850b | 8 | @Override
public void e(float sideMot, float forMot) {
if (this.passenger == null || !(this.passenger instanceof EntityHuman)) {
super.e(sideMot, forMot);
this.W = 0.5F; // Make sure the entity can walk over half slabs,
// instead of jumping
return;
}
EntityHuman human = (EntityHuman) this.passe... |
98585f16-8004-437c-aba4-3518b4921b0a | 7 | protected boolean advanceAfterCurrent() throws IOException {
do { // repeat until minimum nr of matchers
currentDoc = scorerDocQueue.topDoc();
currentScore = scorerDocQueue.topScore();
nrMatchers = 1;
do { // Until all subscorers are after currentDoc
if (!scorerDocQueue.topNextAndAdj... |
c31ff9e6-a694-4cb1-8e6a-fc8a96d6f369 | 4 | private void updateTableMembership() {
topTable.clear();
bottomTable.clear();
for ( String rowItem : topOfTableRow ) {
for ( String columnItem : columns) {
addToTopOfTable(rowItem, columnItem, issueMembershipQuery(rowItem, columnItem));
}
}
for ( String rowItem : bottomOfT... |
8c4f4863-f329-4ef9-bffe-19149ef41e98 | 7 | public static Packet readPacket(DataInputStream var0, boolean var1) throws IOException {
Packet var3 = null;
int var6;
try {
var6 = var0.read();
if(var6 == -1) {
return null;
}
if(var1 && !serverPacketIdList.contains(var6) || !var1 && !clientPacketIdLi... |
2d6d17ec-0296-49bb-84f0-90f3176e4571 | 3 | void dump(OutputStream out) throws IOException {
try{
HostKey hk;
synchronized(pool){
for(int i=0; i<pool.size(); i++){
hk=(HostKey)(pool.elementAt(i));
//hk.dump(out);
String host=hk.getHost();
String type=hk.getType();
if(type.equals("UNKNOWN")){
out.write(Util.str2byte(hos... |
1d39dcfb-9ae2-4fe9-9f24-cf5bbfacde87 | 0 | public boolean accept(File f){
return f.getName().endsWith(".bmp");
} |
2e5b1c8f-7a9e-4f4c-a46f-d3a46f234a84 | 3 | @Override
public Confirmation deliver(final Message message) {
int count = 0;
for (final Permissible permissible : Bukkit.getPluginManager().getPermissionSubscriptions(this.permission))
if (permissible instanceof CommandSender && permissible.hasPermission(this.permission)) {
... |
3bf607f9-6cda-40bf-95ed-416a88ff73d5 | 7 | final private void addOperator(Operator anOperator)
{
//make sure the operator is valid
if (!anOperator.getRepresentation().equals(""))
{
int thisOperatorPriority = anOperator.getPriority();
int previousOperationPriority = -1;
Token previousOperation = this.m_operationsStack.peek();
if (previousOpera... |
688ff053-e185-4bca-83fb-b02b0dba5543 | 4 | public boolean moveCompatible(Territory t1, Territory t2){
if(!t1.hasConnection(t2) || t1.getOwner().getID() != t2.getOwner().getID() || (t1.getNbrOfUnits() < 2 && t2.getNbrOfUnits() < 2)){
return false;
}
return true;
} |
5f39294b-3ca2-4dc6-86e4-dbfe80199620 | 1 | public QueryPlansResponse queryPlans(QueryPlansRequest request)
throws GongmingConnectionException, GongmingApplicationException {
URL path = _getPath(QUERY_PLANS);
QueryPlansResponse response = _GET(path, request, QueryPlansResponse.class);
if (response.code != GMResponseCode.COMMON_SUCCESS) {
... |
da2e6c6e-ad34-4c4a-beb1-08c73e39724c | 5 | protected Option[] work(){
try{
openConnection(server,instruction);
Mission requestMission = new Mission(server,instruction,options);
send(requestMission);
Mission responseMission = receive();
return dealResponse(responseMission);
}catch(Exception e){
return ActionResult.makeFai... |
1bda511e-bbf4-4f3e-b474-50919179a0c0 | 9 | @Override
public void run() throws Exception {
// TODO Auto-generated method stub
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
String server = config.getProperty("... |
e8c1fe93-35a5-4c28-a63f-32ab5dd9cfd1 | 9 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder( );
for(String line; (line =in.readLine() ) !=null;){
if(line.trim().equals("0")) break;
StringTokenizer st = new StringTokenizer(line);
... |
3aae3846-2db2-4ff4-92de-0afcdd59c671 | 2 | public Set<Box> getBoxes() {
Set<Box> boxes = new HashSet<>();
final Game game = getGame();
final int baseX = getX();
final int baseY = getY();
final int width = getWidth();
final int height = getHeight();
for(int x = 0; x < width; x++) {
for(int y = 0; y < height; y++) {
boxes.add(game.getBox(bas... |
b4a11995-ea2e-43ea-a2c6-1d0c1bcc6163 | 1 | private String calc(String input) {
//Person 1 put your implementation here
String output = input;
if (input.length() > 2) {
output = input.substring(2, input.length()) + input.substring(0,2);
}
return output;
} |
6ba17539-006a-49bb-a22f-8dcbc8cb8bd7 | 8 | public List<Integer> picturesInAlbum(int albumId) {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
List<Integer> picturesIds = new ArrayList<Integer>();
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(PICTURE_ALBUM_STMT);
stmt.setInt(1, albumId)... |
a74bc06f-9527-4083-ab49-216f1822ebf7 | 1 | public boolean connect() {
System.out.println("Controller:connect() is working");
try {
String computername = InetAddress.getLocalHost().getHostName();
OtpErlangObject[] message = new OtpErlangObject[2];
message[0] = mbox.self();
message[1] = new OtpErlang... |
9b94ce5b-b2a4-4465-b289-a286aadc6e9b | 9 | public boolean checkCommandTriggers(String command){
for(Trigger trigger : triggers){
if(trigger.used == false){
if(trigger.hasCommand() && trigger.commandMatch(command)){
if(trigger.checkConditionsTrue()){
trigger.used = true;
trigger.execute();
for(Trigger trigger2 : triggers){
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.