method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
20497098-2c48-46ce-a5f7-4e7823a119dc | 3 | public static boolean inAuburyShop() {
int x = Players.getLocal().getLocation().getX();
int y = Players.getLocal().getLocation().getY();
return x >= 3250 && y >= 3399 && x <= 3255 && y <= 3404;
} |
23ed5202-8f31-4590-8e32-065311d05c4e | 8 | private void placeLightGrenadeNearPlayer() {
for (Player p : grid.getAllPlayersOnGrid()) {
boolean placed = false;
int minX = (p.getPosition().xCoordinate > 1) ? p.getPosition().xCoordinate - 2 : 0;
int maxX = (grid.width - p.getPosition().xCoordinate > 1) ? p.getPosition().xCoordinate + 2 : grid.width;
... |
06397902-8d5c-43b3-b60c-89bc10351238 | 0 | private Application(Manufacturer manufacturer, int versionId, String name,
String[] aliases, ApplicationType applicationType) {
this.id = (short) ((manufacturer.getId() << 8) + (byte) versionId);
this.name = name;
this.aliases = aliases;
this.applicationType = applicationType;
this.manufacturer = manufactu... |
00aa7fa3-b0f2-452d-85e1-e7273a7d98d9 | 2 | public static synchronized void midisave(byte abyte0[], int i) {
if (i > 0x1e8480) {
return;
}
if (Signlink.savereq != null) {
} else {
Signlink.midipos = (Signlink.midipos + 1) % 5;
Signlink.savelen = i;
Signlink.savebuf = abyte0;
Signlink.midiplay = true;
Signlink.savereq = "jingle" + Signli... |
d57337f0-6b8f-43be-a4d1-8fbb7bdda31a | 1 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
EmpresaBean oEmpresaBean = new EmpresaBean();
EmpresaParam oEmpresaPar... |
ea9717d5-5213-4935-9566-bee7a7969071 | 1 | public Logger(String confName, String localName) {
this.localName = localName;
this.confName = confName;
this.logMP = new MessagePasser(confName, localName);
this.logFile = "log/log.txt";
try{
this.fr = new FileWriter(this.logFile,true);
}
catch(IOException e){
e.printStackTrace();
System.exit(1)... |
c01da6f8-44be-4805-b58c-3ef6a1c8a0bb | 3 | @Override
public void update(Observable o, Object arg) {
if(arg instanceof Piece) {
PieceView v = new PieceView((Piece)arg, this);
add(v);
revalidate();
} if(arg instanceof String && arg.equals("clearGame")) {
pieceViews.clear();
removeAll();
revalidate();
}
re... |
67eac1b7-4658-4e2f-bb40-1c8a1903bce8 | 2 | public void setOut(Node node, Object o)
{
if(this.out == null)
{
this.out = new Hashtable<Node,Object>(1);
}
if(o != null)
{
this.out.put(node, o);
}
else
{
this.out.remove(node);
}
} |
a4d5adc3-cfc3-4694-a044-0f554ee90fbe | 1 | public int getColumnDividerPosition(int index) {
int divider = getColumnDividerWidth();
int pos = 0;
for (int i = 0; i <= index; i++) {
pos += mColumns.get(i).getWidth() + divider;
}
return pos - divider;
} |
63c87d84-db0e-4b5f-8bfa-ad3e96536ef5 | 8 | public boolean canBook(User connectedUser, GregorianCalendar startDate,
GregorianCalendar endDate) {
if (connectedUser.getUserType() == UserType.STOCK_MANAGER) {
return true;
}
if (connectedUser.getUserType() == UserType.STUDENT
|| connectedUser.getUserTy... |
818dcd17-2fcc-4413-9894-c2da9c98753b | 9 | public void valueChanged(ListSelectionEvent e) {
if (!e.getValueIsAdjusting()) {
if ((this.PFPanel.getSelectedIndex() == 0 || this.PFPanel.getSelectedIndex() == 1) &&
patientList.getSelectedIndex() >= 0 &&
e.getSource() == patientList) {
String... |
0970d2d6-147e-4b58-94b3-cfcbd7eaedd5 | 9 | public Raster3D(Axis axis, Vector3d origin, int linecount, int distance) {
final int MAXLENGTH = linecount * distance;
// FIXME: really ugly, use the Vector inside 'axis'
switch (axis) {
case X:
for (int i = -linecount / 2; i <= linecount / 2; i++) {
Vector3d start = new Vector3d(origin.x + i * distance... |
522abb44-ecf3-4a9b-b667-a48e46835c45 | 0 | public String getCode() {
return code;
} |
1fb71490-fb67-4d9a-96bc-6760e9b07127 | 8 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player player = null;
if (sender instanceof Player) {
player = (Player) sender;
}
if (args.length != 1) {
sender.sendMessage("/readmail <ID>");
return true;
}
ResultSet rs... |
8e4c07b7-0f87-4f2d-a25c-9b5b1050d2f9 | 6 | public static void saveProperties()
{
try {
Properties properties = new Properties();
if(!dataDir.exists())
{
dataDir.mkdirs();
}
File file = new File(dataDir.getAbsolutePath() + "/CachedProps.txt");
if(!file.exists())
{
file.createNewFile();
}
FileOutputStream outp... |
d977509e-5ca6-4354-83ce-d6b06b927f89 | 9 | protected static Object argToNetStream(Argument arg)
throws ExtensionException, LogoException {
Object value = arg.get();
if (value instanceof Boolean || value instanceof Double
|| value instanceof String)
return value;
LogoList list = arg.getList();
if (list.isEmpty())
throw new ExtensionExceptio... |
eb991b7f-437e-4f41-b59b-6ac742615100 | 9 | private void tryRegisterGuava() {
try {
RenameHandler.INSTANCE.loadType("com.google.common.reflect.Types");
@SuppressWarnings("unchecked")
Class<?> cls = (Class<TypedStringConverter<?>>) RenameHandler.INSTANCE
.loadType("org.joda.convert.TypeTokenStringCon... |
d8b6f639-c1e1-4205-ab77-61eb50d041af | 8 | public static void main (String[] args) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(in.readLine());
long[] array = new long[n];
String[] numbers = in.readLine().split(" ");
for(int i=0;i<n;++i)
... |
89cfdbf6-548f-4306-8af9-38f33c7b3acc | 9 | static private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpo... |
2b9b5d05-5814-471c-8c50-26df4ca8a2fa | 5 | private TreeItem [] getSelectedTreeItems() {
List <TreeItem> selectedItems = new LinkedList<TreeItem>();
for (TreeItem element : tree.getItems()) { // каждый элемент
if (element.getItemCount() == 0) {
if(element.getChecked()){
selectedItems.add(element);
... |
501f3f89-d5e4-4d58-8e7a-18eccae4ce15 | 1 | @Override
public boolean init(List<String> argumentList, DebuggerVirtualMachine dvm) {
if (argumentList.size() > 0) {
UserInterface.println("This command takes no arguments.");
HelpCommand.displayHelp(this);
return false;
}
return true;
} |
d2a0efd6-e245-4e3e-bb4a-8d75c17cdc20 | 2 | public beansProducto searchName(String nombre){
for(beansProducto producto : productos){
if(producto.getNombre().equals(nombre)){
return producto;
}
}
System.out.println("No se encuentra este producto.");
return null;
} |
5b81af88-2349-4b35-be13-71d8609f4cd4 | 4 | @Override
public void execute() {
String msg = Widgets.get(13, 28).getText();
if (msg.contains("FIRST")) {
Widgets.get(13, Character.getNumericValue(Settings.pin[0]) + 6).click(true);
Task.sleep(750, 1200);
}
if (msg.contains("SECOND")) {
Widgets.get(13, Character.getNumericValue... |
f71a64ab-0b1f-46b9-8dd1-c230daafdfd0 | 7 | public static void main(String[] args) throws Exception{
Scanner reader=new Scanner(System.in);
ReadPhrase readPhrase=new ReadPhrase(new File("phrase.txt"));
File favorite=new File("favorite.txt");
System.out.println("是否从上次结束开始读取成语Y/N");
String answer=reader.nextLine();
if(answer.startsWith("Y")||answer.sta... |
a5be1d68-c54f-4268-b413-e75ddaffd561 | 7 | public void moveBullets()
{
for (int i = 0; i < bullets.size(); i++)
{
bullets.get(i).move();
if (bullets.get(i).y <= -20)
{
bullets.remove(i);
}
}
for (int i = 0; i < zap.size(); i++)
{
zap.get(i).move();
if (zap.get(i).y < 0 || zap.get(i).y > 690 || zap.get(i).x < 0... |
8aa0ed94-7d2d-44bc-b4d7-c361a49ddb50 | 3 | protected String validate(String emailAddress) {
String REGEX = "^[_A-Za-z0-9-\\\\+]+(\\\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\\\.[A-Za-z0-9]+)*(\\\\.[A-Za-z]{2,})$\n";
if (emailAddress == null) {
throw new NullPointerException("Email Address cannot be null!");
}
if (!strictMo... |
2e45a01c-945d-4c9f-ae1d-989a975d9308 | 9 | public static void printStatistics() {
int numMonster = 0;
int numEffect = 0;
int numSpell = 0;
int numRitual = 0;
int numEquip = 0;
int numTrap = 0;
int numField = 0;
int numObtainable = 0;
for(Card c : cards) {
if(c.obtainable) {
numObtainable++;
}
if(c instanceof MonsterCard) {
num... |
37674868-f271-4931-8998-6a3d376aff8a | 4 | public void choosePoints(Vertex v, MouseEvent e)
{
if (v == null) return;
if (v.getClass() != Point.class) return;
Point p = (Point)v;
if (leftPoint == null) leftPoint = p;
else
{
rightPoint = p;
if (e.getButton() == MouseEvent.BUTTON3)
... |
2f282a1d-9735-4a27-a45b-65d6b71504c9 | 8 | public static void setupTipMappings() {
tipMappings = new HashMap<>();
try {
Scanner tipScanner = new Scanner(new File("Tipper.txt"));
while (tipScanner.hasNext()) {
String className = tipScanner.nextLine().trim();
while (tipScanner.hasNext() && className.isEmpty())
className = tipScanner.nextLi... |
9b658d40-c754-4234-80f3-2b41a64325f7 | 1 | public static boolean setupPermissions()
{
RegisteredServiceProvider<Permission> permissionProvider = Bukkit.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null)
{
permission = permissionProvider.getProvider();
... |
0df84b70-0159-46b6-9627-fde9a51a3931 | 1 | private static int sumOfNumbers(int n) {
if (n <= 0) {
return n;
} else {
return n + sumOfNumbers(n - 1);
}
} |
e49fe061-b9af-46cb-8ce7-27b0ab713521 | 7 | private void initElements(String title, int size, Movie movie,
boolean editable) {
// labels
lMovietitel = new JLabel("Titel");
lOriginaltitle = new JLabel("Originaltitel");
lYear = new JLabel("Jahr");
lCountries = new JLabel("Produktionsländer");
lDirector = new JLabel("Regisseur");
lActors = new JLa... |
89b9c994-dcb4-4686-91db-d3837e4dbe7d | 5 | private static List<String> getResourcesFromDirectory(File classpathEntry, File directory, String path, boolean directories) {
List<String> resources = new ArrayList<String>();
for (File file : directory.listFiles()) {
if (!file.isDirectory() || directories) {
String fileNa... |
402903dd-a432-48e3-8201-6a547ecc93e7 | 3 | public String toString() {
StringBuffer m = new StringBuffer();
m.append("#");
m.append(sym);
if (value != null) {
m.append(" (");
m.append(value.toString());
m.append(")");
}
if (left >= 0) {
m.append(" @");
m.append(left);
if... |
c96b9f92-1c98-451c-b57c-8823859eef2a | 8 | private HttpResponse executeRequest(final HttpUriRequest request, final String url) throws RestClientException {
final HttpClient client = new DefaultHttpClient();
try {
if( LOG.isDebugEnabled()){
LOG.debug(String.format("Making HTTP %s request to '%s'", request.getMethod(), url));
}
try {
... |
e6cab04f-382d-4bfd-aa65-b5ea8ea4338e | 3 | public void setDocumentRelative(String id) {
try {
Box box = xHTMLPanel.getSharedContext().getBoxById(id);
if (box != null) {
Point pt;
if (box.getStyle().isInline()) {
pt = new Point(box.getAbsX(), box.getAbsY());
} else {
RectPropertySet margin = box.getMargin(xHTMLPanel
.getLayou... |
4f8247f6-b44e-4f99-a2c0-f24da2d43c85 | 1 | public static void main(String[] args) {
Binomial binomikeko = new Binomial();
for (int i = 10; i != 0; i--) {
binomikeko.insert(i);
}
binomikeko.extract_min();
binomikeko.extract_min();
binomikeko.extract_min();
System.out.println(binomikeko.toString... |
095213f7-f1b5-45f5-99a5-71d1a2a77d11 | 5 | public IMessage crypter(IMessage clair, String key) {
/*
* Les caractres sont encods un un via oprations elementaires
* Les caractres ne correspondant pas des lettres sont ajouts tel quels.
*/
long d=new Date().getTime();
int k=Integer.parseInt(key);
char[] c=new char[clair.taille()];
for(int i=0;i... |
50509409-c7b1-4ce0-a0c5-67108e155361 | 2 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int r= in.nextInt();
int c= in.nextInt();
int[][] A = new int[r][c];
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
A[i][j]=in.nextInt();
}
}
System.out.println(count(A));
} |
7c21cb24-bc5e-4532-ad57-7944bbca1ec3 | 0 | public void run() {
mediator.consultation(this);
} |
11ee4da6-a043-40ba-b4fb-dedf9c2a389c | 6 | public void execute(TridentTuple tuple, TridentCollector collector) {
LOGGER.info("Executed!!!!!!!!!!!!!!!!!!!!!!!!!");
if(tuple==null) return;
TransObj obj = null;
long beginTime = System.currentTimeMillis();
if(tuple.get(0)!=null && tuple.get(0) instanceof TransObj)
... |
9e8c3172-6b01-4cde-baca-bf0d64f4cee3 | 3 | private void getLineIfNeeded() throws EOFException, IOException
{
if ( line == null )
{
if ( r == null )
{
throw new IllegalArgumentException("attempt to use a closed CSVReader");
}
allFieldsDone = false;
line = r.readLine(); /* this str... |
6c19d14b-5ac8-4755-9a85-40f175eac8bf | 6 | public static List<Node> generateNodeList(double graph[][])
{
int length=graph.length;
List<Node> nodeList=new ArrayList<Node>();
for(int i=0;i<length;i++)
{
Node n=new Node(i,Double.MAX_VALUE,0,null);
nodeList.add(n);
}
for(int i=0;i<length;i++)
{
List<Node> list=new ArrayList<Node>();
for(i... |
ebc7d7ff-cc38-47c8-9a09-f898864dfbb3 | 7 | @Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
String[] possiblities;
String part;
switch (args.length) {
case 2:
possiblities = new String[] { "one", "two" };
part = args[1];
... |
0b5df883-c4c3-471c-b93c-7392380293a4 | 9 | @Override
public void compute(List<Card> holecards, List<Card> board, IHandRange range, int numPlayers) {
initArrays();
List<Card> boardCpy = new ArrayList(board);
IHand ownCurrentHand = PokerFactory.buildHand(holecards, board);
List<Card> c1Cand = new Arra... |
a20e2a05-b0f6-43dc-93ae-d1738881ac51 | 1 | public boolean setStandardButtonMinHeight(int height) {
boolean ret = true;
if (height <= 0) {
this.buttonStd_Height = UISizeInits.STD_BTN.getHeight();
ret = false;
} else {
this.buttonStd_Height = height;
}
somethingChanged();
retur... |
29c59efd-1434-40db-9a62-b4cd1976673b | 8 | public byte[] getContent() throws IOException {
if (this.content == null && this.file != null && this.file.exists()) {
InputStream in = null;
byte[] readBuffer = new byte[1024 * 1024];
ByteArrayOutputStream out = null;
try {
in = new FileInputStream(file);
out = new ByteArrayOutputStream();
in... |
74617682-dd4b-43a2-a0a2-455df6756ab8 | 8 | public static void handleEvent(int eventId)
{
// Changes focus to Main Ship Shop Menu
if(eventId == 1)
{
System.out.println("Exit Ship Shop Engines menu to Main Ship Shop Menu selected");
Main.ShipShopEnginesMenu.setVisible(false);
Main.ShipShopEnginesMenu.setEnabled(false);
Main.ShipShopEnginesMenu.... |
76596834-e0d3-4761-8bf7-2daaba251cef | 1 | public void updateMaxLocalInf(int x) throws InterruptedException {
s4.acquire();
if (maxLocalInf < x)
maxLocalInf = x;
s4.release();
} |
0763ef8c-048c-4bd5-afcb-2410e3e47602 | 3 | public boolean deletePatient(Patient2 patient) {
if (nextPatient.isFirst) {
return false;
} else if (nextPatient.name.equals(patient.name)) {
if (nextPatient.isLast) {
this.isLast = true;
}
nextPatient = nextPatient.nextPatient;
... |
3b36c890-bf48-4b6f-a66e-d354ce9accc1 | 7 | private static TspPopulation[] generate(){
Graph g = new Graph(INDIVIDUAL_SIZE);
TspPopulation[] h = new TspPopulation[GLOBAL_STEPS];
for (int i = 0; i < GLOBAL_STEPS; ++i){
h[i] = new TspPopulation(POPULATION_SIZE, INDIVIDUAL_SIZE, g.getGraph());
}
resultsRandom = ne... |
c95bab15-82a2-4f96-9215-1dfa869b94c5 | 5 | @Override
public void mouseMoved(MouseEvent e) {
if (po != null) {
po.temp = new Point(e.getX(), e.getY());
}
if (global == GlobalMode.EditMode) {
panned = new ArrayList<PolygonObject>();
for (PolygonObject O : manager.objects) {
if (O... |
630d0b22-39a4-4a49-b64a-9ae27944b61e | 8 | public ComponentManager() {
// load all the classes in our desired package (the components package)
try {
// get the code source that we're in
CodeSource src = CommandsManager.class.getProtectionDomain().getCodeSource();
if(src != null) {
URL jar = src.getLocation();
ZipInputStream zip = new ZipInp... |
5696d6e1-909d-4df5-b76e-4ecfa402a6b6 | 0 | @Test public void itShouldHaveProperties() throws Exception
{
TestGeoJsonObject testObject = new TestGeoJsonObject();
testObject.setProperty("property", "value");
Assert.assertNotNull(testObject.getProperties());
} |
89900e9c-03fb-45e7-abe3-6ca5ac98f1fe | 1 | public static String getStackTrace(Throwable t) {
String stackTrace = null;
try {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
pw.close();
sw.close();
stackTrace = sw.getBuffer()... |
41ed32df-7f09-4232-ace6-ee75b0785876 | 4 | @SuppressWarnings("unchecked")
private static <E> List<Class<E>> findClasses(File directory, String packageName) throws ClassNotFoundException {
List<Class<E>> classes = new ArrayList<Class<E>>();
if (!directory.exists()) {
return classes;
}
File[] files = directory.listFiles();
... |
a426ef6e-01eb-409d-9413-89e8c7b52a5b | 2 | @Override
public void act() {
if (!checkLife()) {
System.err.println("Player has died");
removeSelfFromGrid();
return;
} else {
while (exp >= nextExp) {
System.out.println("player level up");
exp -= nextExp;
... |
e1c7b736-3750-4dd7-a83a-a12a45a9dd6a | 7 | public static void ejecutaObjetivo4 () throws SQLException, ClassNotFoundException, IOException{
String query = EntidadDAO.QUERY_BASE + " where osmid is not null and admin_level in (4,6,7,8) and estado_4 = 0 ";
query = query + "and cod_prov in ('35', '38')";
List<Entidad> entidades = null;
try (... |
e7cc0fa5-f198-4eb8-a0ef-385eb726aab2 | 5 | public boolean equals(AxiomCNF cnf) {
int found = 0;
if(cnf == null || cnf.length() != this.length()) {
return false;
} else {
// compare each operand to every other operand
for(String operand1 : operands) {
String ors1[] = operand1.split("\\|");
for(String operand2 : cnf.getOperands()) {... |
7bf53b68-e720-43de-9479-7fbf83d3c6c6 | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.source().location()!=null)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0)
&&(msg.tool()==this)
&&(msg.target() instanceof MOB)
&&(!((MOB)msg.target()).amDead()))
{
fina... |
a1a19838-7e85-42dc-a61a-801fa43f0b43 | 6 | @Override
public void paintComponent(Graphics graphics) {
if (tileSheet != null) {
int x = 0;
int y = 0;
for (Tile tile : tileSheet.getTiles()) {
graphics.setColor(Color.WHITE);
graphics.fillRect(x, y, 8, 8);
graphics.fillRe... |
051bd8d5-3067-4e54-9409-c2284c11b6c6 | 9 | private int retrieveStartingPositionAfterOpeningParenthesis(int sourceStart, int sourceEnd, int numberOfParen) {
if (this.referenceContext == null) return sourceStart;
CompilationResult compilationResult = this.referenceContext.compilationResult();
if (compilationResult == null) return sourceStart;
ICompilationUnit... |
e66cd585-df8f-45f7-b0de-33d1a61568d9 | 1 | public void updateContent()
{
for(Control control : Controls)
{
control.updateControl();
}
} |
8794ef3b-3d0f-4634-80bc-7133902e2a76 | 3 | public void carregaBairros(String codCid){
if(comboCidade.getSelectedItem().toString().equals("Selecionar ...")){
System.out.println("Nenhuma cidade selecionada");
}else{
System.out.println("Carregando bairros...");
combo... |
94d76739-76a3-4395-8b6c-b0bd1b28474b | 3 | public static void main(String s[])
{
Bag<Integer> bag = new Bag<Integer>();
for (int i = 0; i < 10; i++)
bag.add(i);
if (!bag.isEmpty())
{
System.out.println("Size : " + bag.size());
for (Integer i : bag)
System.out.println(i);
bag.iterator().remove();
}
} |
a6116b68-e369-48bd-9a2f-d6dc241968ce | 5 | public void moveX(int playerX) {
if(!dead){
if(playerX > x){
dx = .3;
}else if(playerX < x){
dx = -.3;
}
if(!knockback){
x += dx;
}else{
x += dx * -1;
}
... |
9ca13d8e-655f-4bf7-a9fa-39653f26a625 | 6 | public int analizaEntrada(char c){
if(c!=';' && !Character.isWhitespace(c) && c!=13)
return 0;
else
if(c==';')
return 1;
else
if(c==32 || c==9)
return 2;
else
return 3;
} |
2aa038ed-2886-43c0-a2b6-a21844e255df | 6 | public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if(sender instanceof Player)
{
Player player = (Player) sender;
if(player.hasPermission("MasterPromote.token.create"))
{
if(args.length == 2)
{
try
{
Intege... |
6c6aaa42-acb4-49b6-b9c1-e59f54e26d3e | 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... |
98bf74ba-fc54-48cf-ba49-7c28d2b2e9d8 | 0 | public void showChartFrame(){
setSize(frameWidth, frameHeight);
centerFrame();
addControlPanel();
setVisible(true);
} |
69fb4522-adaa-40b5-9ce7-6fb9159fbbe2 | 7 | public Set<Map.Entry<Short,V>> entrySet() {
return new AbstractSet<Map.Entry<Short,V>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TShortObjectMapDecorator.this.isEmpty();
}
public b... |
37aad5ee-7d2d-4639-a96e-6906ac7a80d9 | 1 | public static int kullbackDist(int color1, int color2) {
int red1 = (color1 & RED_MASK) >> 16;
int green1 = (color1 & GREEN_MASK) >> 8;
int blue1 = (color1 & BLUE_MASK);
int red2 = (color2 & RED_MASK) >> 16;
int green2 = (color2 & GREEN_MASK) >> 8;
int blue2 = (color2 ... |
b8e04d42-fe47-461f-9d22-7605d4d915a1 | 7 | public static void main( String args[] )
{
int x=5, y=2;
//igual
if (x==5) System.out.println("x=5");
//distinto
if (x!=2) System.out.println("x!=2");
//y lógico
if (x==5 && y==2) System.out.println("x=5, y=2");
//o lógico
if (x==5 || y==1) System.out.println("x=5");
//operación
if (x+y>10)
{
System.out.println("x+y>10... |
843dbe2e-78e5-4c66-a52d-b59dc432834c | 1 | public void setBtn_Std_Fonttype(Fonttype fonttype) {
if (fonttype == null) {
this.buttonStdFontType = UIFontInits.STDBUTTON.getType();
} else {
this.buttonStdFontType = fonttype;
}
somethingChanged();
} |
009d8994-c5b3-4869-85bd-6eb596fb18a0 | 2 | private void acao109() throws SemanticError {
IdentificadorMetodo idMetodo = pilhaMetodosAtuais.pop();
if(idMetodo.getTipo() != null && !retornoDeclarado)
throw new SemanticError("Métodos com tipo devem possuir pelo menos um comando de retorno");
retornoDeclarado = false;
tabela.clear(nivelAtual);
nivel... |
fabf92cc-5523-457e-84d5-662daa137385 | 5 | protected void closestTargets(Game game)
{
targets.clear();
double bestDist = Double.MAX_VALUE;
Iterator<VGDLSprite> spriteIt = game.getSpriteGroup(itype);
if(spriteIt == null) spriteIt = game.getSubSpritesGroup(itype); //Try subtypes
if(spriteIt != null) while(spriteIt.has... |
71a419c0-81ff-4f7c-a3d9-3032782829ff | 2 | public boolean init() {
if(!actorManager.init()) {
System.out.println("ActorManager init failed!");
return false;
}
// TODO replace this with proper initialization of levels or somesuch stuff.
//game = new SettiLogic(this);
physics = new ... |
9fb5d95d-4d13-4557-9ede-a138b4908358 | 1 | public void changeEdge(Edge edgeToRemove, EdgeState newState) {
// If the edge does not exist then throw an error
if (!edgeMap.containsValue(edgeToRemove)) {
throw new IllegalStateException("Tried to change a nonexistent edge");
}
... |
2186c79d-97b9-4c0c-ba66-25f3753ebf62 | 0 | private void combo_tasksActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_combo_tasksActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_combo_tasksActionPerformed |
7acb5b39-a407-4a95-ae8d-ee3e2d94b192 | 4 | private void parseRoom(Command command) {
if (!command.hasNthWord(2)) {
System.out.println("Go where?");
} else {
String direction = command.getNthSegment(1);
String nextRoom = rooms.get(currentRoom).getExit(direction);
if (nextRoom == null) {
... |
d56038ac-e8a7-4d7c-946d-1528d40dce9d | 3 | private void lenna() {
/*
* Ehtolause joka käsittelee tilanteen jossa pelaaja pitää
* hyppynappia pohjassa hypätäkseen korkeammalle
*/
if (isoHyppy > 0) {
yNopeus = -10;
isoHyppy--;
}
/*
* Normaali tilanne
*/
if... |
941c2ee9-0546-499b-86c7-0eaaad9449ec | 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 fe... |
5cb223b1-b2e4-4021-8e58-b38487edc56c | 2 | public String getValue(String attributeName) {
NodeList methodNodes = getDocument().getElementsByTagName(attributeName);
if (methodNodes.getLength() == 0 || methodNodes.getLength() > 1){
System.err.println("Couldn't read XML");
return null;
}
return methodNodes.it... |
4ba99c1e-b53f-450a-9c49-035315dec526 | 3 | public static void main(String[] args) {
for (int i = 20/2; i > 0; i--)
{
for (int j = 20/2-i; j >=0; j--) {
System.out.printf(" ");
}
for (int j = i*2-1; j >= 1; j--) {
System.out.printf("*");
}
System.out.printf("\n");
}
} |
af8946fa-d584-4506-b9a2-d42458d407e8 | 0 | public boolean equals(Object o) {
return map.equals(o);
}//equals |
d14a78b1-afd2-46d7-98c6-2d4b899455f7 | 0 | public int getAttributeID() {
return this.attributeID;
} |
8c587907-2d54-4d9b-bb4f-f3a5fd49a446 | 2 | public boolean equals(Object other) {
if (other instanceof Type) {
Type type2 = (Type) other;
return typeSig.equals(type2.typeSig) && instr == type2.instr;
}
return false;
} |
82e3bf80-c91c-4da2-9ec2-261e4beed9ce | 4 | protected void skipSubPath() throws ParseException, IOException
{
for (;;)
{
switch (current)
{
case -1:
case 'm':
case 'M':
return;
default:
break;
}
current = reader.read();
}
} |
96c792f9-5035-4d4a-8061-671b4b1033de | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TaxonAttribute)) {
return false;
}
TaxonAttribute other = (TaxonAttribute) object;
if ((this.taxonAttributePK =... |
d1c8af13-52e8-4040-b94a-ec92486cbc85 | 8 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.target()==null)||(!(msg.target() instanceof MOB)))
return ;
final MOB mob=(MOB)msg.target();
if(mob!=this.owner())
return;
if((msg.targetMinor()==correctTargetMinor())
&&(CMath.bse... |
fe7fc744-7104-494f-8631-fef8abe06ca5 | 6 | @Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
AbstractDomain other = (AbstractDomain) obj;
if(name == null) {
if(other.name != null)
return false;
} else if(!name.equals(other.name))
... |
55e4f96b-3cb6-431f-ab5f-14695aaae0a3 | 1 | public boolean pass(int[] bowl, int bowlId, int round, boolean canPick, boolean musTake) {
updateStats(bowl, round);
if (totalFruitSeen >= 60) {
return distributionStrategy(bowl);
} else {
return stoppingStrategy(bowl, round);
}
} |
fdadd50b-141f-46c3-bc62-1ba997280ab4 | 0 | @Override
public T save(T entity) {
entity.setId(UUID.randomUUID().toString());
database.putIfAbsent(entity.getId(), entity);
return entity;
} |
760e86bd-7542-467c-bd64-23a7f52ce638 | 2 | @Override
public void handle(HttpExchange he) throws IOException {
String method = he.getRequestMethod();
Headers h = he.getResponseHeaders();
switch (method) {
case "GET":
String json = facade.getAcademysAsJson();
h.add("Content-Type", "applica... |
3e054223-6499-4c03-95ae-eb5f617e63cf | 4 | public static byte[] decodeFromFile( String filename )
throws java.io.IOException {
byte[] decodedData = null;
Base64.InputStream bis = null;
try
{
// Set up some useful variables
java.io.File file = new java.io.File( filename );
byte[] bu... |
51db8545-57d2-40dc-ab83-4a501daef1a9 | 8 | @Override
public void computeFitnesses() {
for (int r = 0; r < N; r++) {
for (int c = 0; c < N; c++) {
List<GameCreature> pool = new ArrayList<GameCreature>();
for (int i = r-1; i <= r+1; i++) {
for (int j = c-1; j <= c+1; j++) {
... |
7c2d7ec6-21fb-4da5-880f-36a8880134ad | 2 | public void newGame() {
_isBallStart = true;
_isGameOver = false;
//очистить поля
clearField();
// создать новые условия игры
gameField().setField(_level);
gameView().createSpriteGroup();
for (int i = 0; i < gameField().balls().size(); i++) {
g... |
367a85d1-192d-4d1e-b17a-b8c83e300c40 | 0 | public TextQuestView() {
super();
this.add(new JLabel("Field"));
setSize(PANEL_WIDTH, PANEL_HEIGHT);
//textGoTo = new JTextField();
//textGoTo.setBounds(23,302,157,29);
//add(textGoTo);
lblAnswer = new JLabel("Odpowiedź")... |
d7f14777-9715-4fb1-bc3f-bd94dd9624f8 | 6 | public void setPlayableCardsOnBoard() {
for ( int i = 0; i < 6; i++ ) { // Check every row except row 6.
for ( int j = 0; j < getBoard()[i].length; j++ ) {
Card card = getBoard()[i][j];
if ( getBoard()[i + 1][j].isMatched()
&& getBoard()[i + ... |
d395f248-8a12-4b57-84c1-a54bbe11f6da | 1 | public NotEnoughBytesException(int numBytes) {
super("Packet construction requires minimum of " + Packet.HEADER_SIZE + " bytes. Only " + numBytes + (numBytes == 1 ? " byte" : " bytes") + " given.");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.