method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
fdff42aa-2a3f-4eba-a684-ca594e31b435 | 9 | public static boolean copyFolder(String srcDirectoryPath, String dstDirectoryPath, boolean recursive){
File srcDirectory = new File(srcDirectoryPath);
File dstDirectory = new File(dstDirectoryPath + File.separator + srcDirectory.getName());
if(srcDirectory.exists() && srcDirectory.isDirectory()){
if(!dstDirect... |
df7913b4-b63b-4bd5-a03a-e6e31bdd7108 | 8 | private void Animator(){
if (framestarttime==0L) framestarttime=System.currentTimeMillis();
framecurrenttime=System.currentTimeMillis();
if (framecurrenttime>=framestarttime+frametime){
framestarttime=framecurrenttime;
if (mill>0){//.......................................... |
aa55d7f9-e91c-46e0-9ae3-d859b8f4c233 | 8 | private void jButtonResetActionPerformed(
final java.awt.event.ActionEvent evt) {
int response = JOptionPane.showConfirmDialog(null,
"Voulez vous vraiment "
+ "réinitialiser le converter?",
"Confirmation", JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE);
if (response == JOptionPane.YES_O... |
85bad45e-aa15-4091-bf31-fc80eb0c33b2 | 5 | @Override
/*public boolean TryInstantiate(int x, int y, int value)
{
boolean success = true;
cpController.solver.worldPush();
try {
cpController.InstantiateVar(x, y, value);
} catch (ContradictionException e1) {
// TODO Auto-generated catch block
System.out.println("instantiation failed : " + e1.to... |
161519c8-b0e7-45e9-a5b0-aec33f37689c | 2 | public static void main(String[] args) {
ForkJoinPool forkJoinPool = new ForkJoinPool();
Future<Integer> result = forkJoinPool.submit(new Calculator(0, 10000));
try {
System.out.println(result.get());
} catch (InterruptedException e) {
e.printStackTrace();
... |
0d4ffcbe-1759-4b6a-ba7b-135def254637 | 2 | protected int getFreeVertexPosition() {
for ( int i = 0; i < vertices.length; i++ ) {
if ( vertices[i] == null ) {
return i;
}
}
return -1;
} |
11fe45f4-e224-48a6-a7f0-ac21713e72c0 | 5 | protected PingResult pingRight(){
for(int i = this.posX; i < BattleBotsGUI.instance.xDim; i++) {
if (i == enemyPosX && this.posY == enemyPosY) {
return new PingResult(i - this.posX - 1, true);
}
else if (BattleBotsGUI.instance.obstacles[i][this.posY]) {
... |
3a80850c-bd04-4f3d-9da5-545efc7b0aaa | 6 | public int getMonthDays(int year, int month) {
/**
* 返回所选年月的天数,因为数组中的数值从0开始,所以3/5/8/10分别代表4/6/9/11几个小月.
* 而1代表2月,经过是否为闰年判断,选择返回28或29天. 其余月份为大月,返回31天.
**/
switch (month) {
case 4:
case 6:
case 9:
case 11:
return 30;// 小月返回30天
case 2:
if (gregorianCalendar.isLeapYear(year)) {
// isLeapYea... |
ac439a60-9e0e-4933-8c83-bb67f8976b06 | 3 | public static long addContact(Contact contact, long sessionID) throws SessionException {
if (sessionID <= NO_SESSION_ID) {
sessionID = getSessionID();
}
if (contacts.indexOf(contact) != -1) {
if (!editContacts.containsValue(contact)) {
editContacts.put(new... |
bc230a3c-dea2-4374-b78e-424af5fa89d3 | 4 | @Override
public void onEnable() {
plugin = this;
//Creating the folders
if (!subdir.exists()) {
subdir.mkdir();
}
if (plugin.getConfig().getBoolean("Log.SeparateFolderforStaff")) {
if (!subdir2.exists()) {
subdir2.mkdir();
}
}
config.LoadConfiguration();
getConfig.getValues();
mys... |
ddbb279f-8858-4552-9da3-ff9b8b8085f1 | 9 | private void updateWaveGraphs(AVClipNDir vc0, int vClapPosIdx, AVClipNDir acd, int aClapPosIdx)
throws IOException {
float vShift = (Float)controls().getVideoShift().getValue();
WaveGraphPanel vGraphPanel = controls().getVideoGraphPanel();
WaveGraphPanel aGraphPanel = controls().getAudioGraphPanel();
vGraphPa... |
76ce4496-a4ed-4eb2-ad9d-24c18ec114ac | 7 | private void jComboBoxTipoCuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxTipoCuentaActionPerformed
try{
if(jComboBoxTipoCuenta.getSelectedIndex()==0 && jComboBoxTipoCliente.getSelectedIndex()==0){
tipoCuenta=1;
tipoCliente=1;
... |
2c3ddf61-315f-4d9b-bcf1-74fc7e316519 | 9 | private Pair EvaluateParameters(Pair currentPair) //Sets un this Function's SymbolTable
{
if(funcRoot == null)
{
return new Pair();
}
else
{
Object o;
while(currentPair != null)
{
o = exec.run((Atom)currentPair);... |
95521d84-dc66-4e0e-ab71-8a4daa6d7fe3 | 7 | private PageDNAScroller createDNAScroller() {
PageDNAScroller s = new PageDNAScroller();
s.setPage(page);
s.setModelID(modelIndex);
if (uid != null) {
s.setUid(uid);
uid = null;
}
if (borderType != null) {
s.setBorderType(borderType);
borderType = null;
}
if (!opaque) {
s.set... |
7e5dde1f-636b-438e-8478-1aa37df15ea1 | 1 | @Override
public Iterable<Entry<K, V>> entrySet() throws InvalidPositionException,
BoundaryViolationException, EmptyTreeException {
ArrayList<Entry<K, V>> ps = new ArrayList<>();
if (size != 0)
inOrderPositions(root(), ps);
return ps;
} |
219e0262-06ef-4155-8877-a0be2b8165ca | 0 | public BallContainer() {
balls = new ArrayList<Ball>();
} |
4fdbd705-79ba-4883-8f10-261c3ada0312 | 2 | public static boolean existsName(Clientes cli){
String sql = " SELECT * FROM clientes WHERE rut = '"+cli.getRut()+"' AND dv = '"+cli.getDv()+"' ";
if(!BD.getInstance().sqlSelect(sql)){
return false;
}
if(!BD.getInstance().sqlFetch()){
return false;
... |
4f0253aa-4d82-4603-9ce6-6e82b51309b3 | 9 | public int getPotentialProduction(GoodsType goodsType, UnitType unitType) {
int production = 0;
TileType tileType = workTile.getType();
if (isColonyCenterTile()) {
production = (unitType != null) ? 0
: (tileType.getPrimaryGoods() != null
&& tileTyp... |
71e8f46b-bc65-42b9-a31d-6d85c82a8015 | 0 | public void setPrix(float prix) {
this.prix = prix;
} |
ddae86bc-fae1-46cc-8433-05885d72b18d | 7 | public void actionPerformed(ActionEvent e) {
if (_startNumber) {
actionClear();
_displayField.setText("ERROR - No operator");
} else {
_startNumber = true;
try {
String displayText = _displayField.getText();
if (_previousOp.... |
3639d2d8-dd21-4e6e-ac1c-075f39d5423b | 9 | private String romX(int x) {
switch (x) {
case 1: return "X";
case 2: return "XX";
case 3: return "XXX";
case 4: return "XL";
case 5: return "L";
case 6: return "LX";
case 7: return "LXX";
case 8: return "LXXX";
case 9: return "XC";
default:return "";
}
} |
64a30011-c7e1-4037-9285-fea33f618f7c | 0 | public void sendToMaxSteps(int maxNumberOfSteps) {
OSCMessage message1 = new OSCMessage("/ch/maxsteps");
message1.addArgument(maxNumberOfSteps);
send(message1);
} |
dfb564a4-9f64-419a-89b8-e5d31fcc323b | 1 | public void choke() {
if (!this.choking) {
logger.trace("Choking " + this);
this.send(Message.ChokeMessage.craft());
this.choking = true;
}
} |
b4bc69a4-a5b5-40a3-bb18-c9f524f28c51 | 1 | @Override
public Auction bid(String username, Long itemId) throws ExpiredBidException{
// searches.get(itemId));
Auction a = searches.get(itemId);
if(a != null){
a.setCurrentBid(a.getCurrentBid()+1);
a.setNumerOfBidsRemaining(a.getNumberOfBidsRemaining()-1);
a.setOwner(username);
// return a;
}... |
0dd1c3f8-265a-417e-a12e-524fc8fffdf4 | 1 | public String[] allBuddies() {
String[] s = new String[buddies.size()];
for(int i = 0; i < buddies.size(); i++)
s[i] = buddies.get(i).name.text;
return s;
} |
56db70b5-c672-4469-b9a0-9c8a6a0c33f2 | 9 | void updateStatusInfo() {
if (metafast.progress.currentRunningStep != null) {
String s = metafast.progress.currentRunningStep.getStageName(curLang) + " " +
"(" + ((curLang == 0) ? "stage " : "этап ") + (metafast.progress.doneSteps + 1) + ((curLang == 0) ? " of " : " из ") + metaf... |
90358ee5-6e28-4984-afe6-56d7562befde | 0 | public void setField2(Object field2) {
this.field2 = field2;
} |
45ec2e07-2e8f-48d0-9448-4fb031e4b302 | 2 | MenuItem(Font f, String s, int _x, int _y, int align, Color normal, Color selected) {
this.textFont = f;
this.itemText = s;
this.x = _x;
this.y = _y;
this.normalColor = normal;
this.selectedColor = selected;
width = f.getWidth(itemText);
height = f.getLineHeight();
switch (align) {
... |
7e53d3e4-c52b-46f4-be9f-be26117ec955 | 3 | private boolean identify_peer (Pipe pipe_)
{
Blob identity;
Msg msg = pipe_.read ();
if (msg == null)
return false;
if (msg.size () == 0) {
// Fall back on the auto-generation
ByteBuffer buf = ByteBuffer.allocate(5);
buf.put((byte)0)... |
08358b32-8c76-4b57-b628-29e90527d04c | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,null,this,CMMsg.... |
8e8f4166-383a-4252-9991-b7d73737b2cf | 4 | private boolean enemyHasDama(Model m){
for(int i=0;i<m.getDamiera().getDim();i++)
for(int j=0;j<m.getDamiera().getDim();j++)
if(m.getDamiera().getCasella(new Posizione(i,j)).isEvidenziata() && m.getDamiera().getPezzo(new Posizione(i,j)).isDama())
return true;
return false;
} |
3fc9e410-5457-4c33-baa9-827ac228e2bb | 8 | public void compExecTime() {
double newExeTime;
double newCost;
dEval = 0;
dTime = 0;
dCost = 0;
for (int i = 0; i < iClass; i++) {
newExeTime = 0;
// System.out.print("Cost[" + i + "]");
for (int j = 0; j < iSite; j++) {
if (dmAlloc[i][j] != -1) {
if (dmAlloc[i][j] < 1) {
newExeTime... |
c9ba5a02-c124-44a0-a454-e3eefe562289 | 2 | @Override
public void send(String message, Pilot pilot) {
for (Pilot p : pilots) {
if (!p.equals(pilot)) {
p.notify(message);
}
}
} |
5afb878a-4e5d-411d-8ec9-5625f26bbb2d | 6 | private int isPlacementOk(int row, int col, int markercolor)
{
//check if location is within board
if ((row >= totalrow || row < 0) || (col >= totalcol || col < 0))
return invalid_move;
//check if location is on an empty square
else if (board[row][col] != EMPTY)
... |
5d3bffa9-a188-45d8-8ba5-39d7def52359 | 8 | public int surroundingBombs(int x, int y) // checks surrounding 8 squares
// for number of bombs (it does
// include itself, but has
// already been checked for a
// bomb so it won't matter)
{
int surBombs = 0;
for (int q = x - 1; q <= x + 1; q++) {
for (int w = y... |
64846494-2f67-45a9-8112-73d3a6bbd835 | 4 | public void setPlayerSkin(int character) {
String s;
s = character == 1 ? "/Characters/TestChar.png"
: "/Characters/TestChar2.png";
// load sprites
try {
final BufferedImage spritesheet = ImageIO.read(getClass()
.getResourceAsStream(s));
sprites = new ArrayList<BufferedImage[]>();
for (in... |
f525b65b-7464-495c-b2ef-42f6531dce7d | 3 | private void modifyDistribution(int[] newBowl) {
if(firstInvocation)
{
firstInvocation=false;
if(replaceInitialDistribution)
{
Arrays.fill(mExpDistrib, 0);
}
}
for(int i=0;i<newBowl.length;i++)
{
mExpDistrib[i]=(mExpDistrib[i]*mExpDistrib.length*passNumber + newBowl[i]);
... |
f6c37e0d-13fb-4386-bb0b-5cda9f95fc13 | 2 | public ArrayList<String> getParticipantNames() {
ArrayList<String> participantsList = new ArrayList<String>();
Iterator<String> participantsIter = participants.keySet().iterator();
Participant partp;
while(participantsIter.hasNext()) {
partp = participants.get(participantsIter.next());
if(partp.isOnline()... |
fda2e047-7cce-47d4-b678-d5c7badb3d33 | 1 | public void save(String file) throws IOException {
SVGGraphics2D generator = new SVGGraphics2D(doc);
File outfile = new File(file);
if (!outfile.exists()) {
outfile.createNewFile();
}
Writer out = new OutputStreamWriter(new FileOutputStream(outfile),
"UTF-8");
generator.stream(doc.getDocumentElement(... |
72a0441e-2962-4603-b47c-eacac4fd76b3 | 6 | @Override
public boolean equals(Object obj) {
if (!(obj instanceof Wall)) {
return false;
}
Wall other = (Wall) obj;
boolean areIdentical = this.getStartPoint().equals(
other.getStartPoint())
&& this.getEndPoint().equals(other.getEndPoint());
boolean areInversed = this.getStartPoint().equals(other... |
02e717cf-0777-4863-9c39-b8ea0443377b | 4 | @Override
public String toString() {
StringBuilder builder = new StringBuilder(name);
switch (degree) {
case BACHELOR: {
builder.append(" - бакалавър");
break;
}
case MASTER: {
builder.append(" - магистър");
... |
c6994d4f-b75c-4bef-aa2f-78048ae84f4a | 2 | @Override
public void write(int b) throws IOException {
delegate.write(b);
if (b == '\r') {
// Do nothing
} else if (b == '\n') {
addLine();
} else {
line.append((char) b);
}
} |
1d834487-eced-4f87-bfb6-9e83e4af0160 | 9 | public Object getDropTarget(Object[] cells, Point pt, Object cell)
{
if (!isSwimlaneNesting())
{
for (int i = 0; i < cells.length; i++)
{
if (isSwimlane(cells[i]))
{
return null;
}
}
}
// FIXME the else below does nothing if swimlane is null
Object swimlane = null; //getSwimlaneAt(... |
f383aeb7-b0fe-44f8-982c-92e45b8f8a82 | 9 | @Override
public int compare(Row rowOne, Row rowTwo) {
if (rowOne.getParent() == rowTwo.getParent()) {
for (Column column : mSortingOrder) {
int result;
if (column == null) {
return 0;
}
result = column.getRowCell(null).compare(column, rowOne, rowTwo);
if (result != 0) {
return colu... |
11a30034-7de8-4f0a-8f0b-0dce83629233 | 3 | @Override
public void uncaughtException(Thread t, Throwable e) {
if (!ready) {
init();
}
Date date = new Date();
try {
FileWriter fstream = new FileWriter("debug.log", true);
BufferedWriter out = new BufferedWriter(fstream);
System.o... |
6e056455-aa0f-4409-a41e-2df6e675fc43 | 5 | public void solve(HashMap<Integer, ArrayList<Integer>> X, HashMap<Integer, ArrayList<Integer>> Y, ArrayList<Integer> solution){
if (X.isEmpty()) {
if (!soluList.contains(solution)) {
ArrayList<Integer> tmp = new ArrayList<Integer>();
for (int i = 0; i < solution.size(); i++)
tmp.add(solution.get(i));
... |
daf6d513-d9aa-4bd0-8d94-f125d8cbf5e0 | 3 | public static ImageIcon icon(String path) {
ImageIcon icon = null;
try {
icon = new ImageIcon(ImageIO.read(Application.class.getClassLoader().getResource(path)));
} catch (IllegalArgumentException e) {
} catch (IOException e) {
}
if (icon == null) {
icon = new ImageIcon(path);
}
return icon;... |
72e481ba-42d5-494f-8d63-9fa49d77f784 | 0 | public void setPassword(String password) {
this.password = password;
} |
a6732246-7525-4c22-83bb-f27bd19ddfa2 | 1 | public Tex tex() {
if(tex == null)
tex = new TexI(img);
return(tex);
} |
cc01b775-4154-4835-87cb-01ac765801a5 | 6 | public static void makeGrid(Container parent,
int rows, int cols,
int initialX, int initialY,
int xPad, int yPad) {
SpringLayout layout;
try {
layout = (SpringLayout) parent.getLayout();
}... |
2159b612-a1ae-4b9c-9fc8-34302c6420a4 | 1 | static public void zoomOut()
{
if(zoom>13)
{
zoom--;
zoomIndex--;
}
} |
011ffb1e-b3d9-4355-921e-ad02ebe6bee4 | 6 | public static String escape(String string) {
char c;
String s = string.trim();
StringBuffer sb = new StringBuffer();
int length = s.length();
for (int i = 0; i < length; i += 1) {
c = s.charAt(i);
if (c < ' ' || c == '+' || c == '%' ... |
095f8651-c9cb-47cb-92eb-855a89441523 | 8 | public int minDepth(TreeNode root) {
if(root==null){
return 0;
}
LinkedList<TreeNode> queue = new LinkedList<TreeNode>();
LinkedList<TreeNode> childQueue = new LinkedList<TreeNode>();
queue.add(root);
int depth = 1;
while (!queue.isEmpty()){
... |
9146ec5f-a4df-46c2-b86f-5bc5735e5924 | 4 | @EventHandler(priority = EventPriority.LOWEST)
public void onBlockBreak(BlockBreakEvent event) {
Database db = new Database();
// Get the block
Block b = event.getBlock();
Player p = event.getPlayer();
int playerId;
World w = b.getWorld();
int worldId = 1;... |
5ec742d9-e0ae-46f9-94e9-bacc890e9963 | 0 | public void operation() {
implementor.operation();
} |
686922e9-5147-4df4-b9f2-8b6b9d03aac6 | 6 | protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
HttpSession session = req.getSession();
String url = "/";
String action = (String)req.getParameter("action");
RegisterViewHelper registerViewHelper =
ViewHelperFactory.getInstance()... |
e0be256a-ef3b-4cd8-ae1c-9dd39603750f | 2 | public ArrayList<MatchScheduling> scheduleQuarterFinals(ArrayList<Team> teams) throws SQLException
{
ArrayList<MatchScheduling> matches = new ArrayList();
int i = 1;
while (getGroup(i + 1, teams) != null)
{
ArrayList<Team> group = getGroup(i, teams);
ArrayLi... |
761b26db-aec1-4b84-a3de-61c375e09252 | 0 | public Set<String> getEntities() throws DataLoadFailedException {
return dataHolder.getEntities();
} |
ea2801cc-75ce-4171-bebf-aefafdca2b70 | 4 | @Test
public void testUpdateRecurringJobFromQueue() throws LuaScriptException {
String jid = addRecurringJob();
String json = getRecurringJob(jid);
Map<String, Object> job = JsonHelper.parseMap(json);
assertEquals(jid, job.get("jid").toString());
assertEquals(TEST_QUEUE, job.get("queue").toString());
asse... |
99a80bbd-f422-4de2-9520-eaf2d6fdbf8f | 3 | public boolean getDocumentParseState(int docId)
{
boolean isparsed = false;
String strStatement = "SELECT dIsParsed FROM document AS d WHERE d.dID = " + docId;
ResultSet rstResultSet = null;
try
{
rstResultSet = startQuery(strStatement);
if (rstResultSet.next())
{
isparsed = rstResultSet.getBool... |
480d151e-9b70-4918-9cbc-04153093f9bd | 7 | @Override
public void sendTradeOffer() {
int brick = (this.offeredBrick == 0) ? -this.desiredBrick : this.offeredBrick;
int wood = (this.offeredWood == 0) ? -this.desiredWood : this.offeredWood;
int sheep = (this.offeredSheep == 0) ? -this.desiredSheep : this.offeredSheep;
int wheat = (this.offeredWheat == 0) ... |
7ed16100-d737-455a-8227-e3d3e6169a9f | 6 | private void processBlock() {
String linesOut[]=new String[3];
boolean divider=false;
// Convert the block to an array of ints
int data[]=circularBitSet.returnInts();
// Data[4] and [5] contain the line number (bits 32 to 41)
int lineNos=(data[4]<<3)+((data[5]&224)>>5);
// Count the number of missing bloc... |
084a1968-ae26-45df-b618-4055978ac938 | 1 | private BufferedReader getBufferedReader() {
BufferedReader clientRequest = null;
try {
clientRequest = new BufferedReader(new InputStreamReader(
this.clientSocket.getInputStream()));
this.log.info("CREATE BufferedReader: " + clientRequest.toString());
} catch (IOException e) {
// TODO Auto-generate... |
25406a05-9368-4455-9e95-565ab7e70eaa | 6 | private void initialize() {
frmVotingParticipants = new JFrame();
frmVotingParticipants.setTitle("Voting Participants");
frmVotingParticipants.setBounds(100, 100, 684, 528);
frmVotingParticipants.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
model.addTableModelListener... |
e573210f-4032-436b-ad8b-9974e2a40084 | 5 | public static void main(String[] args)
{
ArrayList<Integer> array = readIntegerArrayFromFile();
int sum = 0;
PriorityQueue<Integer> heapLow = new PriorityQueue<Integer>();
PriorityQueue<Integer> heapHigh = new PriorityQueue<Integer>();
for(Integer x_i :... |
1f2f5eec-bca2-4023-a860-4d84b5c77b2d | 2 | private void createUserDir() {
homeDir = new File(System.getProperty("user.home") + File.separator + ".laura");
if (!homeDir.isDirectory()) {
if (homeDir.mkdir()) {
print("Created .laura directory");
} else {
print("COULD NOT CREATE .laura DIRECTORY!");
}
}
} |
e52bac44-2f55-4569-9c62-2d13e4960ec8 | 0 | public float getY() {
return y;
} |
dd3c7bb2-4939-46a6-aa38-12f111a89622 | 7 | public ArrayList<String> cbAtividades(String nomeUsuario) throws SQLException {
ArrayList<String> Atividade = new ArrayList<>();
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
try {
conexao = BancoDadosUtil.getConnection();... |
8aefabdf-b3ed-48a0-b401-893e83889c58 | 8 | private final UnitValue[] getPos(ComponentWrapper cw,
CC cc) {
UnitValue[] cbPos = null;
if (callbackList != null) {
for (int i = 0; i < callbackList.size() && cbPos == null;
i++) {
cbPos = callbackList.get(i).getPosition(cw); // NOT a copy!
... |
afe05b99-e1ab-4b51-a21a-69f5a5254b6b | 2 | @Test
public void vaikeustasonKasvatusSuuriMaaraTest(){
for (int i = 1; i < 20; i++){
peli.nostaVaikeustasoa();
}
peli.laskeTaso();
assertEquals(20, peli.getTaso());
for (int i = 0; i < 10; i++){
peli.nostaVaikeustasoa();
}
peli.laskeTa... |
3a73efb6-61ce-457b-8b29-c8bd812cd145 | 5 | @EventHandler(priority = EventPriority.HIGHEST)
public void precommand(PlayerCommandPreprocessEvent event) {
long time = System.nanoTime();
if (plugin.isEnabled() && (event.getMessage().toLowerCase().startsWith("/pp".toLowerCase())) && (plugin.getConfigHandler().getConfig().getBoolean("debugfile"))) {
if (plugi... |
bfe24eea-5727-4d96-99e6-54e040f24afe | 7 | private static double getDoubleImpl(Object o, Double def) {
try {
if (o == null) return def;
if (o instanceof String) return Double.parseDouble((String) o);
if (o instanceof Number) return ((Number) o).doubleValue();
if (o instanceof Range) return ((Range) o).randDouble();
if (o instanceof Boolean) ret... |
e1b1a3c0-33ca-4d23-ba6e-6c972af3a4ff | 8 | public static void updateBoard(int column) {
PachydermUnit[] boardArray = earBoard.getBoardArray();
PachydermUnit earUnit = boardArray[column];
PachydermUnit leftUnit = null;
PachydermUnit rightUnit = null;
if(column != 0){
leftUnit = boardArray[column-1];
}
if(column != earBoard.getBoardSize()-1){
... |
76899864-fee0-44e3-a279-fd5c52593e64 | 8 | public int getLongIndex(long y)
{
int start=0;
int end=longArray.length-1;
int mid=-1;
while(start<=end)
{
mid=(end+start)/2;
if((mid>0)&&((longArray[mid-1]&NEXT_FLAGL)>0)){mid--;}
if(y<(longArray[mid]&LONG_BITS))
end=mid-1;
else
if((longArray[mid]&NEXT_FLAGL)>0)
{
if(y>longArray[mi... |
64272b0b-f9c0-4e18-8197-83441e365cf5 | 8 | public byte[] readBytes(int numBytes) throws BeanstalkDisconnectedException, BeanstalkException{
byte[] bytes = new byte[numBytes];
byte[] array = this.outbuf.toByteArray();
this.outbuf = new ByteArrayOutputStream();
int bytesWritten = 0;
//first read any bytes that are already in the outbuffer.
for ... |
de960221-5e01-4326-9e92-6b679db4d673 | 6 | public IProviderDescription findContentProvider(IContentType target,
Class<? extends IContentProvider> minimumProtocol) {
for (ContentProviderDescriptor descriptor : providerDescriptors)
for (IContentType contentType : descriptor.getAssociations())
if (target.isKindOf(con... |
570d0002-c800-44b5-a0ab-2279621ed195 | 3 | public boolean checkInput(Object[] input) {
if(input.length != getArgumentCount()) {
return false;
} else {
for(int i = 0; i < getArgumentCount(); i++) {
Class desiredType = args[i];
if(!desiredType.isInstance(input[i])) {
return false;
}
}
return true;
}
} |
9262c1ed-fae8-4ce9-b373-731344a2966f | 3 | @Override
public List<Cliente> ListByNome(String nome) {
Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Cliente> clientes = new ArrayList<>();
try{
conn = ConnectionFactory.getConnection();
pstm = conn.prepareStatement... |
adb3e2b9-aa6a-40b3-a7c8-93dc52c4f027 | 4 | private int getIDLastMedia()
{
Statement st = null;
ResultSet result = null;
String req = "";
int id = -1;
try
{
st = cnx();
if(st == null) return -1;
// RECUPERATION ID
req = "SELECT MAX(id) AS max FROM t_medias";
result = (ResultSet) st.executeQuery(req);
if(result.last() && re... |
d4748853-9d55-487e-aa5b-b9cc21c86d36 | 8 | private void processBidEvent(BidEvent event) {
// max global Bit
if (event.getType().equals(BidEvent.BID_PLACED)
|| event.getType().equals(BidEvent.BID_OVERBID)) {
if (maxBidEvent == null) {
Timestamp currentTimestamp = new Timestamp(
System.currentTimeMillis());
long timestamp = currentTimest... |
b88fdd73-e0b5-40a2-a773-b48ec7336871 | 0 | public void setAge(String age) {
this.age = age;
} |
267491bf-a1e1-47d2-812d-fad024145306 | 0 | public Shaker(int b) {
super(b);
} |
2fb10bb8-124f-461c-9a53-564139781f6e | 8 | public void init() throws RemoteException, UnknownHostException, NotBoundException, IOException {
/* Export and bind TaskTracker */
Registry registry = LocateRegistry.createRegistry(this.registryPort);
TaskTrackerRemoteInterface stub = (TaskTrackerRemoteInterface) UnicastRemoteObject.exportObject(this, 0);
r... |
2fcfb81b-9663-4ffb-9ee7-21e307f9b453 | 6 | public void ReadData() {
BufferedReader br = null;
//Read data from file
try {
String sCurrentLine;
br = new BufferedReader(new FileReader(filename));
String CurrentID = "";
List ProbabilityList = new ArrayList();
//Read through file ... |
0e330eb6-47da-43de-b46f-6a5916717b05 | 0 | public void setCantidad(int cantidad) {
this.cantidad = cantidad;
} |
e81b8d98-c090-4a96-8ab5-30fe850a10d2 | 7 | public static void main(String[] args) {
int highestCount = 0;
int highestStarting = 5000000;
for (int i = 500000; i < 1000000; i++) {
long current = i;
int count = 1;
while (true) {
//if current is even
if (current % 2 == 0) {
... |
7dc335f9-b52b-4aa5-8051-6c723d7139e7 | 8 | private void initClsToOwnerMap() {
Map<Class<?>, Set<Class<?>>> clsToOwnersMap = buildDirectOwnedToOwnerdMap();
//For each class, add owners of its super-classes to the set of the owners of that class.
for (Class<?> cls : clsToSynFldMap.keySet()) {
inheritSuperOwner... |
b4d204eb-e658-4601-9a62-83c9dee83275 | 5 | public static Class[] getParameterTypes(Member m) {
if (m instanceof Method) return ((Method)m).getParameterTypes();
if (m instanceof LocalMethod) return ((LocalMethod)m).getParameterTypes();
if (m instanceof Constructor) return ((Constructor)m).getParameterTypes();
if (Debug.enabled)
Debug.check... |
480725c9-00c5-44fc-8a8e-5467924b0ce8 | 5 | private LinkedHashMap<String,LinkedHashMap<String,List<String>>> RturnTempLinkedMapQuery(String getstring){
LinkedHashMap<String,LinkedHashMap<String,List<String>>> queryLinkedHashMap = new LinkedHashMap<String,LinkedHashMap<String,List<String>>>();
//if current query is format two
if(getstring.contains("name") &... |
959aff93-3e9d-4d72-b677-bc0cff62982d | 0 | public void mailCheck()
{
System.out.println("Mailing a check to " + name
+ " " + address);
} |
352453fa-7a94-4ffb-b938-15639659c4ae | 9 | private static void getOptionalElements(Operation operation,
Map<String, ComplexTypeParameter> tipuriComplexe,
XSParticle xsParticle) {
if (xsParticle != null) {
XSTerm pterm = xsParticle.getTerm();
// daca am gasit un element inner
if (pterm.isElementDecl()) {
if (pterm.asElementDecl().getName()... |
9e75c8f6-2cd1-43f8-9717-dcab4aac3907 | 0 | public AIMerger() {
super("App Inventor Merger v1.1");
// Set the size and location of the application's window based on the screen size.
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
setSize((int) (screenSize.width * WIDTH_PERCENT_OF_SCREEN),
(int) (screenSize.height * HE... |
3996def7-009a-49b3-8669-e28e1fcb96a6 | 1 | @Override
public int compare(Employee e1, Employee e2) {
int diff = e1.surName.compareToIgnoreCase(e2.surName);
if (diff == 0)
diff = e1.givenName.compareToIgnoreCase(e2.givenName);
return diff;
} |
4e32d6e7-2e77-401f-8835-1ee37f3f828d | 5 | public boolean moveItem(FieldItem item, Position positionFrom, Position positionTo) {
if (!isOccupied(positionFrom)) {
return false;
}
if (!isInField(item)) {
return false;
}
if (!item.getPosition().equals(field.get(positionFrom).getPosition())) {
... |
6c1378d5-8100-4148-bf38-100d5046fcbf | 9 | private void readPage(final String uri) {
synchronized (lock) {
// this disables the SaveReminder when the file is in the "/cache/tmpzip/" zone
if (!isRemote()) {
if (runOnCD) {
if (saveReminder != null)
saveReminder.setEnabled(false);
} else {
if (saveReminder != null)
saveReminde... |
c9291689-a55b-4f99-94b6-6097c4b4ab8e | 2 | public void run() {
NPC cat = NPCs.getNearest(new Filter<NPC>() {
@Override
public boolean accept(NPC npc) {
if (npc.getInteracting() == null)
return false;
int interId = npc.getInteracting().getId();
int myId = Players.getLocal().getId();
return interId == myId;
}
});
if (cat != nul... |
8e5bf71f-b47b-4b64-af00-cebade1d359b | 0 | @Id
@Column(name = "FES_ID_POS")
public Integer getFesIdPos() {
return fesIdPos;
} |
7db299a1-bbe7-4e42-b372-1976bf5b3500 | 8 | @Override
public void mousePressed(MouseEvent e) {
if (e.isConsumed()) {
return;
}
if (e.getButton() != MouseEvent.BUTTON1) {
return;
}
Object task = chart.getTaskAtPoint(e.getPoint());
if (task == null) {
if (!e.isControlDown()) {
chart.clearSelection();
}
} else {
if (e.isCo... |
7c5816a1-b030-40fc-b35f-64a493b0bee5 | 9 | public static int[][] zeroifyMatrix(int[][] in) {
if (in == null) {
return null;
}
if (in.length == 0) {
return in;
}
final int M = in.length;
final int N = in[0].length;
Set<Integer> rows = new HashSet<Integer>();
Set<Integer> cols = new HashSet<Integer>();
// O(n^2) space, O(n) time
... |
fe58e23b-58ab-4d8a-84d3-915fef328367 | 3 | @Test
public void test_random_decrease() {
int size = 100000;
PairingHeap<Data> heap = new PairingHeap<Data>();
Random random = new Random();
List<PairNode<Data>> nodelist = new ArrayList<PairNode<Data>>();
for (int i = 0; i < size; i++) {
int rint = random.nextIn... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.