method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f0d3e825-65ea-472a-a234-78d31dc337b6 | 5 | @Override
public Object getValueAt(int rowIndex, int colIndex) {
// Eintrag der Zeile
Entry e = todolist.get(rowIndex);
// Attribut des Eintrags in der jeweiligen Spalte
switch (colIndex) {
case 0:
return e.getAufgabe();
case 1:
return e.getEndzeitpunkt();
case 2:
if(e.getEnddate() != null){
... |
19cecb89-ea40-4b08-9805-d2c14ad55ab5 | 1 | public static Integer getDiscountForDeleteOrder(Integer discount) {
Integer discountForDeleteOrder = Integer.decode(ConfigurationManager.getProperty("user.discount.fine"));
if (discountForDeleteOrder > discount) {
return 0;
} else {
return discount - discountForDeleteOrde... |
ff8b457d-56cc-49c3-b60d-93e22439e999 | 3 | private void fillEmptyRefs(ArchiveDatabase archiveDatabase) {
for (UpdateItem emptyRef : emptyRefs) {
FileItem file = new FileItem();
file.setName(emptyRef.getName());
if (emptyRef.isAttribDefined()) {
file.setAttributes(emptyRef.getAttrib());
... |
a00e5263-5c44-4511-a24c-4db42240e471 | 5 | public boolean applySpeedTool(MouseEvent mouse, ui.Tool tool) {
Object o = getObject(mouseGetX(mouse), mouseGetY(mouse), tool);
if (o == null)
return false;
if (o instanceof Vertex) {
for (Edge edge : ((Vertex) o).edges)
edge.setSpeed(tool.value);
... |
04a3665d-719c-4aa3-898b-9cf49185819f | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
a42632dd-032c-4a04-a6af-c9428d2470e9 | 8 | public static Node jump(final Obstacles obs, final Node prev, final int dx, final int dy, final OffsetPoint goal) {
final Node cur = prev.derive(dx, dy);
if (obs.blocked(cur)) {
return null;
}
if (goal.equals(cur)) {
return cur;
}
if ((dx | dy) == 0)
return null;
List<Node> next = getNext(obs, cu... |
151d43a2-78c0-4881-bd7c-f4d2c377958e | 5 | private void sendButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendButtonActionPerformed
// TODO add your handling code here:
String[] values = sensorValuesTextArea.getText().split(",");
if (values.length > roombaDummyIF.sensorPacketsRequested.length) {
sen... |
33e2f583-e1bf-4b68-98c4-764d9e9c1543 | 0 | public static int zufallszahl(int untereGrenze, int obereGrenze) {
return Math.abs(RANDOM.nextInt() % (obereGrenze + 1 - untereGrenze)) + untereGrenze;
} |
55734226-ffdf-4654-8f8a-ddcefcc58b98 | 6 | @EventHandler
public void CaveSpiderSlow(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.getCaveSpiderConfig().getDouble("CaveSpide... |
f3fcd8e2-caf9-4f85-8b86-20ad896160d9 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if((!auto)&&(!CMLib.flags().isWateryRoom(mob.location())))
{
mob.tell(L("This magic will not work here."));
return false;
}
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
retu... |
3dfceac6-a769-44a9-bd64-d95d27851e9b | 0 | public void setName(String name) {
this.name = name;
} |
b3325781-7532-4ac7-aa38-7da7c6200cd2 | 3 | private void jTable_OutboxMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable_OutboxMouseClicked
System.out.println("Count:" + evt.getClickCount());
if (evt.getClickCount() == 2) {
String key = (String) jTable_Outbox.getModel().getValueAt(jTable_Outbox.getSelectedRow(), 7);... |
ca3b04eb-1d37-4351-8704-86ecb1a94543 | 4 | public void drawTitle(SpriteBatch sb) {
if(!titleReached) {
if (titleY[0] == 0)
if (titleY[1] > titleYMax - 6)
titleY[1]-=.02f;
else {
titleReached = true;
titleY[0] = 1;
titleTime = 0;
}
else
if (titleY[1] < titleYMax)
titleY[1]+=.02f;
else {
titleReached = tru... |
6bd719c0-73b8-4954-8224-dc7aaa291835 | 9 | public void avoid(PolarPoint obstacleLocation) {
System.out.println("Avoiding...");
keepAvoiding = true;
int turnDirection = 0; //1 for left, -1 for right
int scanAngle = 0;
PolarPoint leftCorner = new PolarPoint(0,90);
PolarPoint rightCorner = new PolarPoint(0,-90);
int prevDist = 0;
while ((le... |
f4e5f414-4e54-489a-a5df-8e6a7b5218ce | 6 | public boolean updateVecs(Equation e, Integer i) {
if (e.TypeSel.getSelectedIndex() == Equation.posCartLine) {
float[] out = getInput(e.cartLInputs);
vecs[i] = createCartLine(out);
return true;
}
if (e.TypeSel.getSelectedIndex() == Equation.posVecLine) {
float[] out = getInput(e.vecLInputs);
vec... |
927a6cf4-776e-4270-a527-5b004ecec23f | 4 | private void readObject(ObjectInputStream ois) throws IOException
{
this.version = STATS_VERSION;
int version = ois.readInt();
if(version >= 2)
{
this.mode = ois.readInt();
this.date = ois.readLong();
this.playcount = ois.readInt();
this.rankedScore = ois.readLong();
this.totalScore = ois.readLo... |
83ffa419-c0f1-4f59-ac84-6739effc9d06 | 3 | public static void main(final String args[]) throws RemoteException,
AlreadyBoundException, NumberFormatException,
MalformedURLException, NotBoundException
{
_param = args;
runnable = new Runnable()
{
@Override
public void run()
{
if(args.length == 1 && args[0].equals("console"))
{
... |
eb8730d2-cbb5-4840-bcad-091d77a8cd9a | 4 | private void loadFile()
{
File inFile = new File("C:");
DataInputStream iStream;
JFileChooser fileChooser = new JFileChooser(inFile);
//Terminate the method early if the user does not pick a file.
if(fileChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION)
... |
1d7b8623-590b-4fc4-b3f0-5ee1a45f568a | 4 | public String normalise(String userJob) {
StringTokenizer uJT = new StringTokenizer(userJob);
String[] userJobTokens = toArray(uJT);
int jMax = userJobTokens.length;
for (int i=0; i<normalList.length; i++) {
int wordsInCommon = 0;
String no... |
35ecd7da-6636-4b24-9258-a0e97cfa4878 | 1 | public void initialize(String string) {
DefaultTreeModel oldTree = tree;
tree = parseTree(string, pane.grammar, pane.table);
if (tree == null) {
tree = oldTree;
pane.statusDisplay.setText("Preliminary parse failed.");
return;
}
dehighlight();
pane.treeDrawer.setModel(tree);
pane.treeDrawer.hideAl... |
8e9022c9-ff89-4a94-8af8-1337f74bdded | 1 | public void test_getDifference_long_int() {
assertEquals(0, iField.getDifference(1L, 0L));
assertEquals(567, iField.getDifference(567L * 90L, 0L));
assertEquals(567 - 1234, iField.getDifference(567L * 90L, 1234L * 90L));
assertEquals(567 + 1234, iField.getDifference(567L * 90L, -1234L * ... |
8ba24acd-e60e-42c1-9944-2b06f1d966fc | 0 | @Before
public void setUp() throws Exception {
this.card1 = new CreditCard("Madalin Ignisca");
this.card2 = new CreditCard("John Doe", 3000);
} |
867a938c-6b8a-4289-ae97-bf0a6d9d2ac5 | 7 | private static void SortsOrder(CartsModel cm) {
// sorts components
switch (Airsched.getOrder()) {
case (Airsched.NO_ORDER):
break;
case (Airsched.CRITICALITY_FIRST):
cm.sort(new PartitionCriticalityFirstComparator());
break;
case (Airsched.LARGER_FIRST):
cm.sort(new PartitionLargerPeriodFirstCom... |
13b7abb2-9132-4624-ab00-bc48fd71314d | 7 | protected void readImage() {
ix = readShort(); // (sub)image position & size
iy = readShort();
iw = readShort();
ih = readShort();
int packed = read();
lctFlag = (packed & 0x80) != 0; // 1 - local color table flag
interlace = (packed & 0x40) != 0; // 2 - inte... |
86e93dc0-d685-4fc8-b4c6-1d354009cef8 | 3 | public ReleaseType getLatestType() {
this.waitForThread();
if (this.versionType != null) {
for (ReleaseType type : ReleaseType.values()) {
if (this.versionType.equals(type.name().toLowerCase())) {
return type;
}
}
}
... |
439ffb2d-1ca9-42d0-8c9b-49b9c6aebb44 | 2 | public ArrayList<Weekplanning> getWeekplanning(){
ArrayList<Weekplanning> weekplanning = new ArrayList<Weekplanning>();
try {
this.leesDatabase();
output = statement.executeQuery("SELECT * FROM weekplanning");
while (output.next()){
int id = output.getInt("id");
String klusNaam = output.getStrin... |
75516a7a-f22b-4d8a-9661-44f52af6dbea | 0 | public static void addDocumentInfo(DocumentInfo docInfo) {
frameInfoList.add(docInfo);
} |
8b0ebbde-376c-4d73-be52-b406bdd3b55f | 1 | @Override
public void run() {
arr_data = Employee.showAll();
data = new Object[arr_data.size()][];
for (int i = 0; i < arr_data.size(); i++) {
data[i] = arr_data.get(i).Array();
}
this.fireTableDataChanged();
} |
3c0df977-bc25-4202-b468-b4dfa5dfccec | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
System.out.println("Error en " + e.toString());
... |
2ba2f6a0-5774-4bfb-91bc-dd743d39727b | 9 | public void setColor()
{
if(typ == 0)
{
//Check if the name is broadcasting
if(!myinfo.getBroadcasting())
{
myButton.setBackground(Color.red);
myButton.setForeground(Color.white);
}
else
{
myButton.setBackground(Color.orange);
myButton.setForeground(Color.black);
... |
0f201acc-fb6a-49e3-bc89-4cda5d1812c7 | 4 | boolean piecesContiguous(Side player) {
HashMap<Integer, Integer> set;
set = player == WHITE ? _whiteSetMap : _blackSetMap;
int prev = 0;
for (int v : set.values()) {
if (prev == 0) {
prev = v;
}
if (prev != v) {
return ... |
96c7d5c3-b418-4b05-b481-a35fb5ebdd0b | 3 | @Override
public void addUser(User user) throws SQLException {
Session session=null;
try{
session=HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
}catch(Exception e){
e.printStackTrace();
}finally{
if(session!... |
d51f49cf-0ac9-4ee5-b145-826d5be3a5d8 | 9 | public String change(String t) {
String str = "";
if (t.equals("fz"))
str = "服饰";
else if (t.equals("xb"))
str = "鞋包";
else if (t.equals("zb"))
str = "珠宝手表";
else if (t.equals("sm"))
str = "数码";
else if (t.equals("dz"))
str = "电子产品";
else if (t.equals("ry"))
str = "日用百货";
else if (t.eq... |
f6cf74a4-811f-44d7-9503-9de6aafdf031 | 0 | public static void main(String[] args) {
final AttemptLocking al = new AttemptLocking();
al.untimed();
al.timed();
new Thread() {
{
setDaemon(true);
}
public void run() {
al.lock.lock();
System.out.print... |
13bf84c3-c5d2-422a-9aa9-47f4719c8e6f | 4 | public final void vertex(float var1, float var2, float var3) {
if(this.texture) {
this.data[this.length++] = this.u;
this.data[this.length++] = this.v;
}
if(this.color) {
this.data[this.length++] = this.r;
this.data[this.length++] = this.g;
this.data[this.... |
b305c0fa-f3d0-4789-85a9-eeee83d0dd76 | 9 | private static boolean isVowel(char chr){
return (chr == 'A' || chr == 'E' || chr == 'I' || chr == 'O' || chr == 'U' || chr == 'a' || chr == 'e' || chr == 'i' || chr == 'o' || chr == 'u');
} |
5a92b47e-e6bb-4e7b-9a0c-bb081f6f9357 | 0 | private void addWorldButtonActionPerformed(java.awt.event.ActionEvent evt) {
chooseWorld.showOpenDialog(controlFrame);
} |
a32aec5f-6271-4a2b-a1d5-9f87366803c5 | 5 | public static BookCopy getBookCopy(int bookCopyId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Statement stmnt = conn.createStat... |
258ebd49-f8dc-4014-b0b0-c4bb8441836c | 0 | public String toString(String input) {
return "S("+input+")";
} |
810577ab-f362-4984-95ba-de742ae40b4b | 7 | public boolean esUsuarioCorrecto(UsuarioDTO u) {
Connection co = null;
PreparedStatement pst = null;
ResultSet rs = null;
String passwordEncriptado = null;
String sql = null;
try {
co = EscolarConnectionFactory
.getInstance().getConnection();
sql = "SELECT usuario_id, link_id, usuario, co... |
12efe15e-46c5-47c4-8d52-d58b108ac3c8 | 5 | public void run()
{
while (duration >= 0 && isAlive)
{
if (duration <= 10)
{
if (duration == 0)
{
adapter.stop();
}
else
{
adapter.displayCountDown(duration);
}
}
duration--;
try { Thread.sleep(1000); } catch (Exception ex) {}
}
} |
67c00b10-73ef-49d9-92ff-0738e4267856 | 8 | final public void Function_parameter_type() throws ParseException {
/*@bgen(jjtree) Function_parameter_type */
SimpleNode jjtn000 = new SimpleNode(JJTFUNCTION_PARAMETER_TYPE);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
... |
eed11333-7c77-4f58-aeb3-6db4d1617b77 | 0 | @Basic
@Column(name = "country")
public String getCountry() {
return country;
} |
1d2d5902-d829-4722-85c4-09ea5e879601 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Zahlungsintervall)) {
return false;
}
Zahlungsintervall other = (Zahlungsintervall) object;
if ((this.id == nul... |
137447ca-87ae-44f5-848f-27a91af696e2 | 3 | public Object getObject(RPCInetAddress address) {
if (hasObject.compareAndSet(false, true))
try {
if (checkOutRequest())
startCall(address);
else {
log.error("hasn't finish request.");
}
} catch (InterruptedException e) {
e.printStackTrace();
log.error("connect fail.");
}
retu... |
0ada4cb4-de6c-46b1-8ec2-a0c594c537a4 | 0 | public static void int2byte2(int n, byte buf[], int offset)
{
buf[offset] = (byte)(n >> 8);
buf[offset + 1] = (byte)n;
} |
e6a954cd-97b3-4290-93c5-46509da2a33a | 0 | @Override
public String toString() {
return "WRITE";
} |
aff0b6d1-0388-4935-9a41-6f78fc2f1e52 | 2 | private ArrayList<Cellule> watchForum(){ // Methode qui renvoie ce que regarde le villageois (les cellules adjacante a la sienne + la sienne) sans les diagonalles)
ArrayList<Cellule> autour = curent.env.getenv(curent);
for (int i =0 ; i<autour.size() ; i++){
if (!(autour.get(i).objet instanceof Forum )){
... |
d419fdc9-9d3d-4930-ae37-1d429824c30e | 2 | public static void main(String[] args) {
int i = 0;
System.out.println("WHILE LOOP");
while(i < 10) { // checks that the condition is equal to 'true' before processing the body of the construct.
System.out.println(i + " is less than 10");
++i;
}
/*
... |
2ce89941-6466-4c8f-b97b-c76203ebc988 | 7 | public boolean canShowTo(MOB showTo, MOB show)
{
if((show!=null)
&&(show.session()!=null)
&&(showTo!=null)
&&(((show.phyStats().disposition()&PhyStats.IS_CLOAKED)==0)
||((CMSecurity.isAllowedAnywhere(showTo,CMSecurity.SecFlag.CLOAK)||CMSecurity.isAllowedAnywhere(showTo,CMSecurity.SecFlag.WIZINV))
&&(sho... |
ff89eacb-5921-4c56-a787-f42608d61bae | 2 | private String getFileName() {
if ((config.getFileName() == null) || (config.getFileName().isEmpty())) {
return getDirectory() + new SimpleDateFormat("ddMMyyyy_HHmmss").format(new Date());
}
else return getDirectory() + config.getFileName();
} |
ab2e0fbf-806f-4bbc-be71-bca21a1c3073 | 8 | static void enable(JComponent c, boolean b, Object source, int modelID, String modelClass, Page page) {
if (page == null)
return;
boolean yes = false;
if (modelID != -1) {
if (isTargetClass(modelClass)) {
try {
Object o = page.getEmbeddedComponent(Class.forName(modelClass), modelID);
if (o == ... |
20ab6deb-c560-4522-b69f-a78727fc85f8 | 4 | public Boolean copyFolder(File src, File dest)
throws IOException{
if(src.isDirectory()){
//if directory not exists, create it
if(!dest.exists()){
dest.mkdir();
}
//list all the directory contents
String files[] = src.list();
for (String file : files) {
... |
d50dbaa5-a865-4d94-98ca-cb5f44237852 | 7 | private Instances[] computeInfoGain(Instances instances, double defInfo, Antd antd){
Instances data = new Instances(instances);
/* Split the data into bags.
The information gain of each bag is also calculated in this procedure */
Instances[] splitData = antd.splitData(data, defInfo);
Instance... |
53359ff7-d0c5-405e-bf18-dead7ec7a939 | 1 | @Override
public void destroy() {
if (this.mcApplet != null) {
this.mcApplet.destroy();
return;
}
} |
8538df58-28ec-4169-8f96-1879a7173b5d | 6 | public void subscriptTrainings(List<Training> trainings, Customer customer) throws SQLException {
Connection c = null;
PreparedStatement ps = null;
Statement s = null;
ResultSet rs = null;
boolean transactionState = false;
try {
s = c.createStatement();
... |
8b02c38d-719c-43c1-8974-9c47ce16c1ea | 7 | public void drawDomainMarker(Graphics2D g2,
CategoryPlot plot,
CategoryAxis axis,
CategoryMarker marker,
Rectangle2D dataArea) {
Comparable category = marker.getKey();
Cat... |
39dde082-61f2-4195-bb34-6d143c1baf03 | 8 | public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
int i = 0;
int n = 0;
String line = "";
HashMap<String, String> map = new HashMap<String, String>();
String name = "";
String phone ... |
0f4f452c-5e28-4b53-be62-0de3c1cba69a | 8 | private void goLawnmower(Lawnmower lawnmower) {
// If N or S, y move else x
if (OrientationEnum.N.equals(lawnmower.getCurrentOrientation())
|| OrientationEnum.S.equals(lawnmower.getCurrentOrientation())) {
int y = lawnmower.getCoordinate().getY();
y += OrientationEnum.N.equals(lawnmower.getCurrentOrientat... |
66d2947c-d2cc-40c7-af0d-a187c71aaf3c | 9 | @RequestMapping(value = "/generateSumReport.do")
public ModelAndView generateSumReport(String txnType, String startDate,
String endDate, String fileName, HttpServletRequest request,
HttpServletResponse response) {
// 传递是否是admin到页面
HttpSession session = request.getSession();
Users u = (Users) session.getAt... |
ec6bfc9b-477c-49a7-a8bb-d1efc91243dc | 9 | @Override
public void draw(Graphics2D g2d) {
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1.0f));
AffineTransform at = new AffineTransform();
// g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
// ((float) hp)/(float) maxHP));
//g2d.setComposite(AlphaComposite.get... |
7dae1b1c-4e4b-466a-a48a-78498837f27f | 8 | public void insert(Player player, League l, String division) throws NamingException
{
String INSERT_STMT="insert into registration(PID,LID,division) values (?,?,?)";
DataSource ds = null;
Connection connection = null;
PreparedStatement insert_stmt = null;
try {
... |
dfe64483-d871-417f-921a-bf3dc834ea6b | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof AgenciaFinanciadora)) {
return false;
}
AgenciaFinanciadora other = (AgenciaFinanciadora) object;
if ((this.id ... |
c57ec618-17e8-4aa7-862f-962d02f00c0d | 5 | static boolean isThereTwoPair(Hand hand) {
Hand testHand = new Hand();
for (int x = 0; x < hand.size(); x++){
for (int y = 0; y < hand.size(); y++){
if (y != x && hand.get(y).getValue() == hand.get(x).getValue())
testHand.add(hand.get(y));
}}
if (testHand.size() == 4)... |
71f5038c-62fb-439e-af85-72ad1ecdd2ad | 6 | public static double GradientCoherentNoise3D (double x, double y, double z, int seed,
NoiseQuality noiseQuality)
{
// Create a unit-length cube aligned along an integer boundary. This cube
// surrounds the input point.
int x0 = (x > 0.0? (int)x: (int)x - 1);
int x1 = x0 + 1;
... |
b002e353-18c3-4a99-884b-f42e4f164a69 | 4 | public void iterate(String text, int start, Collection<String> list, Position position) {
int stop = parts.size();
if (start == stop) {
if (parent == null) {
list.add(text);
} else {
parent.iterate(text, position.value, list, position.parent);
... |
a18ede57-0e12-48f7-a56c-a10f847a994a | 7 | public void processMouseDragged(int x, int y)
{
// WE MAY HAVE TO USE VALUES IN POSE SPACE
Rectangle2D.Double poseArea = zoomableCanvasState.getPoseArea();
int incX = x - lastMouseDraggedX;
int incY = y - lastMouseDraggedY;
lastMouseDraggedX = x;
lastMouseDraggedY = y... |
178472f8-d003-4f87-bd37-d506fb918fb3 | 7 | public void updatePosition() {
if (xPos < xDestination)
xPos++;
else if (xPos > xDestination)
xPos--;
if (yPos < yDestination)
yPos++;
else if (yPos > yDestination)
yPos--;
if (xPos == xDestination && yPos == yDestination ... |
c3615ad4-c2bb-4934-a654-0de5ac652f65 | 4 | void pushInput(String ename) throws java.lang.Exception
{
Object input[] = new Object[12];
// Check for entity recursion.
if (ename != null) {
Enumeration entities = entityStack.elements();
while (entities.hasMoreElements()) {
String e = (String) enti... |
ec01fe19-6246-4ada-b11f-7f47d24e5fc5 | 4 | public void update()
{
for(int i=0; i<stars.size(); i++)
{
stars.get(i).update();
if(stars.get(i).xPos < 0)
{
stars.remove(i);
}
}
if(startLevel1) gsm.setState(2);
if(startTutorial) gsm.setState(1);
} |
a067f858-3a5c-4ac6-acdc-d4047638873c | 3 | public boolean matches(Card otherCard) {//Compares this card to another, if suit, rank and point value are the same returns true
if (this.suit.equals(otherCard.suit))
{
if (this.rank.equals(otherCard.rank)){
if (this.pointValue == otherCard.pointValue){
System.out.println("True");
return true;
... |
5770d786-6a5a-4409-8cc8-71d20a1624d4 | 0 | @Test
public void itShouldDeserialize() throws Exception
{
MultiPolygon multiPolygon = mapper.fromJson(
"{\"coordinates\":[[[[102.0,2.0],[103.0,2.0],[103.0,3.0],[102.0,3.0],[102.0,2.0]]],"
+ "[[[100.0,0.0],[101.0,0.0],[101.0,1.0],[100.0,1.0],[100.0,0.0]],"
+ "[[100.2,0.2],[100.8,0.2],[100.8,0.8],[10... |
05d590bc-c704-400b-8e77-e1a697e23243 | 1 | @Before
public void setUp() {
rand = new Random();
vectors = new Vector[TESTS];
for (int i = 0; i < vectors.length; i++) {
vectors[i] = new Vector(rand.nextInt(), rand.nextInt());
}
} |
c6ffd4bb-f587-4da4-b390-5883fdcdc092 | 4 | public static RSImage getSprite(String name, int id, Archive archive) {
Main.getInstance().mediaArchive.addKnownArchive(name);
long hash = (TextUtils.stringToLong(name) << 8) + (long) id;
RSImage sprite = null;
if (spriteNodes != null) {
sprite = (RSImage) spriteNodes.get(hash);
if (sprite != null) {
... |
3042e1b8-32ea-4cd8-88b6-0e0cd33cbafc | 8 | public Board crearTablero(Percept p) {
Board tablero = new Board(size);
for (int a = 0; a < size; a++) {
for (int b = 0; b < size; b++) {
if (((String) p.getAttribute(a + ":" + b + ":" + Squares.COLOR)).equals(Squares.SPACE)) {
if (((String) p.getAttribut... |
3936b897-042a-48f2-a62a-73eb8c2d845c | 8 | public void sureUzat(String masaAdi, int sure){
Bilgisayar b = masaBul(masaAdi);
if(b != null){
if(sure==0){
try{
sure = Integer.parseInt(JOptionPane.showInputDialog(null,
"Süre Sınırlamasını giriniz", "Süreli Masa Aç",
... |
d2463e60-e557-4796-bd18-f9a925a62cb8 | 2 | public BufferedImage getRender() {
BufferedImage output = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = output.createGraphics();
BufferedImage temp;
for (int i = 0; i < tilesX; i++) {
for (int j = 0; j < tilesY; j++) {
... |
e13ba4a7-5171-4596-b8fc-fece061b7c7c | 2 | public MP3List(MP3Container con, MouseListener ml, KeyListener kl) {
super();
mainCon = con;
showCon = con;
nextList = this;
curSong = 0;
final MyRenderer renderer = new MyRenderer();
table = new JTable() {
private static final long serialVersionUID = -7666798269867418515L;
public TableCellRe... |
531f3dd0-00ad-4e92-b6f1-a883a50f2c36 | 2 | public void selectCastle(Object object)
{
//castleSelected.emit((Castle)castle);
WindowStack ws = WindowStack.getLastInstance();
if (ws != null) {
Castle castle = (Castle)object;
ws.push(new WindowCastle(player, castle, castle.getHero()));
core.WorldMap wm = core.WorldMap.getLastInstance();
if... |
839a32d7-794e-43f1-9ed7-d69c4dd89a36 | 2 | private void paintViews(Graphics g){
synchronized(lock_critter){
Iterator<Critter> iter = play_pen.listIterator();
while(iter.hasNext()){
Critter temp = iter.next();
if(temp.food == 1){
g.setColor(new Color(0xcb,0x60,0x60));
}
else{
g.setColor(new Color(0x75,0xb6,0x77));
}
... |
2d8d2141-ee50-4893-b156-d1a25560486a | 0 | @Override
public void mouseClicked(MouseEvent e) {
game.getCurrentScreen().onMouseClick(e.getX() / game.getScale(), e.getY() / game.getScale(), e.getButton());
} |
0d1e3aff-70e1-41b6-a27d-5906283515e9 | 9 | @Override
public int compare(String o1, String o2) {
if (o1.equals(o2) || o1.contentEquals(o2)) {
return 0;
}
int minStringLength;
if (o1.length() <= o2.length()) {
minStringLength = o1.length();
} else {
minStringLength = o2.length();
... |
68deca39-1114-476f-ba8a-c427290e1817 | 0 | public File getFile() {return this.file;} |
04df89aa-2d88-4a69-8ea8-4a44370fedf7 | 2 | public boolean validPositions(List<Position> positions) {
for (Position position : positions) {
if (!validPosition(position))
return false;
}
return true;
} |
9c106fb0-b7b8-41c4-936a-67605a4105dc | 1 | public boolean alive() {
return((me != null) && me.isAlive());
} |
992b806a-6938-4d53-a94c-7e0cb661cd72 | 2 | private void renderTetromino(Screen screen) {
for (Point point : tetromino.getSelection()) {
int yy = getY() + GameFrame.BLOCK_SCALE * point.getY() - BLOCK_SCALE * HIDDEN_ROWS;
if (yy >= getY()) {
screen.render(getX() + GameFrame.BLOCK_SCALE * point.getX(), yy, tetromino.getSprite());
... |
b8d32847-e4a4-4824-ae66-57ad1ec3d4fa | 9 | public static void upclassifyOneDescription(LogicObject self) {
if (Logic.upclassifiedP(self) ||
(!Stella_Object.isaP(self, Logic.SGT_LOGIC_DESCRIPTION))) {
return;
}
if ((Stella.$TRACED_KEYWORDS$ != null) &&
(Stella.$TRACED_KEYWORDS$.membP(Logic.KWD_CLASSIFIER) ||
Stella.$TRA... |
0d755824-c497-4970-bf92-e8cb4d5aff92 | 8 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[23];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 6; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if... |
b23b66c4-093c-4519-af01-70e964ba924f | 0 | public static void main(String[] args) {
installLnF();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
ChooseFrame frame = new ChooseFrame();
frame.setDefaultCloseOperation(ChooseFrame.EXIT_ON_CLOSE);
frame.setTitle("Choose Option");
frame.getContentPane().setPreferredSize(frame.g... |
33bb7e78-9e2f-49f9-aa64-00d6c04e4b52 | 1 | public void returnParkingPlace(ParkingPlace place) throws ParkingException {
if (releaseItem(place)) {
SEMAPHORE.release();
}
} |
93649da9-b422-4c36-a16d-d410c1ad8345 | 3 | public static List<Record> getNewRecords(String baseformat) throws SQLException
{
String cd_extra = "AND riploc IS NOT NULL";
if (!baseformat.equalsIgnoreCase("cd"))
cd_extra = "";
String sql = "SELECT recordnumber from formats,records LEFT JOIN score_history ON recordnumber = record_id ... |
0b1e8072-e896-4ebd-a9c7-c1a2dec3e73e | 1 | public void testConstructor_ObjectStringEx1() throws Throwable {
try {
new DateTime("10:20:30.040");
fail();
} catch (IllegalArgumentException ex) {
// expected
}
} |
5dbb1c49-b2d1-4078-ac78-b8f70a8accea | 5 | @GET
@Path("/bet")
public RaceBettingResult placeBet(@PathParam("raceNumber") Long raceNumber, @QueryParam("raceId") String raceId, @QueryParam("amountCents") Integer amountCents) {
logAuditForBetRequest(raceNumber, raceId, amountCents);
if (raceNumber == null) {
throw new WebAppli... |
7a90cc1e-b39d-4b1e-82c8-2c00f9c43386 | 0 | public static void main(String[] args) {
// Type Casting
double dNum = 34.59;
int iNum = (int) dNum;
System.out.println(iNum);
String sNum = "50";
iNum = Integer.parseInt(sNum);
System.out.println(iNum);
} |
219a297f-e761-412d-a89c-fcc12fb3df7c | 2 | static void figureOutIndexes(int index, int[] sizes, int[] indexes) {
int prev_div = 0;
for (int i = (sizes.length - 1); i > 0; i--) {
int div = sizes[0];
for (int j = 1; j < i; j++) {
div = div * sizes[j];
}
indexes[i] = (index - prev_div... |
d951565a-521d-400a-a03a-a2ee843e53f4 | 2 | public static void appendArr(String daoName, String dbName, Criteria criteria, List<Object> list, StringBuilder sb, String separator){
Collection objArr = (Collection) criteria.getParam(daoName);
if (objArr != null){
objArr.stream().forEach((obj) -> {
if (!list.isEmpty()) {
... |
4f2779f0-926d-4670-bd0a-57abbd3d2da7 | 1 | public void draw(Graphics2D g) {
if (needsRefresh)
refreshCurve();
g.draw(curve); // Draws the main part of the arrow.
drawArrow(g, end, control); // Draws the arrow head.
drawText(g);
} |
2674dbc2-6962-45bb-bc02-a85b591a1309 | 4 | public void loadInventory(Player p)
{
ItemStack[] invMain = new ItemStack[0], invArmor = new ItemStack[0];
try {
invMain = (ItemStack[]) main.playerData.get(p.getUniqueId().toString() + ".inventoryMain");
invArmor = (ItemStack[]) main.playerData.get(p.getUniqueId().toString() + ".inventoryArmor");
} catch ... |
702cdfbd-963c-4033-a363-e98ccf9d622b | 4 | @Override
public T convertFromString(Class<? extends T> cls, String str) {
try {
return cls.cast(fromString.invoke(null, str));
} catch (IllegalAccessException ex) {
throw new IllegalStateException("Method is not accessible: " + fromString);
} catch (InvocationTargetE... |
6a4c3d7a-4d9b-4cc6-88f3-2f605afe6da5 | 5 | public void updateAnimation() {
elapsedTime++;
Frame currentFrame = frameList.get(currentIndex);
if (elapsedTime > currentFrame.getEndTime() && currentIndex < maxIndex - 1) {
currentIndex++;
}
if (elapsedTime > maxTime) {
if (!looping) {
for (AnimationObserver observer : observers) {
obse... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.