method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
78dc122d-66c7-44cd-9ebe-eab715c2abf5 | 0 | public int getDoneSymbols() {
return completedSymbols;
} |
ad010417-f480-4715-aac0-c09fdd78714b | 5 | private void verifBouton() {
if ((!nomProjet.getText().isEmpty() && !dateFinPrevue.getText().isEmpty()
&& !dureeProjet.getText().isEmpty() && !prixJournee.getText().isEmpty()
&& !clientSelectionne.getText().isEmpty())) {
validerNouvProjet.setEnabled(true);
}
... |
7192ba62-6f9c-44e5-800d-3c6e706d4b03 | 3 | public void grille(){
for(int y = 0; y<env.taille_envi;y++){
for(int x = 0; x<env.taille_envi;x++){
if(env.grille[x][y]!=null){
Graphics g = agent[x][y].getGraphics();
g.setColor(((Particule)env.grille[x][y]).color);
g.fillOval(0, 0, agent[x][y].getHeight(), agent[x][y].g... |
8722f193-424d-41dd-841c-2876b3e67215 | 5 | protected String RemoveNonNumbers(String input)
{
String temp = "";
for (int i = 0; i < input.length(); i++)
{
int c = (int)input.charAt(i);
if ((c >= 48 && c <= 57)
|| c == 10
|| c == 46)
{
temp += (char)c;
}
}
return temp;
} |
51e3e4e3-857d-4213-9fe9-94b10acb10e4 | 4 | @Override
public void deserialize(Buffer buf) {
super.deserialize(buf);
firstNameId = buf.readShort();
if (firstNameId < 0)
throw new RuntimeException("Forbidden value on firstNameId = " + firstNameId + ", it doesn't respect the following condition : firstNameId < 0");
la... |
d761686f-70b2-49a3-8efa-224f473a31de | 1 | public void uimsg(String msg, Object... args) {
if (msg == "sz") {
isz = (Coord) args[0];
recalcsz();
}
} |
28a5b567-2595-4bcc-9aa2-f9a2f653ff2d | 6 | public static void makeAllPieces() { // Make an image showing all the pieces in all postions
BufferedImage icons = new BufferedImage(9*56,12*56,BufferedImage.TYPE_INT_RGB);
Graphics g = icons.getGraphics();
g.setColor(Color.white);
g.fillRect(0,0,9*56,12*56);
g.setColor(Color.black);
... |
a1c25558-15d1-4f58-a5ce-1112adbb2aa4 | 7 | public void scanColumn(int columnPoint) {
HashMap<Integer, SpanInfo> rowMap = new HashMap<Integer, SpanInfo>();
SpanInfo si = new SpanInfo();
si.name = originTable[0][columnPoint];
si.row = 0;
si.num = 0;
rowMap.put(0, si);
for (int i = 0; i < originTable.length; i++) {
if (si.name.equals(originTable[i... |
6b502a64-526c-4338-bf35-1ce8bd8d1d18 | 0 | public GetQuestionsFromSqliteDatabase()
{
} |
eb14dfe8-9b28-4900-9d46-118a5e9f0d1b | 7 | protected Long coerceToLong(Object value) {
if (value == null || "".equals(value)) {
return Long.valueOf(0l);
}
if (value instanceof Long) {
return (Long)value;
}
if (value instanceof Number) {
return Long.valueOf(((Number)value).longValue());
}
if (value instanceof String) {
try {
return ... |
c8164644-15e1-4161-ae21-39e7501e9fd4 | 2 | @FXML
protected void doubleClickPlaySelectedSong(MouseEvent mouseEvent) throws Exception {
if (mouseEvent.getButton().equals(MouseButton.PRIMARY)) {
if (mouseEvent.getClickCount() == 2) {
playSong();
}
}
} |
f9aa3d78-a6ef-4fa8-b111-86d2f1df2931 | 2 | public EditorController getLevel(File file)
throws LevelMisconfigurationException {
// loads just the level itself from the xml
Level level = XmlService.getInstance().getLevelFromFile(file);
EditorController controller = new EditorController();
int col = XmlService.getInstance().getMaxColumnCount(level.getRo... |
14b8fe27-841d-42ff-8f0e-6cad5425aef4 | 8 | public static String sample(String srcfile,int sampleN,int N) throws IOException{
String output = srcfile.substring(0, srcfile.indexOf(".")) + "_sample.txt";
File fout = new File(output);
if (fout.exists()) {
fout.delete();
}
ArrayList<Integer> trainIndices = new ArrayList<Integer>(sampleN);
BootStrapSa... |
dfd2263e-4d13-49d3-90cb-2f6138b8c208 | 7 | public boolean equals(ChessPiece p) {
if (p.TYPE != TYPE ||
p.COLOR != COLOR ||
p.RANGE != RANGE ||
p.ATTACK_SLOPES.length != ATTACK_SLOPES.length ||
p.hasMoved != hasMoved)
{
return false;
}
for (int i = 0;i < ATTACK_SLOPES.le... |
881af905-ffd2-4757-b7a0-035682f9b96f | 0 | public void pushOperand(double operand){
operandStack.push(operand);
} |
2639562b-fa4d-461a-9d83-64bd35f95ed0 | 0 | public void setVitality(double vitality) {
this.vitality = vitality;
} |
b066f2f9-4c08-4a6d-90e7-4ee5b1462831 | 0 | public Upgrade(UpgradeType type, String name, Ability additionalAbility) {
this.type = type;
this.name = name;
this.additionalAbility = additionalAbility;
} |
da0c8b8a-3ba5-4153-a4ef-d0486003a4ef | 9 | public ImageData getImageData() {
Point size = getSize();
/* Create a 24 bit image data with alpha channel */
imageData = new ImageData(size.x, size.y, 24, new PaletteData(0xFF, 0xFF00, 0xFF0000));
imageData.alphaData = new byte[imageData.width * imageData.height];
drawCompositeImage(size.x, size.y);
... |
5d9b907f-bf47-4725-a934-df3961b666ed | 5 | public Forwarder() throws JSchException {
worker = new Thread(new Runnable() {
@Override
public void run() {
while (!Thread.interrupted()) {
lock.lock();
try {
if (init) {
try {
inits();
} catch (JSchException e) {
// TODO Auto-generated catch block
e.... |
465c977b-1cbd-41d6-b557-83c1250ece5f | 7 | public void set(String[] command) {
int idIn = Integer.parseInt(command[0]);
int noIn = Integer.parseInt(command[1]);
int idOut = Integer.parseInt(command[2]);
int noOut = Integer.parseInt(command[3]);
CompuertaLogica compIn = null;
CompuertaLogica compOut = null;
... |
f8645af0-d967-4634-b195-ad8699fc431f | 9 | private boolean addStack(Stack stack,
LinkedHashMap<Integer,Stack> destinationStack)
{
if ((null == stack) || (null == destinationStack)) return false;
Integer subStackKey = Integer.valueOf(stack.stackID());
// When the stack ID is zero, the keys in the sub-stack map are
// set incr... |
966866c6-a20f-4d44-974d-1325928b103d | 8 | public void doAlignment(String sq1, String sq2) {
super.prepareAlignment(sq1, sq2);
int n = this.n, m = this.m;
float[][] score = sub.score;
start = new TracebackSimple[2][sq2.length() + 1];
char[] s1 = sq1.toCharArray();
char[] s2 = sq2.toCharArray();
... |
43defc68-c43c-453b-8d87-89dea7ac68dc | 6 | @Override
public void actionPerformed(ActionEvent e) {
visibleScreen.getFrame().getContentPane().removeAll();
visibleScreen.getSetup().getRound().getPlayerInTurn().clearListOfLastCheckedCards();
visibleScreen.getSetup().getRound().playTurn();
if (visibleScreen.getSetup().getRound(... |
72bf5a0b-6e93-4805-876e-2a9113437819 | 1 | @Override
public int hashCode() {
int hash = 0;
hash += (idPerfil != null ? idPerfil.hashCode() : 0);
return hash;
} |
6f6391d4-ce9c-4bd5-955c-7ceb530aa57f | 0 | public void addExpressionListener(ExpressionChangeListener listener) {
listeners.add(listener);
} |
64b295cc-e557-43fc-b72b-0d1b0633ddf5 | 0 | public List<T> findAll() {
javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();
cq.select(cq.from(entityClass));
return getEntityManager().createQuery(cq).getResultList();
} |
e9dfa775-d4f5-4ce2-8692-4f4b7b2085b2 | 9 | private String checkValidArguments(String operation, String[] arguments)
{
//Checks if actual operation
if(!operationArgs.containsKey(operation))
{
return "The operation you requested could not be found: " + operation;
}
//TODO Consolidate this and make it more efficient
//Checks number of arguments.
... |
38cbbd01-00af-4a7c-9cf1-fcea41929370 | 6 | private boolean isValidEmpNum(){
boolean isValid = false;
if(employeeNumber.length() != 5){
return false;
}else{
if(employeeNumber.charAt(3) != '-')
return false;
else{
if((employeeNumber.charAt(4) >= 'A' && em... |
94f805ef-583c-40dd-9147-fa019d4d0cb0 | 2 | private static int cyclesHeight(int n) {
int height = 1;
for (int i = 0; i < n; i++) {
if (i % 2 == 0) {
height *= 2;
} else {
height++;
}
}
return height;
} |
0fb613db-21fc-4dbe-92f5-890ee207ad83 | 6 | private boolean calculate(Double number) {
LOG.debug("START_METHOD calculate().");
boolean ret = true;
switch ( operation ) {
case OPERATION_ADD:
{
result += number;
LOG.info("Execute operation ADD for number < " + number + " >. Result operation is " + result);
break;
}
... |
4c9264a9-67ea-4425-896d-b49fc908078a | 9 | public int threeSumClosest(int[] num, int target) {
// similar to threeSum; keep track of the min_diff
if (num.length < 3) {
return Integer.MAX_VALUE;
}
int diff = Integer.MAX_VALUE;
int result = 0;
int[] r = new int[3];
Arrays.sort(num);
for (... |
3e6d46a9-ba60-43b8-b731-e45ff7cb2fd5 | 5 | private void create(int[] init, Color bg, String fieldTitle) {
setPreferredSize(new Dimension(GUIConstants.DEFAULT_FIELD_WIDTH, FIELDHEIGHT));
setBackground(bg);
setBorder(BorderFactory.createTitledBorder(fieldTitle));
setLayout(new VerticalLayout(0, VerticalLayout.CENTER));
setT... |
b6f601b3-8fd1-4f6c-94b6-c7f2c72c8172 | 0 | public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
} |
639e0504-77c3-472e-a800-35a076a6224b | 0 | public void setRealname(String realname) {
this.realname = realname;
} |
3a5dba5b-6700-4a86-a1ea-f3af1b162697 | 5 | public void process() throws IOException {
T incomingMessage= _tokenizer.getMessage(_in);
while ((!_serverStop.getValue()) && (!_protocol.isEnd(incomingMessage))){
String response = _protocol.processMessage(incomingMessage);
if (response != null){
addToOutBuffer(response);
}
incomingMessage= _tokeni... |
05270c18-16ac-4dde-bbac-7dc02028cbbb | 7 | public static void main(String[] args) {
LogManager.getLogger(Lab5Test.class).log(Level.INFO, "TEST START");
final Scheduler scheduer = new Scheduler();
Runnable generatorRunnable = new Runnable() {
@Override
public void run() {
Proxy proxy = scheduer.getProxy();
Random rand = new Random(System.... |
63ff5b38-4fbb-44e3-b326-c1c24443fad7 | 4 | private String map () {
if (mapType == 0)
map ="roadmap";
else if (mapType == 1)
map = "terrain";
else if (mapType == 2)
map = "satellite";
else if (mapType == 3)
map = "hybrid";
return (map);
} |
c8a55f16-2297-4ade-9c7f-a8bdab859f26 | 3 | private synchronized void savePage(Page page) {
FileWriter writer = null;
try
{
writer = new FileWriter("page" + page.getPageId());
writer.write("LSN:" + Integer.toString(page.getLsn()) + "|");
writer.write("taId:" + Integer.toString(page.getTa().getTaId()) + "|");
writer.write("data:" + page.getDa... |
682377dd-8047-4553-8f20-54214f26dc1f | 2 | public int connect() {
System.out.println("Connecting to the database...");
int errorCode = 0;
// load MySQL driver
// --- 1) get the Class object for the driver
try
{
Class.forName ("com.mysql.jdbc.Driver");
System.out.println("Found/loaded MySQL Connector JDBC driver");
}
c... |
62d4a18d-c1b6-48e5-8e86-924237aa05b3 | 7 | public void run()
{
// システム情報取得
String str = System.getProperty("os.name");
mOSName = str;
str = System.getProperty("os.arch");
mOSArch = str;
str = System.getProperty("os.version");
mOSVersion = str;
str = System.getProperty("user.name");
mUserName = str;
DebugLog("user name:" + str);
DebugLo... |
8f3c3188-df69-4a6b-ab21-bf8660e34dc7 | 2 | private int[] initRandomArray(int i) {
Random r = new Random();
int[] array = new int[i];
for (int j = 0; j < array.length; j++) {
array[j] = j;
}
/**
* for i from n − 1 downto 1 do
* j ← random integer with 0 ≤ j ≤ i
* exchange a[j] and a[i... |
30bd4d3e-1cb8-487a-988a-1b06822a1c17 | 4 | protected void initFromModel() {
Random rand = new Random();
for (int x = 0; x <= 3; ++x) {
int maxY = 3 - x;
for (int y = -3; y <= maxY; ++y) {
int r = rand.nextInt(HexType.values().length);
HexType hexType = HexType.values()[r];
HexLocation hexLoc = new HexLocation(x, y);
getView... |
a6790794-d974-4a2e-a83f-983b936ec401 | 5 | final int[][] method3047(int i, int i_0_) {
if (i_0_ != -1564599039)
return null;
anInt9356++;
int[][] is = ((Class348_Sub40) this).aClass322_7033.method2557(-90, i);
if (((Class322) ((Class348_Sub40) this).aClass322_7033).aBoolean4035) {
int[] is_1_ = this.method3048(i, i_0_ + -2096661920, 2);
int[]... |
26a3c691-0e9c-4943-8379-de04c72f2779 | 7 | public void run() {
try {
Socket socket = new Socket(this.hostName, this.portNumber);
ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream());
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String fromServer = "";
... |
b489b049-7ed1-4bf3-a596-228ee3680a82 | 9 | public BufferedImage read() throws IOException
{
if (!sourceFile.exists())
{
throw new FileNotFoundException(
"Could not find file: " + sourceFile.getAbsolutePath()
);
}
/* TODO refactor.
* The following code has been adapted from the
* StreamThumbnailTask.read method.
*/
ImageInputStr... |
68e93e88-50dc-4746-bc50-157f8b5d6987 | 6 | public void move() {
Direction direction = DirectionMove.selectDirection();
switch (direction) {
case LEFT:
moveOnAxisX(direction);
break;
case RIGHT:
moveOnAxisX(direction);
break;
case DOWN_LEFT:
... |
29d8f566-2a91-49cc-96a5-0e7bb937fb2c | 3 | public Collection<V> values() {
Set<Map.Entry<K, CachedValue<V>>> entrySet = cache.entrySet();
List<K> expiredKeys = new ArrayList<K>(128);
Collection<V> result = new ArrayList<V>(entrySet.size());
for (Map.Entry<K, CachedValue<V>> entry : entrySet) {
CachedValue<V> cachedVal = entry.getValue();
... |
b3509fee-3aef-4bf8-9007-69a53b02db7b | 7 | public static void rsaCrypterFile(CryptobyConsole console) {
scanner = new Scanner(System.in);
do {
System.out.println("\n");
System.out.println("RSA File Cryption");
System.out.println("-----------------\n");
System.out.println("1 - Encryption and genera... |
1e8bd363-0d89-4965-b00e-9a24eddfdf85 | 2 | public ArrayList<HiloBean> getPage(int intRegsPerPag, int intPage, ArrayList<FilterBean> alFilter, HashMap<String, String> hmOrder) throws Exception {
ArrayList<Integer> arrId;
ArrayList<HiloBean> arrHilo = new ArrayList<>();
try {
oMysql.conexion(enumTipoConexion);
arrId... |
f8be9cee-a8d0-40f9-b560-46c69304af0f | 2 | public void weeklyBonus(Player player)
{
if (color == player.getColor()) {
for (Artifact a: active.values()) {
a.weeklyBonus(player);
}
}
} |
7ee61d5e-eb78-4e1c-90c5-1dba41ea4fb3 | 5 | public boolean mouseup(Coord c, int button) {
for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
if (!wdg.visible)
continue;
Coord cc = xlate(wdg.c, true);
if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) {
if (wdg.mouseup(c.add(cc.inv()), button)) {
return (true);
}
}
}
r... |
602e2f84-6830-4e66-87b0-7c24e5777a27 | 6 | public synchronized void setRun(int state) throws InvalidArgumentException {
if (state == NEW || state == RUNNING || state == ERROR || state == PAUSED || state == DISCONNECT || state == CLOSED) {
this.state = state;
} else {
throw new InvalidArgumentException("State must equal NE... |
fb7af328-967d-4069-a1ed-b1e08fa064d1 | 9 | @Override
public boolean perform(final Context context) {
// Example: /<command> format set[ <Player>] <Format>
if (context.arguments.size() < 3) return false;
OfflinePlayer target = Parser.parsePlayer(context, 2);
if (target == null && context.sender instanceof OfflinePlayer) targe... |
8b92f91f-1420-429e-9135-c467deee4062 | 5 | public void drawLoadGraph(Graph graph){
if (graph==null) return ;
controller.setModel(graph);
this.diagramPanel = new DiagramPanel(graph);
this.setPopMenu(new PopUpMenu(getDiagramPanel()));
diagramScrollPane.setViewportView(this.getDiagramPanel());
int x = 0;
int ... |
410eece5-a62a-451e-82a1-31731bd9226e | 2 | @Override
public void addResult(String key, Result r) {
if(results.containsKey(key) && results.get(key) != null){
results.get(key).add(r);
}
else{
ArrayList<Result> list = new ArrayList<Result>();
list.add(r);
results.put(key, list);
}
} |
fc481ea9-b87e-4ee9-85b8-e13e2c0c832d | 9 | public static void evaluateEquivalentProposition(Proposition self) {
{ Vector arguments = self.arguments;
Stella_Object firstarg = Logic.innermostOf((arguments.theArray)[0]);
Stella_Object secondarg = Logic.innermostOf((arguments.theArray)[1]);
if (Proposition.trueP(self)) {
if (Propositi... |
3cc2d1bf-680a-4619-89a9-06d470645471 | 9 | @Override
public P<NeuronStorage, List<Integer>> processAlg(Void _v) {
Main.print("VectorQuantizer start " + new Date());
List<Integer> indexes = new ArrayList<Integer>();
for (int i = 0; i < blocks.size(); i++) {
ColoredBlock cb = blocks.get(i);
NeuronSeq history = new NeuronSeq();
for (int j = 0; j <... |
184b9bfa-cf8e-4723-a4c3-1b2039d27e97 | 1 | public ArrayList<LinkedHashMap<Path, Patch>> listFilesDiffsFromSourcewToTarget() throws IOException{
ArrayList<LinkedHashMap<Path, Patch>> patches = new ArrayList<LinkedHashMap<Path,Patch>>();
for(int i=0;i<targetDirs.size();i++)
patches.add(getFileDiffsOfDirectories(sourceDir,targetDirs.get(i)));
re... |
897d86c3-4ea6-4676-a235-94f92617954a | 4 | public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
out.println("Please enter the maze you would like to run:");
String input = "src/MazeReadIn/trickySearch";//console().readLine();
String output = input+"Solution";
Maze myMaze = ReadMaze.parseMaze(input); // classNa... |
f22be02f-8fe2-4c31-b0c3-0caf6db4c831 | 0 | public CompanyPendingApplication() {
setIconImage(Toolkit.getDefaultToolkit().getImage(CompanyPendingApplication.class.getResource("/InterfazGrafica/Images/pendientes.png")));
getContentPane().setBackground(new Color(248, 248, 255));
setBounds(10, 50, 836, 758);
getContentPane().setLayout(null);
contentPanel.setBackgro... |
aeb8bc62-c9b6-4183-93f9-ab1799880b3c | 9 | public Location getPlayerSpawnLocation(Player player, Location location){
Location location_new = location;
String worldName = location.getWorld().getName();
for (String worldN : plugin.mainWorlds){
if (worldName.startsWith(worldN + "_")){
//World is a copy world
String playerName = player.getName()... |
41914bcc-5a6a-4b48-a262-886a7ea52667 | 2 | public void createNewPerson(Person person, String name, String email, String contactNumber, String address, int accessLevel, String password, String vatNumber, String contactName ){
if (person instanceof Customer){
customerList.add( new Customer(name, email, contactNumber, address));
}
else if(person instanceo... |
e072bafd-8262-4e49-b24e-874bf1979bff | 7 | public boolean isSameTree(TreeNode p, TreeNode q) {
if (p ==null&&q ==null){
return true;
}
if (p ==null||q == null){
return false;
}
if (isSameTree(p.left,q.left)&&isSameTree(p.right,q.right)&&p.val == q.val){
return true;
}
el... |
c102dc7b-80e3-43b0-8ec9-f29b90103582 | 6 | public void keyPressed(KeyEvent e) {
int code = e.getKeyCode();
if (e.VK_LEFT == code) {
desiredVelX = -1;
desiredVelY = 0;
}
if (e.VK_RIGHT == code) {
desiredVelX = 1;
desiredVelY = 0;
}
if (e.VK_UP == code) {
d... |
3c0122c0-23bf-494d-8fa2-b5f0a0947469 | 6 | @EventHandler
public void SilverfishMiningFatigue(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.getSilverfishConfig().getDouble("... |
8230d937-c431-4aeb-ab17-899b6b609dcd | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
3eb34166-8a63-4e8a-af51-601f0df61551 | 2 | private TreeMap<Float, Point2D.Float> pairPriceWithMarketByDate(
TreeMap<Float, float[]> technicals, int idPt) {
TreeMap<Float, Point2D.Float> pricePoints = new TreeMap<Float, Point2D.Float>();
for (Entry<Float, float[]> ent : technicals.entrySet()) {
try{
Point2D.Float priceMatch = new Point2D.Float(ent.g... |
c51e7825-c971-4ea6-8d6d-e5fd8a43f29f | 1 | public void merge(Cluster cluster) {
for (int i = 0; i < cluster.size(); i++)
this.addInstance(cluster.get(i));
} |
d9c48e25-0b74-4212-9eeb-21835864386d | 3 | public static void setPageMargins(PrintService service, PrintRequestAttributeSet set, double[] margins, LengthUnits units) {
PageOrientation orientation = getPageOrientation(service, set);
if (orientation == PageOrientation.LANDSCAPE) {
setPaperMargins(service, set, new double[] { margins[3], margins[0], margin... |
d0153156-8ca2-4121-ba94-65cbfc1fcc3f | 7 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (task != null) {
return true;
}
// Begin hitting the s... |
7ae37990-d143-4228-882f-49ffe46be252 | 1 | @Override
public void run() {
InputStream is;
try {
is = client.getInputStream();
DataInputStream dis = new DataInputStream(is);
Date d = new Date(dis.readLong());
System.out.println("Client " + d + " socket: "
+ client.toString());
client.close();
} catch (IOException e) {
// T... |
41482a1f-5aba-496a-be0b-0e03159eb077 | 2 | public static void main(String[] args){
for(int i=1;true;i++){
int tri = getTri(i);
if(numOfFactors(tri)>500){
System.out.println(tri);
break;
}
}
} |
80e72598-4686-495f-bac8-ace850ca0331 | 3 | public static void main(String[] args) throws IOException{
Board board = new Board();
BoardGUI boardGUIStart = new BoardGUI(board);
JFrame frame = addToFrame(boardGUIStart);
List<Move> moves = new ArrayList<Move> ();
try {
Move move1 = new Move(new Coordinate("E2"), new Coordinate("E4"));
Move move2 ... |
af596963-e8db-41e6-8990-3437392e579f | 6 | public void updateTotal(int col)
{
int totalHours = 0;
int totalMinutes = 0;
int currentRow = 0;
while(currentRow < tableRows-1 && tableData[currentRow][col] != null && tableData[currentRow+1][col] != null)
{
//Elaborated for visibility purposes
int hourIn = timeToCode(tableData[curren... |
b97d03a6-4f30-47d5-b3eb-496a9b67f59c | 8 | public void ProcessInput(int key)
{
if(Keyboard.KEY_W == key)
{
if(holder != null)
holder.Step(Directions.NORTH);
}
if(Keyboard.KEY_D == key)
{
if(holder != null)
holder.Step(Directions.EAST);
}
if(Keyboard.KEY_A == key)
{
if(holder != null)
holder.Step(Directions.WEST);
}
if(K... |
ec2f6eb6-96e0-4cd8-b77c-644d531f0690 | 8 | public static AABB createMeshAABB( Mesh mesh )
{
Vector3f min = new Vector3f( 0, 0, 0 );
Vector3f max = new Vector3f( 0, 0, 0 );
for ( Triangle triangle : mesh.getTriangles() )
{
for ( int i = 0; i < 3; i++ )
{
Vector3f vector = triangle.getPoint( i + 1 );
float posX = vector.getX();
float po... |
531fd7f9-faf0-47de-8129-eb074ef3fdd5 | 9 | public static void saveHighScores(){
//Erase and recreate save file
try{
Game.file.delete();
}catch(Exception e){
e.printStackTrace();
}
try{
if (!Game.file.exists()) {
Game.file.createNewFile();
}
}catch(IOException e){
e.printStackTrace();
}
long winnerTime = (Game.stopTime-Game.st... |
b0643068-9404-4328-b86d-4e3470a50421 | 8 | public void setOptions(String[] options) throws Exception {
String mString = Utils.getOption('P', options);
if (mString.length() != 0) {
setPercent((double) Double.parseDouble(mString)); //setNumberOfAttributes((int) Integer.parseInt(mString));
} else {
setPercent(0);
mString = Utils.getOption('... |
450b58f8-7888-4622-9326-c1b7e205a040 | 2 | @Override
public boolean activate() {
if(Tabs.getCurrent() != Tabs.INVENTORY && hasSpinTicket()) {
return false;
}
return hasSpinTicket();
} |
962cec63-bd36-40aa-aa48-f1fce5fd7bb3 | 7 | public void loadTable()
{
if(isTableLoaded())
return;
table = new double[350][23];
BufferedReader br = null;
String line = null;
StringTokenizer tok = null;
int y = 0, x= 0;
try
{
br = new BufferedReader(new InputStre... |
8be7b506-0658-4cc7-b056-53ec4a5deb59 | 2 | private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed
if (task == null || !task.isAlive()) {
return;
}
task.interrupt();
setEnableControls(true);
setRunningIndicator(false);
sout.println("\n\nSTOPPE... |
b3c5d027-625e-4206-ad8d-36edbc7f65a0 | 9 | protected String getStandardHitWordInternal(int type, int damnCode)
{
damnCode++; // always add 1 because index into hitwords is type=0, annoy=1;
final Object[][][] hitWords = CMProps.getListFileGrid(CMProps.ListFile.DAMAGE_WORDS);
if(hitWords != hitWordsChanged)
{
hitWordsChanged=hitWords;
hitWordIndex=... |
a9421f47-8a0d-4df3-b1b9-1e0e979f157c | 6 | Class226(int i, IndexLoader class45, IndexLoader class45_3_) {
do {
try {
aClass45_2961 = class45;
aClass45_2965 = class45_3_;
if (aClass45_2961 != null)
aClass45_2961.getAmountChildEntries(0);
if (aClass45_2965 == null)
break;
aClass45_2965.getAmountChildEntries(0);
} catch (RuntimeExc... |
4c72d7af-4b0c-4507-a2a3-604f9dca48b7 | 9 | public void resetGame(int sx,int sy)//清空地圖、隨機地圖、重設按鈕文字
{
gameOver = false;
aroundBombNum = new int[mapHeight][mapWidth];//清空地圖
map = new boolean[mapHeight][mapWidth];
isPressed = new boolean[mapHeight][mapWidth];
isTurned = new boolean[mapHeight][mapWidth];
i... |
0f535f9a-9868-4174-894c-5eb801430afb | 1 | public void toggleClick() {
if (this.isSelected == false) {
this.isSelected = true;
}
else {
this.isSelected = false;
}
repaint();
} |
96ce91b4-f51f-4524-8271-29333f643187 | 0 | public int getRowCount() {
return data.size();
} |
35ccc613-5477-4109-9103-e8b16215931e | 4 | public int getOpcode(final int opcode) {
if (opcode == Opcodes.IALOAD || opcode == Opcodes.IASTORE) {
// the offset for IALOAD or IASTORE is in byte 1 of 'off' for
// primitive types (buf == null)
return opcode + (buf == null ? (off & 0xFF00) >> 8 : 4);
} else {
... |
971fe56e-13f0-4ef0-a7b1-6854b3e1512e | 1 | private void notifyListeners()
{
for (AnswerSideListener listener : listeners)
listener.onAnswerSideChanged(answerSide);
} |
f86522ae-6826-49f6-ba06-a0c437c8705d | 4 | private void processFilterFiles(Sim_event ev)
{
if (ev == null) {
return;
}
Object[] data = (Object[]) ev.get_data();
if (data == null) {
return;
}
Filter f = (Filter) data[0];
int destination = ((Integer) data[1]).intValue();
... |
1d5eb74f-5ab4-4531-8a4f-18ef617975fa | 3 | private boolean isBlocked(float x, float y) {
boolean blocked = false;
float tweakedX = x + 4;
float tweakedY = y + 8;
beeBoundingRect.setLocation(tweakedX,tweakedY);
for(int i = 0; i < map.length; i++){
if(beeBoundingRect.intersects(map[i])){
if(map[i].type !=... |
41ab2833-90cc-43c2-816c-e6b414a7f346 | 7 | */
private void updateMouseAutoScroll(Point point) {
// FIXME: This entire thing is some huge pile of fail.
// It scrolls too slowly and causes viewport issues.
if (!(getParent() instanceof JViewport)) {
return;
}
JViewport p = ((JViewport) getParent());
Rectangle vr = p.getViewRect();
... |
9a78f019-d228-414d-805e-2730ea896137 | 5 | private void addProperty(PropertyDescriptor propertyDescriptor,
JComponent editor, GridBagLayout grid) {
String text = propertyDescriptor.getDisplayName();
String newText = "";
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (((c >= 'A'... |
9d80e93a-ee48-41a9-ab08-8f71084837f8 | 9 | static void RunMessagesOption(Client client, Scanner scanner)
throws UnspecifiedErrorException, IOException, InvalidHeaderException {
MessagesOptionShell.in = scanner;
MessagesOptionShell.client = client;
StringBuilder builder = new StringBuilder(String.format("\n%s > %s\n\n", SHELL_TITLE, Options.MESSAGES... |
7e487793-c57e-4e24-8818-83a4ffbca2e7 | 7 | public NodeFoldingComponent(NodeView view) {
super();
if (logger == null) {
logger = freemind.main.Resources.getInstance().getLogger(
this.getClass().getName());
}
this.nodeView = view;
setModel(new DefaultButtonModel());
init(null, null);
... |
62bba120-b7d1-4515-bfeb-7efa27d2baa8 | 2 | public void update() {
if (timer >= frames.get(frameNum).duration) {
timer = 0;
if (++frameNum >= frames.size()) {
frameNum = 0;
}
} else {
timer++;
}
} |
a2ba84d7-64f4-4a7e-819d-4fc83069b189 | 1 | @Override
public void setCorrectAnswer() {
for (int i=1; i<=col1Choices.size(); i++){
int choice = InputHandler.getInt("Which item in column 2 matches item "+i+" from column 1?");
answer.put(i, choice);
}
} |
47bdd991-ca0d-4682-9800-99f1c3a9adfa | 9 | public int volumnwithwater(int[] A) {
int[] Av = new int[A.length];
int volumn = 0;
int lmax = 0;
while (lmax < A.length) {
int p = lmax;
while (p < A.length && A[p] <= A[lmax])
p += 1;
if (p < A.length) {
volumn += (p-lmax... |
077a6fd5-b123-4e88-a826-00d386fc97a6 | 8 | private char scanCells(Direction direction) {
final boolean isHorizontal = direction == Direction.Horizontal;
for (int i = 0; i < _board.length; ++i) {
final char startToken = _board[isHorizontal ? i : 0][isHorizontal ? 0
: i];
boolean foundWinner = true;
for (int j = 1; j < _board.length; ++j) {
... |
780fa9a0-030b-45af-86fd-53b97ca2d37c | 4 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof DenseGrid) {
DenseGrid<?> other = (DenseGrid<?>) obj;
return Arrays.equals(values, other.values);
}
return super.equals(obj);
} |
fc63c248-e2de-4d43-88f4-ad1335a2d44c | 8 | private String contohex (int num) {
String test = "";
for (int i = 16; i >= 1; i = i / 16) {
if (num / i < 10) test += num / i;
else if (num / i == 10) test += "A";
else if (num / i == 11) test += "B";
else if (num / i == 12) test += "C";
else if (num / i == 13) test += "D";
else if (num / i == 14... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.