method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d165fdb3-3bd0-4ea8-8c56-0c6acef0ecaa | 9 | public void doDownload(HttpRequest request, long contentLength, OutputStream clientOut)
{
cout = clientOut;
SpeedThread speedThread = new SpeedThread(this);
buffer = new CircularDownloadBuffer(bufferSize);
// Also write the request out to a file
BufferedOutputStream fileOut ... |
0486be23-81c4-4c6a-b66d-a03e94b92856 | 7 | public synchronized void makeimages ()
// create images and repaint, if ActiveImage is invalid.
// uses parameters from the BoardInterface for coordinate layout.
{
Dim = getSize();
boolean c = GF.getParameter("coordinates", true);
boolean ulc = GF.getParameter("upperleftcoordinates", true);
boolean lrc = GF.... |
73c6d5fc-dc5f-483c-8dac-ac4c04a8aed5 | 2 | public ResultSet GrabRow()
{
try
{
ResultSet Result = Statement.executeQuery(ClassQuery);
while(Result.next())
{
return Result;
}
}
catch(SQLException E)
{
Grizzly.WriteOut(E.getMessage());
return null;
}
return null;
} |
959aedda-577e-4ab8-afa2-3da794d09d25 | 8 | public static void shoot() {
// pellet created
if (gunRoll == 1){
if(Data.ammo > 0){
Data.p_list.add(new Pellet(x_gunpos + Data.x_adjust_gun, y_gunpos, 0, VELOCITY_Y));
Data.ammo -= 1;
}
} else if (gunRoll == 2){
if(Data.ammo > 0){
shootDouble();
Data.ammo -= 2;
}
}
if (gunR... |
3fd87912-8e2e-4898-9e6f-1371e0258216 | 9 | public void YCC_to_RGB(int count)
{
if((ncolors != 3)||parent.isRampNeeded())
{
throw new IllegalStateException("YCC_to_RGB only legal with three colors");
}
while(count-- > 0)
{
final int y = parent.data[offset];
final int b = parent.data[offset +... |
bb5c17dc-9834-4a73-ac6a-66823d4d5ae1 | 6 | private Genetics[] makeNewGenetics(Genetics oldGen) {
System.out.println("makeNewGenetics() is running");
Genetics gen1 = new Genetics(oldGen);
Genetics gen2 = new Genetics(oldGen);
Random r = new Random();
// OBS inte s�ker p� att detta blir helt r�tt.
// f�rst har vi ett tal mella... |
482cf677-0ef5-4d70-a448-85a32a12387d | 1 | public static void insertCommercial(int idservice, String nom, String prenom, String adresse1, String adresse2 ) throws SQLException {
String query;
try {
query = "INSERT INTO COMMERCIAL (ID_VILLE,COMMNOM,COMMPRENOM,COMMADRESSE1,COMMADRESSE2) VALUES (?,?,?,?,?) ";
PreparedSt... |
856f0ca6-2d2c-442c-b610-3ce807c4a8aa | 0 | public final void show() {
StackPane parentRoot = (StackPane) ((Stage) stage.getOwner())
.getScene().getRoot();
parentRoot.getChildren().add(mask);
stage.show();
} |
20d8457c-400d-438e-9f9e-3b631fb41597 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
StatefulContext other = (StatefulContext) obj;
if (id != other.id)
return false;
return true;
} |
6fdf5c76-c5ec-43ab-8f2f-704c1d6bd0c2 | 6 | public void runGame()
{
WorldGUI view = new WorldGUI(world);
for(int rounds=0; rounds<1000; rounds++){
for(int i = 0; i<127; i++){//127 ants per team in the game?
step(i, Colour.RED);
step(i, Colour.BLACK);
}
//refresh/update representation here
if(rounds%15 == 0){
view.update(cellsToUpdat... |
f0e4a6f9-32df-4c58-a72f-5ac2db872534 | 2 | public void writeBoolean(boolean v)
throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeBoolean = " + v);
}
if (v) {
writeSymbol(CycObjectFactory.t);
}
else {
writeSymbol(CycObjectFactory.nil);
}
} |
a472c3c5-dff3-4b06-ac28-016961b69346 | 1 | private static String hashPieces(File source)
throws NoSuchAlgorithmException, IOException {
MessageDigest md = MessageDigest.getInstance("SHA-1");
FileInputStream fis = new FileInputStream(source);
StringBuffer pieces = new StringBuffer();
byte[] data = new byte[Torrent.PIECE_LENGTH];
int read;
while ((... |
1ed8d3ce-33ca-4464-88e0-55db5b2bc0b1 | 9 | protected void setUDPOptionsEnabled(boolean enabled)
{
lb_udpBufferSize.setEnabled(enabled);
udpBufferSize.setEnabled(enabled && lb_udpBufferSize.isSelected());
udpBufferSizeUnit.setEnabled(enabled && lb_udpBufferSize.isSelected());
lb_udpPacketSize.setEnabled(enabled);
udpPacketSize.setEnabled(enabled && l... |
08821cc8-503f-4311-8160-ac3537b70f98 | 8 | protected int countNeighbours(int col, int row) {
int total = 0;
total = getCell(col-1, row-1) ? total + 1 : total;
total = getCell( col , row-1) ? total + 1 : total;
total = getCell(col+1, row-1) ? total + 1 : total;
total = getCell(col-1, row ) ? total + 1 : total;
total = getCell(col+1, row ) ? total +... |
d87f138d-1666-4bea-88e7-d5d4fca96c55 | 3 | void setExampleWidgetAlignment () {
int alignment = 0;
if (leftButton.getSelection ()) alignment = SWT.LEFT;
if (centerButton.getSelection ()) alignment = SWT.CENTER;
if (rightButton.getSelection ()) alignment = SWT.RIGHT;
label1.setAlignment (alignment);
label2.setAlignment (alignment);
label3.setAlignme... |
6957b446-4750-47e8-aac0-e27d7a509cba | 3 | public static void initialize(ParseMode mode) {
System.out.println("started");
props = new Properties();
if (mode == ParseMode.POS) {
props.put("annotators", "tokenize, ssplit, pos");
} else if (mode == ParseMode.WORD_TOKENIZE) {
props.put("annotators", "tokenize, ssplit");
} else if (mode == ParseMo... |
3fbae227-b7aa-4c61-9a76-35d552a36a34 | 7 | @Override
public boolean execute(SimpleTowns plugin, CommandSender sender, String commandLabel, String[] args) {
final Localisation localisation = plugin.getLocalisation();
if (!(sender instanceof Player)) {
sender.sendMessage(localisation.get(LocalisationEntry.ERR_PLAYER_ONLY_COMMAND))... |
a5d11809-05fe-4e2b-ae83-4e9b41c4c8a3 | 9 | private void scavenge()
{
Thread thread = Thread.currentThread();
ClassLoader old_loader = thread.getContextClassLoader();
try
{
if (_handler==null)
return;
ClassLoader loader = _handler.getClassLoader();
if (loader!=nu... |
8efa3535-a025-4e57-a05c-9002c1785884 | 3 | @Override
public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException {
super.update(gc, game, delta);
player.update(gc, game, delta);
map.update(gc, game, delta);
if(gc.getInput().isKeyPressed(Input.KEY_D)) {
if(((Game) game).isDebug()) ((Game) g... |
8a39ca92-294c-44e7-988b-cf07a37585bd | 3 | public void fillUnobstructedArea(Graphics g, int pixelsize)
{
g.setColor(Color.green);
for (int i = 0; i < gui.getWidth(); i += pixelsize)
for (int j = 0; j < gui.getHeight(); j += pixelsize)
if (!AngleElimination.isObstructed(new Vertex(i+pixelsize/2, j+pixelsize/2)))
... |
77c70372-3d03-466a-b383-bec412f9210f | 5 | @Override
public boolean show() {
if (!getTab().open())
return false;
final WidgetChild list = Widgets.get(EMOTE_WIDGET, EMOTE_LIST);
if (list == null || !list.visible())
return false;
final WidgetChild emote = list.getChild(childId);
return Widgets.scroll(emote, Widgets.get(EMOTE_WIDGET, EMOTE_SCROLLB... |
454dae67-2ae5-4ae5-a1fb-7c7d2ead263a | 1 | private void handleAdjustShooterAngle(PlayerAdjustShooterAnglePacket packet) {
ClientPlayer player = getPlayer(packet.name);
if (player != null) {
player.setShooterAngle(packet.angle);
}
} |
f86d744d-d5bf-4fa5-b7e5-e49b47661ae2 | 2 | public void mouseReleased(MouseEvent e) {
if (!b.isEnabled()) return;
if (b instanceof javax.swing.JButton) {
b.setBorder(inactive);
b.setBorderPainted(false);
}
} |
17f29360-a58d-4a8e-b811-3e788816f847 | 4 | public void updateSprite(int currentState) {
switch (currentState) {
case 0: currentSprite.set(new Sprite(Art.player[2][0])); currentSprite.flip(true, false); break;
case 1: currentSprite.set(new Sprite(Art.player[2][0])); break;
case 2: currentSprite.set(new Sprite(Art.player[1][0])); break;
case 3: currentS... |
b43c18f2-d55b-4001-a0a0-e26123291cc7 | 0 | public boolean isSelected(){
return selected;
} |
a0b281a6-ad40-49fe-91f7-76119f01669d | 4 | public void fecharConexao(){
try
{
if(c != null)
c.close();
if(stmt != null)
stmt.close();
if(rs != null)
rs.close();
}
catch (SQLException ex)
{
Logger.getLogger(TrackingNumberWatcher... |
1d0be4de-1593-43bd-940e-5bf27c759248 | 1 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
} |
0a5ac347-4f09-4e25-ad71-dac3a46ae656 | 7 | void notifyListeners(Object created, Page modified, Object deleted) {
Page root = null;
if (created != null) root = findRoot(created);
else if (modified != null) root = findRoot(modified);
else if (deleted != null) root = findRoot(deleted);
else throw new RuntimeException("Root w... |
e6b21c95-2121-4533-83b1-a5edb0e98a9c | 6 | @EventHandler
public void PlayerPoison(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.getPlayerConfig().getDouble("Player.Poison.D... |
ad7c3856-924a-4e79-ba19-f938bb112e54 | 5 | public void neglectDeath(Player p, Entity animal ){
if(this.willDie && this.getAge() < 120){
p.getWorld().createExplosion(animal.getLocation().getX(), animal.getLocation().getY(), animal.getLocation().getZ(), (float)0, false, false);
animal.remove();
animalUtility au = new animalUtility(plugin);
this.anim... |
e9757048-db4d-4bee-8903-1d3cda5c1efb | 3 | public Object getFieldValue(_Fields field) {
switch (field) {
case ID:
return Long.valueOf(getId());
case NAME:
return getName();
case PRICE:
return Integer.valueOf(getPrice());
}
throw new IllegalStateException();
} |
d4c34184-9055-4bfa-8a66-30b6c2de47d5 | 5 | public int getDistance(String after) {
if (ignoreSize)
after = StringSizeConverter.getFullString(after);
int[][] cost = new int[before.length() + 1][after.length() + 1];
for (int i = 0; i < cost.length; i++)
cost[i][0] = i;
for (int i = 0; i < cost[0].length; i++)
cost[0][i] = i;
int eq;
for (int ... |
872277fc-6b65-44bf-a301-eb2aa04442f8 | 3 | protected void fireTreeNodesInserted(Object source, TreePath path,
int[] childIndices, Object[] children) {
// Guaranteed to return a non-null array
Object[] listeners = this.listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested... |
e9b3fdad-fb80-49ae-9071-67139844ac33 | 2 | public static void main(String args[])
throws java.io.IOException {
char ch;
char answer = 'K';
System.out.println("I'm thinking of a letter between A and Z.");
System.out.print("Can you guess it?: ");
ch = (char) System.in.read(); //read ch... |
ebb9417d-00f4-4f3e-88b7-fd5423e19cb8 | 3 | private Inventory solveExhaustivelyRecursively(int indexOfNextItem, int remainingCapacity, ArrayList<Double> result, int value) {
if (indexOfNextItem >= items.size()) {
return new Inventory(this, result, value);
}
Item nextItem = items.get(indexOfNextItem);
result.add(0.0);... |
42ad5ced-c77e-4a0f-b51d-0acda45e3d46 | 1 | public void deleteUser(User user) {
try {
beginTransaction();
session.delete(user);
session.getTransaction().commit();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
} |
b51c9813-88f3-4f27-92f6-1f4f92e6af83 | 3 | public static void main(String[] args) {
System.out.println("Starting.");
System.out.flush();
final Semaphore sem = new Semaphore(0);
for (int i = 0; i < 10; i++) {
System.out.println("Queing proc " + i);
System.out.flush();
final int threadNum = i;
getDefaultPool().execute(new R... |
15c0948a-8fd4-4971-93a6-c8c036cf3293 | 0 | public Cuenta getDestino(){
return this.destino;
} |
083a2a95-1108-4c08-ba6d-fb5a76fac6c3 | 6 | public List validate() {
String error;
if(!isNameValidate()) {
error = "Name is not valid.";
validateErrors.add(error);
}
if(!isSurnameValidate()) {
error = "Surname is not valid.";
validateErrors.add(error);
}
if(!isBirt... |
6a14f273-c3f5-434a-bd5f-ace24228e7cd | 0 | private String readStringUTF8(byte[] remainingData, int stringIdx) throws IOException {
// skip the length, will usually be 0x1A1A
// int strLen = readUInt16(remainingData, stringIdx);
// the length here is somehow weird
int strLen = readUInt8(remainingData, stringIdx + 1);
stringIdx += 2;
String str = new ... |
745eb8ce-9287-400b-97ac-13f0133fa739 | 1 | @Test
public void testTimeStep_DAILY2_period() throws Exception {
printDebug("----------------------------");
printDebug("DAILY with Period Range: " + this.toString());
printDebug("----------------------------");
CSTable t = DataIO.table(r, "obs");
Assert.assertNotNull(t);
... |
a92ac0ef-be94-4ca0-8362-e0b04436e1f6 | 9 | @Override
public void layoutContainer(final Container target) {
final Dimension d = target.getSize();
final Insets insets = target.getInsets();
// preferred layout size for Image5dCanvas
final Dimension prefCanvasSize = new Dimension(d);
contentBounds.x = insets.left;
contentBounds.y = insets.top;
//... |
8daceeaa-c278-4c9a-9cc7-bcf42bc41a38 | 9 | public void lancer() {
System.out.println("lancement du serveur ...");
String[] serveursIP = { "http://checkip.amazonaws.com/", "http://icanhazip.com/", "http://curlmyip.com/",
"http://www.trackip.net/ip" };
for (String servIP : serveursIP) {
try {
URL whatismyip = new URL(servIP);
BufferedReade... |
e53b649f-5bc6-4f43-b396-12e1b2085a7a | 3 | @Override
public void update(Stage stage) {
updateFleeRange();
ArrayList<Actor> actors = new ArrayList<Actor>();
actors = PropQuad.get().getActors(fleeRange);
if(!actors.isEmpty()) {
if(actors.size() > 1) {
Actor target = getClosestTarget(actors);
if(target != null) {
source.getAI().setTarge... |
e2b9ef33-b999-4148-bffd-0f30b20bbe46 | 6 | public static int[] generateRandomIntArray(int size, boolean allowsDuplicate, int min, int max)throws ArrayIndexOutOfBoundsException {
if(countNumbersInRange(min, max) < size) {
throw new ArrayIndexOutOfBoundsException();
}
int randArr[] = new int[size];
int randNum = MathUtils.generateRandomNumb(min, max);
... |
ee19d9a1-b610-4e5c-b0ee-1aa520f0b149 | 3 | public void encrypt(InputStream in, OutputStream out)
throws IOException
{
byte inbuf[] = new byte[8];
byte outbuf[] = new byte[8];
boolean done = false;
while (!done) {
int n = readn(in, inbuf, 8);
if (n < 8) {
done = true;
int m = n;
while (n < 7)
inbuf[n++] = 0;
inbuf[n++] = (byte) (... |
09ea8502-2c7b-4252-9007-370723dbf40b | 6 | public static void quicksort(Comparable[] a, int lo, int hi) {
if (lo < hi) {
int pivotIndex = lo;
Comparable pivot = a[pivotIndex];
a[pivotIndex] = a[hi];
a[hi] = pivot;
int i = lo - 1;
int j = hi;
do {
do {
i++;
}
while (a[i].compareTo(pivot) < 0);
do {
j--;
... |
6810d070-b95b-42ae-ab04-37061b8dfe2d | 0 | @Override
public void startSetup(Attributes atts) {
String id = atts.getValue(A_ID);
setCommand(id);
Outliner.prefs.addPreference(id, this);
} |
f8b0cbca-79ac-424e-8ba0-97f9d929a092 | 3 | public void enqueue(E e)
{
if (e == null) return;
Node u = new Node(e);
if (tail != null) tail.setNext(u);
tail = u;
if (isEmpty())
head = tail;
size++;
} |
e17deec6-90ee-44f6-a777-49087913e310 | 5 | private void replacedata( boolean repl )
{
if(isReadOnly()) return;
try { fdbf.seek( recordpos() ); } catch (IOException e) {}
writeChars(0,1,(repl && deleted ? "*" : " "));
for(int i=0;i<fcount;i++) replacefielddata(i);
update_key();
getfieldsValues();
} |
0c183dbf-a553-4c58-a7d6-11730c4259fb | 2 | public boolean containsAttribute(String locationpath){
if (locationpath.contains("@") || locationpath.contains("attribute::")){
return true;
}else{
return false;
}
} |
ddba8b3e-3d06-49ed-b8cf-dee72eeb41ad | 3 | public ArrayList<String> readFile(String arg) {
String thisLine;
ArrayList<String> fileToRead = new ArrayList<String>();
try {
//BufferedReader to scan in the file
BufferedReader buffy = new BufferedReader(new FileReader(arg));
while((thisLine = buffy.readLine()) != null && !thisLine.substring(0... |
5c932097-7c26-4507-bf2e-b7776de099b3 | 8 | protected static Ptg calcINTRATE( Ptg[] operands )
{
if( operands.length < 4 )
{
return new PtgErr( PtgErr.ERROR_NULL );
}
debugOperands( operands, "calcINTRATE" );
try
{
GregorianCalendar sDate = (GregorianCalendar) DateConverter.getCalendarFromNumber( operands[0].getValue() );
GregorianCalendar... |
8fe65dff-d618-4d97-94eb-4448f450c8f3 | 0 | public int getProcessMode() {
return processMode;
} |
4dca070b-fc3c-4852-bce3-8093183da8b6 | 2 | @Override
public String toString() {
String name = getName();
String append = "";
if(name != null && !name.equals("")) {
append = "(\"" + this.getName() + "\")";
}
return "TAG_Float" + append + ": " + value;
} |
a6a05eda-b8bd-44e8-8cd1-87edd1cb0320 | 0 | public void popEntriesSymbolTable(int numberToRemove) {
symbolTable.popEntries(numberToRemove);
} |
d055f332-a801-4ff5-945f-d1b20d9e290a | 6 | @Override
public void actionPerformed(ActionEvent e) {
JTextField rowField = new JTextField("", 5);
JTextField colField = new JTextField("", 5);
JPanel myPanel = new JPanel();
myPanel.add(new JLabel("Rows:"));
myPanel.add(rowField);
myPanel.add(Box.createHorizontalStrut(15)); // a spacer
myPanel.add(new... |
b4607278-256b-4c9d-95e8-c6411ad97da1 | 2 | private void swim(int k) {
while (k > 1 && greater(k / 2, k)) {
exch(k, k / 2);
k = k / 2;
}
} |
097a7c26-d701-47b2-95c3-11c903afd392 | 0 | public float getY() {
return y;
} |
1438ebe8-790a-450b-9949-9f13cf8d4b60 | 8 | public Model getRotatedModel()
{
if(desc == null)
return null;
Model model = method450();
if(model == null)
return null;
super.height = model.modelHeight;
if(super.anInt1520 != -1 && super.anInt1521 != -1)
{
SpotAnim spotAnim = SpotAnim.cache[super.anInt1520];
Model model_1 = spotAnim.getModel(... |
d3218c82-254f-416b-bb43-e7406042d164 | 9 | boolean isMatch(String str, int i, String pat, int j, Map<Character, String> map, Set<String> set) {
// base case
if (i == str.length() && j == pat.length()) return true;
if (i == str.length() || j == pat.length()) return false;
// get current pattern character
char c = pat.char... |
c8d33750-536f-40d3-8b74-3565fc21e0a6 | 1 | public int getCount(ArrayList<FilterBean> hmFilter) throws Exception {
int pages;
try {
oMysql.conexion(enumTipoConexion);
pages = oMysql.getCount("empresa", hmFilter);
oMysql.desconexion();
return pages;
} catch (Exception e) {
throw n... |
14a668c5-2aa7-41c8-826b-3730b3e63b04 | 2 | public void keyPressed(KeyBindingEvent keyBindingEvent) {
//Only toggle state when not on the gamescreen
if (!keyBindingEvent.getScreenType().equals(ScreenType.GAME_SCREEN)) {
return;
}
SpoutPlayer sPlayer = keyBindingEvent.getPlayer();
if(sPlayer.hasPermission("playerplus.use")) {
new Texture... |
e37673b2-463a-4259-bb17-0042a0d899f1 | 0 | public DocumentAttributesPanel getDocumentAttributesPanel() {
return this.attPanel;
} |
b77f9fdb-47af-4fab-bc64-004d4e3944b5 | 6 | @EventHandler
public void PlayerNausea(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.getPlayerConfig().getDouble("Player.Nausea.D... |
36457a9e-b5a5-4742-97c0-b11b95442361 | 8 | private void startSimulation() throws InterruptedException {
start = System.currentTimeMillis();
SimpleDirectedWeightedGraph<Node, DefaultWeightedEdge> swg = createMapGraph();
Queue<Node> pathForVehicle = getPathForVehicle(vehicle, swg, null);
if(pathForVehicle.isEmpty()) {
removeTemporaryStreets();
... |
2fae998b-14cd-42fc-801e-aaad9b73117a | 8 | private void extractFile(String name) {
File actual = new File(getDataFolder(), name);
if (!actual.exists()) {
InputStream input = getClass().getResourceAsStream("/Default_Files/" + name);
if (input != null) {
FileOutputStream output = null;
try
{
output = new FileOutputStream(ac... |
dfff83a6-0994-4d86-8808-ce53cfa2d48d | 3 | public static int[][] TerrainLoad() {
int[][] map= new int[320][240];
String filePath = "src/map.lvl";
Scanner scanner = null;
try {
scanner = new Scanner(new File(filePath));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int i=0;
int j=0;
while... |
af396739-a5d0-44d3-8bb3-9017fe2d2f23 | 9 | private boolean verificaQteAulaHorario(String anoletivo, Date datageracao) {
Boolean resp = false;
int ocorrmath = 0;
int idmat = 0;
List<Integer> idmatprof = new ArrayList<>();
for (int i = 0; i < erroperiodo.size(); i++) {
try {
List<HorarioAulaBeans... |
c35ec43a-f464-405b-a526-8acaf06961fb | 5 | private void callSetter(HashMap<String, String> headerToFieldMap, T instance, Method method,
CSVMapperSetterMethod annotation, Class<?> parameterType) {
Class<?> wrapperType;
if (parameterType.isPrimitive()) {
wrapperType = wrapperMap.get(parameterType);
... |
4230c775-9923-4cdb-81f9-1cbf4d0ebd6e | 1 | public Record findById(java.lang.Integer id) {
log.debug("getting Record instance with id: " + id);
try {
Record instance = (Record) getSession().get(
"com.oj.hibernate.daoNdo.Record", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
} |
1f8b37fb-2427-42d4-8dde-a95797a56e5c | 3 | public static void saveImage(BufferedImage img, File output) throws IOException {
output.delete();
final String formatName = "png";
for (Iterator<ImageWriter> iw = ImageIO.getImageWritersByFormatName(formatName); iw.hasNext();) {
ImageWriter writer = iw.next();
ImageWriteParam writeParam = writer.... |
2b399a89-7b3e-43b8-82c8-18d1277a1f6f | 8 | private static void createAndShowGUI() {
//Check the SystemTray support
if (!SystemTray.isSupported()) {
System.out.println("SystemTray is not supported");
return;
}
final PopupMenu popup = new PopupMenu();
final TrayIcon trayIcon =
new Tra... |
61a1d0cf-86fd-4817-8596-67f8d567c83b | 6 | public void generateNotes() throws InvalidChordException {
// If this is the first chord of the song, treat it differently.
if (prevBeat == null) {
generateFirstChord();
return;
}
// Until all the rules are followed, continue generating combinations.
int tries = 0;
boolean notesFollowAllRules = fal... |
8979cc98-b5b4-419b-9194-1b5b74de3bc6 | 7 | protected boolean checkCoverage() {
int i;
int n;
int[] count;
Range r;
String attrIndex;
SubspaceClusterDefinition cl;
// check whether all the attributes are covered
count = new int[getNumAttributes()];
for (i = 0; i < getNumAttributes(); i++)... |
332043b8-a76c-4f0f-8336-c1be3deb3b9c | 0 | @BeforeClass
public static void setUpClass() {
} |
2dd529e5-f263-476e-8ba1-23d2b819c7e7 | 3 | private void fixColUp() {
turnLeft();
while (frontIsClear()) {
if (noBeepersPresent()) {
putBeeper();
}
move();
}
if (noBeepersPresent()) {
putBeeper();
}
turnRight();
} |
8322df99-c78f-41de-b2d2-ff941c1e5cc5 | 3 | public static String classPackageAsResourcePath(Class<?> clazz) {
if (clazz == null) {
return "";
}
String className = clazz.getName();
int packageEndIndex = className.lastIndexOf('.');
if (packageEndIndex == -1) {
return "";
}
String packageName = className.substring(0, packageEndIndex);
return p... |
a3fc9f1e-1de7-4f88-861f-16200b607edb | 9 | public static void main(String[] args) {
if (args.length < 1 || args.length >1){
System.out.println("Error: incorrect arguments");
}
else {
//Object to hold word information for given web pages.
WebPages webPage = new WebPages();
//Commands from in... |
dbf23b7e-44cb-4a19-9a5b-31e6f46655fe | 8 | @Override
public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp)
{
final java.util.Map<String,String> parms=parseParms(parm);
final String last=httpReq.getUrlParameter("FACTION");
if(parms.containsKey("RESET"))
{
if(last!=null)
httpReq.removeUrlParameter("FACTION");
return "... |
a3d0ff65-7fa3-4224-bec9-4e28052e947e | 6 | @Override
public void run() {
while(true) {
while(queueOfMessages.peekFirst() != null) {
String s = queueOfMessages.removeFirst();
Iterator<Client> iteratorOfClients = listOfClients.iterator();
while(iteratorOfClients.hasNext()) {
... |
131db61e-451d-4060-ba96-cfb3d85fe08a | 2 | @Override
public ArrayList<Object> show(int id) {
conn = new SQLconnect().getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "select * from eventnodes where display = 'true' and owner = "+ id + ";";
Statement st = (Statement) conn.createStatement(); // 创建用于执行静态sql语句的Sta... |
19f243a0-c8e3-4f94-a39a-89f3973c3973 | 1 | protected void appendLabel(final Label l) {
String name = (String) labelNames.get(l);
if (name == null) {
name = "L" + labelNames.size();
labelNames.put(l, name);
}
buf.append(name);
} |
bbf969c6-0a77-4df6-bd46-6daf1b5f74d6 | 5 | private void drawExits(Graphics g){
g.setColor(exitColor);
//int size = this.getWidth() / 10;
int xPos = 0;
int yPos = 0;
int width = 0;
int height = 0;
for (Relative_Direction dir: room.getAbsoluteExits()){
//Relative_Direction dir = room.convertAbsoluteDirectionToRoomRelativeDirection(exit);
... |
30c34695-2d09-4a1e-a323-0e2d3e80fba6 | 0 | @Override
public void setValue(Object o) {
// TODO support setting (by pushing properties to parent)
throw new UnsupportedOperationException("Not supported yet.");
} |
ca4e866a-ce8f-4bae-bc31-356da41cdcca | 4 | public boolean isOptOut() {
synchronized (optOutLock) {
try {
// Reload the metrics file
configuration.load(getConfigFile());
} catch (IOException ex) {
if (debug) {
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
}
return true;
} catch (InvalidConfigurationExcept... |
4baeec80-a249-4f1e-af49-69d6f9b497ef | 9 | public void learn(String learn) {
char c;
String name = "";
for (int i = 0; i < learn.length(); i++) {
c = learn.charAt(i);
switch (c) {
case '(':
if (name.length() > 0)
startElement(name);
name = "";
break;
case ')':
if (name.length() > 0)
startElement(name);
name = "";
... |
41b8de5b-0be5-4426-9dc2-cfaf4e86ebeb | 3 | public String toString() {
if (isFree)
return "FREE";
else if (isInvalid)
return "INVALID-CONSTANT";
else if (name != null)
return name;
else
return "[CycConstant: " + guid.toString() + "]";
} |
414f713f-db6f-4dec-99d6-f1a424f040a6 | 1 | private Double calculateExpressionValue() throws MalformedParenthesisException, InvalidOperandException, MalformedTokenException, MalformedDecimalException {
if(this.expressionList==null) {
tokenize();
}
//Magic happens here (i.e. PEMDAS)
performParentheticalExpressionEvaluation();
performExponenti... |
c2ce4acf-92e5-4c47-b7d8-bd511dd68d94 | 2 | @Override
public void onMoveTick(int x, int y, Game game) {
SinglePlayerGame spg = (SinglePlayerGame) game;
if (filterByID(spg.getSquareNeighbors(x, y, 1), juggernaut.id).isEmpty()) {
Location loc = spg.getFirstSquareNeighborLocation(x, y, 2, zombie.id);
spg.moveEntity(x, y, ... |
b20552b2-dc21-4e30-9f39-4173b353f857 | 4 | private void dealtDamage(int getX, int getY, int getWidth, int getLength, int getTime, int getDelay, double getDamage, int applyForce)
{
if (character.equals("P1"))
{
if (direction)
{
getWorld().addObject(new P1AttackArea(getX + x, y + getY,getWidth,getLength,... |
2c1834e0-3104-479f-9950-2017e4807fbd | 3 | public Type getSubType() {
if ((clazz == null && ifaces.length == 1) || ifaces.length == 0)
return tRange(this, tNull);
/*
* We don't implement the set of types, that are castable to some of the
* given classes or interfaces.
*/
throw new alterrs.jode.AssertError(
"getSubType called on set of cla... |
c7994d5a-7804-4428-9c0e-b275921bf2eb | 1 | static CommandLine doCommandLineParsing(String[] args) {
/*
* Lese Kommandozeilenargumente ein
*/
Option sourceFileOpt = new Option("s", "sourceFile", true,
"Die Ausgangsdatei");
sourceFileOpt.setRequired(true);
Option destFileOpt = new Option("d", "destFile", true, "Die ... |
c0190c38-0b45-4614-9e05-ae6b61ee9288 | 7 | public boolean isComplexNotOfMiddle() {
return (truthTable[0] == true) && (truthTable[1] == true) &&
(truthTable[2] == false) && (truthTable[3] == false) &&
(truthTable[4] == true) && (truthTable[5] == true) &&
(truthTable[6] == false) && (truthTable[7] == false);
} |
c0b303f3-7747-431e-a59a-21a840f0ac09 | 1 | private EncryptedCard encryptEncCard(EncryptedCard card)
throws InvalidKeyException, IllegalBlockSizeException,
BadPaddingException {
if (e == null) {
System.err
.println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)");
return null;
}
EncryptedCard encCard = new Encr... |
1c7f5414-5b82-485f-b106-f4f87fc649c6 | 1 | public void visit(int version, int access, String name, String signature,
String superName, String[] interfaces) {
this.className = name;
super.visit(version, access, remapper.mapType(name), remapper
.mapSignature(signature, false), remapper.mapType(superName),
interfaces == null ? null : remapper.mapTyp... |
d8b89e45-8b43-4389-8bec-59e10addd3c7 | 9 | private void resetElements() {
// remove ParameterChangeListeners on editable elements to prevent memory leaks
if (nt != null)
nt.removeParameterChangeListener(this);
if (pl != null)
pl.removeParameterChangeListener(this);
if (ws != null)
ws.removeParameterChangeListener(this);
if (ck != null)
ck... |
0fb247e1-1d9b-4ff2-93a7-c4f9405affa6 | 9 | private void meetingMenu(int meetingJoined) throws IOException, ClassNotFoundException {
String opt = "";
while (!("0".equals(opt))) {
System.out.println("Welcome to the meeting, " + username_logged + "!\n");
System.out.println("Please select one of the following options (0 to qu... |
26686c50-34a7-4fe7-abcd-6b8ba1b9309c | 9 | public static void main(String[] args) {
Round round;
do {
round = new Round();
Square square = new Square();
round.hello();
IPlayer player1 = new Human();
IPlayer player2;
if (round.getTypeOfGame() == '2') {
play... |
43739b75-1e58-49a8-af2d-030134853264 | 6 | private static void removeIsomorphicPieceOrientations()
{
for(int x = 0; x < p.size(); x++)
{
for(int y = 0; y < p.get(x).size(); y++)
{
if(p.get(x).get(y) != null)
{
for(int z = y+1; z < p.get(x).size(); z++)
{
if(p.get(x).get(z) != null)
{
if(p.get(x).get(y).equals(p.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.