method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a7d8e561-de79-49b8-9d53-c0e293d3b353 | 6 | @Override public void keyPressed ( KeyEvent arg0 ) {
if ( arg0.getKeyCode ( ) == KeyEvent.VK_DOWN ) {
GUI.commandHistoryLocation-- ;
if ( GUI.commandHistoryLocation >= 0
&& GUI.commandHistoryLocation < GUI.commandHistory.size ( ) ) {
this.console.setText ( GUI.commandHistory
... |
5a012893-3b37-46e7-afe4-b4969fe72ced | 8 | public String simplifyPath(String path) {
if(path == "") {
return "";
}
String[] level = path.split("/");
String resultPath = "/";
Stack<String> pathStack = new Stack<String>();
for(String curLevel : level) {
if(curLevel.equals(".")) {
... |
7f36aec4-2c46-4d58-bc2d-94166842c53b | 5 | private void acquireLocks(Lock firstLock, Lock secondLock) throws InterruptedException {
while (true) {
// Acquire locks
boolean gotFirstLock = false;
boolean gotSecondLock = false;
try {
/**
* tryLock() which will only acquire a l... |
415e0c3b-4a66-41d1-9aad-589cf7b1e59e | 9 | public static void main(String[] args){
Scanner cin = new Scanner(System.in);
String str = cin.nextLine();
int max = 0;
int length = str.length();
for (int i = 0; i != str.length(); i ++){
//'aba', take care the lower limit is 0.
int j = 0;
while(i-j >= 0 && i+j < length && str.charAt(i-j) == str.cha... |
531a10e6-b4b4-400c-badc-0242068c2909 | 3 | public void actionPerformed(ActionEvent ev)
{
try
{
Curso objt = classeView();
if (obj == null)
{
long x = new CursoDAO().inserir(objt);
objt.setId(x);
JOptionPane.showMessageDialog(null,
"Os dados foram inseridos com sucesso", "Sucesso", JOptionPane.INFORMATION_MESSAGE);
if (tabela ... |
7ebc1f30-c970-4c05-b500-2c056471b177 | 3 | private void showSelectedDirection(SessionRequestContent request) throws ServletLogicException {
String selectId = request.getParameter(JSP_SELECT_ID);
if (selectId != null) {
Integer idDirection = Integer.decode(selectId);
request.setAttribute(JSP_ID_DIRECTION, idDirection);
... |
626f879d-031f-4455-b6ac-3d3e77a5c57b | 1 | @Override
public ArrayList<Map<String,String>> getItemsOfUser(String username) {
ArrayList<Map<String,String>> itemsList = new ArrayList<Map<String,String>>();
TypedQuery<Item> itemsByUserQuery = emgr.createNamedQuery(
"Item.findAllByUser", Item.class);
itemsByUserQuery.setParameter("userName", username);... |
5f3e7fb5-d683-4f36-9444-83664b79365a | 3 | @Override
public void deserialize(Buffer buf) {
cellId = buf.readShort();
if (cellId < -1 || cellId > 559)
throw new RuntimeException("Forbidden value on cellId = " + cellId + ", it doesn't respect the following condition : cellId < -1 || cellId > 559");
direction = buf.readByte(... |
7f33d760-2c13-4ee6-9981-cec6a56ed2d9 | 5 | public static void importSegment(File file){
FileReader fileReader = null;
try {
fileReader = new FileReader(file);
BufferedReader fileOpen = new BufferedReader(fileReader);
String line = null;
while((line = fileOpen.readLine()) != null){
f... |
b467dcd3-df6c-4e78-921b-1fa4e71c88ef | 7 | public void setLineStyle(final LineStyle style) {
if (style.getWidth() != null) {
float width_prev = this.lineWidth;
this.setLineWidth(style.getWidth().floatValue());
this.lineWidth = width_prev;
}
if (style.getCap() != null) {
this._out(style.getCap().toString() + " J");
}
if (style.getJoin() !=... |
d6e1c5c4-a02f-4f97-acf9-769a17a7077f | 2 | public String toAnoMesDiaString() {
return ano + "/" +
((mes<10)?"0":"") + mes + "/" +
((dia<10)?"0":"") + dia;
} |
93abf20b-14a4-477c-9022-4885199239e4 | 5 | @Override
public int sizeOf( Collection<?> v )
{
if (v == null)
{
return 1;
}
int size = Compress.sizeOfUnsignedNullable( v.size() );
for (Object o : v)
{
if (o != null)
{
Reflect<Object> r = ReflectFactory.cre... |
876eb383-3eaf-4de7-9032-d5ee752e399a | 6 | public static ListTableModel createModelFromResultSet(ResultSet resultSet)
throws SQLException
{
ResultSetMetaData metaData = resultSet.getMetaData();
int columns = metaData.getColumnCount();
// Create empty model using the column names
ArrayList<String> columnNames = new ArrayList<String>();
for (int ... |
5d3dacc5-c5b8-4c6c-8d07-3d407a002fce | 2 | public boolean deletePatient(PatientCL patient){
if (this.nextPatient == patientListStart){
return false;
} else if (this.nextPatient.name.equals(patient.name)){
this.nextPatient = nextPatient.nextPatient;
return true;
} else {
return this.nextPatient.deletePatient(patient);
}
} |
34d35370-64dd-457f-9c82-588b303694a6 | 2 | @Override
public void mark(int boardPosition, Cell[] cellBoard, int rows, int columns) throws IllegalMark {
//Find the row.
int boardPositionRow = boardPosition / columns;
//Find the column.
int boardPositionColumn = boardPosition % columns;
//Position to ma... |
91c5f9ae-90df-45a5-8393-0cf989d208af | 3 | public boolean hasDevice(String name){
if (name != null){
for(Parser p : Parser.values()){
if (p.name().equals(name.toUpperCase()))
return true;
}
}
return false;
} |
bcade825-d299-4664-95a9-bc9054fab6a0 | 4 | public Media checkMedia(String title, String type){
if(mediaList.size() == 0){
mediaList = MediaDAO.getAllMedia();
}
for(Media m: mediaList){
if(m.getTitle().equals(title) && m.getType().toUpperCase().equals(type)){
return m;
}
}
return null;
} |
30adedee-1380-4c8e-90ab-63caf8662f8f | 9 | public static boolean is_INT_PACK_Data(SampleModel sm, boolean requireAlpha) {
// Check ColorModel is of type DirectColorModel
if (!(sm instanceof SinglePixelPackedSampleModel))
return false;
// Check transfer type
if (sm.getDataType() != DataBuffer.TYPE_INT)
ret... |
8e785b04-8f1c-4a0d-b707-c48ff02bcc18 | 6 | int unpack_info(Buffer opb) {
version = opb.read(32);
if (version != 0) {
return (-1);
}
channels = opb.read(8);
rate = opb.read(32);
bitrate_upper = opb.read(32);
bitrate_nominal = opb.read(32);
bitrate_lower = opb.read(32);
blocksi... |
c93f55f1-f465-4d13-9e3d-201f9dc52574 | 0 | @Override
public void closeFrame(JInternalFrame f) {
//System.out.println("closeFrame");
super.closeFrame(f);
updateDesktopSize(false);
} |
4ff0b676-fb35-4bb1-9de2-0bf71864ebbb | 3 | * The statement after which to add stmt.
*/
public void addStmtAfter(final Stmt stmt, final Stmt after) {
if (Tree.DEBUG) {
System.out.println("insert: " + stmt + " after " + after);
}
final ListIterator iter = stmts.listIterator();
while (iter.hasNext()) {
final Stmt s = (Stmt) iter.next(... |
0147b9f3-4a7b-4700-85ed-a82f4ee36324 | 4 | public static void processInput(int button, int mouseX, int mouseY){
if(renderOverview){
processOverviewInput(button, mouseX, mouseY);
if(Mouse.isButtonDown(0)) return;
}
if(renderCreateSkill || renderEditSkill) processEditSkillInput(button, mouseX, mouseY);
} |
c7445fa2-3a41-4a29-ace8-574ba6d58cfc | 3 | private static void player1SwapPieces(int i, int j) {
ImageIcon p1Icon;
ImageIcon p1FlipIcon;
ImageIcon p1FlipIcon2;
if (m_p1colour != Piece.OthelloPieceColour.WHITE) {
p1Icon = m_whitePiece;
p1FlipIcon = m_blackToWhitePiece;
p1FlipIcon2 = m_whiteToBlackPiece;
} else {
p1Icon = m_blackPiece;
... |
e0610b66-7a09-45db-a485-232ec45ff4aa | 6 | public MainFrame(String folder){
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setTitle("PersonSimulator");
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we) {
db.dispose();
}
... |
a3264391-bdca-477b-8d70-cb053d31fb0e | 7 | private DrawFile getDrawFileFromHref(final String href) throws IOException {
if (diagram.getUmlDiagramType() == UmlDiagramType.CLASS || diagram.getUmlDiagramType() == UmlDiagramType.OBJECT) {
final DrawFile drawFile = staticFilesMap.getDrawFile(href);
if (drawFile != null) {
return drawFile;
}
}
fina... |
ceffd0df-213c-4663-8244-585087517a72 | 5 | double smallestPullBackTimeOfEmptyTrack(double pt){
double min = Double.MAX_VALUE;
boolean empty = false;
for(Track t : outboundTrack){
if(t.ifEmpty == true){
empty = true;
if(pt >= t.pullBackTime)
return pt;
if(t.pullBackTime < min){
min = t.pullBackTime;
}
}
}
if(empty == tru... |
b89a755f-29c7-4d20-a072-bdde3d8b1ad2 | 2 | public void updateImageUI() {
JLabel[] labels = imagePanel.getImageContainers();
Image[] imgs = this.iterator.getImages();
for(int i=0; i<labels.length; i++) {
if(imgs[i] == null)
labels[i].setIcon(null);
else
labels[i].setIcon(new ImageIco... |
72c826a7-f279-4949-bcd5-5c5a3e8bb074 | 6 | ItemLoader(GameMode class230, int i, boolean bool, Class326 class326,
IndexLoader class45, IndexLoader class45_22_) {
try {
aBoolean3269 = bool;
class326_ = class326;
((ItemLoader) this).modelIndexLoader = class45_22_;
((ItemLoader) this).anInt3286 = i;
itemIndexLoader = class45;
if... |
0fcc45df-1770-4a56-8b36-de1c0c6822f3 | 9 | public String getMessage() {
if (!specialConstructor) {
return super.getMessage();
}
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expectedTokenSequences.length; i++) {
if (maxSize < expectedTokenSequences[i].length) {
maxSize = expectedTokenSeq... |
65afcdef-7931-48f5-92ed-c298a3a25fd9 | 6 | public static TreeSet<Integer> primeSieve(int limit) {
boolean[] numberList = new boolean[limit + 1];
TreeSet<Integer> primeList = new TreeSet<>();
for (int i = 2; i <= limit; i++) {
numberList[i] = true;
}
for (int i = 2; i * i <= limit; i++) {
if (numberList[i]) {
for (int j = i; i * j <= limit;... |
9a5e6a80-4e1f-42d1-9844-4f006319ceb9 | 6 | public OrderReport processMarketOrder(int time, String side,
int qty, String takerId, boolean verbose) {
ArrayList<Trade> trades = new ArrayList<Trade>();
int qtyRemaining = qty;
if (side =="bid") {
this.lastOrderSign = 1;
while ((qtyRemaining > 0) && (this.asks.getnOrders() > 0)) {
OrderLis... |
420f005d-834e-4973-9c1b-7670f0d8a621 | 0 | public ConfigurationIcon(Configuration configuration) {
this.configuration = configuration;
this.automaton = configuration.getCurrentState().getAutomaton();
} |
e24ad3fe-88d6-486a-9efe-f24f96580599 | 3 | @RequestMapping("/showStaff")
public String showStaff(Staff s, String pages,HttpServletRequest request) {
Map<Object, Object> map = new HashMap<Object, Object>();
map.put("name", s.getName());
map.put("username", s.getUsername());
map.put("status", s.getStatus());
map.put("telephone", s.getTelephone());
... |
d74a995d-5a64-4c6e-9199-bfdb7127d38d | 1 | public static void sleep(int deciSec, int l) {
if (deciSec < 600) {
printTabLn("Schlafe " + (deciSec / 10) + " Sekunden", l);
} else {
Calendar end = new GregorianCalendar();
end.setTime(Config.getDate());
end.add(Calendar.MILLISECOND, deciSec * 100);
printTabLn("Schlafe " + Math.round(deciSec /... |
c1dcffad-ecc0-46ce-8710-b315938f2f36 | 8 | @Override
public void decode(final ByteBuffer buf, final int available, final StringBuilder log)
throws Exception
{
final int start = buf.position();
// Count
final short count = buf.getShort();
if (log != null)
log.append("UINT count : ").ap... |
1ff180bb-28f3-43f3-8ddb-5a8ed5d0182f | 5 | public int getUniqueDataId(String var1) {
Short var2 = (Short)this.idCounts.get(var1);
if(var2 == null) {
var2 = Short.valueOf((short)0);
} else {
var2 = Short.valueOf((short)(var2.shortValue() + 1));
}
this.idCounts.put(var1, var2);
if(this.saveHandler == null) {
... |
de3180e7-5f28-4eb1-beb1-1b77fb4f1657 | 1 | final public void Identifier() throws ParseException {
/*@bgen(jjtree) Identifier */
SimpleNode jjtn000 = new SimpleNode(JJTIDENTIFIER);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(IDENTIFIER);
} finally {
... |
6f892b6d-08d2-42a6-9cbc-116f31b5eced | 9 | protected void refresh() {
lblName.setText(person == null ? "" : person.getName().toString());
txtBirth.setText(person == null || person.getBirth() == null ? ""
: person.getBirth().getDateAndPlace(), false);
txtBaptism.setText(person == null || person.getBaptism() == null ? ""
: person.getBaptism().getD... |
a82ba3d6-ae6d-45b0-a292-21fb70bbc001 | 3 | public double getTip() {
double tip = 0.00; // always initialize local variables
switch(serviceQuality) {
case GOOD:
tip = bill * GOOD_RATE;
break;
case FAIR:
tip = bill * FAIR_RATE;
break;
case POOR:
... |
9bafba6e-b1bc-453f-9d98-6971cb166f10 | 2 | public int insert(String table, String[] cols, String[] vals) throws Throwable {
// one-table insert
String query = "";
int i = 0;
if (cols.length == vals.length) {
for( String column: cols ) {
query += "INSERT INTO "+table+"("+column+") VALUES("+vals[i]+");";
i++;
}
... |
71599f0d-987e-48f1-80ed-2ae7e07f670d | 3 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
HttpSession sesionOk = request.getSession();
if (sesionOk.getAttribute("usuario") != null) {
response.setContentType("text/html;charset=UTF... |
53708214-ec18-48d9-9322-5f9f948f82f1 | 2 | public static void fillScanShots()
{
int x, y;
int num = 10 * 10;
for (int j = 0; j < 3; j++)
{
for (int i = j; i < num; i += 3)
{
x = i % 10;
y = i / 10;
enqueue(new Point(x, y));
}
}
} |
90fb33a7-7864-42e4-8baa-34e793e131d1 | 6 | public int[] projectWall(RayIntersect intercept, BufferedImage texture, double distance, int x){
Screen screen = raycaster.getBuffer();
Camera camera = raycaster.getCamera();
int[] wall = this.getWallProjection(screen, camera, intercept.getWall(), distance);
if(distance > camera.getVi... |
ed51ba3a-1a1e-48ae-9ce5-54af8c22d7f6 | 4 | private void updateAlbumListView() {
albumList.clear();
albumList.add("[any]");
if(selectedArtist == null || selectedArtist.isEmpty()) {
//if no selected artist, add all albums
for (String s : albumTracks.keySet())
albumList.add(s);
} else {
... |
06c317d2-425f-4ff2-9623-bcd3a65889da | 3 | public void giveCardsOfSpecificNumberToHand(int num,
PlayerHand aHand) throws NoMatchInHandException {
int numFound = 0;
boolean finding = true;
Card aCard = new Card(num, 'd');
while (finding) {
try {
Card removed = returnAndRemove(aCard);
aHand.insert(removed);
numFound++;
} catch (Except... |
a8e8900d-4d45-4d34-b190-0616e9dbae1f | 5 | public void keyPressed(int k){
if(k == KeyEvent.VK_RIGHT) player.setRight(true);
if(k == KeyEvent.VK_LEFT) player.setLeft(true);
if(k == KeyEvent.VK_W) player.setJumping(true);
if(k == KeyEvent.VK_R) player.setScratching();
if(k == KeyEvent.VK_F) player.setFiring();
} |
1ba7fb15-ab8b-434e-b994-96eac55cd3a4 | 4 | private static void writeIterator(Appendable appendable, Iterator<?> iterator) throws IOException {
if (iterator != null && iterator.hasNext()) {
deepToString(appendable, iterator.next());
while (iterator.hasNext()) {
appendable.append(ITERABLE_NEXT);
deep... |
65e6eff1-068d-49a5-ac11-af53707ceb4b | 9 | public boolean hasNext() {
Plate plate;
switch (filter) {
case NONE:
return (!belt.isEmpty());
case PRICE:
for (int i = 0; i < belt.getSize(); i++) {
plate = belt.getPlateAtPosition(i);
if ((plate == null) || (plate.getPrice() > max_price)) {
continue;
}
return tr... |
cbab2486-bfac-45a9-9c36-742bea89e40b | 5 | public void autoLevelGenerator(Point startPoint){
for (int i = 0; i < getRoomList().size(); i++){
if (i == 0){
this.roomList.get(i).setPos(new Point(startPoint.getX(),startPoint.getY(),startPoint.getZ()));
this.roomList.get(i).setEntrance(new Point (this.roomList.get(i).getEntrance().getX()+startPoint.getX... |
7e06b820-3c6b-4b01-bf98-3d0c1f49ea84 | 7 | @Override
public Expression evaluate(Expression leftSideOperand, Expression rightSideOperand)
{
if (Operator.outputMode == Calculate.OUTPUT_EXACT_MODE)
{
//try to evaluate using operands as fractions first. if fails, try to use them
//as numbers. if still fails, evaluate treating operands as expressions
... |
e7e05063-a461-48a1-a6ab-e21d452e0657 | 1 | private void itmMnuRelatorioAtividadesProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuRelatorioAtividadesProjetoActionPerformed
if (usuarioLogado.getTipo().equals("Gerente")) {
EscolhaProjetoForm escolhaProjetoForm = null;
escolhaProjetoForm = new Escolha... |
9bf72dd3-7d2c-4d96-9664-c63bb70be18d | 2 | public void addProperty(String section, String line) {
int equalIndex = line.indexOf("=");
if (equalIndex > 0) {
String name = section + '.' + line.substring(0, equalIndex).trim();
String value = line.substring(equalIndex + 1).trim();
if (map.containsKey(name)) map.remove(name);
map.put(name, value);
... |
d1e41780-3c4d-4243-9529-f55ea81bcb0d | 3 | public static String lineWrap(String src,int width) {
String result="";
int ix=0;
while(ix+width < src.length()) {
int nextSplit = src.indexOf(System.lineSeparator(), ix);
if(nextSplit<0 || nextSplit>width) {
result += src.substring(ix,ix+width);
result += System.lineSeparator();
ix+=width;
}... |
8a6b0bec-b8ae-4c03-baf2-e805b1de0302 | 0 | EventListItf deserializeFromJson(String json) {
AutoBean<EventListItf> bean = AutoBeanCodex.decode(factory, EventListItf.class, "{\"events\": " + json+ "}");
return bean.as();
} |
68f338c4-4bbc-458a-92d4-a1871241d376 | 9 | public boolean equals(Object obj) {
if (obj instanceof Rule) {
boolean equal = true;
Rule otherRule = (Rule) obj;
for (Specie s : this.lhs) {
if (!otherRule.lhs.contains(s)) {
return false;
}
}
for (Specie s : this.rhs) {
if (!otherRule.rhs.contains(s)) {
return false;
}
}
... |
e7bb8be1-47c9-46ce-a34f-c1998a8242dc | 3 | private void analyseRegisters(String line) throws AssemblerException {
if (line.trim().length() == 0)
return;
line = line.trim();
// Valid register expression:
// (!space)+ space+ (!space)+
boolean legitRegExp = Pattern.matches("[^\\s]+\\s+[^\\s]+", line);
if (!legitRegExp)
throw new AssemblerExce... |
897a6587-2dfb-4e40-98d4-30d153a9afb4 | 4 | public void setTurnsTaken(JLabel label) {
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: setTurnsTaken() BEGIN");
}
m_turnsTaken = label;
if (test || m_test)
System.out.println("Drawing:: setTurnsTaken() - END");
} |
557d2a34-c0ea-40df-9d4c-233344b3c544 | 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);
... |
00269c6d-20b6-4ba1-9aef-f4fc6f4d8844 | 2 | @Override
public void dealDamage(int amount, Object source) {
if (source instanceof Projectile) {
Projectile p = (Projectile) source;
if (!p.isOnFire()) return;
}
super.dealDamage(amount, source);
} |
5a41b2dc-57af-4a4f-ab03-2bb174d082cf | 3 | private void btnApagarProdutoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApagarProdutoActionPerformed
try {
if (JOptionPane.showConfirmDialog(rootPane, "Deseja realmente apagar este produto?") == 0) {
carregaObjeto();
if (d... |
337addfc-181e-4c27-8cd8-15988169c60b | 6 | public final WaiprParser.stats_return stats() throws RecognitionException {
WaiprParser.stats_return retval = new WaiprParser.stats_return();
retval.start = input.LT(1);
CommonTree root_0 = null;
Token char_literal52=null;
ParserRuleReturnScope stat51 =null;
ParserRuleReturnScope stat53 =null;
CommonTr... |
7b9f1e8a-9e24-4efb-861a-7943c1c3f7a7 | 6 | @EventHandler
public void MagmaCubeMiningFatigue(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getMagmaCubeConfig().getDouble("Ma... |
846c90c6-2bd0-45e4-b106-17c410d48589 | 5 | private void processDeleteResult(Sim_event ev, boolean isMaster) {
if (ev == null) {
return;
}
Object[] pack = (Object[]) ev.get_data();
if (pack == null) {
return;
}
String filename = (String) pack[0]; // get file name
int msg = ((Intege... |
d5f49767-bda9-47da-88e2-f6e431a5bad4 | 6 | private void atualiza_Competicao_ComboBox() {
Competicao_ComboBox.removeAllItems();
String escalao;
for (Competicao c: a.getDAOCompeticao().values()) {
escalao = c.getEscalao().getClass().toString();
if (escalao.equals("class Escalao." + Escalao_ComboBox.getSelectedItem()... |
7f3f1f5c-9b97-4e9e-846a-37fedb303938 | 5 | public void actionPerformed(ActionEvent ev)
{
Object o = ev.getSource();
if(o == changestotalincome)
{
modifyPrompt(4);
}
else if(o == modifyExpenses[0])
{
modifyPrompt(BILLS);
}
else if(o == modifyExpenses[1])
{
modifyPrompt(FOOD);
}
else if(o == modifyExpenses[2])
{
modifyPromp... |
1c67ce47-3e4c-42fa-83bb-027ccf065f71 | 5 | private void validateFilter(Document filter) throws IncorrectFilterException{
//Define which types to check for.
//TODO The types should probably be converted to classes in case we want to add more in the future, but for now, this suffices.
List<String> inclusionTypes = new ArrayList<String>();
inclusionTyp... |
905e8a32-3fa8-4fc5-80c0-e89d2888c891 | 5 | public void setCount(int newHeadCount) {
if (newHeadCount >= headCount)
return;
headCount = newHeadCount;
if ((GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_CONSTRS) != 0) {
GlobalOptions.err.println("setCount: " + this + "," + newHeadCount);
new Throwable().printStackTrace(GlobalOptions.err);
}
... |
8bbd0582-a35f-479d-a7dc-2f5d55eb4c38 | 0 | @Override
public String getName() {
return "help";
} |
76287605-4d85-4037-8273-e4b5900f8d96 | 9 | public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int T = 0;
while (sc.hasNextInt()) {
if(T!=0)
System.out.println("");
T++;
int N = sc.nextInt();
String groupMember[] = new String[N];
Map ben... |
ef36f867-de56-40b9-b7ce-71e86a10d164 | 0 | public BSTNode getRight() {
return right;
} |
051dc6ab-4369-458b-89f0-5b9eb0305127 | 5 | @Override
public void mousePressed(MouseEvent e) {
if (pointer.world==null)
{
return;
}
int button = e.getButton();
double scale = pointer.owner.getHeight()/300d;
if (pointer.world!=null){
pointer.world.mouseX = (int)((e.getX()+getStuff())/scal... |
cbeaffbb-d1e3-4678-bd14-8f7d48ee3c6b | 4 | public static void startShell() {
String request = "";
while(true) {
try {
if(System.in.available()>0) {
char readByte = (char)System.in.read();
if(readByte != '\n') {
request = request + readByte;
}
else {
//end of request
processConsole(request);
request = "";... |
fe52608b-8c32-4fb7-bb9b-4babb1a4cb17 | 1 | public int getCharsWidth() {
if( charsWidth == -1 ) {
charsWidth = fontMetrics.charsWidth( text, 0, text.length );
}
return charsWidth;
} |
9bd4d05c-0f11-4b17-bb89-f0740953731f | 9 | private Fraction addSub(Fraction fraction, boolean isAdd) {
if (fraction == null) {
throw new NullArgumentException(LocalizedFormats.FRACTION);
}
// zero is identity for addition.
if (numerator == 0) {
return isAdd ? fraction : fraction.negate();
}
... |
1dfb70fe-d023-4103-a833-da28d2a983b8 | 0 | public void countDimmension()
{
width = (y2Coordinate - yCoordinate);
height = (x2Coordinate - xCoordinate);
} |
2e4bfa19-3b63-41fa-9867-acabe18ba1ad | 0 | public void onScoreChanged()
{
leftScorePanel.setScore(scoreManager.getLeftScore());
rightScorePanel.setScore(scoreManager.getRightScore());
} |
5cb970fb-85c5-4283-bb99-42f1bdc8a1f4 | 6 | public Person getMan()
{
RandomContainer random = new RandomContainer();
Person man = new Person(id);
byte luck = (byte)random.next(1,6);
try {
if (luck == 1)
man = _warriorPrototype.clone();
if (luck == 2)
man = _traderPrototyp... |
b6553c64-ae9e-4b5f-acec-abdf3ce0ba8f | 3 | public void readjustOffsets(ArchiveFile startArchiv)
{
ArchiveFile before = null;
for(ArchiveFile file : archiveFiles)
{
if(file.getOffset() > startArchiv.getOffset() && before != null)
{
long newOffset = before.getOffset()+before.getLength();
... |
e6c8a603-417c-4a7e-b92a-0e143891eddb | 3 | public void newItemList(int ItemId, String ItemName, String ItemDescription, double ShopValue, double LowAlch, double HighAlch, int Bonuses[]) {
// first, search for a free slot
int slot = -1;
for (int i = 0; i < 9999; i++) {
if (ItemList[i] == null) {
slot = i;
break;
}
}
if(slot == -1) return... |
ecdc85de-c533-4c37-bf30-1d3b723d6333 | 5 | public static synchronized void drawDTFractal(Graphics g, int startX, int startY, int maxBranches) throws Exception {
if (g == null) {
throw new Exception("Cannot draw on null graphics!");
}
g.setColor(Color.black);
int currBranches = 0;
int created = 0;
Node... |
a0a3198d-a100-43fd-94fc-c2cb3b9743ff | 3 | private boolean checkPasswordMatching(String password, UserData userData)
{
boolean matching = false;
try
{
String saltedPassword = password + userData.getSalt();
MessageDigest md = MessageDigest.getInstance(mdAlgorithm);
md.update(saltedPassword.getByte... |
d221dbdf-cf7f-441c-bfbc-4c9154705149 | 2 | /*package*/ List<String > filterUpgrades(List<String> upgrades) {
List<String> filteredUpgrades = new ArrayList<String>();
for (String upgrade : upgrades) {
if (this.transports.contains(upgrade)) {
filteredUpgrades.add(upgrade);
}
}
return filtered... |
e767feed-1ae3-44e2-a02c-df82273ae92e | 3 | private void set(String strParam, String strValue) {
Boolean entrado = false;
for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
if (entry.getKey().equals(strParam)) {
entry.setValue(strValue);
entrado = true;
}
}
... |
b2db1cb1-1175-4a5a-99f3-6546cd065d02 | 5 | @Override
protected void updateImage() {
if (vertMoveMode == VertMoveMode.JUMPING) {
setImage("Monsters/" + name + "/Jumping");
} else if (vertMoveMode == VertMoveMode.FLYING) {
loopImage("Monsters/" + name + "/Flapping");
} else if (vertMoveMode == VertMoveMode.FALLI... |
713e8197-36f1-46be-949f-5f6188c8d142 | 6 | public ListNode deleteDuplicatesII(ListNode head) {
if (head == null) {
return null;
}
if (head.next == null) {
return head;
}
ListNode fakeHead = new ListNode(-1);
fakeHead.next=head;
HashMap<Integer,ListNode> hm = new HashMap();
HashSet<Integer> hs = new HashSet();
ListNode node = fakeHead;
... |
1ba4f2e9-f0e9-4b0a-9ef8-70e1ece65eb2 | 5 | public static int findSmallestMRNA(String path) {
int smallest = Integer.MAX_VALUE;
try
{
FileInputStream fstream = new FileInputStream(path);
Scanner fScanner = new Scanner(fstream);
String currLine = new String();
while (fScanner.hasNextLine()) {
currLine = fScanner.nextLine();
... |
4c285b47-8e6b-49ae-a98b-fcf74eaf97ed | 2 | public static void main(String[] args) {
// Be forwarned that when you write arrays directly in Java as below,
// each "row" of text is a column of your image--the numbers get
// transposed.
PixImage image1 = array2PixImage(new int[][] { { 0, 10, 240 },
{ 30, 120, 250 }, { 80, 250, 255 } });
System.out.pr... |
8b23d42d-e61a-4de2-8db0-575cfa502030 | 8 | public static void onConRequest(String msg){
log.info("onConRequest called :" + msg);
JSONParser parser = new JSONParser();
try {
Object obj = parser.parse(msg);
JSONObject json = (JSONObject) obj;
String action = (String) json.get("action");
if(action.equals("start")){
onStar... |
652a8306-8629-4826-b040-114df0dce96f | 6 | @SuppressWarnings("serial")
public boolean isValid(String s) {
if (s == null || s.isEmpty()) {
return true;
}
Map<Character, Character> mapping = new HashMap<Character, Character>() {
{
put('(', ')');
put('[', ']');
put... |
4851ea61-5f96-4313-8cbc-0d8fba5f7ede | 8 | @SuppressWarnings("empty-statement")
public Vector getClientRecherche(String recepNumCli, String recepNom) {
Vector myVector2D = new Vector();
try {
int recepNUCLI;
Connection connection = factory.getConnection();
Statement statement = connection.createStatement()... |
067ac917-a0ad-4d6f-bfcd-f0d0de0ce8bc | 3 | public boolean lossOfLife(){
int loop;
for (loop = 0; loop < enemiesPresent.size(); loop++){
if (enemiesPresent.get(loop).portalPassing() && !enemiesPresent.get(loop).lifeLost()){
enemiesPresent.get(loop).lifeRemoved();
return true;
}
}
return false;
} |
15cd1b60-efb6-47e8-88cf-6413a90ff26d | 3 | public void prepareNextRound() {
for (int i = 0; i < getBoardWidth(); i++) {
for (int j = 0; j < getBoardHeight(); j++) {
if (cellAlive(i, j)) {
board[i][j].willBeAlive(cellSurvives(numberOfLivingNeighbors(i, j)));
} else {
boar... |
0069b20e-230a-4fe7-a263-96c5ebbe9ed1 | 9 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!(affected instanceof MOB))
return true;
final MOB mob=(MOB)affected;
if(msg.amITarget(mob)
&&(CMLib.flags().isAliveAwakeMobileUnbound(mob,true))
&&(msg.tool() instanceof Ability)
&&(msg.tool().ID().equals("Skill_Dis... |
a5e89d46-03c2-412a-9461-71a9bd866414 | 5 | @Override
public int getActivatedCount(String type) {
int count = 0;
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
if (placeable != null) {
if (placeabl... |
9b8ca040-0fc7-4bb9-928e-57db6348f2ff | 8 | public static long getScaleFactorBinary(final String scaleUnit) {
if(scaleUnit == null) throw new IllegalArgumentException("Ihre Präfix-Angabe ist ungültig. " + scaleUnit);
if(scaleUnit.length() == 0) return 1;
switch(scaleUnit.toLowerCase().charAt(0)) {
case 'k':
return 1024;
case 'm':
return 1024 ... |
f6b12387-fa19-4cf2-8303-e5327ca35681 | 5 | public MACGUI() {
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 403, 219);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JLabel lblNewLabel = new ... |
5b9bd977-5903-4626-897d-fe0f359a5994 | 4 | private String convToHex(byte[] data) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
buf.appe... |
81c0e1c5-7e67-42c2-8a07-a57e8b54558d | 4 | public static boolean isContiStr(String str) {
if (isMatcher("[a-zA-Z0-9]+", str)) {
int len = str.length();
int[] paddings = new int[len - 1];// 字符间隔
char preChar = str.charAt(0);
for (int i = 1; i < len; i++) {
paddings[i - 1] = str.charAt(i) - preChar;
preChar = str.charAt(i);
}
for (int... |
718f3af5-4dee-4821-aa9c-5c4199d783da | 4 | @Override
public Value evaluate(Value... operands) throws Exception {
// we want only two operands
if (operands.length != 2) {
throw new EvalException(this.name()
+ " Error: wrong number of operands");
}
// get operands
Value l = operands[0];
... |
be84e219-8faa-4338-b526-271fe6111049 | 5 | public EditUserUI(String itemN, String[] origin) {
this.itemName = itemN.split(";")[0];
String[] item = (String[]) logic.showInfoTableHead(itemName + "_list");
frame = new JFrame();
frame.setTitle("修改项目: " + itemName);
panel = new JPanel();
iteml = new JLabel[item.length];
itemtf = new JTextField[item.len... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.