method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
832c4148-ea1d-42c5-8e8f-39b2994be6ff | 8 | @Override
public void run() {
open = true;
System.err.println("Die Kasse mit Id: " + cashpointId + " soll geöffnet werden!");
try {
Thread.sleep(6000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
System.err.println("Die Kasse mit Id: " + cashpointId + " wurde geöffnet!");
while ... |
3660dbcc-d45f-48ef-90aa-3e5ffdbe77ac | 7 | private void getPerson() throws SQLException {
clear();
curPerson = peopleSet.getInt("idCustomer");
firstTF.setText(peopleSet.getString("First"));
lastTF.setText(peopleSet.getString("Last"));
streetTF.setText(peopleSet.getString("Street"));
cityTF.setText(peopleSet.getString("City"));
stateTF.setText(peop... |
310b4e9e-7de9-4d4c-9958-452f77823800 | 9 | public boolean read(long byteStart, int byteCount, int arrayOffset, byte bytes[]) throws IOException
{
if(byteStart < 0)
throw new IllegalArgumentException("negative start position");
final long limit = byteStart + byteCount;
if(limit > size)
throw new IllegalArgumentException("exceeds device size");
i... |
32a3b5e1-2898-411c-9593-1562f0cf5d1a | 1 | @Test
public void deleteTest() {
for (int i = 1; i < 9; i++) {
System.out.println("");
printTime(testJavaLinkedListDeletions(10000 * (int) Math.pow(2, i)));
printTime(testDoublyLinkedListDeletions(10000 * (int) Math.pow(2, i)));
}
} |
734c4dd4-6005-4f97-b121-f4cb90d79da0 | 2 | public SubForum getSubForumById(String id) {
for (int i=0; i<subForums.size(); i++) if (id.equals(subForums.get(i).getId())) return subForums.get(i);
return null;
} |
ca0a8b61-5b02-46f8-bbca-25f7b97d0341 | 7 | public void drawRandomPattern(int num) {
writeTo.print("\n");
writeTo.print("/design{\nnewpath\n10 neg unit 10 mul moveto\n");
int dir;
for(int i = 0; i < num; i++){
dir = (int) (Math.random() * 6);
switch (dir) {
case 0: writeTo.print("U ");
break;
case 1: writeTo.print("D ");
break;
case ... |
c1ff8025-a938-4adf-a1d9-7e5086fe9d71 | 2 | public static ArrayList<TestDistance> findTestDistanceByTestId(ArrayList<TestDistance> testDistances, int id) {
ArrayList<TestDistance> outputDistances = new ArrayList<TestDistance>();
for(TestDistance td:testDistances) {
if(td.test==id) {
outputDistances.add(td);
}
}
return outputDistances;
} |
3db3371f-f309-4416-80df-624b3a703414 | 8 | public static void describeClass(CtClass c) throws ClassNotFoundException, NotFoundException {
StringBuilder bb = new StringBuilder();
bb.append("name: ").append(c.getName()).append("\n");
bb.append("annotations: ");
Object[] ann = c.getAnnotations();
if (ann.length == 0) {
bb.ap... |
920c8fce-c3d9-481c-9e13-3bd72836a240 | 6 | public void updateMonster(int w, Character mon) {
Monster tempMonster = (Monster) mon;
int tempy = tempMonster.getY();
int tempx = tempMonster.getX();
int temph = tempMonster.getHV();
int tempv = tempMonster.getVV();
int vcount = tempMonster.getVcount();
int hcount = tempMonster.getHcount();
int mid ... |
178c078c-b063-46a8-a034-9b294a26df59 | 7 | public int[] getInts(int par1, int par2, int par3, int par4)
{
int[] var5 = this.parent.getInts(par1 - 1, par2 - 1, par3 + 2, par4 + 2);
int[] var6 = IntCache.getIntCache(par3 * par4);
for (int var7 = 0; var7 < par4; ++var7)
{
for (int var8 = 0; var8 < par3; ++var8)
... |
caca2ef0-2eb8-43bd-8e25-1cb6713ee501 | 0 | public static void saveImageAsJpeg(String src, String dest,
int formatWidth, int formatHeight) throws IOException {
File saveFile = new File(dest);
BufferedImage destImage = imageZoomOut(src, formatWidth, formatHeight);
ImageIO.write(destImage, "JPEG", saveFile);
} |
363fa629-9b3a-4d67-89a5-3fd297a598d0 | 5 | protected boolean nearPlayer() {
if(targetEntity.x > x-(width/2)-detectionRadius && targetEntity.x < x+(width/2)+detectionRadius && targetEntity.side != side){
if(targetEntity.y > y-(height/2)-detectionRadius && targetEntity.y < y+(height/2)+detectionRadius ){
return true;
} else return false;
} else retu... |
5789b33c-ac18-4dce-a3bc-0cbf213b01ae | 0 | public void fireKeyEvent(KeyEvent event) {
processKeyEvent(event);
} |
bd13fdc9-6aa3-40ef-be54-224459bde104 | 1 | public void addToData(List<Float> list, int i) {
if (TMIData.containsKey(i)) {
TMIData.get(i).addAll(list);
} else {
TMIData.put(i, new ArrayList<Float>(list));
}
} |
c91c340c-20b2-4016-87cf-0345d296455c | 4 | public GameState doAction(GameState state, Card card, int time)
{
Color faction = card.getFaction();
Player player = state.getPlayer(faction);
if(!player.checkCPU())
{
//First we just display all the possible choices for treasure
String choice = "";
Loot Lbag = state.getBoard().getLoot(state.getDay(... |
bafc8ac2-7505-49f5-bccc-cc62e679a2fd | 5 | BitSet getVersionsLeading( int index )
{
BitSet bs = new BitSet();
if ( index == pairs.size()-1 )
{
for ( int i=0;i<versions.size();i++ )
bs.set( i+1 );
}
else
{
Pair p1 = pairs.get( index );
Pair p2 = pairs.get( ind... |
cce4dc22-e966-47d8-b1cd-af44a8f87164 | 9 | protected void _socketReceivingMessage(ByteBuffer _buf)
{
//将数据放入缓冲中
try
{
_m_bByteBuffer.put(_buf);
}
catch (BufferOverflowException e)
{
ALServerLog.Error("_socketReceivingMessage length is too long, Socket Buffer need more!");
_m... |
696ca28c-b7b6-40b8-9edd-17a27ddb4202 | 7 | public int getParameter(String paramname){
if(paramname == "HoodSize"){return 0;}
if(paramname == "NextX"){return -1;}
if(paramname == "NextY"){return -1;}
if(paramname == "Mat"){ return mat;}
if(paramname == "Matcount"){ return matcount;}
if(paramname == "InMode"){return inmode;}
if(paramname... |
bfb27d0f-6f9c-495b-aa90-4d15b134ca48 | 2 | public void send(ConduitMessage msg) {
while (true) {
try {
msg.send(mOutput);
return;
} catch (Exception exception) {
reconnect();
}
}
} |
880cf7bf-3ab2-4516-a0f9-35cf6721b74b | 3 | public Expression getValueBySlot(int slot) {
slot--; // skip this parameter (not an outer value)
for (int i = 0; i < headCount; i++) {
if (slot == 0) {
Expression expr = head[i];
if (i >= headMinCount)
headMinCount = i;
return expr;
}
slot -= head[i].getType().stackSize();
}
return nul... |
1c32323d-9574-474c-9f2a-09e4f02417c6 | 3 | public Octave(int seed) {
p = p_supply.clone();
if (seed == RANDOMSEED) {
Random rand = new Random();
seed = rand.nextInt();
}
// the random for the swaps
Random rand = new Random(seed);
// the seed determines the swaps that occur between the default order
// and the order we're actually going to... |
818fb137-f269-4b02-9712-3dec73bb16d6 | 6 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
try {
String playerName = event.getPlayer().getName().toLowerCase();
Benutzer sp;
if (!this.plugin.alleBenutzer.keySet().contains(playerName)){
// User aus der DB holen
ResultS... |
6c873fc0-0274-4a84-a69d-45cce19563fb | 2 | public static void main(String[] args) {
// TODO Auto-generated method stub
Controller test=new Controller();
TowerDefense_TransData data;
test.startTurn(1, 0, null);
test.run();
data=test.getInfo(1, 0);
for(int i=0;i<data.getSize();i++)
System.out.println(data.TowerDefense_TransArray[i]);
test.run()... |
7ecdd790-9b3f-42c3-89c1-7eb3caca63ba | 6 | public void onBlockBreak(BlockBreakEvent event) {
Sign sign;
if (!event.isCancelled()
&& event.getBlock() != null
&& (event.getBlock().getType() == Material.WALL_SIGN || event
.getBlock().getType() == Material.SIGN_POST)) {
sign = (Sign) event.getBlock().getState();
if ... |
67d7eb25-1050-4e78-ae6d-be7ac08491c7 | 0 | public Scene getScene() {
return scene;
} |
181e99f6-ff44-4bd5-b54b-8d27b9a6967a | 4 | public boolean valid(String url) {
if (url == null || url.isEmpty())
return false;
try {
String cssURL = getCssURL(url);
if (cssURL == null)
return false;
String content = getContent(cssURL);
ValidationResponse response = new ValidatorBuilder().css().validate(content);
warnings = response.war... |
808e07a8-09ac-40c2-9ff0-b0c404dd52f0 | 6 | private void idCmbxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_idCmbxActionPerformed
String id = "";
try {
if (idCmbx.getSelectedItem() != null) {
ComboBoxUtility.setComboItem(currentClasses, "select classID from classdetail where studentID='" + idCmbx.... |
d557bf2a-ae7e-44af-897e-00ead49ce0fa | 1 | final public CycVariable simpleVariable(boolean requireEOF) throws ParseException {
CycVariable val = null;
Token t = null;
t = jj_consume_token(SIMPLE_VARIABLE);
val = new CycVariable(t.image);
eof(requireEOF);
{if (true) return val;}
throw new Error("Missing return st... |
f66ef48b-6871-4e63-ae83-4a76e0a26f87 | 9 | private boolean statStarters()
{
if((currentToken.kind == Token.NAME) || (currentToken.kind == Token.LPAREN) || (currentToken.kind == Token.DO) || (currentToken.kind == Token.WHILE) || (currentToken.kind == Token.REPEAT) || (currentToken.kind == Token.IF) || (currentToken.kind == Token.FOR) || (currentToken.kind =... |
3a023cc6-dec5-4d45-954f-ce46ad9e4d74 | 6 | public Object getValueAt(int row, int column) {
switch(column) {
case 0 : return row;
case 1 :
// Get memory value
int memoryValue = Integer.parseInt(memory.get(row));
switch(modelType) {
case ACSII :
... |
90e3f75f-5901-41d9-a0b0-d68e39f63de7 | 2 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == acceptadress){
accept();
}
if (e.getSource() == changeNick){
nick.setText(nickGenerator.getNew());
}
} |
4cd6df3a-e845-4d3d-b675-5689afcc0080 | 0 | public static void main(String[] args) {
} |
ee079145-3bf5-4f7d-9061-b1ca2bed9bf9 | 8 | public void mouseMoved(MouseEvent e) {
//鼠标移动到了返回按钮处
if( e.getX() >= 850 && e.getX() <= 890 && e.getY() >= 300 && e.getY() <= 340){
this.returnBtnFlag = true ;
}else{
this.returnBtnFlag = false ;
}
//鼠标移动到了存档按钮处
if( e.getX() >= 850 && e.getX() <= 890 && e.getY() >= 350 && e.getY() <= 390){
this.... |
e394a004-6a87-4c54-82b3-fadeed84e60d | 8 | final int read(int len, int off, int i_3_, byte[] dest) throws IOException {
anInt4555++;
if ((len ^ 0xffffffff) > -1 || (off ^ 0xffffffff) > -1 || (off + len ^ 0xffffffff) < (dest.length ^ 0xffffffff))
throw new IOException();
synchronized (this) {
int i_4_;
if ((anInt4558 ^ 0xffffffff) <= (anInt4556... |
c4c2cf93-b8f9-46b3-9972-ac621703f2dd | 8 | private void getData_with_index(ByteBuffer buf, final int index, OnDataListener dataListener) {
int offset = index;
final int idx[] = new int[6];
getIndex(buf, offset * 10, idx);
int wordid = -1;
if ((idx[3] == 0) && ((idx[5] - idx[1]) > 0)) {
//word
wordid = dataListener.OnWordData(WordFlag.... |
5d729ad6-22fb-4280-89f1-d2b70698e472 | 0 | public void close() throws IOException {
init();
internalIn2.close();
} |
4b88309c-ddfd-44f5-b40a-ff324582574d | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for (String linea; (linea=in.readLine())!=null;) {
StringTokenizer st = new StringTokenizer(linea);
int H = Integer.parseInt(st.nextToken());
double U = Integer.parseInt(st.nex... |
eb49588f-1c1b-440b-948e-5280402a5b6f | 5 | @Override
public void run() {
try {
parsRequest();
if (response.isOK()) {
if (isSMTPorIndexRequest()) {
SMTPRequest.handler(request, response);
} else {
buildResponse();
}
}
} catch (Exception e) {
this.response.setInternalServerError(request.GetHttpVer());
} finally {
... |
35425546-4b03-4c60-8844-d5e478d4611d | 0 | public void addWatcher(Watcher watcher)
{
list.add(watcher);
System.out.println("Add One Watcher !");
} |
cdceff66-1d8c-47f0-aac4-6af581642fd0 | 4 | @Override
public void controlPressed(Command c) {
if (c.equals(up)) {
choice -= 1;
if (choice < 0) {
choice = 0;
}
}
if (c.equals(down)) {
choice += 1;
if (choice >= buttons.size()) {
choice = buttons.size() - 1;
}
}
} |
b23972a6-e73c-406b-962b-adc1401adef4 | 4 | @Override
public boolean containsFloatArray(String name) {
JOSObject<? , ?> raw = this.getObject(name);
if(raw == null) return false;
if(raw.getName().equalsIgnoreCase(FLOAT_ARRAY_NAME)) return true;
return false;
} |
c7d66264-3a80-4bca-b744-ea7eaaf2a624 | 4 | public void setQuantities()
{
if(isElement())
{
int protons = miniCompounds[0].elements[0].protons;
for(int i = 0; i < Element.eDiatomic.length; i++)
{
if(protons == Element.eDiatomic[i])
{
miniCompounds[0].elements[0].quantity = 2;
}
}
}
else if(miniCompounds.length == 1)
{
... |
cc1c28c5-ba15-4a3c-8257-80cef0b6d536 | 4 | public int compareTo(Object other)
{
Location otherLoc = (Location) other;
if (getRow() < otherLoc.getRow())
return -1;
if (getRow() > otherLoc.getRow())
return 1;
if (getCol() < otherLoc.getCol())
return -1;
if (getCol() > otherLoc.getCol(... |
957ab2b8-4bde-4f4e-99fe-04f3b3c8ed3e | 6 | public Case chercheMouvementCase(Case CaseObjectif) {
Case nouvelleCase = new Case(0, 0, null);
int deplacement_X, deplacement_Y;
int deplacement_effectif_X = 0, deplacement_effectif_Y = 0;
deplacement_X = CaseObjectif.getAbscisse() - this.position.getAbscisse();
deplacement_Y = CaseObject... |
309596c8-822e-4141-a877-9d880e71e5fa | 4 | public static int findIndex(String src, String... delimiter)
{
int i = -1;
for (String s : delimiter)
{
int lastIndexOf = src.toUpperCase().lastIndexOf(s.toUpperCase());
if ((lastIndexOf > 0) && (lastIndexOf < (src.length() - 1)))
i = (i == -1) ? lastIndexOf : Math.min(i, lastIndexOf);... |
065a2671-ecaa-4985-9b18-5ad4652f9a4d | 9 | public static PlaneDimension loadDimension(File file) {
try {
FileReader reader = new FileReader(file);
BufferedReader br = new BufferedReader(new FileReader(file));
String line;
ArrayList<ArrayList<Integer>> seatList = new ArrayList<ArrayList<Integer>>();
... |
a922fedb-3872-45a1-ae65-48225ac8a691 | 1 | private void selectionUp() {
pointer--;
if (pointer < 0) {
pointer = buttons.size()-1;
}
} |
dfe68175-e2cf-4861-8028-8477526238d2 | 9 | public String getNextComponent(Identifier ident) {
if (isOr == AND) {
for (int i = 0; i < matchers.length; i++) {
String next = matchers[i].getNextComponent(ident);
if (next != null && matchesSub(ident, next))
return next;
}
return null;
}
// OR case
String next = null;
for (int i = 0; i... |
d97b9527-1d75-485f-a348-ac93966ed562 | 9 | static void lsp_to_curve(float[] curve, int[] map, int n, int ln,
float[] lsp, int m, float amp, float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0; i<m; i++)
lsp[i]=Lookup.coslook(lsp[i]);
int m2=(m/2)*2;
i=0;
while(i<n){
int k=map[i];
float p=.7071067812f;
floa... |
631b300f-8ca3-4dde-905b-14ea19af864b | 0 | private static Image getScaledImage(Image image, float x, float y) {
// set up the transform
AffineTransform transform = new AffineTransform();
transform.scale(x, y);
transform.translate(
(x-1) * image.getWidth(null) / 2,
(y-1) * image.getHeight(null) / 2);
... |
433f92d8-0f0a-4a49-b0bd-b256a552c445 | 0 | public int getIdAlmacen() {
return idAlmacen;
} |
deab4c1f-c412-4b59-bae8-2d63e5efa5d8 | 1 | public MethodInfo[] getMethods() {
if ((status & METHODS) == 0)
loadInfo(METHODS);
return methods;
} |
8c8d3fb6-862e-49e6-982b-93003454309b | 3 | public void updateBoutonsDifficultee(String diff) {
switch(diff) {
case "Facile":
// On change la partie en facile
this.buttonFacile.setEnabled(false);
this.buttonFacile.setForeground(new Color(102,153,255));
this.but... |
d3c4bbde-4143-4597-895c-dce9373bab7a | 7 | public Collector() {
try {
sock = new DatagramSocket(2055);
} catch(SocketException e) {
System.out.println("Can't open socket on port 2055.");
System.exit(-1);
}
if (!ConfigParser.isInitialized()) {
try {
new ConfigParser(new FileInputStream(new File("./collector.cfg")));
} catch (... |
d7bdbf43-51d4-4b86-a0a6-65d26537a862 | 0 | public static String sign(byte[] data, String privateKey) throws Exception {
// 解密由base64编码的私钥
byte[] keyBytes = SecurityCoder.base64Decoder(privateKey);
// 构造PKCS8EncodedKeySpec对象
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
// KEY_ALGORITHM 指定的加密算法
KeyFactory keyFactory = KeyFac... |
643b3438-1de1-4517-b81e-5bc073cd9568 | 4 | public boolean isAlive(Snake snake){
ArrayList<Cell> body = (ArrayList<Cell>) snake.getSnakeBody();
Cell head = body.get(0);
for(int i = 0; i < body.size(); i++){
Cell c = body.get(i);
if(!inBounds(c) || (i != 0 && cellEquals(head, c)))return false;
}
return true;
} |
c4a8f260-5f82-491e-8d54-4704faa34b17 | 4 | public final void log(final Level level, final String logMsg, final Throwable exception) throws Throwable {
if (!shouldLog(level)) {
return;
}
String formatedLog = formatter.giveFormat(level, logMsg);
if (this.shouldFilter(formatedLog)) {
for (Output output: outputs) {
try {
output.write(formated... |
a1257009-7c5d-4a72-981f-e186f60334b5 | 8 | public void scheduler()
{
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable()
{
@Override
public void run()
{
List<String> promotedPlayers = new ArrayList<String>();
synchronized (timepromote)
{
for(String playername : timepromote.keySet())
{
... |
e233cbc2-c076-4e98-8d85-31162aba2221 | 7 | public void mouseMoved(MouseEvent e) {
if (this.horizontalAxisTrace) {
drawHorizontalAxisTrace(e.getX());
}
if (this.verticalAxisTrace) {
drawVerticalAxisTrace(e.getY());
}
Object[] listeners = this.chartMouseListeners.getListeners(
ChartMo... |
71965f54-8749-48bf-8423-76532dcada92 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("crack")){
int publicKey = Integer.parseInt(this.window.publicKeyTextField.getText());
int moduloN = Integer.parseInt(this.window.moduloNTextField.getText());
String encryptedText = this.window.encryptedTextTextField.ge... |
05b60f7d-3033-4fa8-9229-1a2fd62f1d2e | 6 | public String getDirectionStr() {
String dir = direction.name().toLowerCase();
switch(dir) {
case "northwest":
dir = "NW";
break;
case "northeast":
dir = "NE";
break;
case "east":
dir = "E";
break;
case "west":
dir = "W";
break;
case "southwest":
dir = "SW";
break;
case ... |
c47fad17-407a-4fe7-b858-bb1b52dcaffe | 0 | private void jButtonPreviousActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonPreviousActionPerformed
ctrlP.precedent();
}//GEN-LAST:event_jButtonPreviousActionPerformed |
714cda28-ceaf-4649-b9c8-1482a6db8ca9 | 8 | public void checkOutFile( ByteBlob data, long mtime, String path, OnFileCollision onFileCollision, Run run )
throws CollisionException, IOException
{
FileMetadata md = filesystem.getMetadata(path);
if( md != null ) {
switch( onFileCollision ) {
case ABORT: throw new CollisionException(path+" already exists... |
c6eb564f-574e-4833-9118-cf07791ac427 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
52933ff3-031c-4ff2-bf12-aee53267b8b5 | 9 | public void setBiggestP() {
biggestRank = Rank.Engineer;
for (int row = 0; row < RowNum; ++row) {
// for all pieces on the board
// find the piece with the biggest rank on the board
// that belongs to us
for (int col = 0; col < ColNum; ++col) {
Piece p = getPi... |
06a1e43a-469f-431b-b3da-005387dfc19f | 2 | public static WifesGlobalState getSingleton(){
// needed because once there is singleton available no need to acquire
// monitor again & again as it is costly
if(singleton==null) {
synchronized(WifesGlobalState.class){
// this is needed if two threads are waiting at the monitor at t... |
bc5cd960-b14d-4830-95d9-58f60dde7ee3 | 6 | public boolean setParams(Properties props) {
// TODO Consider having it fall back to defaults for missing props
// Look up each property
SEGMENTER_NAME = props.getProperty(SEGMENTER_PROP);
STRESS_SENSITIVE_LOOKUP = new Boolean(props.getProperty(STRESS_SENSITIVE_PROP));
USE_TRUST = new Boolean(props.getProper... |
60cf2919-9a78-4d3a-8117-f5cb140f5a52 | 0 | protected String createXYZ()
{
return "<i>xy</i><sup>" + myLemma.getI() + "</sup><i>z</i>";
} |
31e03b8e-4e76-4bac-961d-d155ef93d37f | 0 | public static int keyIdRequired(int roomId) {
return keyRequired[roomId-1];
} |
888fb581-3dcb-4dbf-9170-a1edc361dc4f | 3 | private static ArrayList<Ability> generateAbilities(int numberOfAbilities) {
ArrayList<Ability> abilities = new ArrayList<Ability>(numberOfAbilities+1);
abilities.add(Ability.ATTACK);
ArrayList<Ability> possibleAbilities = new ArrayList<Ability>(Arrays.asList(Ability.values()));
possibleAbilities.remove(Ability... |
9d6d0d93-eb76-4d1e-9914-709b87603b17 | 5 | private void putMarkInTheConnerOfTheMatrix (Square square, Mark mark) {
Random rand = new Random(System.currentTimeMillis());
do {
switch (rand.nextInt(4)) {
case 0:
mark.setLeftCoord('1');
mark.setTopCoord('a');
... |
7b3b7d15-e6d2-4927-a0aa-2bc4bfdd64cb | 4 | public XMLNode setName(String name) {
if(name == null || name.isEmpty()) {
throw new TXMLException("Names of nodes cannot be null or empty");
} else if(name.matches("[0-9" + TXML.PUNC + "](.+)?")) {
throw new TXMLException("Name '" + name + "'is invalid,"
+ " names of nodes cannot start with numbers or p... |
713d722d-0415-425e-9377-c14764de25e8 | 7 | public void draw(Graphics2D g) {
// Draw the map image
g.drawImage(_image, 0, 0, null);
//Draw the locations
for(int i=0;i<mygraph.getCurr();i++){
mygraph.locations[i].draw(g);
}
// Draw the line
for(int i=0;i<mygraph.getCurr();i++){
for(int j=i+1;j<mygraph.getCurr();j++){
... |
81fd66f6-8217-4e18-b067-1de3cb1ad8cd | 1 | public static void main(String[] args) {
DB database = new DB();
if (database.init()) {// ɹݿ¼
LoginFrame frame = new LoginFrame(database);
frame.setVisible(true);
} else
JOptionPane.showMessageDialog(null, "ݿʧ", "",
JOptionPane.ERROR_MESSAGE);
} |
1e1af48a-cc41-4939-95eb-dd31a56aff2d | 8 | public static String getShortUnitText(double v, String u) {
double va = Math.abs(v);
if (va < 1e-13) {
return null;
}
if (va < 1e-9) {
return shortFormat.format(v * 1e12) + "p" + u;
}
if (va < 1e-6) {
return shortFormat.format(v * 1e9) ... |
8bd3da63-b9f9-4189-87e0-84fc8dddfe6b | 6 | public HawkWwwAuthenticateContext build() throws HawkException {
/*
* If this is a builder for/from a header that has a ts-parameter...
* (tsm can be set (when parsed from header) or null, in which case
* it will be generated when a header is built from us.
*/
if (this.ts != 0) {
/*
* Si... |
dda53f05-8f81-4e27-b0f5-83f78926d77e | 2 | private void computerTurn() {
if(!isPlay) return;
int []pos = game.nextMove(computer);
if(pos!=null) {
int i = pos[0];
int j = pos[1];
buttons[i][j].setText(chars[computer]);
game.setBoardValue(i,j,computer);
}
checkState();
} |
bc2dc2d3-c5ff-4c1e-afcb-5393fc290bec | 0 | private void printTime(double time) {
System.out.println("Average time taken: " + time + " ms");
} |
9a94ab59-7ef2-4417-a2ec-cd96b4d720f1 | 1 | public boolean ModificarProveedor(Proveedor p){
if (p!=null) {
cx.Modificar(p);
return true;
}else {
return false;
}
} |
019c1bc2-c2d3-4f56-8657-f83ff923d7cc | 7 | @Override
public void run() {
// InputStream.read(buf, offs, len)
InputStream is;
byte[] length_buffer = new byte[4];
byte[] message_buffer = new byte[2048];
int message_length;
int num_touches;
ByteBufferView view = new ByteBufferView(length_buffer);
... |
230b0616-fcb8-4783-a054-b62fdaac1576 | 1 | private void createAttachements( List<EndPoint> endPoints, Side side ){
sort( endPoints, side );
int sx = startX( side );
int sy = startY( side );
int tx = endX( side );
int ty = endY( side );
int dx = (tx - sx) / (endPoints.size()+1);
int dy = (ty - sy) / (endPoints.size()+1);
int d... |
ddaa132a-6340-4f7a-bb4d-1ce466b92a91 | 1 | public List<String> getSongPath() {
if (songPath == null) {
songPath = new ArrayList<String>();
}
return this.songPath;
} |
d9f7f8e2-39a6-4cf0-9190-b4b9e91abf06 | 2 | public static PassengerCommsFacilityEnumeration fromValue(String v) {
for (PassengerCommsFacilityEnumeration c: PassengerCommsFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
954512df-9f31-495b-baba-b128e60a9358 | 3 | public void doLoop() {
String insert="insert into paperTermcount(paperid,count)values(?,?);";
int num=0;
try {
PreparedStatement statement=sqLconnection.conn.prepareStatement(insert);
this.rs=getPaperID();
while (rs.next()) {
int id = rs.getInt("paperid");
int termcount = getCount(id);
statem... |
e1788d03-a7db-4c1a-a095-fbeb724d7a0a | 3 | private void maybeReconnectOnOpen() {
if (!this.openReconnect && !this.reconnecting && this._reconnection) {
this.openReconnect = true;
this.reconnect();
}
} |
27485800-b612-42c4-bd05-961fec2fc8d2 | 4 | public void create(){
if(!sDir.exists()){
sDir.mkdir();
}
if(!playerData.exists()){
playerData.create();
setupPlayerData();
}
if(!inventoryData.exists()){
inventoryData.create();
}
if(!worldData.exists()){
worldData.create();
}
} |
10b1ae62-088c-4089-8fd9-49fef455f675 | 2 | private void InitDH()
{
this.PublicKey = new BigInteger("0");
while (this.PublicKey.equals(zero))
{
this.Prime = BigInteger.probablePrime(BITLENGTH, new Random());
this.Generator = BigInteger.probablePrime(BITLENGTH, new Random());
this.PrivateKey = new BigInteger(GenerateRandomHexString(30), 16);
... |
8931ed2a-1a09-4064-a33d-909b69bfaba0 | 2 | public Shape rotateRight() {
if (pieceShape == Tetrominoes.SquareShape)
return this;
Shape result = new Shape();
result.pieceShape = pieceShape;
for (int i = 0; i < 4; ++i) {
result.setX(i, -y(i));
result.setY(i, x(i));
}
return result;
} |
83407e02-2b07-49d1-8dbb-1e9979700e59 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addbtn) {
AddProduct s = new AddProduct("เพิ่มสินค้า");
}
if (e.getSource() == salebtn) {
ProductSale s = new ProductSale("ขายสินค้า");
}
if (e.... |
032152d1-705f-410f-84af-597182360e3f | 3 | public V put(K key, V value) {
searchElement(key);
// Previous value associated with the key
V previousValue = null;
if (_searchHolder == null) {
// Create the bucket sub-array if there is none
if (buckets.getElement(_searchBucketIndex) == null) {
... |
6823da9a-d5c6-4fb4-b22f-b609fd37e706 | 0 | @SuppressWarnings("unchecked")
public List<Order> getAllPendingOrders() {
return (List<Order>)this.em.createNamedQuery("findAllPendingOrders").getResultList();
} |
ca873555-77d7-48f5-96d7-1c4c0665da14 | 3 | public Bncd(File f)
{
ArrayReader inp = new ArrayReader(f.getContents());
inp.readInt(); //Magic;
unk = inp.readShort();
int entryCount = inp.readShort();
int entriesOffset = inp.readInt();
int subEntriesOffset = inp.readInt();
int dataOffset = inp.readInt();
... |
33e27e45-3605-460a-8d7f-a00da3465617 | 6 | public byte[] parse() {
if ( filename == null ) return null;
Scanner file = readerOpen();
if ( file == null ) return null;
// Checks for nulls and returns, expects
// Caller to do something with this
byte[] squares = new byte[128];
String x;
for ( int i = 0; i < 128; i ++ ) {
if ( ( i & 0x88 ) != 0 )... |
27c7fe90-3e8f-41ad-9985-3bbd7f45d872 | 3 | public synchronized byte[] getBlock(int offset, int length){
if(!this.completed)
return null;
if(offset + length > this.length)
return null;
byte[] block = new byte[length];
for(int i = 0; i < length; i++){
block[i] = this.data[offset + length];
}
return block;
} |
93d48d3c-ee37-47b1-857e-cce248a2e3bc | 5 | public boolean move() {
decreaseMoveDelay(); //csökkenti a késleltetést
if (moveDelay==0) { //ha 0 a késleltetés
if (((PathTile) currentTile).getNextTiles().size()>0) {
ArrayList<Tile> nextTile = ((PathTile) currentTile).getNextTiles();//lekéri az elérhető cellákat
((PathTil... |
8d25001d-e9e3-4a95-a6a9-ba2ab1e91c8e | 6 | static final public void primaire() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VRAI:
case FAUX:
case entier:
case ident:
valeur();
break;
case 52:
jj_consume_token(52);
expression();
jj_consume_token(54);
break;
default:
jj_... |
8353d744-e548-4afb-93eb-2a49758e1b79 | 9 | public void run() {
// Launch the pipeline, and execute each stage in sequence.
while (this.isRunning) {
// Start FETCG stage.
if (fetchStage.execute() != 0) {
// FETCH stage failed.
log.error("FETCH stage failed. Please check");
}
// Start ISSUE stage
if (issueStage.execute() != 0... |
29609b75-568b-4d27-9121-5e7b56a0f38a | 7 | private void sendOrderCaps(RdpPacket_Localised data) {
byte[] order_caps = new byte[32];
order_caps[0] = 1; /* dest blt */
order_caps[1] = 1; /* pat blt */// nb no rectangle orders if this is 0
order_caps[2] = 1; /* screen blt */
order_caps[3] = (byte) (Options.bitmap_caching ? 1 : 0); /* memblt */
order_c... |
a118248c-e586-4ecb-8a50-305d01ae6f2e | 8 | private void input() {
if (Keyboard.isKeyDown(Keyboard.KEY_W) || Keyboard.isKeyDown(Keyboard.KEY_UP)) {
platform.setDY(-SPEED);
}
else if (Keyboard.isKeyDown(Keyboard.KEY_S) || Keyboard.isKeyDown(Keyboard.KEY_DOWN)) {
platform.setDY(SPEED);
}
else if (Keyb... |
2a89c0f5-55d4-4358-8499-675bdf69e1be | 6 | private AlgebraicParticle multiply(AlgebraicParticle a, AlgebraicParticle b) {
//if a is a fraction and b is the bottom of that fraction
if(a instanceof Fraction && ((Fraction)a).getBottom().equals(b)) {
Fraction frac = (Fraction) a;
//return the top of the fraction, making sure it's got the right sign
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.