method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8fbfa7e0-1e29-442a-88cd-9bcdbf661ef3 | 9 | private List<CmdArg> tokenize()
throws Exception
{
char[] str = value.toCharArray();
int p = 0;
List<CmdArg> tokens = new ArrayList<CmdArg>();
String tok = "";
boolean invar = false;
boolean instr = true;
while (p < str.length) {
if (invar)... |
b596678a-2171-4f02-a7fd-6c7a8edea884 | 2 | public final void push(T val) {
back_chunk.values [back_pos] = val;
back_chunk = end_chunk;
back_pos = end_pos;
end_pos ++;
if (end_pos != size)
return;
Chunk sc = spare_chunk;
if (sc != begin_chunk) {
spare_chunk = spare_chunk.next;
... |
eaa3fa71-c7c1-4d59-a38e-11e29f91cc10 | 5 | private int lookup(int left, int right) {
if (found) {
return 0;
}
if (user.theNumberIs(left)) {
found = true;
return left;
}
if (user.theNumberIs(right)) {
found = true;
return right;
}
if (left == right... |
7a7204d9-3fda-4c14-a50d-5826f1b64177 | 4 | void drawLoadingText(int i, String s) {
while (graphics == null) {
graphics = getGameComponent().getGraphics();
try {
getGameComponent().repaint();
} catch (Exception exception) {
}
try {
Thread.sleep(1000L);
} catch (Exception exception) {
}
}
java.awt.Font boldFont = new java.awt.Fo... |
ffb6befc-37df-43b5-a533-e7058fbd06fd | 3 | private void loadKompetenser() {
PanelHelper.cleanPanel(kompetensHolder);
ArrayList<String> al = null;
try {
String query = "select kid from kompetensdoman";
al = DB.fetchColumn(query);
} catch (InfException e) {
e.getMessage();
}
for... |
6affe862-fc28-4d91-9958-4d5a8080503b | 2 | public static boolean isItalic(JTextPane pane)
{
AttributeSet attributes = pane.getInputAttributes();
if (attributes.containsAttribute(StyleConstants.Italic, Boolean.TRUE))
{
return true;
}
if (attributes.getAttribute(CSS.Attribute.FONT_STYLE) != null)
{
Object fontWeight = attributes
.getAttr... |
82cfc0b3-021a-4c1e-9e2d-6d472afa0200 | 1 | public static final String format(boolean value) {
return value ? "yes" : "no"; //$NON-NLS-1$ //$NON-NLS-2$
} |
042213f0-7de5-49a2-9a44-09384088587a | 7 | public static void initParser(String[] args) throws IllegalArgumentException{
_CSPort = CS.DEFAULT_PORT;
_CSName = "localhost";
if(args.length != 0){
if(args.length == 2){
if(args[0].equals("-n")){
_CSName = args[1];
}
else if(args[0].equals("-p")){
_CSPort = Integer.parseInt(args[1]);
... |
fd4c1287-24d6-43a5-af25-d95e67dc1a83 | 3 | public ArrayList<ArrayList<Integer>> levelOrderBottom(TreeNode root) {
ArrayList<ArrayList<Integer>> result = new ArrayList<ArrayList<Integer>>();
ArrayList<Integer> row = new ArrayList<Integer>();
if (root == null) {
return result;
}
TreeIterator iterator = new Tr... |
47959dee-fc28-4e7d-9bcd-71f027b191fa | 4 | public char getNextChar() {
try {
//Leemos un caracter y seteamos a nuestra variable currentChar de objeto
setCurrentChar((char) pr.read());
//Sumamos 1 al caracter en la línea
setNumeroDeCaracterEnLinea(getNumeroDeCaracterEnLinea()+1);
... |
589782f8-0439-4d6b-bcc0-372b9540a9a5 | 5 | public void gameTick() {
if (player.isLevelAdvance()) {
levelsCompleted++;
totalPoint += temporaryPoint;
temporaryPoint = 0;
if (currentLevel.getNextLevel() == 0)
gameCompleted = true;
else {
currentLevel = new Level(currentLevel.getNextLevel());
player.setxCoord(currentLe... |
650099d1-4e53-4153-aa66-fb7ef80ac18f | 1 | public int get(long millis) {
int dayOfWeek = (int) TestGJChronology.mod(iChronology.fixedFromMillis(millis), 7);
if (dayOfWeek == 0) {
dayOfWeek = 7;
}
return dayOfWeek;
} |
9e8c9deb-a131-4026-998e-7bd5b4a5dac1 | 1 | private void showFilter() {
if (isAncestorOf(searchPanel)) {
remove(searchPanel);
} else {
add(searchPanel,java.awt.BorderLayout.NORTH);
searchPanel.set(mp3list.getIndex(),mp3list.NoE(),mp3list.length());
searchPanel.Focus();
}
revalidate();
repaint();
} |
a6a135b5-d515-4090-84d6-853c96cdd311 | 5 | public boolean similarColors(Card c2){
boolean result = false;
String cost1 = this.cost + "1";
String cost2 = c2.getCost() + "1";
for(char c : cost1.toCharArray())
if(c != 1 && cost2.indexOf(c) != -1)
result = true;
for(char c : cost2.toCharArray())
if(cost1.indexOf(c) == -1)
result = f... |
1545902a-126d-4a9a-a4cb-6e496127632e | 4 | public static void connectGraph(){
int n = _graph.getVertexCount();
System.out.println("n = " + n );
System.out.println("Calculating Euclidean Distance");
Collection<BCNode> nodes = _graph.getVertices();
Iterator<BCNode> iti = nodes.iterator();... |
686a6399-cac3-46d8-aa95-6dc19bf0e60e | 0 | public void printComponent(Graphics g) {
int recursionDepth = spinnerModel.getNumber().intValue();
List expansion = expander.expansionForLevel(recursionDepth);
// Now, set the display.
Map parameters = lsystem.getValues();
Matrix m = new Matrix();
double pitch = pitchModel.getNumber().doubleValue(), roll = ... |
1cb829e9-4359-484e-a3be-20cf8bbdea7f | 7 | public Timestamp asTimestamp()
{
try {
if (isNull()) {
return null;
} else if (isTimestamp()) {
return (Timestamp) value;
}
if (isTime()) {
Calendar cal = Calendar.getInstance();
cal.setTime((Time) value);
return new Timestamp(cal.getTime().getTime());
} else if (isUtilDate()) {... |
0afc929c-92b0-4b57-bbf1-ba1f23f5a39a | 3 | public Integer Byte4ToInt32(byte[] bytes) throws Exception {
if (bytes.length != 4) throw new Exception("aBytes.length != 4");
/*** forward algorithm [123][0][0][0] ***/
Integer result = new Integer(0);
byte i = 3;
while(true) {
result |= bytes[i] & 0xFF;
if (i == 0) break;
result ... |
74ccacb1-3016-4853-9854-3c6fac4cc342 | 6 | private Location findFood(Location location)
{
Field field = getField();
List<Location> adjacent = field.adjacentLocations(getLocation());
Iterator<Location> it = adjacent.iterator();
while(it.hasNext()) {
Location where = it.next();
Object animal = field.getO... |
09d6dd63-ec4e-4ae5-a1ad-31df2317e18d | 2 | @EventHandler(priority = EventPriority.NORMAL)
public final void onVotifierEvent(final VotifierEvent event) {
Vote vote = event.getVote();
String user = vote.getUsername();
log.info(String.format(plugin.getMessages().getString("player.vote.event"), user));
OfflinePlayer thePlayer =... |
d2daf906-e6fc-464b-89ca-13d3d19091bf | 0 | public void setTitle(String title) {
this.title = title;
} |
db0ab12b-4028-4bef-be7a-9f20f5291d21 | 1 | public boolean ApagarTodosQuandoExcluiPessoa(int idPessoa){
try{
PreparedStatement comando = banco.getConexao()
.prepareStatement("UPDATE enderecos SET ativo = 0 WHERE id_pessoa= ?");
comando.setInt(1, idPessoa);
comando.executeUpdate();
comand... |
dd81541f-304a-407a-9d21-1dc1d3e21e6d | 6 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
3dc1e294-891d-4f00-b8f0-eb8bc53c45e7 | 8 | private static Class<? extends AttributeImpl> getClassForInterface(Class<? extends Attribute> attClass) {
synchronized(attClassImplMap) {
final WeakReference<Class<? extends AttributeImpl>> ref = attClassImplMap.get(attClass);
Class<? extends AttributeImpl> clazz = (ref == null) ? null : ref... |
fb7014ab-1d61-42e0-ad45-7bbc61798fa1 | 8 | public void redraw(GameWorld world) {
this.gameWorld = world;
for (Avatar a : gameWorld.getAvatars()) {
if (a.getName().equals(name)) {
this.avatar = a;
}
}
if (avatar != null) {
int health = avatar.getHealth();
healthBar.setValue(health);
if (health > 75) {
healthBar.setForeground(Color... |
9a74ce3a-4ffe-43d2-8c8b-10cf397f6806 | 1 | private void openSession()
{
if(session == null)
session = HibernateUtils.getSessionFactory().openSession();
} |
ccec9aff-7e28-443c-b5ab-af5e496269f7 | 1 | public void down() {
currentlySelected--;
if(currentlySelected == -1)
currentlySelected = countItemsInInventory() - 1;
} |
9c5f1147-c860-44c0-a1a6-886d1172cacf | 7 | public Grammar(final Reader in) throws GrammarSyntaxException {
productions = new HashMap<String, TreeSet<String[]>>();
leftmost = new HashMap<String, Set<String>>();
final Scanner sc = new Scanner(in).useDelimiter("\\s*[\r\n]+\\s*");
while (sc.hasNext()) {
final String line = sc.next().trim();
... |
71292911-072c-49de-b93c-b722f8330a92 | 6 | @Override
public boolean equals(Object matrix) {
if (!(matrix instanceof Matrix)) {
return false;
}
if (((Matrix) matrix).getRows() != rows || ((Matrix) matrix).getColumns() != columns) {
return false;
}
for (int x = 0; x < rows; x++) {
f... |
baa8146f-62b2-4ea6-bc96-f1a942f0deff | 2 | @Test
public void testNumberOfDoorways()
{
int numDoors = 0;
int totalCells = board.getNumColumns() * board.getNumRows();
Assert.assertEquals(506, totalCells);
for (int i=0; i<totalCells; i++)
{
BoardCell cell = board.getCellAt(i);
if (cell.isDoorway())
numDoors++;
}
Assert.assertEquals(16, n... |
1b7e24d3-8c03-4446-8442-c2f7081ef62c | 1 | public void testSetMinuteOfDay_int2() {
MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8);
try {
test.setMinuteOfDay(24 * 60);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals("2002-06-09T05:06:07.008+01:00", test.toString());
} |
efa28562-c64a-4e05-992b-f00ba11ad06a | 7 | public void keyPressed(KeyEvent key)
{
int code = key.getKeyCode();
if(code == KeyEvent.VK_LEFT)
{
player.setLeft(true);
}
if(code == KeyEvent.VK_RIGHT)
{
player.setRight(true);
}
if(code == KeyEvent.VK_DOWN)
{
player.setDown(true);
}
if(code == KeyEvent.VK_Z)
{
player.setJumping(t... |
fd98a9e3-d3ed-4350-8c82-3c2e86836119 | 2 | public static Object[] sliceFromFinalBoundary(Object[] sequence, Boolean[] boundaries) {
// Find the last boundary. If no boundary is found, -1 is correct since
// when it is incremented it will be zero, the first index in the text
int last = -1;
for (int i = 0; i < boundaries.length; i++) {
if (boundaries[i... |
dffed64d-4bcd-47e9-a4d1-4f3b0c60ac8e | 8 | public static void main(String[] args)
{
// initialize all data
try
{
// start reading the input txt file
String fname = "Assignment03.txt";
Scanner scnr = new Scanner(new File(fname));
int numpatch = scnr.nextInt();
int numit ... |
3f13bcb0-2300-47d9-8a2a-93c1fd29e521 | 8 | public void readInput(int level, String type, Client c, int amounttomake) {
if (c.getItems().getItemName(Integer.parseInt(type)).contains("Bronze"))
{
CheckBronze(c, level, amounttomake, type);
}
else if (c.getItems().getItemName(Integer.parseInt(type)).contains("Iron"))
{
CheckIron(c, level, amountt... |
f88bf8d6-c20e-486c-8965-4fcdf0483169 | 0 | @Override
public void newbie() {
hello.newbie();
} |
f8edcc4a-925c-482e-a557-405de5c419f8 | 2 | private boolean isCtrlTabPressed(KeyEvent e) {
return e.character == SWT.TAB && ((e.stateMask & SWT.CTRL) != 0) && ((e.stateMask & SWT.SHIFT) == 0);
} |
98eac146-4ff4-4ff3-98fa-3fc73c449655 | 2 | public ArrayList<Cliente> searchClientes(String nom){
ArrayList<Cliente> cList = new ArrayList();
ArrayList<Cliente> res = new ArrayList();
cList.addAll(cjtClientes.values());
for(int i=0; i<cList.size(); ++i){
if(cList.get(i).getNombre().contains(nom))
res.ad... |
07f3d126-c0f8-4326-a0b1-1063836f9cd9 | 8 | public void updatePlayerCards(List<Card> cardlist) {
int size = cardlist.size();
if (size >= 2) {
FirstCardPlayer.setImage(new Image(cardlist.get(0).getLink().toString())); //initialize only if the user has only two
FirstCardPlayer.setVisible(true);
SecoundCardPlayer.setImage(new Ima... |
74b9c690-3971-480e-97ff-a2ce14a47e02 | 8 | public List<Integer> getIntegerList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Integer>(0);
}
List<Integer> result = new ArrayList<Integer>();
for (Object object : list) {
if (object instanceof Integer) {
... |
acc218d7-15e1-40f2-80e4-eb93e0e01554 | 9 | @EventHandler
private void onInventoryClick(InventoryClickEvent event) {
if(event.getWhoClicked() instanceof Player) {
if(ColoredArmor.config.getBoolean("Check.move-item")) {
Player player = (Player) event.getWhoClicked();
if(!(player.hasPermission("ca.check.move.bypass"))) {
if(event.getView().getTo... |
58e49528-6def-4af5-9b88-6ea124bef743 | 4 | @Override
public BinaryNodePS<T> addLeftChild(Node<T> parent, T info) {
if (!(parent instanceof BinaryNodePS)) {
throw new DifferentNodeTypesException();
} else if (isSafe() && !contains(parent)) {
throw new NodeNotFoundException();
}
BinaryNodePS<T> bn = (BinaryNodePS<T>) parent;
if (bn.getLeft() != n... |
a90cf44c-4222-44ce-a9e1-48cfabcfc48b | 7 | protected static int levelCapacity(int lev)
{
if(lev == 1)
return 2;
else if(lev == 2)
return 8;
else if(lev == 3)
return 18;
else if(lev == 4)
return 32;
else if(lev == 5)
return 32;
else if(lev == 6)
return 18;
else if(lev == 7)
return 8;
return 0;
} |
163b2d63-c33c-4fd1-9bc2-7e7c1d0fc7e7 | 6 | @Override
public void newSource( boolean priority, boolean toStream, boolean toLoop,
String sourcename, FilenameURL filenameURL, float x,
float y, float z, int attModel, float distOrRoll )
{
SoundBuffer buffer = null;
if( !toStream )... |
bb9eaa39-a072-4a24-82a6-e6637fe1df98 | 0 | public int size() {
return N;
} |
b80fe3d3-f997-490c-8566-ee15ea9d9fe7 | 4 | public void tick (int verb)
{
if(!gameOn) return;
//sets the new ivars
Move newMove = computeNewPosition(verb, currentMove);
//how to detect when a piece has landed
//if this move hits something on its down vert, and the pervious verb was also down
... |
fb11b71c-39b9-4f20-9523-3cbdcf3bc638 | 3 | public void body()
{
//register oneself
write("register this entity to GridInformationService entity.");
super.sim_schedule(GridSim.getGridInfoServiceEntityId(),
GridSimTags.SCHEDULE_NOW, GridSimTags.REGISTER_ROUTER,
new Integer(super.get_id()) );
// ... |
8170a719-2e38-4197-bbdf-fb231192e277 | 7 | private static double calculateAngle(double x1, double y1,
double x2, double y2) {
double dx = x2 - x1;
double dy = y2 - y1;
double angle = 0.0; // Horisontal to the right
if (dx == 0.0) { // Vertical
if (dy == 0.0) { // No angle
angl... |
c413272d-da4c-44df-b4d7-8e8ad0ecf619 | 8 | public static Node sumThat(Node node1, Node node2, int extraCarry, Node result)
{
if(node1==null && node2==null)
return result;
int sum = extraCarry;
if(node1.val != null)
sum += node1.intVal;
if(node2.val != null)
sum += node2.intVal;
if(sum > 10)
{
sum = sum - 10;
extraCarry = 1;
... |
acdc5ea5-e9fd-41b8-a178-7b527b9855a8 | 1 | public List<CallData> getCallData(final String callName) {
List<CallData> callDataList = callData.get(callName);
if(callDataList == null) {
callDataList = new LinkedList<CallData>();
callData.put(callName, callDataList);
callNames.add(callName);
}
return callDataList;
} |
ac56ea6b-f193-4dc8-8a3f-4f616f6c8d35 | 9 | public static float[] fft(final float[] inputReal, float[] inputImag,
boolean DIRECT) {
// - n is the dimension of the problem
// - nu is its logarithm in base e
int n = inputReal.length;
// If n is a power of 2, then ld is an integer (_without_ decimals)
double ld = Math.log(n) / Math.log(2.0);
// Her... |
a70e2815-92e5-4248-be59-f3762a4770f0 | 4 | private void drawTabArea() {
tabImageProducer.initDrawingArea();
Rasterizer.lineOffsets = sidebarOffsets;
inventoryBackgroundImage.drawImage(0, 0);
if (inventoryOverlayInterfaceID != -1)
drawInterface(0, 0, RSInterface.cache[inventoryOverlayInterfaceID],
0);
else if (tabInterfaceIDs[currentTabId] != -... |
e6e63c3a-8918-4db3-b6bf-372973949ffd | 5 | @EventHandler
public void onEntityDamage(EntityDamageEvent event) {
// do not act when disabled TODO, use unregister when available
if ( !this.sheepFeedPlugin.isEnabled() ) {
return;
}
// see whether this is an attack event
if ( event.getCause() != DamageCause.ENTITY_ATTACK ) {
return;
}
Ent... |
98470a6c-da9e-4726-870b-7618fbb1b6bd | 0 | public int getIndex(){
return index;
} |
209bd368-a88f-4d85-a5e6-fcffd4b09878 | 9 | private String romI(int i) {
switch (i) {
case 1: return "I";
case 2: return "II";
case 3: return "III";
case 4: return "IV";
case 5: return "V";
case 6: return "VI";
case 7: return "VII";
case 8: return "VIII";
case 9: return "IX";
default:return "";
}
} |
263ca0db-e1a2-4c08-8ea5-f05315af299a | 8 | public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter pw = new PrintWriter(System.out);
StringTokenizer st;
String line;
int[] LL = new int[100005];
int[] RR = new int[100005];
... |
4b3ca217-92ba-4dd6-8a48-441c0c19859a | 4 | public String toString() {
return new StringBuilder(super.toString())
.append(" [")
.append((this.choked ? "C" : "c"))
.append((this.interested ? "I" : "i"))
.append("|")
.append((this.choking ? "C" : "c"))
.append((this.interesting ? "I" : "i"))
.append("]")
.toString();
} |
6ddd9300-60a1-4123-8b8f-be54f444e090 | 0 | public static void main(String[] args) {
GraphicsMain.init();
main = new Main();
main.start();
} |
2cff7434-dd4f-4743-b61b-8e265b0f4b22 | 7 | private void readEncodingData (int base) {
if (base == 0) { // this is the StandardEncoding
System.arraycopy (FontSupport.standardEncoding, 0, encoding, 0,
FontSupport.standardEncoding.length);
} else if (base == 1) { // this is the expert encoding
// TODO: ... |
abafff04-0582-48eb-bf6d-68528d0b45a5 | 1 | private static byte[] getSecondHalf(byte[] block) {
byte[] temp = Arrays.copyOfRange(block, block.length / 2, block.length);
// middle of block is in the middle of a byte
if ( (block.length / 2d) % 1 == 0.5) {
temp = ByteHelper.rotateLeft(temp, temp.length * 8, 4);
}
... |
5fafbf1f-1960-4830-a6d7-16aa0155e076 | 5 | private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 283, 353);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setTitle("Search");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
e.printStackTrace();... |
65253c9c-020e-4a30-9f42-7ea3552e7cb9 | 2 | public boolean inAny(List<Polygon> polygons) {
for(Polygon p: polygons)
if(p.contains(this))
return true;
return false;
} |
d49c139e-6a68-479f-8b46-85a468ce690b | 6 | void periodCertification() {
int inner = 0;
for (int i = 0; i < 4; i++)
inner ^= sfmt[i] & parity[i];
for (int i = 16; i > 0; i >>= 1)
inner ^= inner >> i;
if ((inner & 1) != 0) // check OK
return;
for (int i = 0; i < 4; i++) {
int work = 1;
for (int j = 0; j < 32; j++) {
if ((work & parity... |
011c7418-1208-41ed-8a8c-e2ef4dbe17b0 | 4 | public static void main(String[] args)
{
if(args.length > 1) {
String filename = args[0];
LinkedList<String> columns = new LinkedList<String>();
for(int i=1; i<args.length; i++) {
columns.add(args[i]);
}
try {
int[] entries = new int[1];
HashMap<Double, Integer> data = calculateDis... |
d6bb25d4-f1b2-456d-aac4-3f6211d6cb7e | 6 | public void update(){
//Sometimes there seems to be a slight lag between audio .start() and .isActive()
//The audioActivation-boolean takes care of that
if(audioActivation && audioClip.isActive()){
audioActivation = false;
}
if(clicked){
clicked();
}else if(!audioActivation&&audioClip!=null&&!aud... |
c0b685c1-e946-4bdf-805a-e1584294e627 | 3 | @Override
public GameState[] allActions(GameState state, Card card, int time) {
GameState[] states = new GameState[1];
states[0] = state;
if(time == Time.DAY)
{
//Do nothing
}
else if(time == Time.DUSK)
{
PickTreasure temp = new PickTreasure();
states = temp.allActions(state, card, time);
}... |
349ffe0e-364a-4f91-bca5-4ceedb696084 | 3 | @SuppressWarnings("unchecked")
public String getOverviewChart() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT team_id, sum(auton_top)*6 + sum(auton_... |
cd06b26e-1cca-48c6-997e-5f1e85b53238 | 0 | public static Image scaleImage(Image source, int width, int height, int gap) {
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = (Graphics2D) img.getGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION... |
25512505-8310-40c9-8632-033de67c9622 | 8 | private boolean r_tidy_up() {
int among_var;
// (, line 183
// [, line 184
ket = cursor;
// substring, line 184
among_var = find_among_b(a_7, 4);
if (among_var == 0)
{
... |
ce5092eb-4a59-421c-99f6-3160ccd41bea | 9 | @Override
public String toString() {
switch (handRank) {
case StraightFlush: return ranks.get(0) + " high " + handRank + " of " + suit;
case FourOfAKind: return "Four " + ranks.get(0) + "s, " + ranks.get(1) + " kicker";
case FullHouse: return handRank + ", " + ranks.get(0) + "s full of " + ranks.get(1) + "... |
7e5db027-4333-42e7-9334-b3a2ddf4d6d5 | 6 | @Override
public void mousePressed(MouseEvent e) {
Piece[][] board = _modelBoard.getBoard();
chessPiece = null;
//Piece[][] board = _modelBoard.getBoard();
Component c = _view.getChessBoard().findComponentAt(e.getX(), e.getY());
if (c instanceof JPanel) return;
if( c == null) return;
Point st... |
fb78bac2-98ac-4979-bcfc-bfbf60a9c04a | 9 | @Override
public void onKeyPressed(char key, int keyCode, boolean coded) {
if(!coded){
if(key == KeyEvent.VK_ENTER){
//Starts playing the midi
this.midiMusic.startMusic(0, null);
//When you start playing a new song, it isn't paused right from the get-go.
this.paused = false;
//And let's reset ... |
62e1d8c7-ed02-45d4-a4bd-880984a3c44c | 0 | @Override
public SkillsMain[] getSkillNames() {
return Constants.rogueSkillSkills;
} |
96d2f3cf-9811-4e28-b684-3f2a2be4e0a8 | 1 | private void afficherDetailsPraticien(String Praticien){
if (ctrlPraticiens == null) {
VuePraticiens vueP = new VuePraticiens(ctrlA);
ctrlPraticiens = new CtrlPraticiens(vueP, vueA);
}
//préparation des combos box
String nomPraticien= Praticien.split(" ")[0];
... |
0d727ae3-91cb-4976-9c90-7038287fbde5 | 3 | public static void main(String[] args)
{
boolean debugger = false;
if(args != null && args.length > 0 && args[0].equals("true"))
{
debugger = true;
}
Main main = new Main(debugger);
main.setVisible(true);
} |
98525eeb-f343-47fb-8d67-85ecea1e1f7a | 0 | public Date getDoneTime() {
return doneTime;
} |
92fd4555-872f-4849-a436-311662112c8a | 6 | public Board(ArrayList<SimulatorRobot> r, String theme) {
setDoubleBuffered(true);
this.bullets = new Vector();
this.deadRobots = new ArrayList();
this.pills = new ArrayList();
this.expAnim = new ArrayList();
this.obstacles = new ArrayList();
this.ovnis = new Arr... |
c5e06a0b-cd74-462e-b025-39be589462df | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if((!mob.amDead())&&((--diseaseTick)<=0))
{
MOB diseaser=invoker;
if(disease... |
c2afb8ab-c9c6-4023-8597-8067bd3083f4 | 2 | private void writeAnimation(Sprite s, XMLWriter w) throws IOException {
w.startElement("animation");
for (int k = 0; k < s.getTotalKeys(); k++) {
Sprite.KeyFrame key = s.getKey(k);
w.startElement("keyframe");
w.writeAttribute("name", key.getName());
for (i... |
a68ac5ba-b9da-4502-a81a-d878a5163cae | 9 | protected static Method findSetter(String name, Class<?> type,
Class<?> self) {
if (name == null || name.trim().isEmpty()) {
return null;
}
Method[] methods = self.getDeclaredMethods();
for (Method method : methods) {
if (!method.getName().equals(name)) {
continue;
}
Class<?>[] ... |
72dda200-1438-4cc9-aa83-fd16f73ea0ea | 1 | private void setTimeSpinners() {
Date date = getDate();
if (date != null) {
timeSpinner.setValue( date );
}
} |
283a576e-dd1f-4e89-8375-a8153fce74cf | 2 | private static Box initialize() {
Box[] nodes = new Box[7];
nodes[1] = new Box(1);
int[] s = {1, 4, 7};
for (int i = 0; i < 3; ++i) {
nodes[2] = new Box(21 + i);
nodes[1].add(nodes[2]);
int lev = 3;
for (int j = 0; j < 4; ++j) {
... |
88fc0be4-b818-40eb-bc10-56beb084f4d2 | 7 | @Override
public int hashCode() {
int result = id;
result = 31 * result + (firstName != null ? firstName.hashCode() : 0);
result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
result = 31 * result + (businessPhone != null ? businessPhone.hashCode() : 0);
result... |
67b1c4c1-383c-41af-8171-caf3e3673318 | 8 | public boolean stateEquals(Object o) {
if (o == this)
return true;
if (o == null || !(o instanceof MersenneTwister))
return false;
MersenneTwister other = (MersenneTwister) o;
if (mti != other.mti)
return false;
for (int x = 0; x < mag01.length; x++)
if (mag01[x] != other.mag01[x])
return fals... |
5d202b10-2038-468d-bbaa-e7b23e7701d6 | 6 | public void equipOutfit(Item outfit) {
if (! (outfit.type instanceof OutfitType)) return ;
final Actor actor = (Actor) owner ;
final JointSprite sprite = (JointSprite) actor.sprite() ;
final Item oldItem = this.outfit ;
this.outfit = outfit ;
if (hasShields()) fuelCells = MAX_FUEL_CELLS ;
//... |
92f19728-4ece-41fd-af09-20ec74055f12 | 9 | private static void parseUnit(UnitTree tree, SourceInputStream in)
throws IOException, ParseException {
int ch = in.read();
List<Tree> children = tree.getChildren();
while (ch != -1) {
in.backup();
switch (ch) {
case '+':
case '-':
children.add(parseInc(in));
break;
case '<':
ca... |
45b431b6-40b0-4a4b-8f15-37cc6e2784ae | 5 | public Collection<String> getFormatableAttributes(Class<?> clazz) {
Collection<String> attributes = new ArrayList<String>();
for(Method m : clazz.getMethods()) {
// lookup getters
String name = m.getName();
if (m.getParameterTypes().length == 0 && name.matches(getterPattern) && !exceptions.contains(name)) ... |
eea13737-16db-4ad6-9525-9df7d2991cc8 | 9 | static String readChunk(BufferedReader br, int len) throws Exception {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; ++i) {
int ch = br.read();
if (ch < 0)
throw new Exception("unexpected EOF in body");
if (ch >= U_0080 && ch < U_0800) // 2 bytes
++i;
else if (ch >= U_D800 &... |
8b4dffe8-b0cd-48cd-9433-1a93845b6758 | 7 | public int SubjectVariable(PHPFileOperations PHPFile, String PHPFileTextClean, int CharNumStart) {
int i = 0, l = PHPFileTextClean.length();
char ch = ' ';
i = CharNumStart;
//recursively detect what follows the function name
while (i < l) {
ch = PHPFileTextClean.cha... |
e61f0548-c615-45aa-9b4f-025205b9b8d0 | 3 | public void vieillir() {
super.vieillir();
loterie = new Random();
if (age > 15)
fertilite = loterie.nextInt(100);
if (age <= 15 && poids < 40)
grossir(loterie.nextInt(3) + 1);
} |
aaf67372-47b0-457c-b8ee-ade4a9bce5f5 | 9 | StandardPlane(AbstractToolkit abstracttoolkit, int i, int i_123_, int i_124_, int i_125_, int[][] is, int[][] is_126_, int i_127_) {
super(i_124_, i_125_, i_127_, is);
anAbstractToolkit8004 = abstracttoolkit;
anInt7993 = -2 + anInt3410;
anIntArrayArrayArray8013 = new int[i_124_][i_125_][];
anIntArrayArrayArra... |
73471b35-effa-4adf-ba13-14d0fec1534d | 8 | public void putAll( Map<? extends Float, ? extends Byte> map ) {
Iterator<? extends Entry<? extends Float,? extends Byte>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Float,? extends Byte> e = it.next();
this.put( e.getKey(),... |
8e437767-e7fd-47b7-bed4-2b9c7e72bb53 | 5 | private void setUpShader(String vertexPath, String fragmentPath) throws IOException {
shaderProgram = glCreateProgram();
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
StringBuilder vertexShaderSource = new StringBuilder();
... |
d973f1c6-3a9b-4feb-aa0e-059ee6dde784 | 7 | public Object newInstance(final Object... override) throws InstantiationException, IllegalAccessException
{
if (clazz != null) {
return clazz.newInstance();
}
else if (isCollection || isArray) {
if (override.length > 0) {
return ((Class<?>) override[0]).newInstance();
... |
3d41dc72-13d9-4707-904f-67e16a8fc1e7 | 3 | @Override
public Titre insert(Titre obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("INSERT INTO Titre (nom,annee,id) VALUES (?,?,?);");
pst.setString(1, obj.getNom());
pst.setString... |
620d522a-a4d9-4e45-8233-26a577833f07 | 0 | @After
public void tearDown() {
} |
c3b3bfd9-7a30-4d35-951f-b15d49b1a5cf | 7 | protected void getClaimDetail(String title) {
if (title != null) {
for (int i = 0; i < claimResultList.size(); i++) {
if (claimResultList.get(i).getTitle().equals(title)) {
if (!(claimResultList.get(i).getDescription() == null
|| claimResultList.get(i).getDescription().equals("null"))) {
des... |
a7768fb8-d285-48a0-9e7b-4fb1115aa675 | 8 | Color getShadedColorForType(int pType, double pSunValue)
{
double lBrightness;
if(pSunValue < 0)
{
// The sun is below the horizon.
lBrightness = fNightSideBrightness / 100;
} else
{
// The sun is above the horizon. The brightness will range from
// the base to the maximum... |
192ec7d1-aad4-42aa-9135-8f1fc04b8dae | 3 | public void redraw() {
// update playing area
// 1) look at cards in playerHand and dealerHand and add/update labes in the "Grid"
for (int i = 1; i < dealerHand.getCardCount() + 1; i++) {
Card dealerCard = dealerHand.getCard(i - 1);
arLblDealer[i].setIcon(new ImageIcon(Ge... |
2518c31d-227d-44ce-9db9-5b70663038dd | 2 | public static BufferedImage crop(BufferedImage image, int x, int y, int width, int height) {
return image.getSubimage(x, y, (width > 0 ? width : 1), (height > 0 ? height : 1));
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.