method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
215fa8f0-0034-4ba3-996a-29c7fe24889d | 0 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// TODO Auto-generated method stub
} |
f68c1ff2-13ae-44af-a1d1-2f0c8238cebf | 0 | public Gem(int x,int y)
{
super(x,y);
URL loc = this.getClass().getResource("/karel/themes/LTTPGem.png");
ImageIcon iia = new ImageIcon(loc);
Image image = iia.getImage();
this.setImage(image);
} |
2225c4b7-8ece-4e88-8cd5-e1952c3d0e67 | 3 | @Override
public String toString() {
String[] hostNameStr = new String[this.clock.size()];
int index = 0;
for(String key: this.clock.keySet()){
hostNameStr[index++] = key;
}
Arrays.sort(hostNameStr);
String tmp = "";
for (int i = 0; i < hostNameStr.length; i++) {
if (this.clock.containsKey(hostNam... |
ba58be6e-afc7-4990-b3df-69dcdebf6219 | 5 | public void initialize(byte[] src) throws IOException {
int uSize = ((src[0] & 0xFF) << 16) |
((src[1] & 0xFF) << 8) |
(src[2] & 0xFF);
int cSize = ((src[3] & 0xFF) << 16) |
((src[4] & 0xFF) << 8) |
(src[5] & 0xFF);
... |
bb4e8dfc-ef48-4a06-82fc-f18f3b909b6f | 1 | public void updateType() {
if (type != Type.tVoid)
updateParentType(subExpressions[0].getType());
} |
ce50ed2f-c5d8-45c8-9fc1-abf27025a790 | 0 | @Override
public boolean supportsEditability() {return false;} |
99d8c08f-0b41-4d0a-bc6e-1f4f12719531 | 1 | public void loadSprites(){
try {
spritesheets.put("HERO", ImageIO.read(LLP.class.getResourceAsStream("/net/bardiches/llp/resources/hero.png")));
spritesheets.put("BRICK", ImageIO.read(LLP.class.getResourceAsStream("/net/bardiches/llp/resources/brick.png")));
spritesheets.put(... |
1189f455-791f-47d6-98e2-aa889a362966 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
399ab66c-b79e-4b3e-bc0a-a9f55f1f9474 | 7 | public void mouseClicked(MouseEvent e, View a_view)
{
int button = e.getButton();
if(button == MouseEvent.BUTTON1)
{
if(clickCount == 0)
{
clickCount++;
x1 = e.getX();
y1 = e.getY();
JOptionPane.showMessageDialog(... |
cda4d23a-a70e-40b6-b116-ac77293251e6 | 0 | public RoomList(String name, String username)
{
this.name = name;
members.add(username);
} |
21570766-df9a-4325-a296-bffca66dc039 | 8 | public AtomicFactory(Class<T> _class, Class<? extends dstm2.factory.Adapter> adapterClass) {
super(_class);
synchronized (lock) { // BCEL is not thread-safe!
interfaceName = _class.getName();
this.adapterClass = adapterClass;
className = _class.getName() + "$";
Class[] in... |
cdf2c610-56f6-41b2-ba83-6713fba3e9c3 | 8 | public NodoArbolBinario<T> eliminar( T aEliminar )
{
if(izquierda==null&&derecha==null)
return null;
if(elemento.equals(aEliminar)){
if(izquierda==null)
return derecha;
if(derecha==null)
return izquierda;
NodoArbolBinario<T> x=derecha.darMenor();
derecha=derecha.eliminar(aEliminar);
x.iz... |
91b7f7a2-bd18-4eba-8c40-1ae9511f6201 | 8 | public static void main(String[] args) {
for(int i=0;i<=S.length;i++){
for(int j=0;j<=T.length;j++){
LCS[i][j]= -1;
}
}
for(int j=1;j<=S.length;j++){
LCS[0][j] = 0;
}
for(int i=0;i<=T.length;i++){
LCS[i][0] = 0;
}
for(int i=1;i<=S.length;i++){
for(int j=1;j<=T.length;j++){
LC... |
e8652015-f1d9-4895-9963-03dff6434918 | 0 | @Override
public Set<PermissionAttachmentInfo> getEffectivePermissions(){ throw new UnsupportedOperationException("Not supported yet."); } |
32a2eb29-6127-440a-9583-fbdf8fc04b73 | 5 | public void mouseMoved(MouseEvent e) {
MyWorldView.SPACE_INVERSE_TRANSFORM.transform(e.getPoint(),p);// Change mouse coordenates from
if (currentElement !=null) // pixels to meters.
if (currentElement.contains(p.getX(), p.getY()))
return;
... |
f2d09711-038d-4331-9db8-20a36b18e4dd | 0 | public int getNumOfTabs() {return numOfTabs;} |
d9a3ec71-811d-43f5-bfdb-6a43ad511410 | 7 | @Override
public void render(Graphics2D graphics) {
int startPointGridXCoordinate = 150;
int startPointGridYCoordinate = 20;
for (Entry<Position, List<ElementInfo>> entry : objectTron.getElements().entrySet()) {
int xCoordinate = startPointGridXCoordinate + (entry.getKey().xCoordinate * 41);
int yCoordi... |
ab2f8a92-24fd-4949-bf76-3d0c2ea6fb15 | 6 | private Object[] getVkeyGettersAndIndexes(Method method, List<String> vkeyParameterNames,
Map<String, Integer> paramIndexes, Map<String, Integer> batchParamIndexes) throws DaoGenerateException {
Class<?> returnType = method.getReturnType();
if (ClassHelper.isTypeCollection(returnType)) {
// 集合类的版本号和... |
92c3063e-0d53-4be3-b6bc-0839aaf44b03 | 3 | public static void prepareSocket()
{
if (EzimAckSender.ms == null)
{
try
{
EzimAckSender.ia = InetAddress.getByName
(
EzimConf.NET_MC_GROUP
);
EzimAckSender.iMcPort = EzimConf.NET_MC_PORT;
EzimAckSender.ms = new MulticastSocket(iMcPort);
EzimAckSender.ms.setNetworkInterface(Ezi... |
433b48fd-f0e9-4788-9e29-e829d1d6f04e | 4 | public Indication() throws InterruptedException {
System.out.println("Making client " + id);
threadcount++;
try {
socket = new Socket(Main.SERVER, Main.INDICATION_PORT);
} catch (IOException e) {
log.info("Socket failed " + e + "/n Restart indikation");
System.err.println("Socket failed");
// пытаем... |
44113246-2b7c-441a-bbd8-33a22aaa5f55 | 1 | public String next() throws IOException {
if (hasNext()) {
String filename = tempdir + (File.separator) + nextSessionId() + ".avi";
names.add(filename);
++currindex;
return names.get(currindex - 1);
}
throw new NoSuchElementException();
} |
e1227be3-f538-4a7d-8649-6232a12c42ed | 8 | public void movePlayer(int i) {
if (currentScreen == this.menu) {
//BUTTONS
}
else
if (i == MOVE_RIGHT) {
//currentMap.player.setXVelocity(10);
rightHeld = true;
currentMap.player.setXVelocity(10);
}
else if (i == MOVE_LEFT) {
//currentMap.player.setXVelocity(-10);
leftHeld = true... |
08e98707-d54d-4404-9044-f278a429679d | 2 | public static Punkt[] generateRandomPunktVektor()
{
// Antalet horn på linjen
int antalPunkter = new Random().nextInt(5) + 1;
// Skapar en Punkt vektor som håller Punkterna
Punkt[] punktVektor = new Punkt[antalPunkter];
for(int i = 0; i < antalPunkter; i++)
{
// X koordinat för Punkten
int x = new ... |
f9826f91-4dbe-46b6-b901-9c5a2586cf71 | 2 | public void stop()
{
if(Run)
{
this.StopTimeStamp = System.currentTimeMillis();
this.Run = false;
}
else
{
try {
throw new Exception("the stopwatch dosen't run");
} catch (Exception e) {
e.printSt... |
bb3856ee-85ce-4955-af9f-16732e425b58 | 3 | public Version(final String version) {
this.original = version;
if (version == null) {
this.major = null;
this.minor = null;
this.revision = null;
this.type = null;
this.build = null;
return;
}
final Matcher m = Pa... |
f255784e-5867-4274-aa40-a4142be1aa57 | 0 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
judgeRoom();
}//GEN-LAST:event_jButton1ActionPerformed |
e448172b-470c-4e58-ae48-decabce51c40 | 8 | public MultiTouchServer() throws IOException, AWTException
{
thisPtr = this;
loadConfig(CONFIG_FILE);
/*
try
{
localAddr = InetAddress.getLocalHost();
if (localAddr.isLoopbackAddress())
{
localAddr = LinuxInetAddress.getLocalHost();
}
mLocalHostName = localAddr.getHostName();
mLocalHos... |
ba62ada4-58f4-43ba-bfed-2e098e2dc27f | 7 | private void formMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMousePressed
double x = evt.getX() * ((double)800/(double)windowSize().width);
double y = evt.getY() * ((double)600/(double)windowSize().height);
String action = menuBar.clickCheck((int)x, (int)y);
if (ac... |
23a2cdf8-7ae3-4bfb-98bd-7193e16433fa | 8 | float eyeAndScreen(Dimension dim)
// Called in paint method of Canvas class
{ initPersp();
int n = w.size();
e = new Point3D[n];
vScr = new Point2D[n];
float xScrMin=1e30F, xScrMax=-1e30F,
yScrMin=1e30F, yScrMax=-1e30F;
for (int i=1; i<n; i++)
{ Point3D P = (Po... |
1e5d5016-f536-44d8-acb3-6f4d97fc2f86 | 7 | public void put(byte[] data, int offset, int len) {
if (len == 0) return;
synchronized (signal) {
// see if we have enough room
while (putAvailable() < len) {
try { signal.wait(1000); } catch (Exception e) { System.out.println("Put.Signal.wait:" + e); }
... |
084ef4be-3f9c-4003-92f0-3176cadfb4d2 | 7 | public static int Valida(char[][] tabla, String cadena2) {
char[] cadena = cadena2.toCharArray(); //Tiene la cadena que va a validar
int columnas = tabla.length; //Obtiene el numero de columas de la tabla de transiciones 5
int filas = tabla[0].length; //Obtiene el numero de filas de la tabla de... |
c6a41014-6156-4920-bdb7-74147a322288 | 2 | public static BufferedImage getImage(String imagePath) throws IOException, IllegalArgumentException {
if (images.containsKey(imagePath)) {
return images.get(imagePath);
} else {
try {
images.put(imagePath, ImageIO.read(ImageLoader.class.getResource(imagePath)));
} catch (IllegalArgumentException except... |
333e994d-35b3-4e26-a7ca-d62fd7cf46e8 | 6 | public static void main(String[] args) throws IOException {
String host = args[0];
int port = Integer.parseInt(args[1]);
String serviceName = args[2];
BufferedReader in = new BufferedReader(new FileReader(args[3]));
// locate the registry and get ror.
RMIRegistryClient sr = RMIRegistryClient.getRegistry(h... |
7706ee41-f55d-4894-9365-b983f00ea412 | 4 | public void equalizeVelocity() {
double d = diffPos();
if (d < 0.0) {
leftV += INC;
} else if (d > 0.0) {
rightV += INC;
}
if (leftV > GOAL_V) {
rightV -= (leftV - GOAL_V);
leftV = GOAL_V;
}
if (rightV > GOAL_V) {
... |
c4117d3b-077a-4468-ad1b-b1cc0ce6b56d | 1 | public String getFldType() {
if ( type == null )
throw new IllegalStateException( "type was never assigned for: " + table.getDomName() + "." + colName );
return type.getWrapperType();
} |
144681cb-7a8f-479d-b174-10decef3f9b6 | 9 | public static void evaluate_all() {
String[] search_types = { "lock-based", "lock-free" };
double[] graph_density = { 0.00015, 0.000015 };
int[] num_nodes = { 500000, 1000000 };
int source_node = 2;
/** Change for LRC machines! **/
int max_threads = 7;
int max_reps = 1;
int n_graphs_to_evaluate = 5;
... |
4576fcba-a311-4d46-92c6-60e9b4ee0121 | 4 | public static String streamToString(InputStream in) {
if (in != null) {
Writer writer = new StringWriter();
char[] buffer = new char[1024];
try {
Reader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
int n;
while ((n = reader.read(buffer)) != -1)
... |
428c446e-f217-4cfc-a051-d7fd03e0dc0a | 8 | private void loadBeanInternal(String loadProperty, BeanLoader loader) {
if (loaded && (loadedProps == null || loadedProps.contains(loadProperty))) {
// race condition where multiple threads calling preGetter concurrently
return;
}
if (disableLazyLoad) {
loaded = true;
return;
}... |
93efab2d-1f49-47d9-b745-777800d35daa | 3 | public static float[] getHole(Vector<int[]> Lines, float[] g, float degrees, float steps)
{
//Funktion bekommt die Anfangsgerade und den aktuellen Winkel, da so Rechenungenauigkeiten vermieden werden
//steps gibt an in welchen Schritten sich der Winkel aendert
//Rueckgabe ist entweder ein Punkt der aus einem "Lo... |
afe62356-1838-4056-8df1-79589092bccc | 0 | public double[] getMemory(){
return memory;
} |
28df1d29-ed03-48b0-b3a6-02baa73826f5 | 8 | private TableCell toTableCell()
{
TableCell tc = new TableCell("td", null);
String className = null;
if ( isBase && nested )
className = "base";
for ( int i=0;i<fragments.size();i++ )
{
Atom a = fragments.get(i);
if ( className == null && a... |
1ef18dda-558c-4ad0-a05e-3d13f625efde | 0 | private ImageProcessor findConnectedComponents(ImageProcessor ip){
ImageProcessor boundariesTemp = ip.convertToByteProcessor(true);
boundariesTemp.threshold(0);
return setLabels(boundariesTemp);
} |
5f0ee532-d3ac-49b1-b019-513f064a12eb | 8 | private void loadOperands(){
if (ins instanceof AddInstruction){
AddInstruction ai = (AddInstruction) ins;
address = (short)ai.getRegA().getIndex();
if (ai.getRegC().getState()==null){
vals[0] = ai.getRegC().getVal();
opsReady[0] = true;
}
else {
ai.getRegC().getState().cdb.add(new CommonDa... |
b4f38b0f-f3df-4002-a851-9d81b90b37aa | 4 | public static void readFile(){
Scanner keyboard = new Scanner(System.in);
Scanner inFile;
System.out.print("Enter name of file containing species data:");
String fname=keyboard.nextLine();
File readIn=new File(fname);
String speciesNames[];
String temp[];
try {
inFile = new Scanner(readIn);
specie... |
6de066d9-3608-4934-bb7a-98be3bbdd071 | 1 | public boolean isEmpty() {
if (dequeue == queue.getSize()) {
return true;
}
return false;
} |
7952ed26-e56e-48cc-8140-c10f842009cd | 1 | public void addCastle(core.Castle castle)
{
if (lockCount != 0) return;
WidgetChooserButton button;
button = new WidgetChooserButton(castle, castle.getName(), false);
button.selected.connect(this, "selectCastle(Object)");
castlesInner.insertWidget(-1, button);
castles.add(castle);
} |
8947d0a0-2527-420c-8ebc-5a3195fedf68 | 4 | @Override
public void writeClass(Class clazz)
{
YamlFile yamlFile = new BukkitYamlFile(clazz.getSimpleName());
yamlFile.set("class", clazz.getName());
for(Method m : clazz.getMethods())
{
try {
writeMethod(yamlFile, m);
} catch (IllegalAcc... |
dafbd6ca-d7c7-433b-8f33-d03dc7ac4baf | 9 | public void run() {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String connectionURL = "jdbc:sqlserver://FRENUM\\SQLEXPRESS;integratedSecurity=true;databaseName=weather;";
Connectio... |
c7b9384b-e470-4f9c-a1b9-ea8901e4b27d | 6 | private void showMessage(){
try {
String[] tokens = inputText.split("\002");
String newText;
if(whisper){
String receiver = (String)sendToCombo.getSelectedItem();
newText = "\n" + "( TO "+ receiver + " )"+client.username + " :";// + inputText;
... |
dcd17541-b3e7-4dff-9ab3-9e33c838f6cd | 2 | protected Checksum createChecksumObject() throws ClassNotFoundException,
InstantiationException, IllegalAccessException {
if (type == AlgoChecksumType.ADLER32) {
return new Adler32();
}
else if (type == AlgoChecksumType.CRC32) {
return new CRC32();
}
else {
throw new Ille... |
ad35b8e4-6533-4402-a7d7-ceea02a9152e | 9 | private void floodFillRecursive(int x, int y, char fromColor, char toColor) {
if (bitmap[y][x] == fromColor) {
bitmap[y][x] = toColor;
} else {
return;
}
// left
if (x - 1 >= 0 && bitmap[y][x - 1] == fromColor) {
floodFillRecursive(x - 1, y, fromColor, toColor);
}
// right
if (x + 1 < col &... |
c5b543aa-7ba1-4f10-97aa-37d6173c0caf | 2 | public static Long toLong(Object obj) {
if(obj==null)
return null;
String string=StringUtils.trimNonNumeric(obj.toString());
Long o=null;
try {
o=new Long(Long.parseLong(string));
} catch (NumberFormatException ex) {
}
return o;
} |
f3beddbc-7022-4c41-a81b-3918e6829d63 | 7 | private void setAtomNamesAndNumbers() {
// first, validate that all atomSerials are NaN
if (atomSerials == null) {
// now, we'll assign 1-based atom numbers within each model
int lastModelIndex = Integer.MAX_VALUE;
int modelAtomIndex = 0;
atomSerials = new int[atomCount];
for (int i = 0; i < atomCoun... |
643403fb-3fc2-4e09-b3a2-4d243aca7e45 | 3 | public static String getDevNull() {
if (new File(UNIX_NULL_DEV).exists()) { // <1>
return UNIX_NULL_DEV;
}
String sys = System.getProperty("os.name"); // <2>
if (sys==null) { // <3>
return FAKE_NULL_DEV;
}
if (sys.s... |
b9514e29-8539-4fe9-96bf-ec29bc590d47 | 3 | protected static Tracker getSingleTracker (String announce) {
try {
URI uri = new URI(announce);
if (uri.getScheme().equals("udp")) {
return new UdpTracker(uri);
} else {
// Create URL tracker
return new UrlTracker(uri.toURL())... |
7572365e-1b7c-4ed7-976f-f3a4b38c5e64 | 5 | private Match resultSetToMatch(ResultSet rs) throws SQLException {
Match match = new Match();
match.setId(rs.getLong("id"));
match.setHomeTeam(teamMngr.findTeamByID(rs.getLong("hometeamid")));
match.setAwayTeam(teamMngr.findTeamByID(rs.getLong("awayteamid")));
match.setDatePlayed... |
28cd04b5-0eb8-4069-af6a-f9e0da9df99e | 2 | private boolean isVarReplicate(int index) {
int count = 0;
for (int i: sites.keySet()) {
Site site = sites.get(i);
if (site.hasVariable(index)) {
count ++;
}
}
return (count>1);
} |
740823c9-047c-46ff-bdf4-7c20d846732f | 1 | public boolean isThereMoreGroups() {
if (allEnemyWaves.size() > currentGroupNr) {
return true;
}
return false;
} |
a4c5d3e8-543f-41d1-ba71-1b994d36036c | 2 | private static int getCharWidth(Font font, char ch, TIntIntHashMap map) {
int width = map.get(ch);
if (width == 0) {
width = Fonts.getFontMetrics(font).charWidth(ch);
if (width == 0) {
width = 1;
}
map.put(ch, width);
}
return width;
} |
debc1400-01f5-4522-9b7b-aa01cc37c9fd | 3 | public boolean isValidGuardian(Coordinate coord) {
if (getCell(coord).getElementType() == ElementType.GRASS
|| getCell(coord).getElementType() == ElementType.LEAF
|| getCell(coord).getElementType() == ElementType.INTRUDE)
return true;
else
return false;
} |
5002178d-a4a8-4d56-9f5b-86bb8164582e | 5 | public void start() {
try {
boolean success = false;
for (String bcIp : getBroadcastAddr()) {
success = broadcast(bcIp);
if (success) {
break;
}
}
if (!success) {
noServersRespon... |
96f22f33-38d4-4f9f-8533-5b553fd28f9a | 5 | public static void main(String[] args) {
Random rnd = new Random();
try {
List<Riff> riffz = new ArrayList<Riff>();
List<Rhythm> r = new ArrayList<Rhythm>();
SongWriter s = new SongWriter();
TrackHandle track1 = s.createNewTrack();
TrackHandle track2 = s.createNewTrack();
s.setInstrument(tra... |
d6e9b511-b1e9-4e71-b08f-5507daaf965d | 8 | @Override
public boolean next() throws IOException {
// if a current term exists, the actual enum is initialized:
// try change to next term, if no such term exists, fall-through
if (currentTerm != null) {
assert actualEnum != null;
if (actualEnum.next()) {
currentTerm = ... |
bdf97ef8-2451-4f0a-83f3-59b69dca6003 | 2 | public String toString() {
return name + (scanned?(colonized?" [colonized]":" [scanned]"):"");
} |
4f7ca9b7-b550-4bdd-8245-a6dbb73c333b | 6 | public void radixSort(int[] data) {
boolean flag = true;
int divisor = 1;
Queue<Integer>[] buckets = new Queue[10];
for (int i = 0; i < 10; i++)
buckets[i] = new LinkedList<Integer>();
while (flag) {
flag = false;
// first copy the values into buckets array
for (int i = 0; i < data.length; i++) {... |
80f0226e-4516-47db-a58f-927ec6467e4f | 2 | private ArrayList<GenericGtfsData> readGtfs(File path, boolean isStopTimes) throws IOException{
GtfsReader reader = new GtfsReader(isStopTimes);
reader.setInputLocation(path);
reader.setInternStrings(true);
ArrayList<String> entities = reader.getEntities();
ArrayList<GenericGtfsData> all_entities_data = new... |
3b61149e-53ca-4ba1-8500-b62b9e9f643c | 1 | public static void main(String[] args) throws Exception {
// lineProtocol = "localhost;localhost;A;APPL;50;20!" +'\n';
socket = new Socket("localhost", 9999);
toServer = new DataOutputStream( // Datastream FROM Server
socket.getOutputStream());
fromServer = new BufferedReader( // Datastream TO Server
... |
046262ae-533f-4f55-ac77-cad07aa88ec4 | 0 | public boolean getIncludeReadOnlyAllDocuments() {
return this.includeReadOnlyAllDocuments;
} |
81f93074-f712-44b3-9f23-397d5f4e8808 | 3 | public String PerbaikiSpasi(double doubleAngka){
String strAngka = KonversiKwitansi(doubleAngka);
String angkaBaru = "";
int JmlSpasi =0;
for (int i=1;i<strAngka.length();i++){
if (strAngka.charAt(i)==' ' && strAngka.charAt(i-1)==' ') {
angkaBaru = angkaBaru.s... |
94631c35-7d58-49b3-aea8-cc86a0b80991 | 3 | public boolean canCreate(Player p) {
if (isAdminPlayer(p)) {
parent.log.debug(p.getName() + " is an admin, can create");
return true;
}
if (checkNijikokunPermissions(p, "controllerblock.create")) {
parent.log.debug("Nijikokun Permissions said " + p.getName() + " can create");
return true;
}
... |
8eef6176-471f-4def-aa2c-4539338c0740 | 6 | public void doPrint(char[] sb, int left, int right, int count) {
//System.out.println("l="+left+",r="+right+":");
//System.out.println(sb);
if (left < 0 || right < left)
return;
if (left == 0 && right == 0) {
System.out.println(sb);
} else {
if (left > 0) {
sb[count] = '(';
doPrint(sb, lef... |
a68b98d9-14db-4ca9-ad3b-39e58c909990 | 3 | @Override
public double getXRotation()
{
double lowest = 9001;
double highest = 0;
int y = 0;
for (Block block : blockArray)
{
if (block.getXValue() > highest)
highest = block.getXValue();
if (block.getXValue() < lowest)
lowest = block.getXValue();
}
return ((highest + lowest) / 2) + y;
... |
532ce7c8-e1c3-47f1-b363-c7ac763ef199 | 5 | private void printCurrentRoom() {
Room curRoom = rooms.get(currentRoom);
System.out.println(curRoom.getShortDescription());
for(NPC npc : npcs.values()){
if(npc.getCurrentRoom() != null && npc.getCurrentRoom().equals(currentRoom)){
System.out.println();
... |
1202985e-7c7e-410e-b34c-d1d6ff001f86 | 8 | Rectangle2D getBoundsRecurse(int level, AffineTransform t)
{
Rectangle2D rUnion = null;
boolean allTooSmall = true;
{
Iterator i = fractalShape.elementShapes.iterator();
if (i.hasNext())
{
rUnion = ((ElementShape) i.next()).getBounds(t);
if (!rectTooSmall(rUnion, smallestScale))
allTooSmall... |
ad293c61-b561-4ffe-a56a-6a91a3e7d4b4 | 5 | public static void merge(Comparable[] arrayChar, int lo, int mid, int hi) {
int i = lo;
int j = mid + 1;
for (int k = lo; k <= hi; k++) {
aux[k] = arrayChar[k];
}
for (int k = lo; k <= hi; k++) {
if (i > mid) {
arrayChar[k] = aux[j++];
} else if (j > hi) {
arrayChar[k] = aux[i++];
} else ... |
0bdfaf1e-32be-47d0-8556-d17f38d560cf | 5 | public void voltar() {
if((combustivel>0)&&(posicao>0)){
posicao--;
combustivel--;
if(posicao==0){
System.out.println("Tanque cheio!");
combustivel=MAX_TANQUE;
}
if((posicao!=0)&&(combustivel==0)){
System.out.println("\nPERDEU!");
combustivel=0;
System.exit(0);
}
}
} |
79499a34-219e-421a-8b1a-94cca8c0b818 | 3 | public static void main(String[] args) {
try {
ArithmeticTree tree = new ArithmeticTree("(+(*23)(-(+89)3))");
CountTree answer = new CountTree(tree);
} catch (WrongStructure exception1) {
System.out.println(exception1.getMessage());
} catch (IncorrectSymbol e... |
a7a458df-b4d8-4967-96f1-e0ec66149f1a | 1 | private static ArrayList<int[]> decodeRLE(ObjectInputStream os)
throws IOException, ClassNotFoundException {
int width = os.readInt();
int height = os.readInt();
int numRuns = os.readInt();
ArrayList<int[]> runs = new ArrayList<int[]>(numRuns);
for (int i = 0; i < numRuns; i++) {
runs.add((int[]) os.rea... |
08f5330d-c632-4078-8016-110db8682bed | 9 | private static int[] getSequence(boolean[][] polyomino){
boolean[][] p = new boolean[polyomino[0].length+2][polyomino.length+2];
int[] seq = new int[4];
for (int x=0; x<polyomino.length; x++){
System.arraycopy(polyomino[x], 0, p[x+1], 1, polyomino.length);
}
for (int ... |
77ced24f-7933-46a5-a3f6-7a18aedda440 | 8 | public void printAllRelTypes(){
if(!rs.conn("mcd")){System.out.print("wrong connection");return;}
if(!rs1.conn("mcd")){System.out.print("wrong connection");return;}
if(!rs2.conn("mcd")){System.out.print("wrong connection");return;}
/*rs.setRs("*", "EntityTypeListTable");
while(rs.next())System.out.p... |
83d5156c-2219-4af0-89ae-9db666c49d06 | 1 | public void setPlayerFlag(PlayerFlag playerFlag) {
if(this.playerFlag !=null )
throw new IllegalStateException("There is already a playerflag set to this player!");
this.playerFlag = playerFlag;
} |
bd3c950f-b11e-448c-8cc4-ec5abb4908d3 | 9 | @Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
String texto = getText(0, getLength());
for (int i = 0; i < str.length(); i++) {
char c = str.charAt(i);
if (!Character.isDigit(c)) {
return;
}
... |
1b451760-44b3-4d1b-8a14-9c99d65cf65a | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Event other = (Event) obj;
if (this.id == null) {
if (other.id != null)
return false;
} else if (!this.id.equals(other.id))
return fa... |
bcc18111-0a18-468c-94c1-cbab278276bd | 5 | @Override
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (args.length < 1) {
sender.sendMessage("§7-> Required argument §cmissing§7: §f§o<Cache>");
return false;
}
String search = args[0].toLo... |
3cfe613e-db2f-46e6-814c-ee570bee1750 | 0 | public void setYearsExperience(int yearsExperience) {
YearsExperience = yearsExperience;
} |
fb6ea588-38f4-46f0-91b3-1bc3512d8d32 | 8 | public static void main(String[] args) throws Exception
{
File topDir = new File(ConfigReader.getVanderbiltDir() + File.separator +
"krakenOut");
for( int x=0; x < KRAKEN_LEVELS.length; x++)
{
HashMap<String, HashMap<String, Integer>> map =
new HashMap<String, HashMap<String,Integer>>();
... |
5df35b21-3b35-4d24-aeae-11ab6240eb76 | 1 | public void actualizaFase(int iGolpes){
if(!this.estaDestruido()){
this.setImagen((Image) arrFases.get(iGolpes));
}
} |
9c841d50-8cb6-4b58-9837-651c38ba0ff0 | 4 | private void preferenceToHtml(StringBuffer buf) {
// array of results below buttons
buf.append("<div>");
buf.append("<div style=\"width: 400px; height: 40px; text-align: center;font-size: 25px; font-weight: bold; font-family: 'Comic Sans MS', cursive, sans-serif\">" + "Player preference" + "</div>\n"... |
2cf6f9e1-6729-4a5b-a6c4-556c02f08a19 | 7 | @Override
public void update(Observable obs, Object ob) {
if (obs instanceof ElectionsServer) {
try {
ElectionsServerThread elec = (ElectionsServerThread) ob;
elec.addObserver(this);
} catch (ClassCastException e) {
System.err.println(... |
0f302f0e-9f9c-4ca4-9e66-99460c4817ef | 9 | private HashSet<NVertex<D>> test( NGraph<D> g, int k ) {
HashSet<NVertex<D>> potentialVertices = new HashSet<NVertex<D>>();
for( NVertex<D> v : g ) {
if( v.getNumberOfNeighbors() >= k-1 ) {
potentialVertices.add( v );
//System.out.println( "Potentially " + v.data.name );
}
}
boolean chang... |
a9689efe-b222-4bd7-8d37-52e1a6a21ec7 | 4 | public static void main(String[] args) {
// Read the number of games.
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
int numOfGames = 1;
int tries = 0;
while(true) {
try {
System.out.println("Please enter a number of rounds to play for this g... |
3915e8a2-7a3d-4548-b2c3-8aeb3af05e85 | 7 | public void setValueAt(Object value, int rowIndex, int columnIndex)
{
Reference.isSaved = false;
DebtAccount account = debtAccounts.get(rowIndex);
switch (columnIndex) {
case 0:
{
account.accountName = (String... |
4e2b2200-afc6-48b2-a1b2-a429c5ddd7db | 6 | @Override
public void deserialize(Buffer buf) {
collectorName = buf.readString();
worldX = buf.readShort();
if (worldX < -255 || worldX > 255)
throw new RuntimeException("Forbidden value on worldX = " + worldX + ", it doesn't respect the following condition : worldX < -255 || wor... |
9d6014fa-fe5b-4582-985c-857b8e8ec5a0 | 0 | @Override
public void removeAllFilters() {
filters = new ArrayList();
} |
4463dd35-0281-4b4e-bb39-7397ff4e481a | 6 | @Ignore
@Test
public void statementOfMaxFiguresOnBoard32Knights() {
Map<String, Integer> figureQuantityMap = new HashMap<>();
figureQuantityMap.put(KNIGHT.toString(), 32);
int dimension = 8;
Chessboard chessboard = Chessboard.newBuilder(figureQuantityMap).withDimension(dimension... |
63b7b762-7c0d-42c3-af87-ac74865d3f81 | 5 | private int minChildPos( int pos ) {
int retVal;
int lc = 2*pos + 1; //index of left child
int rc = 2*pos + 2; //index of right child
//pos is not in the heap or pos is a leaf position
if ( pos < 0 || pos >= _heap.size() || lc >= _heap.size() )
retVal = -1;
//if no right child, then left child is only optio... |
77180513-184a-426f-9805-620124e27d58 | 7 | public static void htmlDescribeSiblings(String title, String head, NamedDescription relation, org.powerloom.PrintableStringWriter stream, boolean ruleP) {
{ Cons parentsofsibs = Stella.NIL;
{ LogicObject p = null;
edu.isi.powerloom.PlIterator iter000 = edu.isi.powerloom.PLI.getDirectSuperrelations(re... |
62a7aeba-95ea-4194-9cfe-4a81a9decb1d | 3 | @SuppressWarnings("static-access")
public void loadConfigForOptions(String fileName, String ext)
{
try{
InputStream read = new FileInputStream("./res/config/"+fileName+ext);
if(ext == ".xml")
{
properties.loadFromXML(read);
} else if(ext == ".... |
5d98eb0d-b682-4cb5-8e43-98f0cb130850 | 8 | @RequestMapping(value = "/", method = RequestMethod.POST)
public String checkShot(@PathVariable int idGame, ShotForm shotForm, ModelMap model) {
model.put("idGame", idGame);
int letter = Integer.parseInt(shotForm.getLetter());
int figure = Integer.parseInt(shotForm.getFigure());
int ... |
f7f0c3b9-676e-4ba0-9247-1994a9177974 | 9 | @Override
public double[] calculateJulia3DWithPeriodicity(Complex pixel) {
iterations = 0;
check = 3;
check_counter = 0;
update = 10;
update_counter = 0;
period = new Complex();
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.