method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
29e24247-2979-45e6-8a90-47a7b7706d70 | 2 | public IframeLinkFinder(final String content) {
if (content == null || "".equals(content.trim())) {
throw new IllegalArgumentException("content cannot be null");
}
this.content = content;
} |
bbe6f91e-df5b-4cf5-a37c-19e6c84ebf60 | 9 | public static String fixupDocumentationStringQuoting(String documentation) {
if (documentation == null) {
return (null);
}
{ int closingquoteposition = Stella.NULL_INTEGER;
char precedingcharacter = Stella.NULL_CHARACTER;
String openparentheses = "([{";
StringBuffer buffer = new Stri... |
925c518b-dac3-4198-9813-df6ac5c46845 | 3 | public static void timeout(long timeInMillis) {
long start = System.currentTimeMillis();
long end = start + timeInMillis;
long now;
long prev = 0;
while ((now = System.currentTimeMillis()) < end) {
// print every second
if (((now - start) % 1000 == 0) && (now != prev)) {
System.out.print(".");
... |
4dcbfa46-1189-4186-90e9-df0c5858e46d | 3 | public static void main(String[] args) {
ExecutorService es = Executors.newFixedThreadPool(10);
List<Future> listFutures = new LinkedList<>();
listFutures.add(es.submit(new CallableImageLoader(1, "http://chudesa-mira.ru/uploads/images/00/00/21/2011/11/17/872999.jpg")));
listFutures.add(e... |
7b443962-10a9-4318-9cb8-fea1d9374f81 | 1 | private FormDataMultiPart createInstance(String filePath) {
File f = new File(filePath);
if (f.isFile()) {
FileDataBodyPart fdp = new FileDataBodyPart("file", f,
MediaType.APPLICATION_OCTET_STREAM_TYPE);
FormDataMultiPart formDataMultiPart = new FormDataMultiPart();
formDataMultiPart.bodyPart... |
a6d6bd30-ba6e-4d7a-9c0b-e14925b4b4ae | 6 | protected void engineInit(final Map attributes) throws KeyAgreementException {
rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);
N = (BigInteger) attributes.get(SHARED_MODULUS);
if (N == null) {
throw new KeyAgreementException("missing shared modulus");
}
g = (BigInteger)... |
01dae936-13f1-4a3e-8848-b922335b84bd | 6 | public void run() {
try {
System.out.println("開始下載[" + fileName + "]");
byte[] b = new byte[1024];// 一次取得 1024 個 bytes
int len, bits = 0;// len單次讀取位元數,bits每秒累計下載位元數
while ((len = bufInStream.read(b, 0, b.length)) != -1) {
if (!isRun) {
// System.out.println("停止下載");
break;
}
fileOutS... |
b534f454-5660-4d67-b620-a58e7993f61e | 5 | public void mousePressed(MouseEvent me){
JComponent c = (JComponent)me.getSource();
TransferHandler handler = c.getTransferHandler();
handler.exportAsDrag(c, me, TransferHandler.COPY);
if("JObjective".equals(me.getComponent().getClass().getName())){
lblSel = (JObjective)me.getComponent();
... |
2814893c-a8d0-4e9b-abb1-617f4d1c56d0 | 5 | @Override
public int check(DiceSet diceSet) {
int points = 0;
Set<Integer> vals = new HashSet<Integer>();
for (int i = 0; i < diceSet.SIZE; ++i) {
vals.add(diceSet.getValue(i));
}
for (int i = 1; i <= diceSet.getDiceMax() - n + 1; ++i) {
points = rew... |
3278a4a5-7cbb-4cb0-b069-78bb15cf4fd8 | 3 | public void start() {
s = new Server("Test", 25565, "Test");
Messages m = new Messages(s);
s.Start();
while (s.Running) {
String line = new Scanner(System.in).nextLine();
if (line.startsWith("/")) {
line = line.substring(1); //Get rid of the / at the beginning
if (line.split("\\ ").length > 1)
... |
38bb9d73-8fd4-4731-948d-a191cd491e64 | 0 | public void clickChooseCharacters(Scanner kb, ArrayList<MainMenuHeroSlot> heroies) {
System.out.println("You have already chosen characters to play with.");
} |
d02008a6-a4f9-416c-aed8-d96a5e86c3f1 | 9 | private final boolean isGmBuff() {
switch (sourceid) {
case 1005: // echo of hero acts like a gm buff
case 10001005: // cygnus Echo
case 20001005: // Echo
case 9001000: // GM dispel
case 9001001: // GM haste
case 9001002: // GM Holy Symbol
... |
139470b2-3311-458e-a6de-998bb2451344 | 3 | public void updateScore(SnakePlayer p) {
int id = p.PlayerID - 1;
if (id >= 0) {
String stringText = playerScores[id].getText();
int index = 0;
for (int i = stringText.length() - 1; i >= 0; i--) {
if (stringText.substring(i - 1, i).equals(":")) {
index = i;
break;
}
}
playerScores[id... |
94ddc122-76b2-4edc-bfa9-e55dcbc41fe9 | 2 | private Cell[][] buildCells(int cellSize) {
cellsWidth = dungeonWidth / cellSize;
cellsHeight = dungeonHeight / cellSize;
Cell[][] cells = new Cell[cellsHeight][cellsWidth];
for (int i = 0; i < dungeonHeight; i += cellSize) {
for (int j = 0; j < dungeonWidth; j += cellSize) ... |
5c9e5d01-1110-42ad-abfa-b1d736d1800c | 9 | public void actionPerformed(ActionEvent e){
String action = e.getActionCommand();
if(action.equals("Add photo")){
popup = new newPhotoPopUp(PhotosScreen.this.control,PhotosScreen.this,PhotosScreen.this.album);
popup.setVisible(true);
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
... |
79c01b39-cc37-49c2-adaa-15c7f9209ca6 | 4 | public boolean check()
{
if (p1Turn && p1.isStop())
{
p1Turn = false;
}
else if (p1.isStop() && p2.isStop())
{
return false;
}
return true;
} |
141e01c4-f537-48bf-bc23-ebe9132146f9 | 5 | public static void load(Plugin plugin) {
FileConfiguration conf = plugin.getConfig();
for (Field field : ConfigurationLoader.class.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers()) && !Modifier.isTransient(field.getModifiers())) {
String path = field.getName(... |
bfd5eea9-9a3b-4f98-bc0b-2d71ffba7dea | 2 | @Override
public boolean isLeaf ( Object node ) {
Value<?> vnode = ( (BencodeTreeNode) node ).getValue();
return ( vnode instanceof IntegerValue ) || ( vnode instanceof StringValue );
} |
d41b4d03-af6c-43d2-b79c-a6c41735b826 | 9 | public void insertString(int offset, String str, AttributeSet a)
throws BadLocationException {
if (str.length() == 1 && str.charAt(0) == '\n' && offset > 0) {// New
// line
String s = getText();
// Locating previous line
int lineStart = offset - 1;
for (; lineStart >= 0; lineStart--) ... |
bc113900-c340-49cd-ae26-01fa76079bc6 | 5 | @Override
public int executeCommand(Object sender, String commandRaw) {
int firstSpace = commandRaw.indexOf(" ");
String command = firstSpace >= 0 ? commandRaw.substring(0, firstSpace) : commandRaw;
String[] args = firstSpace >= 0 ? commandRaw.substring(firstSpace + 1).split(" ") : new Strin... |
e272b713-5147-4be9-b722-505d1005f36d | 8 | private static <A, B, K> JoinCheckResult<A> doJoinCheck(List<A> listA,
FieldGetter<A, K> fieldGetterA, List<B> listB,
FieldGetter<B, K> fieldGetterB, Mapper<B, A> mapper,
boolean leftJoin) {
if (listA == null || listB == null || fieldGetterA == null
|| mapper == null) {
throw new IllegalArgumentExcept... |
87ebd010-d005-4ebf-892c-82a48eb4e158 | 8 | @EventHandler
public void blockBreak(BlockBreakEvent e){
Recipe rr = new Recipe(plugin);
Player p = e.getPlayer();
String timeStamp = new SimpleDateFormat("yyyy/MM/dd HH").format(Calendar.getInstance().getTime());
PlantUtil pla = new PlantUtil(plugin);
if(pla.isGrowableBlock(e.getBlock())){
if(plugin.isPl... |
b5fd4b76-e175-4484-a893-0fbc2e01699d | 7 | public int compareTo(Object o) {
if (!(o instanceof Segment)) {
return -1;
}
Segment s = (Segment) o;
// if regions overlap at all, declare the segments equal,
// to avoid overlap in the segment list
if (((s.en... |
b668502c-dc0a-4b7a-84a1-dbce7690f6d5 | 2 | public void go_hors_ligne(){
new Thread(){
public void run(){
while(!terminer){
vue.afficher_horsligne(true, periode_hors_ligne);
try {
sleep(periode_hors_ligne);
} catch (InterruptedException e) {}
}
}
}.start();
} |
cec4731c-f687-4f6c-9b56-da9dda9ad699 | 7 | private void doAction(SoundManager sm){
//Verificando a ação:
switch(action){
case BTN_ROLLPLAY:
break;
case BTN_MUTE:
sm.toggleMusic();
muted = sm.isMuted();
if(muted)
... |
35b4bcad-d00b-42d1-bcc1-c11522b74ad8 | 5 | public void get(int key) {
int level = 0;
HashPrinter.tryGet(key);
int hash = (key % TABLE_INITIAL_SIZE);
boolean found = false;
if (table[hash] != null) {
Node entry = table[hash];
while (entry != null) {
if (entry.getKey() == key) {
found = true;
break;
}
if (entry !=... |
1c218390-4b80-436b-b5dc-bff36415bed0 | 8 | public DialogSetting(Framework fmwk){
GE = GraphicsEnvironment.getLocalGraphicsEnvironment();
GD = GE.getDefaultScreenDevice();
DM = GD.getDisplayMode();
// this.setAlwaysOnTop(true);
this.setPreferredSize(new Dimension(340,340));
try{
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassNa... |
dcc8da98-ce4c-413e-8b00-aa08c7662c03 | 9 | private boolean isGoodSolution(LightRabin lr) {
if (!lr.initialState.equals(initialState)) {
return false;
}
for (Integer s : lr.states) {
if (!lr.liveStates.contains(s) && !isInSomeUSet(s)) {
return false;
}
}
HashSet<Integer> stss = (HashSet<Integer>) lr.states.clone();
stss.add(lr.initialS... |
b42e564c-4e0b-4aa1-b29d-23426bc3924d | 6 | public static Map mapFromDatabase(String url, String user, String password) {
Connection c = null;
Statement stmt = null;
Map imagesTags = new HashMap();
try {
/* Connect to database */
Class.forName("org.postgresql.Driver");
c = DriverManager.getCon... |
ca201e4e-fe23-4474-b93b-cb4e74500ddd | 8 | @Override
public String healthText(MOB viewer, MOB mob)
{
final double pct=(CMath.div(mob.curState().getHitPoints(),mob.maxState().getHitPoints()));
if(pct<.10)
return L("^r@x1^r is raging in bloody pain!^N",mob.name(viewer));
else
if(pct<.20)
return L("^r@x1^r is covered in blood.^N",mob.name(viewer))... |
e9c9a5d3-eab4-46ad-88fa-c92c4db86621 | 5 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String promo = request.getParameter("promo");
Strin... |
b82d9c18-b258-400c-af34-06823bb3b05c | 9 | @Test
public void testRun()
{
comm1 = new Communicator(comm1PortNumber);
comm2 = new Communicator(comm2PortNumber);
//setUpAddresses
toComm1Address = new InetSocketAddress("127.0.0.1", comm1PortNumber);
toComm2Address = new InetSocketAddress("127.0.0.1", comm2Por... |
ec0409fe-3159-4244-a5e1-aae6d5ba5017 | 1 | public static boolean state(String state){
if(state.matches("[A-Z]{2}"))
return true;
return false;
} |
b2e0e6a0-2398-4f84-bdfd-89313afcad60 | 6 | public BSTNode getName(int isbn) {
try {
if (Tmproot == null) {
Tmproot = root;
}
if (root == null) {
return null;
} else {
if (isbn == Tmproot.getData()) {
return Tmproot;
} else if (Tmproot.getData() < isbn) {
Tmproot = Tmproot.getRight();
} else if (Tmproot.getData() > ... |
8291b606-edff-47fa-ad03-f89190986bc2 | 5 | public CheckResultMessage checkTF02(int day) {
int r1 = get(20, 2);
int c1 = get(21, 2);
int r2 = get(23, 2);
int c2 = get(24, 2);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (0 != getValue(r1 + 1, c1 + day, 2).abs().compar... |
6be77b58-9b6f-4c97-8011-2f790bc5674d | 8 | @Override
protected void setValuesImpl(Frame f) {
TokenMakerMaker app = (TokenMakerMaker)f;
File javac = app.getJavac();
if (javac!=null) {
try {
javac = javac.getCanonicalFile();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
javacField.setText(javac==null ? null : javac.getAbsolu... |
1dc96562-0256-4894-99b9-6eb61296df6e | 1 | private String getNumber(String path) {
File file = new File(path+ File.separator+ "Info.plist");
String date;
try {
NSDictionary rootDict = (NSDictionary)PropertyListParser.parse(file);
date = rootDict.objectForKey("Phone Number").toString();
} catch (Exception e) {
e.printStackTrace();
retur... |
4c77df7a-0818-4711-bf64-b7a91a5ce5a3 | 8 | private void TfCodServicoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_TfCodServicoKeyReleased
if (!TfCodServico.getText().equals("")) {
prodcompravenda.getForneproduto().getProduto().setCodigo(Integer.parseInt(TfCodServico.getText()));
if (prodcompravenda.getForneproduto()... |
0b525fd9-2aab-4a64-8644-3dfa7128afa3 | 2 | private void executeSelecting() {
System.out.println("selecting");
Coordinate coordinate = sphereConverter.giveMouseCoordinates(mouseCoordinateX, mouseCoordinateY);
if (coordinate.giveLatitude() >= -90 && coordinate.giveLongitude() <= 90) {
sphereConverter.setCenterCoordinate(coordinate);
repaint();
}
} |
b40a4bf1-2e8d-4534-a7d2-82f4f8531b7c | 0 | public void mousePressed(MouseEvent e)
{
// TODO Auto-generated method stub
} |
186d2bf0-81e0-4e31-9725-587468c92661 | 0 | public String getRobotName() {
return robot_name;
} |
fcf5aecd-0284-4d7c-b9c9-27480cb7af74 | 3 | public boolean checkPort(int _port){
ServerSocket socket = null;
try {
socket = new ServerSocket(_port);
socket.close();
return true;
} catch (IOException e) {
return false;
} finally {
if (socket != null)
try {
socket.close();
... |
af84ed79-bd4d-4058-ac69-b067cf294bce | 3 | @Override
public List<Paciente> listConsulta() {
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
List<Paciente> pacientes = new ArrayList<>();
try {
con = ConnectionFactory.getConnection();
pstm = con.prepareStateme... |
5a3d9d14-8b54-43d5-b90f-198a1289ac5f | 9 | public JLabel getTecla(int tc) {
JLabel botao = jLabel0;
switch (tc) {
case 0:
botao = jLabel0;
break;
case 1:
botao = jLabel1;
break;
case 2:
botao = jLabel2;
break;
... |
917acc13-7aba-4ecb-a592-55cc87695fb4 | 2 | public void print(int index)
{
System.out.println("\r" + tree.elementAt(index).item
+ "(" + tree.elementAt(index).chance_weight
+ "/" + tree.elementAt(index).family_weight + ")");
if(2*index+1 < tree.size()){ // has son
System.out.println("\tson[" + (2*index+1) + "]:" + tree.ele... |
96a7ca6a-638c-4553-bf33-50ee14102e22 | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
eb136041-b794-46c3-ba73-90bdce849392 | 6 | private static Batch <Class> loadClassesInDir(
String packageName, Batch <Class> loaded
) {
if (loaded == null) loaded = new Batch <Class> () ;
final File baseDir = new File(packageName.replace('.', '/')) ;
if (baseDir.isDirectory()) for (File defined : baseDir.listFiles()) try {
final Stri... |
1ff12b3b-2bae-4e5c-8b86-28a20c04620e | 0 | public String getKind(){
return this.kind;
} |
ab818857-d7c5-4693-9da8-7dce28e3a2c0 | 3 | public synchronized static ImageIcon getImageIcon(String name)
{
if (name == null)
{
return null;
}
try
{
String key = name;
ImageIcon imageIcon = (ImageIcon) sImages.get(key);
if (imageIcon == null)
{
// Try and load the image and place in the set
imageIcon = new ImageIcon(sRHImage... |
d0ac875b-40a0-4e2e-aa67-85e8074ffeaf | 1 | public void mouseReleased(MouseEvent e){
if (e.isPopupTrigger())
doPop(e);
} |
88eeb890-1b46-4de7-9350-f3bd9ad09d0a | 8 | public Node[] getPlayableNodes() {
LinkedList<Node> list = new LinkedList<Node>();
for (Node[] n1 : gameBoard ) {
for (Node n2 : n1 ) {
if ( n2.getChar() != 'n' ) continue;
for ( Node n3 : n2.getNeighbors() ) {
if ( n3 != null && n3.getChar() != 'n' ) {
list.add(n2);
break;
... |
3b66009d-8308-455e-8e94-b8dc2ac80dec | 2 | public static boolean zmq_unbind(SocketBase s_, String addr_) {
if (s_ == null || !s_.check_tag ()) {
throw new IllegalStateException();
}
return s_.term_endpoint (addr_);
} |
fc02a5d8-1d8e-47ac-994f-25350561fb03 | 1 | public void extractAndSaveBooksFromData(){
//Get data from the webservice
String base64String = getDataFromWebService();
//decode it
String bookRecordString = new Base64Decoder().getBase64DataAsString(base64String);
//Get the list of books
List<Book> bookList = getBookListFromData(bookRecordString)... |
67a0638e-e16e-4209-b934-12ab85bcd268 | 1 | private BufferedImage loadImage(String ref) throws IOException
{
URL url = TextureLoader.class.getClassLoader().getResource(ref);
if (url == null) {
throw new IOException("Cannot find: "+ref);
}
BufferedImage bufferedImage = ImageIO.read(new BufferedIn... |
070b12f0-008f-49a0-ba32-3429646b227e | 1 | public T getLast() {
if(nodes.size() < 0)
return null;
return nodes.get(nodes.size() - 1);
} |
f33debe8-3f42-42d6-81a2-20a4f2ea97bd | 3 | public void updatePerfData(boolean answerCorrect)
{
if (phrase.core.reverse)
{
if(answerCorrect)
{
phrase.perf.revSuccess++;
phrase.perf.revLastSuccess = new java.sql.Timestamp(System.currentTimeMillis());
}
else
{
phrase.perf.revSuccess--;
phrase.perf.revLastFail = new java.sql.Time... |
88a033b0-fea3-407e-b6a7-8495c4aa45f4 | 4 | @Override
public int compareTo(BFSSearchNode o) {
if(this.depth < o.getDepth()){
return -1;
}else if(this.depth > o.getDepth()){
return 1;
}else{
if(this.state.id < o.getState().id){
return -1;
}else if(this.state.id > o.getState().id){
return 1;
}else{
return 0;
}
}
} |
b6c9f58b-9a35-4702-a8b9-fe9c0e6f5844 | 9 | public void ReadHistogram() {
// TODO
// currently we are reading always from IP with Index 0
// but how to deal with multiple histograms?
// maybe make the one displayed switchable to select which camera the data should come from?
URLConnection conn = null;
BufferedRea... |
04faa0b7-0c9a-4b3a-835f-67f776b07a36 | 1 | @Override
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
//System.out.println("setBoundsForFrame");
if (!(f instanceof JInternalFrame)) {
newWidth = ICON_WIDTH;
newHeight = ICON_HEIGHT;
newX = findNearest(newX,ICON_WIDTH) * ICON_WIDTH;
newY = findNear... |
6dbc5390-e25c-444d-8780-6e0f9022631b | 0 | public void setPrenom(String prenom) {
this.prenom = prenom;
} |
7572ffdc-2ca5-42ef-ab85-79fccac6fd92 | 9 | public void tick() {
int xa = 0;
int ya = 0;
if (input.up.isPressed())
ya--;
if (input.down.isPressed())
ya++;
if (input.left.isPressed())
xa--;
if (input.right.isPressed())
xa++;
if (xa != 0 || ya != 0) {
move(xa, ya);
isMoving = true;
} else {
isMoving = false;
}
// Sca... |
87e2e9fc-1195-4efa-9d85-aa9c61c2aefd | 5 | private Map<String, String> extractFieldsFromOneFile(File f, WebSite webSite)
throws FileNotFoundException, JSONException {
JSONObject jsonObject = new JSONObject(new JSONTokener(
new FileReader(f)));
Map<String, String> resultingFieldMap = new HashMap<>();
String content = jsonObject.getString("content")... |
c10d3677-48e9-42ea-a83d-59f9b152dd5f | 1 | public FeederTurn(boolean toward) {
addSequential(new GyroTurn((toward ? 1 : -1)*110, 0.65));
} |
9d1b70ff-e8af-4526-89c0-1c0962d7b8b9 | 4 | public void focusLost( FocusEvent e )
{
int id = e.getID() ;
TLangTextField field = langFields[id] ;
if ( field.isDataChanged() && ( !popup.isVisible() ) )
{
// ask
if ( !TGlobal.config.confirmDataOnFocusLost() )
{
if ( JOptionPane.showConfirmDialog( null,
... |
23e978f0-16e1-4cbd-aeee-45719006555d | 1 | public String getSuperName() {
int n = items[readUnsignedShort(header + 4)];
return n == 0 ? null : readUTF8(n, new char[maxStringLength]);
} |
a6a08986-16f0-46bc-a0fe-e6a3fd7a420e | 7 | @Override
public Class<?> getColumnClass(int columnIndex) {
Class<?> clazz;
switch (columnIndex) {
case 0:
case 3:
case 4:
clazz = Integer.class;
break;
case 1:
clazz = String.class;
break... |
327198fd-b3d6-45c7-8751-ad7e197fd263 | 5 | public void setQuestion(String question, ArrayList<String> answerList){
updateScore();
if(currentView != questionPanel){
if(currentView != null){
contentPane.remove(currentView);
}
currentView = questionPanel;
contentPane.add(questionPanel, BorderLayout.CENTER);
}
currentQuestionPanel.remove(c... |
5e4c6109-0bf8-4942-a4cc-f726f53e08fb | 1 | public double getDouble(String o) {
String i = ", ";
if (o.equals("avatarid"))
i = "}";
String v = Pattern.compile(o + ": ").split(line)[1];
return Double.parseDouble(v.substring(0, v.indexOf(i)));
} |
bb031089-9b5b-4322-ab54-a5dbbce4ab6c | 1 | public void testGet_DateTimeFieldType() {
MutableDateTime test = new MutableDateTime();
assertEquals(1, test.get(DateTimeFieldType.era()));
assertEquals(20, test.get(DateTimeFieldType.centuryOfEra()));
assertEquals(2, test.get(DateTimeFieldType.yearOfCentury()));
assertEquals(200... |
b91772f8-f7af-441a-b633-9b1fe449160c | 3 | private void listServices() throws Exception
{
final ListServices list_services = new ListServices();
connection.execute(list_services);
final Service[] services = list_services.getServices();
if (services == null || services.length < 1)
throw new Exception("Device does not support EtherIP ser... |
6e538c15-9131-4ba4-a9c0-fa27afaa9cf5 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TestClass other = (TestClass) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
ret... |
33a93a54-5952-47ca-91fe-c2d190e58793 | 7 | public static void saveChunk(String name, Chunk c) throws Exception{
String chunkPath = path +"/"+ name +"/chunks/";
if (!new FileHandle(chunkPath).exists())
new FileHandle(chunkPath).mkdirs();
NBTOutputStream nbtout = new NBTOutputStream(new FileOutputStream(new FileHandle(chunkPath + c.posx + " " + c.posy + ... |
c9fdc03b-29c0-4db3-b7f5-d6702c56e2ed | 8 | public static Direction flip_y_dir(Direction d) {
switch (d) {
case NW:
return SW;
case W:
return W;
case SW:
return NW;
case N:
return S;
case S:
return N;
cas... |
247dcc0a-e4cd-454b-9576-322d631a1266 | 7 | public void inxbuild() {
int i, j, smallpos, smallval;
int[] p;
int[] q;
int previouscol, startpos;
previouscol = 0;
startpos = 0;
for (i = 0; i < netsize; i++) {
p = network[i];
smallpos = i;
... |
b8075ea5-b60e-4554-b394-cd57e8002d1a | 1 | @Override
public ICacheable put(Object key, ICacheable value) {
ICacheable c = null;
if(null != mMemLruCache){
c = mMemLruCache.put(key, value);
}
return c;
} |
a5dc530e-b2c5-4db7-a9a6-908e2b52b072 | 0 | private static void printUsage() {
System.out.println("usage: java -jar conan.jar [options] folder1 [folder2 [folder3...]]");
System.out.println("");
System.out.println("options:");
System.out.println(" --log LEVEL");
System.out.println(" set the logging verbosity. LEVEL can be INFO (show everything), ... |
d07b401b-8f29-472b-a37b-b6a4c1427f04 | 6 | private String withdrawChecking(Scanner in) throws FileNotFoundException
{
System.out.println("Current balance: " +
supportedBank.getCheckingBalance(currentCustomer));
boolean successWithdraw = false;
while(!successWithdraw)
{
System.out.println(
"Please enter a... |
c296ec25-d3b6-46b3-ba99-1f4f0278e8f4 | 4 | public static void main(String[] args) throws Exception {
if(args.length < 1) {
System.out.println("Usage: fileName");
System.exit(0);
}
Pattern p = Pattern.compile("class \\w+\\s+");
Pattern q = Pattern.compile("^(//|/\\*|\\*)");
System.out.println("class... |
70e9b61a-c2bf-4483-9b8a-ae7abb4c4cec | 7 | public final static BulletIcon get(int type) {
switch (type) {
case OPEN_SQUARE_BULLET:
return SquareBulletIcon.sharedInstance();
case SOLID_SQUARE_BULLET:
return SolidSquareBulletIcon.sharedInstance();
case OPEN_CIRCLE_BULLET:
return OpenCircleBulletIcon.sharedInstance();
case SOLID_CIRCLE_BULLET:
... |
d929f0b0-bd37-442b-a20c-6527bc5236e2 | 9 | private static void installThese(List<Version> toInstall) throws MalformedURLException, IOException {
buildUpdateFrame();
UpdateFrame.setVisible(true);
// Update the files.
OverallProgress.setMaximum(toInstall.size());
int i = 0;
final int maxi = toInstall.size();
for (Version v : toInstall) {
final... |
8504e66e-0f7a-4092-8d98-5bb7d8ca6b1a | 2 | @Override
public void onStatus(final StatusEvent e) {
lastState = state;
state = new State(e, lastState);
if (0 == state.time) {
if (0 == state.roundNum) {
doBattleStart();
}
doRoundStart();
}
} |
662ba858-e2fa-4c47-9544-bb122d986466 | 4 | public void SetSpeed(int speed) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetSpeed() BEGIN");
}
m_speed = speed;
if (test || m_test) {
System.out.println("GameBoardGraphics :: SetSpeed() END");
}
} |
6b10df77-b789-42fb-a312-4153d4ce282c | 2 | public static void main(String[] args) {
if(args.length == 0) {
System.out.println("provide some MRF potential data files");
return;
}
for(String data_file : args) {
System.out.println("[main] testing potentials for data file: " + data_file);
findPotentials(data_file);
}
} |
983f8435-3146-49b4-b332-0d902a4cc3e7 | 9 | @Override
public List<AdversaryState> getSuccessors(AdversaryState state) {
List<AdversaryState> successors = new LinkedList<AdversaryState>(); // list for storing the successors of s
if (state.isMax()) {
AdversaryState gUp = state.clone();
AdversaryState gBelow = state.clone();
... |
9b5966e0-92ff-425c-b5c8-817387999756 | 2 | @Override
public void deleteMin() throws EmptyCollectionException,
KeyNotFoundException {
if (treeIsEmpty())
throw new EmptyCollectionException();
Node x = root;
while (x.left != null)
x = x.left;
delete(x.key);
} |
781cdeaa-41f7-4ea9-bb90-8653cd1b99e8 | 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... |
fb16ea9d-6912-4f62-b052-654f2551c8c7 | 4 | @Override
public void deserialize(Buffer buf) {
objectUID = buf.readInt();
if (objectUID < 0)
throw new RuntimeException("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0");
position = buf.readUByte();
if (positi... |
78c0df90-96b8-485d-9015-40e004d748fb | 3 | private static NullComparison compareNls(Object o, Object o2) {
if (o != null && o2 != null) return NullComparison.NO_NULLS;
if (o == o2) return NullComparison.BOTH_NULL;
return NullComparison.ONE_NULL;
} |
e7414d81-f525-4eea-b02d-07df37b384c9 | 0 | @Override
public void documentRemoved(DocumentRepositoryEvent e) {} |
0d8eed24-ef5b-491a-93c5-d784f6171349 | 5 | public void initialize() {
CommPortIdentifier portId = null;
Enumeration portEnum = CommPortIdentifier.getPortIdentifiers();
//First, Find an instance of serial port as set in PORT_NAMES.
while (portEnum.hasMoreElements()) {
CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
for... |
a9ac2906-693f-46da-8791-b0245ea58fda | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DataSet other = (DataSet) obj;
if (dataInformation == null) {
if (other.dataInformation != null)
return false;
} else if (!dataInformati... |
9b7d1118-c648-4a4c-85a5-8855e4599825 | 2 | private boolean isSizeConsistent(STNode<Key, Value> x)
{
if (x != null)
if (x.N != size(x.left) + 1 + size(x.right))
return false;
return true;
} |
b08bc5d1-cb73-49d8-b0db-4169ddcedf8b | 7 | public static String install(String outputFolder, ProgressListener pl, String... componentPaths) {
StringBuilder sb = new StringBuilder();
List<FileListEntry> files = new LinkedList<FileListEntry>();
int t = 0;
for (String path : componentPaths) {
if (pl != null) {
t++;
pl.onProgress(t, componentP... |
d9a8b68c-83f5-4490-92be-de36c87774ef | 2 | public void tick(Level level, int xt, int yt) {
int xn = xt;
int yn = yt;
if (random.nextBoolean())
xn += random.nextInt(2) * 2 - 1;
else
yn += random.nextInt(2) * 2 - 1;
if (level.getTile(xn, yn) == Tile.hole) {
level.setTile(xn, yn, this, 0);
}
} |
f85836e9-9734-47ea-af3e-da641a240800 | 2 | public Fornecedor buscarFornecedor(String nome) {
for (PecaFornecida f : fornecedores) {
if (f.getFornecedor().getNome().compareToIgnoreCase(nome) == 0) {
return f.getFornecedor();
}
}
return null;
} |
27dd3891-514d-48d1-b3af-23e700b986d3 | 0 | public void setAuthors(String authors)
{
this.authors = authors;
} |
14bb677d-38e8-47c2-b2d5-d6ba7ccac1c6 | 0 | void showSuccessMessage() {
MainController.showMessageBar("登録しました");
} |
47dce56c-51b0-40d2-9e95-b0bbe91eee66 | 0 | public String getLockName() {
return lockName;
} |
24794e65-283e-4f3a-92fa-c75c04291a06 | 1 | public Class<? extends IPlugin> getPtype() {
return ptype;
} |
783c05ff-c457-4a6a-bdd4-e5f98fecbefc | 7 | public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
//====Opens the JFrames when the navigation buttons are clicked====
if(obj == instructions) {injf.setVisible(true);}
if(obj == options) {ojf.setVisible(true);}
if(obj == newGame) ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.