method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
278ec694-4b28-4da2-967f-3d060a1b7196 | 1 | private void callExpression()
{
if (accept(NonTerminal.CALL_EXPRESSION))
{
tryResolveSymbol(current);
expect(Token.Kind.IDENTIFIER);
expect(Token.Kind.OPEN_PAREN);
expressionList();
expect(Token.Kind.CLOSE_PAREN);
}
} |
a05aa530-3b02-457a-9e6e-0c7e95d5e106 | 4 | public void resetOTItems(int WriteFrame) {
outStream.createFrameVarSizeWord(53);
outStream.writeWord(WriteFrame);
outStream.writeWord(playerOTItems.length);
for (int i = 0; i < playerOTItems.length; i++) {
if (playerOTItemsN[i] > 254) {
outStream.writeByte(255); // item's stack count. if over 254, ... |
106d73ba-4a9b-4f38-b4ef-f7864d8d579f | 0 | public static void question1() {
/*
QUESTION PANEL SETUP
*/
questionLabel.setText("How are you feeling today?");
questionNumberLabel.setText("1");
/*
ANSWERS PANEL SETUP
*/
//resetting
radioButton1.setSelected(false);
radioButton2.s... |
7803f5d6-9058-4d76-bc7d-3accb8c21675 | 5 | public Image[] getCells(ImageRetriever paramImageRetriever, int paramInt1, int paramInt2)
{
Integer localInteger = new Integer(paramInt1);
if (animationList == null)
animationList = new Hashtable();
Object localObject = animationList.get(localInteger);
Image[] arrayOfImage;
if (localObject =... |
32ae29ec-f931-4efe-962b-88df504d7bca | 7 | private long deleteByIndex(final long index)
{
assert 0 <= index && index < this.borderIndex : "Index: " + index + " - Border: "
+ this.borderIndex + " - MaxNum: " + this.maxNum + " replace: "
+ this.replace.get(index);
final long preBorderIndex = this.borderIndex - 1;
final long preBorderElement = repla... |
4576bee3-4c04-4930-9003-c29a0f157125 | 1 | public static ResultSet doQuery(String cmd) throws DALException
{
try { return stm.executeQuery(cmd); }
catch (SQLException e) { throw new DALException(e); }
} |
1a891cff-1340-48c0-b86a-6a7882ce6340 | 3 | public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) {
super.changedUpdate(e,a,f);
float align = getVerticalAlignment();
int height = fHeight;
int width = fWidth;
initialize(getElement());
boolean hChanged = fHeight!=height;
boolean wChanged = fWidth!=width;
if( hChanged || wChanged ||... |
c30d773a-a9a3-40db-b14c-7cfbe36656b0 | 3 | @Override
public boolean isPossible(CommandInvocation invocation)
{
String token = invocation.currentToken();
if (token.startsWith("-"))
{
token = token.substring(1);
if (name().equalsIgnoreCase(token) || longName().equalsIgnoreCase(token))
{
... |
cf7a1975-9c23-4dfe-980b-2564e401d0d8 | 5 | public void save(File file) {
try {
if (file.exists()) {
file.delete();
file.createNewFile();
}
Map<String, BufferedImage> images = new HashMap<>();
ZipOutputStream zipOutputStream = new ZipOutputStream(new FileOutputStream(file));
... |
d96d88dd-5edf-4392-861a-ed15cc6f9be1 | 3 | public static boolean stageClear() {
for (Entity e : Game.world.entities) {
if (e instanceof Creature && ((Creature) e).isHostile()) return false;
}
return true;
} |
8c35ec0d-4d0e-4251-ab87-a00430342959 | 3 | private void allocateQueueGridlet()
{
// if there are many Gridlets in the QUEUE, then allocate a
// PE to the first Gridlet in the list since it follows FCFS
// (First Come First Serve) approach. Then removes the Gridlet from
// the Queue list
if (gridletQueueList_.size() > ... |
ccb2106d-a1a6-4beb-afd8-aeb9f953f2d5 | 9 | public ListNode mergeKLists(List<ListNode> lists) {
while (lists.contains(null)) {
lists.remove(null);
}
if (lists.size() == 0) {
return null;
}
if (lists.size() == 1) {
return lists.get(0);
}
... |
bd4fd1ab-f96f-4159-a300-5a3aaaf2f908 | 0 | public void setColumns(int colums) {
this.columns = colums;
} |
3d4d2ea3-2400-4a50-881a-740e8ab0023b | 0 | public XMLGregorianCalendar getStartDate() {
return startDate;
} |
192e3679-2846-4362-9f37-60a9f6e12c65 | 8 | public void testNodeRemoval3() {
setTree(new TreeNode("dummy"));
TreeNode root = new TreeNode("root", 1);
TreeNode subtree = new TreeNode("subtree", 1);
TreeNode leaf = new TreeNode("leaf");
root.branch[0] = subtree;
subtree.branch[0] = leaf;
Map tree = Collection... |
a02517e3-a5e9-46ba-9981-7e76f71d1ab7 | 5 | public void update() {
Vector3f dirToCam = Transform.getCamera().getPos().sub(transform.getTranslation());
float distance = dirToCam.length();
Vector3f orientation = dirToCam.div(distance);
alignWithGround();
faceCamera(orientation, distance);
switch(state){
... |
be3cbe4a-bebc-4732-8841-11116eb40dcf | 7 | private static Mesh loadOBJMesh(String fileName) {
ArrayList<Vertex3f> vertices = new ArrayList<Vertex3f>();
ArrayList<Integer> indices = new ArrayList<Integer>();
try {
BufferedReader meshReader = new BufferedReader(new FileReader(fileName));
String line = new String();
while ((line = meshReader.readL... |
672bfe51-72ca-407f-976e-eb87f900f609 | 2 | @Override
public void itemStateChanged(ItemEvent e) {
// TODO Auto-generated method stub
counter++;
if(counter == 2) {
JComboBox box = (JComboBox) e.getSource();
final String str = (String) box.getSelectedItem();
System.out.println("Changer destination");
new Thread(new Runnable() {
... |
d57f87f5-df9b-4284-8f8c-18e9a98d25f2 | 4 | public void rotate()
{
// Create temp copy of block
int[][] temp = new int[BLOCK_SIZE][BLOCK_SIZE];
for(int i = 0; i < BLOCK_SIZE; i++)
for(int j = 0; j < BLOCK_SIZE; j++)
temp[i][j] = block[i][j];
// Rotate block
/*block[0][0] = temp[3][0];
block[0][1] = temp[2][0];
block[0][2] = temp[1][0];
... |
fa9dd8d1-6678-43e4-84e5-4cb9a4a06d8b | 9 | public void step() throws IncorrectNodeException
{
super.step();
//Get the agent
Object agent = m_tree.getAgent();
GEBT_MarioAgent mario = (GEBT_MarioAgent)agent;
Graph levelGraph = mario.getMap().getGraph();
int marioNodeId = mario.getMarioNodeInM... |
361654c1-bb44-4cfa-bd5d-627c33971ae2 | 4 | public void maxify() {
// Find max dice possible.
int max_dice = 0;
for (int i=0; i<moves.size(); i++) {
int this_move_d = ((Move) moves.elementAt(i)).getNumAtomicMoves();
if (this_move_d > max_dice) {
max_dice = this_move_d;
}
}
// Remove those less than max dice.
// Check from end on down, so a... |
f00418aa-fcc2-4c67-8a5d-25bff3c3dbe6 | 2 | @Override
public void read() {
// TODO process currentEvent through Interpreter, load up next currentEvent?
// How do I handle conditionals?
// Conditionals?
if(currentEvent.isJsonArray()) {
/*if(Interpreter.interpretConditional(currentEvent.getAsJsonArray().get(0).getAsJsonObject())) {
currentEvent ... |
46e47a3b-ffdf-43b9-938f-1fe525f0f816 | 7 | public boolean equals(Object o) {
if (! (o instanceof IPAddressAttribute))
return false;
IPAddressAttribute other = (IPAddressAttribute)o;
if (! address.equals(other.address))
return false;
if (mask != null) {
if (other.mask == null)
... |
a91f2414-41b7-41b1-b337-4685a38179f4 | 5 | public void newSongToLibrary()
{
Song newSong; //Create new song object
//Basic song info
String artist = "";
String title = "";
String path = "";
//JChooser for new song file
JFileChooser fileChooser = new JFileChooser(musicPath);
//... |
837eb4ac-583c-44ed-870e-cb5da39f4c53 | 6 | public void paint(Graphics2D g2d) {
AffineTransform identity = new AffineTransform();
// draw the page
g2d.setColor(Color.BLACK);
g2d.fillRect(0, 0, getWidth(), getHeight());
// draw the title
g2d.translate(40, 60);
g2d.setColor(Color.WHITE);
g2d.setFont(getFont());
g2d.drawString... |
c8b9db60-c35a-405d-b712-03bc511b4c40 | 4 | @Override
public void getMouseEvent(int button) {
if (button == 0 && canClick){
if (PointMath.distance2Points(xLoc, yLoc, Boot.getPlayer().getX(), Boot.getPlayer().getY()) <= 2){
if (!initialized){
fill();
}
Boot.getGUIHandler().addWindow((new GUIInventoryWindow(-1, "Fridge", this, xLoc, yLoc, 3)... |
5bc69fcb-8a41-4809-867c-6ef29deccf43 | 5 | @Override
public void run()
{
ArrayList<Socket> sockets = new ArrayList<Socket>();
init();
while(!stop.get())
{
try
{
Socket clientSocket = serverSocket.accept();
Proxy proxy = new Proxy(clientSocket, config, stop);
sockets.add(clientSocket);
pool.execute(proxy);
}
catch(SocketExc... |
c36821ec-c899-4971-97a0-72ab7ccf1dca | 1 | public LocalInfo getReal() {
LocalInfo real = this;
while (real.shadow != null)
real = real.shadow;
return real;
} |
75aebbbf-982f-4868-a140-557c2ec6bfb0 | 8 | public ListNode reverseKGroup(ListNode head, int k) {
ListNode reverseHead = null, reverseTail = null;
ListNode segHead = null, segTail = null;
int count = 1;
if (!canReach(head, k)) {
return head;
}
while (head != null) {
ListNode next = head.n... |
7d5a4939-3a85-48d8-ae5b-dba6e5abb965 | 1 | public void uimsg(String name, Object... args) {
if(name == "ch") {
img = Resource.loadtex((String)args[0]);
}
} |
de4c3154-b06a-4d79-8f26-863c7a6b1842 | 9 | public HashMap<Integer, Integer> solution(ArrayList<Integer> input) {
HashMap<Integer, Integer> result = new HashMap<Integer, Integer>();
int pos0 = 0;
int pos2 = input.size() - 1;
for (int i = 0; i < input.size(); i++) {
if (input.get(i) != 0) {
pos0 = i;
break;
}
}
for (int i = input.size() ... |
6a739abd-2fba-4afe-a7b0-b8bb6de91762 | 3 | public static void recolor(BufferedImage img, int oldcolor, int newcolor){
for(int i = 0; i < img.getWidth(); i++){ // loops through the image's width
for(int i2 = 0; i2 < img.getHeight(); i2++){ // loops through the image's height
if(img.getRGB(i, i2) == oldcolor){
img.setRGB(i, i2, newcolor);
}
}... |
cff67fcb-e040-4146-ad18-11bba7efb696 | 3 | public Location getDestination(Location location) {
World world = location.getWorld();
double x = location.getX() + 0.5D;
double y = location.getY();
double z = location.getZ() + 0.5D;
while (blockIsAboveAir(world, x, y, z)) {
y -= 1.0D;
}
while (blockIsNotSafe(world, x, y, z)) {
y += 1.0D;
if (... |
2f81898f-721b-4d7d-b43d-0de83369ed71 | 5 | @SuppressWarnings({ "unchecked", "unused" })
@ApiMethod(name = "listDeviceInfo")
public CollectionResponse<DeviceInfo> listDeviceInfo(
@Nullable @Named("cursor") String cursorString,
@Nullable @Named("limit") Integer limit) {
EntityManager mgr = null;
Cursor cursor = null;
List<DeviceInfo> execute = null... |
8ad9b217-049a-47ac-8187-4e67c73632f3 | 8 | private static void makeTet4(SquareColor[][] tet) {
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if (((i == 1 || i == 2) && j == 1) || (i == 3 && (j == 0 || j == 1))) {
tet[i][j] = SquareColor.YELLOW;
} else tet [i][j] = null;
... |
0881ff1e-5306-43c7-a4bb-350592146489 | 8 | public void craftingComplex(int screen) {
if (screen == 1) {
clearMenu();
menuLine("10", "Cloth", 3224, 0);
menuLine("21", "Vegetable Sack", 5418, 1);
optionTab("Crafting", "Weaving", "Weaving", "Armour", "Spinning",
"Pottery", "Glass", "Jewellery", "Weaponry", "Milestones",
"", "", "", "", "");... |
57b2759f-6a16-4dff-b07e-088f01e9bab0 | 1 | private URL getUrlFromString(String text) {
try {
return new URL(text);
} catch (MalformedURLException e) {
return null;
}
} |
e4fd53af-733e-4e8a-9d94-c287dfb06872 | 9 | @Override
public void populate(World world, Random random, Chunk chunk) {
int cxx = chunk.getX() << 4;
int czz = chunk.getZ() << 4;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
world.setBiome(x + cxx, z + czz, Biome.PLAINS);
for (int y = 0; y < PlotConfiguration.intPlotHeight + 2; y+... |
195fd11c-b5cc-4b02-bbd3-9e6d880d11a1 | 8 | public Player(Vec2 pos, Vec2 dim) {
super(pos, dim);
textures = new Texture[Animation.values().length][];
textures[Animation.WALKING.ordinal()] = new Texture[8];
for (int i = 0; i < textures[Animation.WALKING.ordinal()].length; i++) {
try {
textures[Animation.WALKING.ordinal()][i] = TextureLoader.getTex... |
8ef7e8f5-0eb1-4808-8a14-aec2424502b5 | 7 | @Test
public void testInitializationFailures() {
PagedRequest.fromStartWithLimit(0);
PagedRequest.fromStartWithPageSize(0);
PagedRequest.ofOffsetAndLimit(0, 0);
PagedRequest.ofPageNumberAndPageSize(1, 0);
try {
PagedRequest.fromStartWithLimit(-1);
... |
e381c297-071b-47d7-8318-237da14622df | 7 | public void equipArmour() {
// Get all available armour
String[] playerItems = player.getInventory().getArmourTexts();
if (playerItems.length == 0) {
log.println("You have nothing to put on.");
} else {
JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));
final JRadioButton[] radioBut... |
49ea5244-6ef1-4291-9295-963cdbde649c | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
43a70c70-39d4-473c-a5bc-2fa5ca88f73e | 5 | public BigDecimal kurtosisExcess_as_BigDecimal() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
BigDecimal kurtosis = BigDecimal.ZERO;
switch (type) {
case 1:
case 12:
BigDecimal[] bd... |
ed9e6f86-b579-4f8a-9fad-19cae5b51271 | 7 | private final void method1571(int i, int[] is, byte i_96_) {
try {
if (i_96_ <= 81)
anInt2805 = -46;
for (int i_97_ = 31; i_97_ > 0; i_97_--) {
int i_98_ = 36 * i_97_;
for (int i_99_ = 35; i_99_ > 0; i_99_--) {
if (is[i_99_ - -i_98_] == 0
&& is[i_99_ + i_98_ - 1 + -36] != 0)
is[i_98_ + i_99... |
2c368360-e831-4906-a3fb-7c996084c8b0 | 8 | public void endElement(String uri, String localName, String qName) throws SAXException {
try {
if ("Title".equals(qName)) {
result.title = buffer.toString();
} else if ("Summary".equals(qName)) {
result.summary = buffer.toString();
... |
f516ca30-2fc4-4369-af71-4b1ecea156b1 | 2 | @Override
protected void onPrivateMessage(String sender, String login, String hostname, String message) {
PrivateMessagingListener listener = getPrivateMessagingListener(sender);
if (listener != null)
listener.privateMessageReceived(message);
else if (serverEventsListener != null... |
df7b5dcd-e904-4f0e-a275-3faba3c68ae4 | 3 | private final Worker getWorker()
{
try
{
return(Worker) pool.pop();
}
catch(EmptyStackException x)
{
int maxThreads = XmlRpc.getMaxThreads();
if (workers < maxThreads)
{
workers += 1;
if (workers ... |
34b4c73d-6fda-4a4d-a0bd-fd5cc10b6da5 | 8 | public boolean checkToolTips() {
boolean result;
Class cls;
BeanInfo info;
PropertyDescriptor[] desc;
int i;
Vector<String> missing;
String suffix;
print("Tool tips...");
result = true;
suffix = "TipText";
cls = getObject().getClass();
// ge... |
5946bf81-aa9b-4e0c-bf15-2a7d15452498 | 9 | public void actionPerformed(ActionEvent e) {
if (e.getSource() == btn_file) {
JFileChooser chooser;
chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("Select Corpus");
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(this)... |
5a90a04a-217c-4a3d-a1b2-3fe363fbe6a2 | 4 | private ArrayList<ArrayList<String>> getProgramCode() {
ArrayList<ArrayList<String>> code = new ArrayList<ArrayList<String>>();
for (int i = 0; i < tblInput.getRowCount(); i++) {
ArrayList<String> line = new ArrayList<String>();
for (int j = 1; j < tblInput.getColumnCount(); j++) {
String value = (String)... |
80e6fb37-9c5c-4a31-b7be-a00e400b05d0 | 5 | public void changeRectanglePos(int rectId, int result[]){
for(Rectangle rectangle: listRectangles){
if(rectangle.getRectId() == rectId){
rectangle.setX(result[0]);
rectangle.setY(result[1]);
rectangle.repaint();
boolean removed= removeCircleIfExists(result[0], result[1]);
if(removed){
... |
9fa78692-f1de-45d3-a9ac-b5e9b72f3ab0 | 6 | @Override
public void actionPerformed(ActionEvent e) {
DBAccess = new DALObject();
String name = "";
do {
name = new DialogBox(frame).getText();
} while (!(name != null && !name.isEmpty() && !name.trim().isEmpty()));
int TabTailleX = obj.getUpdatedTab().g... |
ef37ef04-063a-40fa-9e8d-683e2f9baaec | 8 | public void clear(){
for(int i=0; i<modes; i++){
mode_param[i]=null;
}
mode_param=null;
for(int i=0; i<maps; i++){ // unpack does the range checking
FuncMapping.mapping_P[map_type[i]].free_info(map_param[i]);
}
map_param=null;
for(int i=0; i<times; i++){ // unpack does the rang... |
e77bb194-4007-4054-a32d-902072364802 | 3 | @Test
public void testGetAllTransactionRecordsWithCriteria() {
CardPaymentRequest paymentRequest = getCreditCardPaymentRequest(
getRandomOrderId("TEST_QUERY"), "12.34");
paymentRequest.getCard().setName("Sideshow Bob");
try {
PaymentResponse payment = beanstream.paym... |
eec2efe7-3cd1-4c33-b614-0a2ed74b572a | 7 | private void InserirNovaMateriaPrima() {
//DAODS A GRAVAR
String nomeMateria = jTextFieldNomeMateriaPrima.getText();
String descricaoMateria = jTextAreaDescricaoMateriaPrima.getText();
String unidadeMateria = jTextFieldUnidadeMateriaPrima.getText();
boolean estadoMP = true;
... |
69938365-1af8-4c15-810f-a155687e3bd3 | 1 | private synchronized Double doubleValue() {
if (doubleValue == null) {
doubleValue = number.doubleValue();
}
return doubleValue;
} |
40aee34e-beea-4f0a-a8c7-848e999ba303 | 4 | public static double chiSquareInverseCDF(int nu, double prob) {
if (prob < 0.0 || prob > 1.0) throw new IllegalArgumentException("Entered cdf value, " + prob + ", must lie between 0 and 1 inclusive");
double icdf = 0.0D;
if (prob == 0.0) {
icdf = 0.0;
} else {
if (prob == 1.0) {
icdf = Double.POSITI... |
857beadb-561d-448b-91d4-3009f6e0bb29 | 7 | @Override
public Query parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("UPDATE ");
sB.append(table.replace("#__", this.db.getPrefix()));
sB.append("\n");
sB.append(" SET ");
int s = this.set.size();
for(int i = 0; i < s; ++i) {
... |
b8712cfc-5ebc-4c88-aec8-38e04cd869fa | 1 | public List<Monitor.Use> getUse() {
if (use == null) {
use = new ArrayList<Monitor.Use>();
}
return this.use;
} |
b0dd9982-c86b-4a13-a23d-85333632c995 | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String categoryid = request.getParameter("categoryid");
String pr... |
48262717-8d33-40c4-8f0b-9a332d05b5e6 | 6 | public void loadData(){
String line = null;
try{
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding));
while ((line = in.readLine()) != null){
if (line.equals("StarDict's dict ifo file")){
continue;
}
if (line.contains("=")){
data... |
5bc85616-c306-4f9a-9b00-4195dde2a7cb | 4 | public boolean CheckVert() {
boolean flat = true;
for (int dcnt = 0; dcnt < ninputs; dcnt++) {
flat &= (this.loc[dcnt] == 0.0);
}
//flat &= (pnt.loc[ninputs] != 0.0);
if (flat) {
boolean nop = true;
}
for (int cnt = 0; cnt < ndims; cnt++) {
if (this.loc[... |
60ec48e6-6141-4ff8-b7d0-19f6e3b5f9ab | 7 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(EditStudentPanel.CHOOSE_STUDENT_FOR_EDIT)) {
this.editStudent(((Student)this.getStudentListModel
().getElementAt(this.getStudentList().getSelectedIndex())));
}
else if (e.getActionCommand().equals(EditStudentPanel.SAVE... |
deafba70-7536-4a88-8226-ca1098069ef3 | 6 | @SuppressWarnings("unchecked")
private void refreshGameList() {
try {
sendToServer(Packet.getGameListPacket());
Packet answer = PacketManager.readPacketFromStream(in);
if(answer == null) {
fatalErrorExit("Server co... |
f3bb7c4f-1c2a-4184-ad3d-9fed12f6e97f | 6 | protected void writeDataToNewFile(Collection<?> input) {
File toWrite = null;
BufferedWriter writer = null;
try {
File dir = new File(getEligibleOutputFolder());
if (!dir.exists())
dir.mkdir();
toWrite = new File(dir, getFileToWriteName());
if (!toWrite.exists())
toWrite.createNewFile();
wr... |
74ee2a2e-4a64-496d-b0ea-c6dc387b8887 | 2 | public boolean checkPassword(String entered_password) {
for(int i=1;i<=3;i++)
if( new User().checkPassword(entered_password))
{
return true;
}
return false;
} |
c41ef7b5-3083-45bc-aa73-5f27fd081b7b | 4 | private void checkDefRelAddress() {
// iterate through the moduleList
Iterator<ObjectModule> modListIt = moduleList.iterator();
while (modListIt.hasNext()) {
ObjectModule module = modListIt.next();
int currModuleSize = module.codeCount - 1;
// iterate through the current defList,
Iterator<SymbolP... |
6cd9baf3-e003-4e92-8113-21a1d5be2696 | 8 | public void variableUnassigned(Variable unassignedVar, int oldAssignment) {
//see if the clause is still satisfied.
//if it is, nothing changes
if(isSatisfied()) return;
//make sure the variable is in this clause
if(! variableInClause(unassignedVar)) return;
//check if someone is unit who shouldn't be
c... |
0b5e9b45-85bd-41a2-b254-ba7b6e9a6731 | 4 | public static Color getColor(StockState state) {
if (state.equals(StockState.EARLY)) {
return new Color(0x5d74ff);
}
else if (state.equals(StockState.MINIMUM_OPTIMAL)) {
return new Color(0x3bbb25);
}
else if (state.equals(StockState.OPTIMAL_MAXIMUM)) {
return new Color(0xe7f730);
}
else if (state... |
37ec00e9-745f-4723-aae5-04d15c4ac108 | 9 | public static void alterar_Evento_individual(int opcao2) {
boolean erro = false;
listar();
confirmar_Id();
for (int i = 0; i < list.size(); i++) {
if (list.get(i).getEvento_ID() == opcao) {
if (opcao2 == 1) {
System.out.println("Evento ID:... |
aadd3615-1fc3-44d7-8899-7cf301df8ebf | 7 | public ArrayList<Move> getPossibleMoves()
{
ArrayList<Move> possibleMoves = new ArrayList<Move>();
int orientation = getLoyalty() == Loyalty.RED ? 1 : -1;
for(int i = - 1; i <= 1; i += 2)
{
Location currentLoc = new Location(getLoc().getRow() + orientation, getLoc().getCol() + i);
if(getBoard()... |
d3c2e439-0a68-4bbd-a806-a2e40fbf762a | 5 | public void move(ArrayList<Coordinate> validPaths) {
boolean catMoved = false;
int index = 0;
Coordinate nextCoordinate;
// shuffling the path
java.util.Collections.shuffle(validPaths);
nextCoordinate = validPaths.get(index);
// if only one path is available then move to that coordinate
if(validPath... |
1508d21f-c152-43f5-9560-e02ad4200448 | 4 | private Position getSubImagePosition() {
Position position = new Position();
switch (currentType) {
case LIGHT_STONE:
position.x = 0;
break;
case GREEN_STONE:
position.x = 93;
break;
case GREY_STONE:
... |
b0fb1d7f-4c05-4041-8328-0ba1d7b61407 | 9 | private static void bump(ArrayList<ArrayList<Integer>> rows, int w) {
if (rows.size() == 0) {
rows.add(new ArrayList<Integer>());
rows.get(0).add(w);
return;
}
for (ArrayList<Integer> row : rows) {
int i = 0;
while (i < row.size() && ro... |
435725e4-adf8-46a2-9328-109eea53727f | 5 | public void dumpMeals() {
SimpleMealDaoImpl dao = getSimpleMealDaoImpl();
List<SimpleMeal> result = new ArrayList<>();
Session session = null;
Transaction tx = null;
try {
session = HbUtil.getSession();
//TRANSACTION START
tx = session.beginTr... |
f45b7d5f-51c8-4d28-a0f7-ae3fd6454fcd | 0 | public FileDownloadItem[] getFileDownloadItems(){
return (FileDownloadItem[]) items.toArray();
} |
00ca9c4f-f4ab-4b6d-b413-86defb3a2534 | 1 | private static String getFileContents(String filename)
throws IOException, FileNotFoundException
{
File file = new File(filename);
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = ... |
19cda33f-42a5-4094-9023-aba2bb263d24 | 3 | @Override
public int subscribe(String nick, String firstName, String lastName, String password, String email) {
Player p = new Player(firstName, lastName, nick, password, email, 0);
//Si le joueur "ordinateur" n'existe pas dans la base
if (em.find(Player.class, "computer") == null) ... |
8adb56a1-d8d1-445b-ae19-de8a3178a27b | 3 | public Set<Map.Entry<K, V>> entrySet() {
Set<Map.Entry<K, CachedValue<V>>> entrySet = cache.entrySet();
List<K> expiredKeys = new ArrayList<K>(128);
Set<Map.Entry<K, V>> result = new HashSet<Map.Entry<K,V>>(entrySet.size());
for (Map.Entry<K, CachedValue<V>> entry : entrySet) {
CachedValue<V> cach... |
b024ee5b-fe01-42b5-90a3-b12fc91df6d5 | 7 | public static void crearCliente(HashMap<Integer, Clientes> tablaClientes)
{
String nombre;
String apellidos;
String dni;
int edad = 0;
boolean edadCorrecta = false;
boolean dniCorrecto = true;
Scanner entrada = null;
do // Validacion nombre
{
entrada = new Scanner(System.in);
System.out.p... |
1750c045-b380-4bb3-83a5-392c647c7c1c | 0 | @Override
public void closeDoors() {
System.out.println("closeDoors");
} |
b28e3f30-308d-4ecb-9106-d5c9b147e2f0 | 4 | public void mouseClicked(MouseEvent me)
{
xpos=me.getX();
ypos=me.getY();
if(xpos>rectlxco && xpos<rectlxco+rectlwidth && ypos>rectlyco&&
ypos<rectlyco+rectlheight) rectlclicked=true;
else
rectlclicked=false;
repaint();
} |
507845b1-a5d0-4db3-a6ae-3f28e1896b9a | 0 | public static String escapeXMLAttribute(String text) {
text = StringTools.replace(text, "&", "&");
text = StringTools.replace(text, "<", "<");
text = StringTools.replace(text, "\"", """);
return text;
} |
c635f620-b3ca-4d73-b617-f298c1f41d6c | 3 | public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
if (context.containsBean("quarantinedDataSource")) {
LOG.info("Using quarantinedDataSource");
} else {
LOG.info("Using normal dataSource");
}
EventService service = context.getBean(E... |
456dc77e-f80f-4889-b0fb-30f8d9bbef60 | 2 | public static void ChooseJason ()
{
if (Game.characterChoice == 1)
{
Game.CharacterOne = "Jason";
Game.CharacterOneHP = CharacterStats.JasonHP;
Game.CharacterOneAttack = CharacterStats.JasonAttack;
Game.CharacterOneMana = CharacterStats.JasonMana;
Game.CharacterOneRegen = CharacterStats.J... |
213c9d2b-2d81-46fc-b33b-d216a554f189 | 4 | private void expand2(byte[] src, byte[] dst) {
for(int i=1,n=dst.length ; i<n ; i+=4) {
int val = src[1 + (i >> 2)] & 255;
switch(n-i) {
default: dst[i+3] = (byte)((val ) & 3);
case 3: dst[i+2] = (byte)((val >> 2) & 3);
case 2: dst[i+... |
3eb7c1db-d281-4982-a989-616be894b51c | 8 | @Override
public void recordRoll(int pinsKnockedDown)
{
assert 0 <= pinsKnockedDown : "pinsKnockedDown = " + pinsKnockedDown + " < 0!";
assert pinsKnockedDown <= 10 : "pinsKnockedDown = " + pinsKnockedDown + " > 10!";
assert (getCurrentBall() == 1) || ((getCurrentBall() == 2) && (((getCurrentFrame() == 10) && ... |
158bc1c5-6a7c-40bf-bf5d-38541a6c43eb | 0 | public TruncateHelper setCompressWhiteSpace(boolean compressWhiteSpace)
{
this._compressWhiteSpace = compressWhiteSpace;
return this;
} |
ce6d93b1-f219-420c-9eb5-3c8bb6c58e17 | 9 | private Command parse(String userInput) {
if (userInput == null) {
return null;
}
StringTokenizer tokenizer = new StringTokenizer(userInput);
if (tokenizer.countTokens() == 0) {
return null;
}
CommandName commandName = null;
String userName = null;
String sellerName = null;
float amount = 0;
... |
c0214bfc-8c3a-4c66-9b93-eddeebd30a04 | 8 | public void run() {
boolean test = false;
if (test || m_test) {
System.out.println("Timer :: run() BEGIN");
}
while (m_running) {
secondInterval();
++m_seconds;
if (m_seconds >= MINUTE) {
++m_minutes;
m_seconds = 0;
}
if (m_minutes >= HOUR) {
++m_hours;
m_min... |
48ba3dbf-f0bc-4fc2-bfec-4b1e82463c3b | 9 | public double getPesoLlaveEntera(int llave){
double peso = 0;
switch (llave) {
case 0:
peso = this.getPeso(THRESHOLD);
break;
case 1:
peso = this.getPeso(EMBARAZOS);
break;
case 2:
peso = this.getPeso(CONCENTRACION_GLUCOSA);
break;
case 3:
peso = this.getPeso(PRESION_ARTER... |
86eccbb0-5b7b-45a9-b86d-e66ad087bbf0 | 3 | @Override
public Seat getResearvedSeat(Passenger passenger) {
for (int i = 0; i < passengerList.size(); i++) {
List<Passenger> _rowIteretor = passengerList.get(i);
for (int j = 0; j < _rowIteretor.size(); j++) {
Passenger _passenger = _rowIteretor.get(j);
... |
8451f537-d0d4-4ac1-9d5b-fefcea65b914 | 2 | public void popup(MouseEvent e){
if (e.isPopupTrigger()) {
if (e.isPopupTrigger()) {
MainRightClickMenu.pop.show(e.getComponent(), e.getX(), e.getY());
MainRightClickMenu.eBox = e;
}
}
} |
d4d590cd-0a51-47d0-8958-0d2ceda2d39e | 2 | public int getCountContainKeyWord(String key,String classFile,
Map<Integer, Map<String, Double>> classMap) {
int ret = 0;
Set<Integer> fileList = classMap.keySet();
for (int file : fileList) {
Map<String, Double> map = classMap.get(file);
if (map.containsKey(key)) {
ret++;
}
}
return ret;
} |
4ae8d54f-f9c3-421b-a7fd-8dd6c14aae07 | 5 | public static double[][] stringToRange(String rangeStr) {
Matcher rangeMatcher = rangePattern.matcher(rangeStr);
List<String> rangeStrs = new ArrayList<String>();
while (rangeMatcher.find()) {
rangeStrs.add(rangeMatcher.group());
}
if (rangeStrs.size() == 0) {
... |
822384a2-b640-48e3-8201-e27591ed8829 | 6 | public Complex mean_as_Complex() {
Complex mean = Complex.zero();
switch (type) {
case 1:
double[] dd = this.getArray_as_double();
double meand = 0.0D;
for (int i = 0; i < length; i++)
meand += dd[i];
meand /= length;
mean = new Complex(meand);
break;
case 12:
BigDecimal[] bd = this.get... |
34bd2486-ed8f-4211-86fc-180fd0cf3d89 | 2 | public void setProtected(final boolean flag) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
int modifiers = fieldInfo.modifiers();
if (flag) {
modifiers |= Modifiers.PROTECTED;
} else {
modifi... |
ec1d80b2-840a-4af0-8378-7ca7696276da | 5 | public String getServerStatus() throws SQLException {
for(int i = 0; i < values.length; i++) {
keyWords.put(keys[i], values[i]);
}
DatabaseMetaData metadata = conn.getMetaData();
serverStatusString = ""; // clear string
serverStatusString += "-----------------------Server status-----------------------\n";
... |
09f67e16-04ea-481f-90ab-147ec3586538 | 4 | @Test
public void testSetDisplayAnswer3() {
int diff = 1;
answers = new LinkedList<Answer>();
answers.add(new Answer("are roses,"));
answers.add(new Answer("moses supposes"));
answers.add(new Answer("irronically"));
dummyQuestion = new Question(question, answers, diff, type, correct);
try {
dummyQue... |
a7b7197a-aacd-4501-b801-ae21383558fd | 6 | @SuppressWarnings("unchecked")
public void reload(){
loadYamlFiles(true);
poisonDuration = config.getInt(Util.concatStrings(Constants.ABILITIES_DATA, ".", Constants.POISON_DURATION));
disorientDuration = config.getInt(Util.concatStrings(Constants.ABILITIES_DATA, ".", Constants.DISORIENT_DURATION));
instance.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.