method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
e7538392-9cd0-4134-9c51-7a28caf5117c | 1 | boolean isMultiple(long n, long m){
try {
result=n/m;
Integer.parseInt(new String(""+result));
} catch (Exception e) {
return false;
}
return true;
} |
6b0f0157-9497-4174-be70-0b29655ddd5f | 7 | protected void configFromAdjacent(boolean[] near, int numNear) {
final Tile o = origin() ;
entrances = null ;
if (numNear == 2) {
type = TYPE_SECTION ;
if (near[N] && near[S]) {
facing = Y_AXIS ;
if (o.y % 8 == 0) {
type = TYPE_TOWER ;
attachModel(TOWER_MODEL_... |
b0f7e03e-e964-4f14-904c-e0340f85e949 | 5 | private File findNextFile() throws SQLException, IOException {
String logFullName = CdDao.findCurrentLogFileName();
String curFileName = new File(logFullName).getName();
File indexFile = findIndexLogfile();
BufferedReader indexReader = new BufferedReader(new FileReader(indexFile));
... |
71f958a4-67ef-47d6-90c9-69b6c1bf1d1f | 6 | public void makeBiLevelWithThreshold()
{
makeGrayScale();
int colorCount = 0;
int[] rgb = new int[3];
for(int y = 0; y < height; y++)
{
for(int x = 0; x < width; x++)
{
getPixel(x, y, rgb);
colorCount += rgb[0];
}
}
int average = colorCount / (width * height);
for(int y = 0; y < ... |
e352f5df-aa98-430f-8a39-865d2769ece6 | 1 | @Override
public int hashCode() {
return id != null ? id.hashCode() : 0;
} |
28f76384-044e-490b-bfad-54fedda1387e | 9 | public static void main(String[] args) {
/**
*
*/
ArrayList<Oak> list3 = new ArrayList<Oak>();
/**
*
*/
Oak object = new Oak();
while (true) {
/**
*
*/
WorkWithOak.getMenu();
/**
*
*/
Scanner scan = new Scanner(System.in);
System.out.println("Input menu");
... |
7d345c1b-d919-4455-9b99-e05a65f1bd8b | 3 | public void reserveTicket(Ticket ticket) {
if (ticket == null) {
throw new CashOfficeManipulationException("Cannot reserve NULL ticket");
}
if (ticket.getStatus() != TicketStatus.ENABLE) {
throw new CashOfficeManipulationException("Cannot reserve ticket with status != ENABLE");
}
ticket.... |
0e621f2a-8959-44bd-9f18-660986a11d72 | 2 | @Override
public void visitCallStaticExpr(ClassNode c, MethodNode m, CallStaticExpr expr) {
for (CallGraph graph : CallGraphBuilder.GRAPHS.keySet()) {
CallGraph other = CallGraphBuilder.GRAPHS.get(graph);
if (other.method().name() == expr.method().name()) {
System.out.println("cse "+other.method().name(... |
96f55b0e-2e5d-4d71-a880-b8ad0bc0a628 | 0 | @Override
public void shuffle() {
} |
47fd0b0f-b420-41fb-8d93-f93526745637 | 6 | private String extractFromResString(QueryResponse r, int idx) {
switch(idx) {
case 0:
return r.getServerName();
case 1:
return r.getModification();
case 2:
return r.hasPassword() ? "yes" : "no";
case 3:
return "" + r.getMaxPlayer();
case 4:
return r.getServerAddress();
}
return null... |
0bfbf3c2-93f8-4674-bb1e-7d003af70716 | 8 | public ListNode mergeKLists(ArrayList<ListNode> lists) {
if (lists == null || lists.size() == 0) {
return null;
}
if (lists.size() == 1) {
return lists.get(0);
}
ListNode head = new ListNode(0);
ListNode result = head;
while (true) {
... |
8ff12768-c576-4046-a45a-1481411f13a0 | 9 | private boolean doesTouchInternal(Polyline other) {
for (int i = 0; i < nbSegments(); i++) {
final LineSegmentInt seg1 = segments().get(i);
for (int j = 0; j < other.nbSegments(); j++) {
final LineSegmentInt seg2 = other.segments().get(j);
final boolean ignoreExtremities = i == 0 || i == nbSegments() - ... |
ba5af421-af5b-42d0-80b9-6490c9cd7d42 | 3 | private boolean parse() throws ParseException {
if (schema.length() == 0 && args.length == 0)
return true;
parseSchema();
try {
parseArguments();
} catch (ArgsException e) {
}
return valid;
} |
9a4aac49-0512-4fce-8975-0038769340f7 | 2 | public double[] standardizedPersonMaxima(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedPersonMaxima;
} |
61447e71-74d4-46bd-a268-4942fd28995b | 8 | public static ArrayList<Object> getData(String s){
selectReader(s);
ArrayList<Object> data = new ArrayList<Object>();
ArrayList<String>info = new ArrayList<String>(); //holds all the information for a specific workshop line
while(input.hasNextLine()){
info = new ArrayList<String>(); //clears the arraylist a... |
eccacb55-380b-460e-886b-912db74acd03 | 7 | private void setPlayerShips(String playerName) {
Scanner input = new Scanner(System.in);
int iLocation = 0;
int jLocation = 0;
Location locationObject = new Location();
String[][] listOfSpots = locationObject.makeStringListOfSpots();
System.out.println(playerName + ", e... |
5111fc33-5232-4d01-94a9-31db44503aa9 | 8 | @Override
public int posicionFichaX(int ficha, int torre) {
int k = (torre - 1) * 200;
switch (ficha) {
case 1:
return 110 + k;
case 2:
return 100 + k;
case 3:
return 90 + k;
case 4:
retu... |
c2c5c8e7-7457-4113-9435-b09c1f5a9761 | 2 | public static JSONArray listById(long[] aId) {
JSONArray ja = new JSONArray();
for(long l:aId) {
User user = User.findById(l);
if(user != null) ja.put(user.toJson());
}
return ja;
} |
d18e4519-3937-4cc0-865f-9772fec1524a | 0 | @Override
@Transactional
public <T extends PersistentObject> T delete(Class<T> entityClass, Long id) {
T entity = read(entityClass, id);
em.remove(entity);
return entity;
} |
f0eeda25-7aa0-4d7b-a301-9c040febe0b5 | 9 | @Override
public void flavorsChanged(FlavorEvent e) {
Transferable tf = null;
try {
tf = clip.getContents(null);
}
catch (IllegalStateException illStateEx) {
return;
}
String copyString = null;
if ( tf.isDataFlavorSupported(DataFlavor.stringFlavor) && this.opt.isEnabled() ) {
t... |
0fdefc03-b167-492e-8d01-0b7b8cc40e6f | 0 | public String toString() {
return "[Item object: id=" + this.id + " name="+ this.itemName + " desc=" + this.desc + " obtained=" + this.obtained + " cost=" + this.cost + "]";
} |
0ba86d68-c77d-40c5-adb1-5dc26b8d07b8 | 0 | public byte[] getBuffer() {
return buf;
} |
7c7efe85-3a36-4c7b-8c56-4f21fa66ba8f | 9 | public static Stella_Object lookupVariableInBindings(Stella_Object obj1, Stella_Object obj2, List bindings) {
{ Cons bind = null;
Cons iter000 = bindings.theConsList;
for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
bind = ((Cons)(iter000.value));
if (Stella_Object.equalConsTre... |
19dad647-9b0a-4c1a-96b3-a3985e6235d7 | 7 | public static int[][] diff(double[][] image1, double[][] image2) {
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
int[][] diffImage = new int[image1.length][image1[0].length];
for (int i = 0; i < image1.length; i++) {
for (int j = 0; j < image1[i].length; j++) {
diffImage[i][j] = (int) (image1... |
fed06238-3b9e-4146-869f-fa770c15c9b9 | 9 | @Override
public void bumped(Entity e) {
if (e instanceof Chest) {
Chest c = (Chest) e;
c.takeDamage(1, this);
addStatus("You opened a chest");
if (c.items().isEmpty()) {
addStatus("It was empty");
}
for (Pickup p : c.it... |
2fe9f5c1-de42-4e51-b71c-fdcb22bb438c | 5 | public List<FsNode> getNodesFilteredAndSorted(String searchkey,String sortkey,String direction) {
List<FsNode> cresult = QueryCache.get(searchkey+sortkey+direction);
if (cresult!=null) return cresult;
ArrayList<FSSortNode> result = new ArrayList<FSSortNode>();
List<String> searchkeys = smartSplit(searchkey);... |
94fc5649-c0a7-4db3-8606-7d95b907646f | 1 | public static void main(String[] args) {
// TreeNode root = BuildTree.buildTree();
TreeNode root = new TreeNode(1);
List<List<Integer>> result = new Binary_Tree_Zigzag_Level_Order_Traversal().zigzagLevelOrder(root);
for (int i=0; i< result.size();i++ ) {
System.out.println(... |
d49253ae-6141-44e4-8ffb-a72e81c1e95e | 8 | int dominates(Genome g1, Genome g2)
{
if ((g1.Ereturn > g2.Ereturn) && (g1.Risk <= g2.Risk))
return 1;
if ((g1.Ereturn >= g2.Ereturn) && (g1.Risk < g2.Risk))
return 1;
if ((g1.Ereturn < g2.Ereturn) && (g1.Risk >= g2.Risk))
return -1;
if ((g1.Ereturn <= g2.Ereturn) && (g1.Risk > g2.Risk))
return -1;... |
76b959b6-2498-466f-b226-c63a0b4cca8b | 0 | public String getName() {
return name;
} |
63fad203-3747-4732-9166-1e20732701e6 | 4 | public static String substringAfterLast(String sourceStr, String expr) {
if (isEmpty(sourceStr) || expr == null) {
return sourceStr;
}
if (expr.length() == 0) {
return sourceStr;
}
int pos = sourceStr.lastIndexOf(expr);
if (pos == -1) {
return sourceStr;
}
return sourceStr.substring(pos + expr... |
a0d647d1-fae6-47a0-bad6-bae8112eb3dc | 9 | @SuppressWarnings("deprecation")
private void processDictionaryRequest(OMMSolicitedItemEvent event)
{
OMMMsg msg = event.getMsg();
String name = "";
OMMItemCmd cmd = new OMMItemCmd();
OMMEncoder enc = _providerDemo._pool.acquireEncoder();
enc.initialize(OMMTypes.MSG, 160... |
ceff4228-c13e-43f7-a0c0-b43db4ecd5f8 | 7 | public void changeDirection(boolean turnLeft){
if (direction == UP){
velocityX = velocityY;
velocityY = 0;
if (turnLeft){
direction = LEFT;
}
else{
velocityX = -velocityX;
direction = RIGHT;
}
}
else if (direction == DOWN){
velocityX = velocityY;
velocityY = 0;
... |
155c949a-c70b-4c1e-b6c4-f95688178df2 | 1 | private void initializeHoles() {
for(int i = 0; i < 500; i++) {
model.addHole(getRandomLocationOnGrid(GameModel.GROUND_LEVEL + 25));
}
} |
8f87be2f-146f-48c5-bce7-07f2c3f475e6 | 9 | public static boolean saveTreeNetworkTest(){
//!!! TEST WILL FAIL IF EQUALS COMPARES TREE IDs!!!
int portTemp=TaskClientNetDriver.SERVER_PORT;
InetAddress tempAddress=TaskClientNetDriver.SERVER_ADDRESS;
TaskClientNetDriver.SERVER_PORT=TEST_PORT;
try {TaskClientNetDriver.SERVER_AD... |
37511a51-8913-4e3b-b5b8-59cc33de145a | 1 | public void put(JSONObject sample) throws InterruptedException {
lock.lock();
try {
samples.add(sample);
if (samples.size() >= batchSize) {
lessThenBatchSizeCondition.signal();
}
} finally {
lock.unlock();
}
} |
f5193669-8aba-4658-b9b6-492833d32775 | 8 | final public void Class_function_declaration() throws ParseException {
/*@bgen(jjtree) Class_function_declaration */
SimpleNode jjtn000 = new SimpleNode(JJTCLASS_FUNCTION_DECLARATION);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1))... |
517b38f5-7a94-4358-9cda-6c0162d1f2e2 | 8 | public boolean run(PlommerKits k, CommandSender sender, String cmd, String[] preArgs) {
this.plugin = k;
this.sender = sender;
this.usedCmd = cmd;
args.clear();
for(String arg : preArgs) {
args.add(arg);
}
for (int i = 0; i < name.split(" ").length && i < args.size(); i++) {
... |
81fa78b5-a9a3-4476-b020-6026a24689f7 | 4 | public JSONObject toJSONObject(JSONArray names) throws JSONException {
if (names == null || names.length() == 0 || this.length() == 0) {
return null;
}
JSONObject jo = new JSONObject();
for (int i = 0; i < names.length(); i += 1) {
jo.put(names.getString(i), this.... |
30cd06aa-a150-4576-9958-629294b39350 | 2 | boolean hasPixels( ImageObserver obs ) {
return fImage != null && fImage.getHeight(obs)>0
&& fImage.getWidth(obs)>0;
} |
0dfe9ad5-2359-4453-bd5d-4970ba1f40a2 | 7 | @Override
public boolean equals(Object o) {
if (o == null) {
return false;
} else if (!(o instanceof PlayerStats)) {
return false;
}
PlayerStats s = (PlayerStats) o;
if (s.getName().equalsIgnoreCase(name) && s.getWins() == wins && s.getLosses() == loss... |
84384a90-9e75-43bd-ba27-ee132ffbdd7c | 1 | public JSONArray optJSONArray(String key) {
Object o = this.opt(key);
return o instanceof JSONArray ? (JSONArray) o : null;
} |
9f9d92bf-5d48-4597-90e2-922e847d82de | 4 | public Direction getOppositeDirection()
{
switch(this)
{
case NORTH:
return SOUTH;
case SOUTH:
return NORTH;
case WEST:
return EAST;
case EAST:
return WEST;
default:
return this;
}
} |
15b1d4da-0a04-4ef1-bafc-bd32e629ad28 | 3 | private void fillCountries(List<Country> countries, AbstractDao dao, Criteria criteria) throws DaoException {
if (countries != null) {
Short cityStatus = (Short) criteria.getParam(DAO_CITY_STATUS);
for (Country country : countries) {
Criteria descCrit = new Criteria();
... |
51883fdc-3d0f-4bc9-b7c0-73b94ee3ea43 | 5 | private ArrayList<AlgebraicParticle> children(Algebra a) {
if(a instanceof Equation) return list(((Equation)a).left(), ((Equation)a).right());
if(a instanceof AlgebraicCollection) return ((AlgebraicCollection)a).toList();
if(a instanceof Fraction) return list(((Fraction)a).getTop(), ((Fraction)a).getBottom());
... |
360c3ea1-8053-4ef3-a482-5ade6a77f5cb | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> alread... |
18c5af0e-142d-4b41-b2bd-9e2a074dddc2 | 9 | public EndMenu(final Fanorona f, final boolean timeOut) {
setTitle("End Game Menu");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
... |
f5dd66b6-a9ff-4cf5-92e1-bebe981192bd | 7 | public boolean findpath(int row, int collumn) {
//in this method recursing over all possible directions after a given square
boolean done = false;
if (valid(row, collumn)) {
grid[row][collumn] = 9; //visited
if (row == endrow && collumn == endcol)
done = true;
else {
done = (findpath(row, collumn... |
73b8cdbd-5a41-4799-b672-05522fcbdada | 2 | public V checkBaseClasses(Class c) {
for (Class base = c.getSuperclass(); base != Object.class; base = base.getSuperclass()) {
V val = lookup.valAt(base);
if (val != null) return val;
}
return null;
} |
767efad2-b9bb-4d13-8502-6eb331e98795 | 5 | @SuppressWarnings("deprecation")
public static void readRAF(Homework_database data) throws IOException
{
String fileName = "/Users/Abhi/Desktop/Database";
/* try
{
DataInputStream instr =
new DataInputStream(
new BufferedInputStream(
new FileInputSt... |
85a38bc3-2cf7-45b0-ad7f-dfd1a0e27d4c | 4 | public boolean criarFantasma(int n)
{
Query q2;
switch(n){
case 0:
q2 = new Query("criarBlinky");
return q2.hasSolution();
case 1:
q2 = new Query("criarClyde");
return q2.hasSolution();
case ... |
8f7bb049-3176-471a-9686-ff2e348d8f57 | 8 | private boolean gameWon() {
int scoreDiff = getScoreDifference();
int totalScore = getTotalScore();
if (gameHasReachedLimit()) {
winner = "Draw";
return true;
}
if (scoreDiff == 4 && totalScore == 4) {
winner = "Player One";
return true;
}
if (scoreDiff == -4 && totalScore == 4) {
winner... |
9ec93090-0866-437f-8171-e98aa8855a07 | 7 | public void setTitles( String range )
{
Name name = sheet.getName( "Built-in: PRINT_TITLES" );
if( name == null )
{
try
{
name = new Name( sheet.getWorkBook(), "Print_Titles" );
name.setBuiltIn( (byte) 0x07 ); //do before setNewScope as it blows out itab
name.setNewScope( sheet.getSheetNum()... |
6794cdc9-05c5-499e-95fb-d97b6a4c48e9 | 1 | public static boolean getMouseUp(int mouseButton)
{
return !getMouse(mouseButton) && lastMouse[mouseButton];
} |
aa02a74d-82c7-4cb6-9677-e462c249a0fe | 5 | @Override
public final boolean equals(final Object object) {
if (object == this) return true;
if (!(object instanceof INIToken)) return false;
final INIToken that = (INIToken)object;
return Objects.equals(this.key(), that.key()) && Objects.equals(this.value(), that.value()) && //
Objects.equals(this.section... |
5ce2171d-08b8-4401-9d7b-36380a06e92d | 2 | public void close() {
try {
logger.close();
} catch (Exception exc) {
// nothing
}
try {
this.finalize();
} catch (Throwable thr) {
thr.printStackTrace();
}
} |
46a5715a-4881-43e4-9b6b-2ff29456ca6d | 2 | @Override
public void handlePeerDisconnected(SharingPeer peer) {
if (this.connected.remove(peer.hasPeerId()
? peer.getHexPeerId()
: peer.getHostIdentifier()) != null) {
logger.debug("Peer " + peer + " disconnected, [" +
this.connected.size() + "/" +
this.peers.size() + "].");
}
peer.reset... |
9d3a968b-c33d-4b57-9ad1-040bff378771 | 0 | public int getG() {
return g;
} |
22ca5099-cdbb-40ed-8ad2-56db861a1edd | 4 | public static Completable getTabCompleter(Class<?> c) {
if (c.isAssignableFrom(Completable.class)) {
if (tabCompleters.containsKey(c))
return tabCompleters.get(c);
try {
return (Completable) c.newInstance();
}
catch (IllegalAccess... |
fd5c9f38-7254-499d-b043-3de02842bb2e | 4 | protected void applyFunction(SynthetizationType synthesizationType) {
List<Mask> masks = new ArrayList<Mask>();
if (horizontal) {
masks.add(getMask(HORIZONTAL));
}
if (vertical) {
masks.add(getMask(VERTICAL));
}
if (diagonal) {
masks.add(getMask(DIAGONAL));
}
if (inverseDiagonal) {
masks.add... |
0fe9791e-545e-4ae1-afc4-3f7cbac85fc8 | 0 | public int getFirstID() {
return first_land.getID();
} |
c75ef446-8b01-4539-9515-8201beb6e72c | 5 | public static String getFileNameFromPath(String path) {
if (path == null || (path.indexOf("/") == -1 && path.indexOf("\\") == -1)) {
return null;
}
if (path.indexOf("/") != -1) {
return path.substring(path.lastIndexOf("/") + 1);
}
if (path.indexOf("\\") != -1) {
return path.substring(path.lastIndexOf... |
dc8ba078-a345-448d-b3f9-519b08518b14 | 2 | public ArrayList<String> getBuddies(String user){
ArrayList<String> buddies= new ArrayList<String>();
Statement st;
ResultSet rs;
String query;
try {
st = conn.createStatement();
query="SELECT t.friend1 FROM"
+" (SELECT * FROM friends f where f.friend1='"+user+"' OR f.friend2 = '"+user+"')t"
... |
59b0eb39-396d-4f76-8412-48efeb95c9d4 | 1 | @Override
public void undo(UndoQueueEvent e) {
if (e.getDocument() == Outliner.documents.getMostRecentDocumentTouched()) {
calculateEnabledState(e.getDocument());
}
} |
74fa5d21-0142-4c25-9dbc-d67a74cc5b74 | 1 | @Before
public void setUp() {
try
{
clientProxy = AqWsFactory.newAqPubClient(TestContext.PublishServiceUrl, TestContext.User, TestContext.Pwd);
}
catch(Exception ex)
{
fail("setUp failed...");
}
} |
74b8a839-c254-4463-bd69-8ed6c95aa53c | 6 | public String elegirArchivoSalida(String directorioDef, String nombreArchivo){
File f = new File(directorioDef);
String ruta = f.getParent();
try{
if (f != null && !f.exists() && f.getParentFile().isDirectory()
&& f.getParentFile().exists()){
ruta = f.getParent();
}
}catch (NullPointerException ... |
cb9b281e-a403-427c-bf65-d25d263a599d | 0 | private long getTimeToTodayInSeconds() {
return new Date().getTime() / 1000;
} |
ef0fe9b5-2a2f-43d6-bd80-a909d8132e19 | 8 | public int insertReservation(Reservation res) throws UnauthorizedUserException, DoubleEntryException, BadConnectionException {
PreparedStatement pStmnt = null;
double rPrice = 0.00;
double dRate = 0.00;
// get the rental price
try {
// get the rental price
... |
ed01d285-de34-4075-9b1d-f6c6d4ec36ea | 6 | public TcpSocket accept() {
SocketChannel newSock = null;
// Accept an incoming connection
try {
if (selector.select(0) > 0) {
Set<SelectionKey> keys = selector.selectedKeys();
Iterator<SelectionKey> iter = keys.iterator();
while (iter.hasNext()) {
SelectionKey key =... |
d23619b7-2878-4b20-bcbe-a6633e4c867c | 1 | @Override
public void run() {
Random rand = new Random();
if (rand.nextBoolean()) {
load();
} else {
unload();
}
} |
5cd09000-248c-4916-bec2-f080145a59aa | 9 | private String getDelete() {
if (rdbtnmntmArea.isSelected()) {
return "DELETE FROM AREA a WHERE a.ID = " + textArea1.getText()
+ " AND a.NAME = '" + textArea2.getText()
+ "' AND a.TYPE = '" + textArea3.getText() + "'";
}
if (rdbtnmntmArtist.isSelected()) {
return "DELETE FROM ARTIST a WHERE a.ID ... |
05f9bef2-373e-4f03-9bdf-5cf001649413 | 3 | public boolean withdrawResponseBipolar(BipolarQuestion bipolarQuestion) {
boolean flag = false;
Element bipolarQuestionE = (Element) document
.selectSingleNode("//responseToBipolar[@id='" + bipolarQuestion.getId() + "']");
if (bipolarQuestionE != null) {
bipolarQuestionE.element("dialogState").setText(bipo... |
e8e0354a-22d7-489c-9bef-0e49e2dde290 | 7 | @EventHandler
public void WitherStrength(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Streng... |
6c727853-a232-4ed4-99c5-1c713f42622b | 1 | private void setUpVisibleRowOfCards(Card[][] cards) {
for(int j = 0; j < NUMBER_OF_COLS; j++){
cards[0][j].setIsFaceUp(true);
cards[0][j].setActive(true);
}
} |
68443feb-1bd8-41d7-9fcf-52bd749fba6e | 6 | private char getBaseLetter(boolean bit0, boolean bit1) {
// T - 00, C - 01, A - 10, G - 11.
if(!bit0 && !bit1)
return 't';
else if(!bit0 && bit1)
return 'c';
else if(bit0 && !bit1)
return 'a';
else
return 'g';
} |
f3dc34da-3113-4fe1-9270-69fa404246e3 | 4 | public final synchronized void update(int paramInt) {
if (!this.init || (this.progress < 0)) {
return;
}
if (paramInt < 0) {
this.max -= paramInt;
this.gui.setProgressSize(this.max);
update(-paramInt);
return;
}
this.gui.setProgress(this.progress += paramInt);
if (this.max > 0) {
final int... |
3b3fcec4-bf46-49f9-af87-f14a37613200 | 8 | public void substituteValues(Node a)
{
if( a.child.size() == 0 )
{
if(a.isConstant()) //you dont need to put values in constants
return;
for(int i = 0; i<leafNodes.size(); i++)
{
if( leafNodes.get(i).equals(a.data) )
{
a.data = matches.get(i).data;
a.child = matches.get(i).child; /... |
d3cc55f1-a67e-40c2-9a0d-9128d28dbff7 | 4 | public ResultSet executeReadQuery(String sqlStatement) {
ResultSet rs = null;
try {
Class.forName(this.sqlDriver);
Connection con = DriverManager.getConnection(this.sqlURL, this.sqlUser, this.sqlPassword);
Statement stmt = con.createStatement();
System.out.println("fetchSQL: " + sqlStatement);
rs = stm... |
dd0e2b8e-0bed-4943-90aa-40a85cafe64f | 3 | public boolean equals(Object object) {
if (!(object instanceof Vector2i)) return false;
Vector2i vec = (Vector2i) object;
if (vec.getX() == this.getX() && vec.getY() == this.getY()) return true;
return false;
} |
e486ca06-25cb-4bf4-be92-ec7ebd8da4d7 | 6 | private void drawAlphaCharacter(byte pixels[], int x, int y, int alpha, int k, int i1, int j1) {
int offset = x + y * RSDrawingArea.width;
int l1 = RSDrawingArea.width - k;
int i2 = 0;
int j2 = 0;
if (y < RSDrawingArea.startY) {
int k2 = RSDrawingArea.startY - y;
i1 -= k2;
y = RSDrawingArea.startY;
... |
cedd6e62-48f9-45fc-a032-05534b6f9cfb | 0 | public String getDeviceBinding() {
return deviceBinding;
} |
442b3549-899e-4cbe-a479-934d49a942aa | 0 | public String allGens() {
return this.population.toString();
} |
8cd1b331-ee0a-410f-bf1f-3794dc0c08ad | 4 | @SuppressWarnings("deprecation")
public static void loadMatch(Match match){
File mapFolder = match.getMap().getMapFolder();
File dest = null;
try {
dest = new File(Bukkit.getWorldContainer().getCanonicalPath(), mapFolder.getName());
} catch (IOException e1) {
e1.printStackTrace();
}
World worldToPlay... |
d956117a-f003-4271-81c5-2fdf9019ffbe | 5 | private long removeRefContactAcct(long lIndex) {
//
// loop through the elements in the actual container, in order to find the one
// at lIndex. Once it is found, then loop through the reference list and remove
// the corresponding reference for that element.
//
ContactAcct refActualElement = GetContactAcct(lInd... |
a79f1f35-271a-465f-b627-12b9936acc2e | 6 | public boolean hitTank(Tank t) {
if(this.live && this.getRect().intersects(t.getRect()) && t.isLive() && this.good != t.isGood()) {
if(t.isGood()) {
t.setLife(t.getLife()-20);
if(t.getLife() <= 0) t.setLive(false);
} else {
t.setLive(false);
}
this.live = false;
Explode e = new Explode(... |
32bc43a5-659a-47fa-8b96-20861e7246a4 | 8 | @Override
public void keyPressed(KeyEvent arg0) {
int x = Main.f.tab.getSelectedRow();
int y = Main.f.tab.getSelectedColumn();
if (arg0.getKeyCode() == 38 && x != 0) x -= 1;
if (arg0.getKeyCode() == 40 && x != 47) x += 1;
if (arg0.getKeyCode() == 37 && y >= 1) y -= 1;
if (arg0.getKeyCode() == 39 && y != 7)... |
a2301d63-8732-4e58-bdf7-6d4730817f1e | 9 | public void testModifyOnUnmodifiable(){
CharArraySet set=new CharArraySet(10,true);
set.addAll(Arrays.asList(TEST_STOP_WORDS));
final int size = set.size();
set = CharArraySet.unmodifiableSet(set);
assertEquals("Set size changed due to unmodifiableSet call" , size, set.size());
String NOT_IN_SET... |
24bf3b65-d5f8-4065-85f9-36ea267cdcc3 | 3 | private void step(int k, int m){//elements[k][m] must be nonzero
//rationalizes below k row, makes zeros in the m column
int i;int j;
double s;
if ((k+1)!=rows){
for (i=k+1;i<rows;i++){
s=elements[i][m]/elements[k][m];
for (j=m;j<columns;j++){
... |
0be6a263-4646-4bac-b9d5-18028be4e599 | 8 | private void initialize() {
if (shards == null || algorithm == null) {
shardedNodes = null;
return;
}
Set<String> nodesId = new HashSet<String>(shards.size());
for (Shard node : shards) {
if(node.getShardId() == null) {
throw new Redis... |
ffdad2dc-6922-48cf-9234-2aaad8bd9bab | 6 | final boolean method2391(AbstractToolkit var_ha, int i, int i_7_, int i_8_) {
anInt10562++;
if (((Player) this).aClass154_10536 == null
|| !method2459(131072, var_ha, 113))
return false;
Class101 class101 = var_ha.method3705();
int i_9_ = ((Mob) this).aClass264_10217
.method2019((byte) -31);
cla... |
4af96a58-bb69-4090-a012-b0652f579721 | 8 | @Override public void sameOwnerCheck() {
boolean sameOwner = true;
Street next = this;
do {
if(next.getOwner() == null || !next.getOwner().equals(owner)) {
sameOwner = false;
}
next = (Street) next.getNextGroupElement();
} while(sameOwner && !next.equals(this));
next = this;
do {
next.upg... |
70b71a89-6554-487c-bb6c-b81a90b87165 | 7 | public void stateCheckDraw(int x,int y, boolean fill){
if( y % 2 == 1 ^ x % 2 == 1){ if(!sedna.getSelected() ||sedna.getSelection(x,y)){if(fill){stateDraw(x,y);}else{stateAltDraw(x,y);}}}
else{if(fill){if(!sedna.getSelected() ||sedna.getSelection(x,y)){stateAltDraw(x,y);}}}} |
bcb1867b-125b-40e6-96e1-deea50b2bc66 | 9 | private int bigv_bitcount(int [] ix, EChannel gi) {
int bits = 0;
if ( gi.window_switching_flag != 0 && gi.block_type == 2 ) {
/*
Within each scalefactor band, data is given for successive
time windows, beginning with window 0 and ending with window 2.
Within each window, the quant... |
fffda024-6a9e-4958-9f85-d31c3c01e0cd | 9 | private double rate(Currency currency, Currency currency2){
switch (currency.toString()){
case "Euro": if (currency2.toString()=="Dolar") return 1.1;
else if(currency2.toString()=="Libra") return 0.8;
case "Dolar": if (currency2.toString()=="Euro") return 0.9;
... |
27a3a895-7939-4bf2-875b-8f814ac07a77 | 6 | * @param arguments
* @return Stella_Object
*/
public static Stella_Object applyMethod(java.lang.reflect.Method code, Cons arguments) {
switch (arguments.length()) {
case 0:
throw ((StellaException)(StellaException.newStellaException("Can't call method code on 0 arguments.").fillInStackTrace()... |
ba881f01-ce53-40f4-a101-25178ad92c66 | 0 | @Override
public void setTmp(String value) {this.tmp = parseColor(value);} |
34d07248-629c-41e6-a2c3-61fd0a8b6933 | 6 | protected static void divide_BYTE_COMP_Data(WritableRaster wr) {
// System.out.println("Multiply Int: " + wr);
ComponentSampleModel csm;
csm = (ComponentSampleModel) wr.getSampleModel();
final int width = wr.getWidth();
final int scanStride = csm.getScanlineStride();
f... |
c1ea6b9f-19cf-42da-aeab-183931bb2c80 | 6 | @Override
public void keyPressed(KeyEvent e)
{
if(e.isControlDown() && e.getKeyChar() != 's' && e.getKeyCode() == KeyEvent.VK_S)
createScreenShot();
else if(e.isControlDown() && e.getKeyChar() != 'c' && e.getKeyCode() == KeyEvent.VK_C)
copyScreenShot();
} |
fabfb196-82e3-494b-b6a9-2da7ee6dc9a1 | 8 | public void parse() throws IOException {
String m_type = null;
String m_objectsString = null;
ObjectInfo objInfo;
m_player_list.clear();
m_ball_list.clear();
m_goal_list.clear();
m_line_list.clear();
m_flag_list.clear();
m_objects.clear();
... |
512e7dc5-029e-417d-bc2c-0bb4cc974b6c | 9 | public final Quiz parse() throws IOException {
Quiz q = new Quiz();
BufferedReader bR = new BufferedReader(fileToParse);
String parsedQ, response, points;
String tmp = getSomeFromFile(bR, '<', '>');
ParserQuestion parserQuestion;
ParserAnswer parserAnswer;
Question question;
Text text;
if (tmp.contai... |
924a46ca-0596-49ad-977c-467306776343 | 2 | public static void main(String args[]) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int length = Integer.parseInt(in.readLine());
int[][] array = new int[length][length];
String[] strArray = null;
for (int i = 0; i < length; i++) {
strArray = in.readLi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.