method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
53770df3-4c73-458e-a0ea-004b97488cd9 | 1 | @Override
public String getAnswerText() {
return isChecked ?
exceptionClass.getSimpleName() + " is checked exception"
: exceptionClass.getSimpleName() + " is unchecked exception";
} |
05f307f3-2143-4ede-9c38-d45a69a891ed | 8 | public void comb_filter(final float[] exc,
final int esi,
final float[] new_exc,
final int nsi,
final int nsf,
final int pitch,
final float[] pitch_gain,
... |
f873f2d2-d98c-4deb-8e13-408f9e8ba355 | 7 | public double[] getEigenEnergy() {
if (eigenEnergy != null) {
return eigenEnergy;
}
ArrayList<Double> eigenEnergyList = new ArrayList<Double>();
// Among all intervals we are looking for those which are truly quantum wells, they bring all the information.
for (int i ... |
56a9d6ac-aec7-4627-ba63-f5bf0b10fd45 | 2 | public void RemoveListener() {
if (UI.instance != null && action.length > 1) UI.instance.menugrid.listeners.remove(action[1]);
} |
3b792f78-53e8-40f7-aaa5-f8e2edaf2d6a | 0 | private ItemFactory(){
} |
2ea126f8-95a4-425e-b182-28525b3359fb | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MyString)) {
return false;
}
MyString other = (MyString) obj;
if (name == null) {
if (other.name != null) {
return false;
}
} else... |
ded3661c-6c1c-45ae-b6cd-2669d5b86a3e | 4 | public static void main(String[] args) {
long sum = 0L;
Map<Integer, String> names = new HashMap<>();
names.put(1, "one");
names.put(2, "two");
names.put(3, "three");
names.put(4, "four");
names.put(5, "five");
names.put(6, "six");
names.put(7, "seven");
names.put(8, "eight");
names.put(9, "nine"... |
7c7707fb-c283-4cd5-ba2e-5b49c7582bf0 | 5 | private CtMethod findOriginal(CtMethod m, boolean dontSearch)
throws NotFoundException
{
if (dontSearch)
return m;
String name = m.getName();
CtMethod[] ms = m.getDeclaringClass().getDeclaredMethods();
for (int i = 0; i < ms.length; ++i) {
String orgN... |
8a77a8c5-6072-4c63-8a57-8be197928b9d | 7 | public static Map<Integer, List<Double>> robustnessParallel(Map<Server, Set<Application>> connections, int runs, int direction, int type) {
Map<Integer, List<Double>> result = new HashMap<>();
ExecutorService es = Executors.newCachedThreadPool();
List<Callable<List<Double>>> callables = new Arra... |
4bf855fe-24be-44bc-8402-57fa8e1dde52 | 2 | private void ImportContactActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ImportContactActionPerformed
try{
this.FileChooser.setVisible(true);
int returnVal = this.FileChooser.showOpenDialog(this);
if (returnVal == FileChooser.APPROVE_OPTION) {
... |
82992a14-e5a9-4c7d-97a1-dff3472dbc3b | 3 | public static void writeVarInt(ByteBuf byteBuf, int varInt) {
int part;
while (true) {
part = varInt & 0x7F;
varInt >>>= 7;
if (varInt != 0) {
part |= 0x80;
}
byteBuf.writeByte(part);
if (varInt == 0) {
... |
c7e759bc-2c31-4278-abae-9189cbaa3314 | 0 | @Override
public void execute(DebuggerVirtualMachine dvm) {
dvm.setStepOutPending(true);
dvm.setRunning(true);
} |
4672344b-8599-4e59-a63e-ce3a462acd6d | 5 | private static void dotGenerator() {
try {
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("which dot");
pr.waitFor();
boolean canDo = (pr.exitValue() == 0);
if (!canDo) {
System.err
.println("dot is not installed on this machine will not be able to generate png file");
} else {
... |
2e956fea-5a53-4fa5-a512-7895e5c6e561 | 6 | public void stepFoward(){
if(isRemovable)return;
xySpeed.y *= friction;
bounds.y += xySpeed.y;
xySpeed.x *= friction ;
bounds.x += xySpeed.x;
if(getSpeed() > MAX_SPEED){
double tempAngle = getMotionAngle();
xySpeed.x = Math.cos(tempAngle) * MAX_SPE... |
957bddf1-48e0-4c29-88a5-ead0be44d3af | 3 | private void fillHive() {
for (int i = 0; i < _populationCapacity; i++) {
boolean newBeeIsWorker = _currentWorkerBeePopulation < _currentPopulation * WORKER_BEE_PERCENTAGE;
Bee newBee = _simulation.beeFactory().createBee(this, newBeeIsWorker);
register(newBee, getName() + "." + (newBeeIsWorker ? "WorkerBee" ... |
b1de8f32-8812-45da-a5ee-ca9cf3310ec8 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
81f32646-fca2-444c-9503-f8944ee3002e | 0 | public Query<T> where(Predicate<T> predicate) throws Exception
{
WhereIterable rs = new WhereIterable(this._source, predicate);
return new Query<T>(rs);
} |
7b1f41dd-976a-4cde-9e3d-ef02e59e0714 | 5 | private static int subsequentCoins(int[][] board, int x, int y, int dx, int dy, int playerID) {
int newX = x + dx;
int newY = y + dy;
if ((newX >= 0 && newX < board.length) && (newY >= 0 && newY < board[0].length) && board[newX][newY] == playerID) {
return 1 + subsequentCoins(board, ... |
fdd7a774-0113-4dbd-82f4-3acb549de9b3 | 1 | public int hashCode() {
return (int)(18 *((color == null) ? 0 : color.hashCode()));
} |
2b7130b7-ecd2-4e57-ab94-08faa67b41ab | 9 | private void gcovParser(String gcovFile) {
TestCase testCase = parseTestCase(gcovFile);
if (achieveCoincidentalCorrectness == true)
achieveCoincidentalCorrectness(testCase);
int totalBlockCnt = 0;
int totalCoverBlockCnt = 0;
for (Statement st: testCase.getStatements())
{
if (st.isBlock())
{... |
c2c03308-c561-4027-afb8-0689bfca0a0d | 3 | private final String[] encodeFilter(final Short[] cbf) {
ArrayList<String> ccbf = new ArrayList<String>();
// find best compression rate by iteratively filling whole word
String word = new String();
int ncells = 0;
int i = 0;
// sth wrong here when working with pruned tables.
while (i<cbf.length) {
St... |
4ac5133d-2de5-4d60-834b-4cb0dec57d53 | 3 | /* */ public void playCached(String userName) {
/* */ try {
/* 65 */ if ((userName == null) || (userName.length() <= 0)) {
/* 66 */ userName = "Minefieldien";
/* */ }
/* 68 */ this.launcher = new Launcher();
/* 69 */ this.launcher.customParameters.put("userName", us... |
c9c56d21-d07d-4691-ac84-cc614e2c8942 | 6 | private void createDepthCharts(int teamNumber,
int setNumber,
int[][] sortedPlayers,
Connection database)
{
int positionNumber=sortedPlayers[0][1];
int positionDepth=1;
for(int currentPlayer=0;c... |
591d51ea-ac3f-4324-a1ff-0c27510c8ca4 | 7 | public void actionPerformed(ActionEvent event)
{
JMenuItem menuItem = (JMenuItem)event.getSource();
if(menuItem.getName().equals("editShapeItem"))
{
EditDialog edit = new EditDialog(this, manager);
edit.setSize(450, 175);
edit.setEnabled(true);
edit.setVisible(true);
}
else if(menuItem.getName()... |
950ca0c5-2f94-4099-97f6-a9b61c4d908e | 0 | public void set(T value, int i)
{
coordonnees.set(i&1, value);
} |
8bdae9d2-83fd-4507-a252-46ea6cb5fe96 | 6 | public void updateHighScores( Player player ) {
int lowestIndex = highScores.size();
Score currentPlayer;
currentPlayer = new Score(0, player.getPlayerName(), player.getScore());
for ( int i = (highScores.size() - 1); i >= 0; i-- ) {
if ( currentPlayer.getScore() > highScore... |
0d0900ae-47d1-43ca-b282-fe1917bae811 | 2 | @Override
public void setCredits(double credits) {
if(credits < 0.5 || credits > 4.0) {
JOptionPane.showMessageDialog(null,
"Error: credits must be in the range 0.5 to 4.0");
System.exit(0);
}
this.credits = credits;
} |
455903b7-9547-46e9-93d8-d133d00719dd | 1 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns * columns;
if (boardPositionRow > 0){
//It's not the first row.
in... |
3436ebc4-880e-4743-9d96-873a37a9a573 | 7 | public static StringBuffer loadOneFile(String fileName) {
String line;
BufferedReader inFile = null;
StringBuffer myBuffer=new StringBuffer();
if (fileName==null) {
return myBuffer;
}
try {
InputStream in = new FileInputStream(fileName);
InputStreamReader reader = new... |
053587ef-7cdf-4a50-a914-d1a06004fa22 | 6 | private static BufferedImage flip(BufferedImage image, boolean horizontal, boolean vertical) {
int width = image.getWidth(), height = image.getHeight();
if (horizontal) {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width / 2; ++x) {
int tmp = im... |
9b07ab8e-8668-43a2-b299-1b879d088625 | 4 | public int getTile(int x, int y){
if(x < 0 || y < 0 || x >= width || y >= height){
return -1;
}
return data.get((y * width) + x);
} |
952b6d83-0c5b-4fd4-8f8c-2f903bdbe0f8 | 9 | private void run_aux() throws ProtboxException, IOException {
try {
if (Constants.verbose) {
logger.info("WatchService for " + root.toString() + " started.");
}
while (!Thread.currentThread().isInterrupted()) {
try {
WatchK... |
2ac8e078-f118-45c6-9680-eec7e96d6126 | 7 | private int access(int arrayIndex, int smpNodeIndexFrom, int numCPUFrom, int startTime){
int i;
for(i = 0;i<syncObjs[arrayIndex].size() && startTime>syncObjs[arrayIndex].get(i).startTime;i++){
}
//must be put after i-1 and before i
Sync so = new Sync();
so.fromNumCPU = numCPUFrom;
so.fromSMPNodeIndex = sm... |
e228a00c-0b93-4b00-97ce-c61ef1e6ad4b | 4 | public void start() {
File fichier_language = new File(OneInTheChamber.instance.getDataFolder() + File.separator + "Language.yml");
FileConfiguration Language = YamlConfiguration.loadConfiguration(fichier_language);
String NomScoreboard = UtilChatColor.colorizeString(Language.getString("Language.Scoreboard.Name... |
a2d187ca-faba-42f8-b93e-7623d8c43bba | 1 | @Override
public void addMessageToDB() {
try {
String statement = new String("INSERT INTO " + DBTable +"" +
"(uid1, uid2, time, qid, bestScore, isRead) VALUES (?, ?, NOW(), ?, ?, ?)");
PreparedStatement stmt = DBConnection.con.prepareStatement(statement);
stmt.setInt(1, fromUser);
stmt.setInt(2, toU... |
23449cd3-fb23-43c0-8a88-74da93f982ea | 8 | String getElementSymbol() {
if (elementSymbol == null)
if (atomName != null) {
int len = atomName.length();
int ichFirst = 0;
char chFirst = 0;
while (ichFirst < len && !isValidFirstSymbolChar(chFirst = atomName.charAt(ichFirst)))
++ichFirst;
switch (len - ichFirst) {
case 0:
brea... |
e5106971-da94-4436-b713-7fe37e4b3da0 | 4 | public static void UpperTitle(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmnt... |
db30512a-a8cd-4bd6-82e4-68763cfdd06c | 6 | @Override
public boolean equals(Object object) {
if (object == null || !(object instanceof PComponent))
return false;
PComponent comp = (PComponent) object;
return comp.getX() == x &&
comp.getY() == y &&
comp.getWidth() == width &&
com... |
9666184f-5792-44b1-ae25-ee4535b34a74 | 5 | @Override
public void deserialize(Buffer buf) {
bonesId = buf.readShort();
if (bonesId < 0)
throw new RuntimeException("Forbidden value on bonesId = " + bonesId + ", it doesn't respect the following condition : bonesId < 0");
int limit = buf.readUShort();
skins = new shor... |
bf6dc79a-0426-48bb-9d87-3a108b453fcd | 3 | public ArrayList<Board> expandChildren(COLOR childColor) {
Board root = this;
ArrayList<Board> children = new ArrayList<Board>();
//System.out.println("EXPANDING CHILDREN...");
for(int i = 0; i < root.boardSize; i++)
{
for(int j = 0; j < root.boardSize; j++)
{
if(root.board.get(i).get(j).color =... |
f8956350-2fe2-4f5f-8079-43da5e5e2708 | 2 | public static double toDegrees(double x)
{
if (Double.isInfinite(x) || x == 0.0) { // Matches +/- 0.0; return correct sign
return x;
}
// These are 180/PI split into high and low order bits
final double facta = 57.2957763671875;
final double factb = 3.14589482087... |
e4395c24-5dce-4fd7-8d09-3f84685113a7 | 5 | public static void main(String[] args) {
//initializing data memory
init();
Scanner scan = new Scanner(System.in);
boolean menu = true;
//display the main menu
while (menu) {
System.out.println("=========================================");
System.out.println("========== Con... |
99f085e9-1f1c-437e-b942-a4d483edabc7 | 4 | @Override
public List<String> getPermissions(Plugin plugin, Player player, ReplicatedPermissionsContainer data)
{
List<String> permissionsList = new ArrayList<String>();
if (this.modList.contains(data.modName))
{
for (String checkPerm : data.permissions)
{
Permission perm = new Permission(checkPerm... |
efeb1e23-2b00-4c4c-baff-0c737345ed74 | 6 | static private final int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 40:
return jjStopAtPos(0, 23);
case 41:
return jjStopAtPos(0, 24);
case 44:
return jjStopAtPos(0, 31);
case 46:
return jjStartNfaWithStates_0(0, 22, 85);
case 47:
... |
e8243f2c-f03b-4b44-87a0-91998ee9115d | 2 | public void addVertexSet(VertexSet s){
Iterator<City> it = s.iterator();
while(it.hasNext()){
City tmp = it.next();
if(!containsID(tmp.getID())){
addVertex(tmp);
}
}
} |
bb4d2375-e723-42f8-9eee-1c42c652b077 | 6 | public static StatisticReturnObject pairedTTest(List<? extends Number> list1, List<? extends Number> list2)
throws Exception
{
if( list1.size() != list2.size())
throw new Exception("Lists must be of equal size");
List<Double> diffs = new ArrayList<Double>();
for( int x=0; x < list1.size(); x++ )
... |
360d4cbc-ee7d-4f3c-8ac5-566612f7e511 | 4 | private String generate_ct(char[] keyed_alphabet,char[][] trans_block, int[] num_k, String plain)
{
String plain_l=plain.toLowerCase();
StringBuilder sb=new StringBuilder();
int init_num=num_k.length<5?num_k.length:5;
for(int i=0;i<init_num;i++)
{
sb.append(num_k[i]);
}
assert(num_k.length==plain.leng... |
dac9a3ed-3721-4b1f-bafa-e4674139c8ac | 2 | public void deletar(T t) throws ValidacaoException, ConstraintViolationException {
try {
transacao = session.beginTransaction();
session.clear();
session.flush();
session.delete(t);
transacao.commit();
} catch (org.hibernate.exception.Constrain... |
d53552bb-b005-4035-a184-24b3a2fbe0f7 | 2 | public void startGame() {
if(players.size() == 2) {
board.addPiece(new Piece(PieceColor.BLACK, 3, 3));
board.addPiece(new Piece(PieceColor.BLACK, 4, 4));
board.addPiece(new Piece(PieceColor.WHITE, 3, 4));
board.addPiece(new Piece(PieceColor.WHITE, 4, 3));
for(Player p : players)... |
c5c1d7c5-bb9d-4083-99f7-899fe6986472 | 2 | private void fetchSubscribedCategoryList(HttpSession session) {
StudentBean bean = (StudentBean)session.getAttribute("person");
StudentDao dao=new StudentDao();
HashMap<String, Boolean> categoryMap = new HashMap<String, Boolean>();
List<String> nonSubscribed = dao.fetchCategories(bean.getUserid(), "NotSubscribe... |
c9705660-7fdb-4a68-b3a7-70541f931c79 | 5 | private void showConfigInfo (StringBuffer buf)
{
try {
Configuration config = dev.getConfiguration ();
String tmp = config.getConfiguration (0);
int value;
buf.append ("<b>");
if (info.getNumConfigurations () != 1)
buf.append ("Current ");
buf.append ("Configuration</b><br>... |
9accb881-dc97-43bf-b7c5-aad8fba3931f | 9 | public void processFire(AbstractTank tank) throws Exception {
bullet = new Bullet(tank.getX() + 25, tank.getY() + 25,
tank.getDirection());
int covered = 0;
int step = 1;
while (bullet.getX() > 0 && bullet.getX() <= 576 && bullet.getY() > 0
&& bullet.getY() <= 576) {
while (covered < 64) {
if (... |
473bdc65-f103-4dde-a42e-6ba67f6187c7 | 7 | public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
// Draw the six tiles of a player's hand
for (int i = 0; i < game.getPlayer(playerIndex).getHand().size(); i++) {
double centerx = (30 + HEX_WIDTH / 2);
double centery = 30 + HEX_HEIGHT / 2 + 80 * i;
Color shading = Color.BLACK;
... |
076e264e-545d-4aa8-bac5-7bf59ea66c3f | 7 | private void rawroom(Rectangle rec) {
for (int y = rec.y; y < rec.y + rec.height; y++) {
for (int x = rec.x; x < rec.x + rec.width; x++) {
if (data[y][x] == null) {
if (y == rec.y || x == rec.x || y == rec.y + rec.height - 1 || x == rec.x + rec.width - 1) {
... |
f4e09044-c182-410d-abdf-601a2e9ea3d9 | 1 | public void messageIn(String x){
Messages.add(0, x);
if(Messages.size()>MAXMSGS){
Messages.remove(MAXMSGS);
}
} |
4d1d5e37-ed1e-4497-b00e-99be058b188b | 3 | public GenerateNodesDialog(GUI p){
super(p, "Create new Nodes", true);
GuiHelper.setWindowIcon(this);
cancel.addActionListener(this);
ok.addActionListener(this);
Font f = distributionModelComboBox.getFont().deriveFont(Font.PLAIN);
distributionModelComboBox.setFont(f);
nodeTypeComboBox.setFont(f);
con... |
ec1abfe7-0dc8-4905-a7b5-18ac2a860fe0 | 2 | static double[][] add(double[][] matrix1, double[][] matrix2){
double[][] sum = new double[matrix1.length][matrix1[0].length];
for(int i = 0; i < sum.length; i++)
for(int j = 0; j < sum[0].length; j++)
sum[i][j] = matrix1[i][j] + matrix2[i][j];
return sum;
} |
686a1bfa-c87c-4904-b331-9776860120a3 | 2 | public static void main(String[] args)
{
Scanner console = new Scanner(System.in);
Unicalc unicalc = new Unicalc();
Map<String,Quantity> env = QuantityDB.getDB();
while (true)
{
System.out.print("input> ");
String input = console.nextLine();
if (input.equals("")) break;... |
e30a60fa-bbae-4b7c-a6ee-cb1f141df2fd | 9 | public static boolean droppedLoot(){
int lootRad = Global.lootRadius;
Tile location = Global.deathLocation;
if(location!= null){
Area lootZone = new Area(new Tile(location.getX() + lootRad, location.getY() + lootRad, Game.getPlane())
,new Tile(location.getX() - lo... |
80c9ba1c-bac4-43ed-97f8-7d15a71df41f | 9 | public static void main( String[] args ) throws Exception {
String sceneName = null;
HDRExposure sum = null;
int avgSpp = 0;
for( String arg : args ) {
if( arg.endsWith(".dump") ) {
String dumpFilename = arg;
File dumpFile = new File(dumpFilename);
sceneName = dumpFile.getName();
sceneName = ... |
4d0c2824-c29a-4a9b-8633-d13f0d432f5f | 1 | public void attemptClose() {
DockContainer dc = getDockContainer();
if (dc != null) {
dc.attemptClose(mDockable);
}
} |
4cfb30bc-41ff-4b3c-b914-a0007ae24907 | 3 | public void update(Category cat) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.update(cat);
session.getTransaction().commit();
} catch (Exception e) {
JOptionPane.sho... |
89e3afa4-bdb7-408f-a7c2-d529c95e10e8 | 9 | public static Predicate.Op getOp(String s) throws simpledb.ParsingException {
if (s.equals("="))
return Predicate.Op.EQUALS;
if (s.equals(">"))
return Predicate.Op.GREATER_THAN;
if (s.equals(">="))
return Predicate.Op.GREATER_THAN_OR_EQ;
if (s.equals("... |
99a5e82f-c232-47e9-a6e4-518cc1423edb | 1 | public V get(K key) {
searchElement(key);
if (_searchHolder == null) {
return null;
}
return _searchHolder.value;
} |
f2717773-1f89-420a-963d-617efed8de47 | 0 | public static int brightness(int color)
{
int red = (color & RED_MASK) >> 16;
int green = (color & GREEN_MASK) >> 8;
int blue = (color & BLUE_MASK);
double brightness = red*red*0.241 + green*green*0.691 + blue*blue*0.068;
return (int)brightness;
} |
8d3e70a8-67d6-4f19-b08b-4af3732c01e5 | 6 | public CharacterPiece(Game.Character character){
this.character = character;
// decide colour
switch (character) {
case MissScarlet:
startingPosition = new int[]{16,0};
colour = Color.red; break;
case ProfPlum:
startingPosition = new int[]{0,5};
colour = new Color(190, 60, 220); break;
c... |
522ea54a-cdaa-4e49-be45-b184c256d102 | 8 | @Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
if (rotation == 1) {
g.drawLine(0, 100, 95, 100);
g.drawLine(105, 100, 200, 100);
g.drawLine(95, 70, 95, 130);
g.drawLine(105, 90, 105, 110);
if (emf!=0) {
... |
1a6097fd-f082-45b4-9199-4b73165517ac | 5 | public int getCurrentRoom(Point playerPos) {
Integer currentRoom = 0;
//It looks trough every room and compares their location in the level to the players.
for (int i = 0; i < getRoomList().size(); i++) {
if(playerPos.getX() >= getRoomList().get(i).getPos().getX() && playerPos.getX() <= (getRoomList().get... |
6f94a402-6cd1-4269-9941-08da077c9ff3 | 6 | public static ListNode insertionSortList(ListNode head) {
if (null == head || null == head.next) return head;
ListNode p = head.next;
head.next = null;
ListNode r = head, rp = r, fp = null;
while (null != p) {
rp = r;
fp = null;
while (null != rp) {
if (p.val < rp.val) {
break;
}
fp... |
5100155c-f763-4a1a-b35d-ef5f48b7ff37 | 3 | public static int executeShellCommand(String command, StringBuilder stderrString) {
int exitVal = -1;
try {
Process proc = Runtime.getRuntime().exec(command);
InputStream stderr = proc.getErrorStream();
InputStreamReader isr = new InputStreamReader(stderr);
... |
8bf4534d-7d51-4557-971f-80202307b6cc | 2 | private void fixHeap( int parent ) {
int child = smallestChild( parent );
// while the parent has a child and the parent's element
// is greater than the element in either child
while ( ( child != NO_CHILD ) &&
( comparator.compare( heap[child],
heap[pare... |
0e413e10-ba9d-48c0-ac14-71fe74be920a | 3 | public source_pktNum lookForSrcPktNum(int src, int glID)
{
source_pktNum srcPktNum;
for (int i = 0; i < source_PktNum_array.size(); i++)
{
srcPktNum = (source_pktNum) source_PktNum_array.get(i);
if ((srcPktNum.getSourceID() == src) && (srcPktNum.getGridletID() == gl... |
c909bae6-cbd7-45e8-b170-13876fe88047 | 3 | public void updateServerModel(ServerModel newServerModel) {
this.serverModel = newServerModel;
gameModel = new GameModel(newServerModel);
HashMap<String, CatanColor> playerColorMap = this.getPlayerColorMap();
if(serverModel != null) {
log = new ArrayList<client.communication.CommsLogEntry>();
for(LogEn... |
390318e1-7e36-49a0-9cec-f2ae97cce589 | 1 | public void animation(Canvas canvas) {
update();
//Buffer strategy
if (canvas.getBufferStrategy()==null) {
canvas.createBufferStrategy(3);
}
draw(canvas.getBufferStrategy().getDrawGraphics());
canvas.getBufferStrategy().show();
} |
d9915e52-b82a-4399-be42-97e46e4af801 | 0 | public void setRecommendation(String recommendation) {
this.recommendation = recommendation;
} |
5ea9ddcf-926e-4f83-8359-e983d472fd7d | 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 TaxonObservationPublic)) {
return false;
}
TaxonObservationPublic other = (TaxonObservationPublic) object;
if (... |
6874b598-f17e-45dd-9583-a46579948d59 | 5 | void setExampleWidgetAlignment () {
int alignment = 0;
if (leftButton.getSelection ()) alignment = SWT.LEFT;
if (centerButton.getSelection ()) alignment = SWT.CENTER;
if (rightButton.getSelection ()) alignment = SWT.RIGHT;
if (upButton.getSelection ()) alignment = SWT.UP;
if (downButton.getSelection ()) ali... |
e30d00c3-b10f-4832-9aa2-210dc2145ea2 | 9 | public void mouseSingleClicked(Point p){
//update current index
curr=mygraph.findIndex(p);
//insert location mode
if(mode==INSERTLOC){
int result=mygraph.addLoc(p);
if(result==(mygraph.getCurr()-1)){
curr=mygraph.getCurr()-1;
changeNotify();
}
}
//delete locatio... |
ee02abb7-6f8e-48c3-984f-ed7d29f606fe | 0 | public T getColor() {
return color;
} |
0a70a285-23da-4117-a2d2-cde7050cea5c | 9 | private IMode getMode(char[] password, int state) {
String s = properties.get("salt");
if (s == null) {
throw new IllegalArgumentException("no salt");
}
byte[] salt = Util.toBytesFromString(s);
IBlockCipher cipher = CipherFactory.getInstance(properties.get("cipher"));
if (ci... |
295d9c67-4549-4f5d-995f-83ffe696ddac | 1 | public RealDef(final LocalExpr var) {
this.var = var;
if (StackPRE.DEBUG) {
System.out
.println("new def for " + var + " in " + var.parent());
}
} |
7ff75f68-1720-4312-8945-487adbfd8ea4 | 9 | private void gererCollision(ControlleurObjets controlleur) {
for (int i = 0; i < controlleur.objets.size(); i++) {
ObjetJeu temp = controlleur.objets.get(i);
if (temp.getId() == IdObjet.TirNormal) {
if (contact().intersects(temp.contact())) {
... |
62b51741-7e14-461e-b98c-233adcdb9db8 | 3 | public boolean equals(Quaternion rhs) {
return (w_ == rhs.w_ && x_ == rhs.x_ && y_ == rhs.y_ && z_ == rhs.z_);
} |
13efed62-be45-4510-8ba0-1f2a9ba471bd | 3 | public ContaCorrente pesquisar (int numero)
{
for(int i=0;i < this.capacidade; i++)
if (this.aContas[i] != null && this.aContas[i].getNumero() == numero)
return this.aContas[i];
return null;
} |
4cea2f2f-aa49-413e-b80e-d7f4539e9a9d | 8 | @Override
public boolean exists() {
try {
URL url = getURL();
if (ResourceUtils.isFileURL(url)) {
// Proceed with file system resolution...
return getFile().exists();
}
else {
// Try a URL connection content-length header...
URLConnection con = url.openConnection();
customizeConnectio... |
21f70232-781a-4ed5-ba09-24373188b52b | 3 | public
void removeEntity( final long someId )
throws NoSuchEntityException {
//
DataCore db = _dataCenter.getDataCore();
//if there is no entity with the given id
if( ! db.getEntity_Data_Table().containsKey( someId ) ) {
//throw an exception
throw new... |
6e681906-3ed0-4633-9b02-254b93b12a47 | 6 | private void insertProtStores(final Block block, final HashSet tryPreds,
final ResizeableArrayList defs) {
final Tree tree = block.tree();
// Visit all LocalExprs in block. Recall that LocalExpr
// represents a reference to a local variable. If the LocalExpr
// defines the variable, then added it to the def... |
e569a430-0fdc-4e28-95d4-e74dc61eb35a | 6 | public static void main(String[] args) {
// TODO Auto-generated method stub
int count =1;
boolean sosuu;
int [] num = new int[1000];
int [] cnt = new int[1000];
for(int i=2;i<=num.length;i++){
if(i>2&&i%2==0){
continue;
}else{
sosuu =isSosu(i);
if(sosuu == true){
cnt[count-1]=i;
... |
3613103e-58d4-4398-a584-ec05db16808d | 4 | public void miniMap(Graphics g){
double xmapTileSize = 3 ;
int mapTileSize = (int) xmapTileSize;
int alignRightSize = Commons.WIDTH - (mapTileSize * mapSize.getX());
//Draws base
for(int y = 0; y < mapSize.getY(); y++){
for(int x = 0; x < mapSize.getY(); x++){
if(col[x][y]){
//draw grey box on mi... |
24195758-f01c-4834-a15c-d8a989f714e0 | 1 | public static void main(String args[]) {
BallContainer ballContainer = new BallContainer();
ballContainer.appendBall(new Ball("red"));
ballContainer.appendBall(new Ball("blue"));
ballContainer.appendBall(new Ball("yellow"));
Iterator ite = ballContainer.iterator();
while (ite.hasNext()) {
Ball ball = (Ba... |
efa87921-0c1e-40a6-bb74-8ecd24c65fc6 | 1 | public JPanel getStatustextInTileChangesMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.statustextTilePanel;
} |
71b0b792-6ade-4365-9b1c-35804e268556 | 1 | public int attackNormal( Character opponent ) {
int damage = (int)( (_strength * _attack) - opponent.getDefense() );
//System.out.println( "\t\t**DIAG** damage: " + damage );
if ( damage < 0 )
damage = 0;
opponent.lowerHP( damage );
return damage;
}//end attack |
cca6e2fd-ab19-40f2-900f-8c288a0b0774 | 5 | void drawMandel() {
Graphics g = getGraphics();
int width = getWidth();
int height = getHeight();
pixels = new Color[width][height];
double xstep = DIV / width;
double ystep = DIV / height;
double y = Y_START;
for (int j = 0; j < height; y += ystep, j++) {
double x = X_START;
for (int i = 0; i < w... |
c80a3704-a51f-4ede-be3f-2a80f6c4c699 | 4 | public void setMergeCombineFunc(MergeInShuffle mergeInShuffle, ReducerCounters counters) {
long inputRecsInPreviousMerges = 0;
long outputRecsInPreviousMerges = 0;
List<InMemoryShuffleMerge> list = mergeInShuffle.getInMemoryShuffleMerges();
InMemoryShuffleMerge info = null;
for(int i = 0; i < list.size(); i+... |
8ae0e008-6d82-4639-b14a-eb3cc3a3e4ab | 9 | private boolean chercheEquipement(String equipement, String annotation)
{
if(annotation.equals("arme"))
{
for(AEquipement i : ArrayListArme)
{
if(i.getClass().getSimpleName().equals(equipement)) return true;
}
return false;
}
... |
e4a74525-179d-4fa1-af5c-abcd2c5dd9a6 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((!CMLib.flags().canBeHeardSpeakingBy(invoker(), mob))
||((invoker()!=null)&&(mob.location()!=invoker().location()))||(!CMLib.flag... |
ecde6bed-14a5-47bf-b8a5-298fea66bb6e | 3 | public void jouer(String nomJoueur, int nombreDeTourMaximum)
{
this.nombreDePionsADecouvrir = NOMBRE_DE_PIONS_A_DECOUVRIR_PAR_DEFAUT;
this.combinaisonAleatoire = new Combinaison(this.nombreDePionsADecouvrir);
// Affichage
for (int numeroDuTour = 1; numeroDuTour <= nombreDeTourMaximum; numeroDuTour++)
{
... |
a8d4601d-6f51-4ec4-9a7a-cd7b9a5b93a3 | 7 | public boolean checkFrequency(Player player, double frequency) throws IOException{
File myFile = new File("plugins/CakesMinerApocalypse/frequencies.txt");
if (myFile.exists()){
Scanner inputFile = new Scanner(myFile);
String setFrequency = "";
while (inputFile.hasNextLine()){
String name = inputFile.ne... |
4e9d5916-339f-4d22-9e33-815a961659f6 | 5 | public void attack (Character ch){
if (this.element.getName() == "air"){
ch.addHP(-(this.AirStrike()));
}
if (this.element.getName() == "earth"){
ch.addHP(-(this.EarthStrike()));
}
if (this.element.getName() == "fire"){
ch.addHP(-(this.FireStrike()));
}
if (this.element.getName() == "water"){
... |
d2c91c1c-68eb-4f8e-aea4-6e4e8d2cd2c1 | 7 | private ROM(String fileName) {
this.fileName = fileName;
buffer = ByteBuffer.allocate(4096);
try {
File file = new File(fileName);
if(!file.isFile())
throw new InvalidFilePathException("Not a valid file name: " + fileName);
// checks if file ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.