method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a36f98b4-a302-48ea-a68c-2dda42fdbdff | 1 | public void testWithFieldAddWrapped5() {
Partial test = createHourMinPartial();
try {
test.withFieldAddWrapped(DurationFieldType.days(), 6);
fail();
} catch (IllegalArgumentException ex) {}
check(test, 10, 20);
} |
e788433c-b4cc-4c7e-9cb8-e5337cb84618 | 8 | @Override
public void keyReleased(KeyEvent e) {
//MOVEMENT KEYS
if (e.getKeyCode() == KeyEvent.VK_W){
// up = false;
}
if (e.getKeyCode() == KeyEvent.VK_A){
left = false;
}
if (e.getKeyCode() == KeyEvent.VK_S){
// down = false;
}
if (e.getKeyCode() == KeyEvent.VK_D){
right = false;
}
... |
d58a8d46-5744-439f-b5c3-bb64634d5e36 | 5 | private void setHistoryData(){
try {
Share [] sharebuffer = super.getAvailableShare();
for (int i = 0; i < sharebuffer.length; i++){
List<Long> values = new ArrayList<Long>();
BufferedReader in = new BufferedReader(new FileReader("../Java_Boersenmanager/da... |
f3933a1e-11c8-4249-8aba-22473e7c7d41 | 0 | private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCloseActionPerformed
//Récupération de la méthode contrôleur 'close'
((CtrlVisiteurs)controleur).close();
}//GEN-LAST:event_jButtonCloseActionPerformed |
7a77e911-6cb0-433b-a4b1-cb13e41c67fa | 2 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Spel spel = new Spel();
List<logic.Onderwerp> onderwerpen = spel.getOnderwerpen();
spel.setOnderwerp(onderwerpen.get(2));
List<logic.Onderdeel> ondrln = spel.getOnderdele... |
73e7f916-db77-487c-98ec-6dda46f63535 | 6 | @Override
public int doEndTag() throws JspException {
if (query == null && bodyContent != null) {
query = bodyContent.getString();
}
if (query == null || "".equals(query)) {
throw new JspException(
"Query must be provided, as an attribute or as BodyContent.");
}
final JspWriter out = pageContext.ge... |
371b33f4-0947-492e-8348-fdc58d591081 | 1 | public void saveConfigFile() {
try {
FileTools.dumpStringToFile(new File(Outliner.FIND_REPLACE_FILE), prepareConfigFile(), "UTF-8");
} catch (IOException ioe) {
JOptionPane.showMessageDialog(null, GUITreeLoader.reg.getText("message_could_not_save_find_replace_config") + ": " + ioe.getMessage());
}
} |
be62bceb-8169-4884-8501-64af0d1aef67 | 1 | public static void main(String args[])
{
In in = new In(args[0]);
try
{
Graph g = new Graph(in);
System.out.println(g.toString());
}
catch (Exception e)
{
System.out.println(e);
System.exit(1);
}
} |
feb2da56-bc32-4f45-883d-63533bf44e24 | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
G.setColor(Color.BLACK);
int deg = r.nextInt(360);
G.fillArc((int)(X-1)-viewX, (int)(Y-1)-viewY, 2, 2, deg, 60);
deg = r.nex... |
bb4c0e87-1273-451c-90e2-57be4addc2eb | 3 | @Test
public void testCrossUncrossableEdgeInvalid(){
try {
testEdgeUncrossable.cross(testTile1, null);
fail("IllegalArgumentException Expected");
}
catch (IllegalArgumentException e){
//exception expected
}
try {
testEdgeUncrossable.cross(null, testCharacter);
fail("IllegalArgumentException Ex... |
2556b40c-7442-44a3-94f9-6eacee620692 | 5 | public char[][] fill_grille(int[] position,String plain)
{
assert(position.length==4);
assert(plain.length()<=16);
int total_len=plain.length();
char[][] result=new char[4][4];
int[] cur_holes=new int[4];
for (int i=0;i<4;i++)
{
cur_holes[i]=position[i];
//System.err.println(cur_holes[i]);
}
... |
9b598ece-0a6f-4b16-a61d-63b3c6bfe8dd | 0 | public Set<AndroidMethod> getSinks() {
return sinks;
} |
4c677275-870b-481e-b129-0f9cda2c53b7 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
f433fea3-c857-4e57-ab0e-734a3569433b | 2 | private boolean alreadyListed (String[] list, String value) {
for (String valueListed : list) {
if (value.equals(valueListed)) {
return true;
}
}
return false;
} |
1102cd4a-e2a3-4efa-884a-c61cfbbcaf8e | 0 | public void setG(byte[] value) {
this.g = value;
} |
d07a607c-52f9-4370-a476-b8fbb17bafe0 | 1 | public static MainWindow getInstance() {
if (instance == null)
instance = new MainWindow();
return instance;
} |
4bcf7b15-93cc-4846-924d-3a46e2d288f3 | 2 | public final void grow(int wantedSize) {
if (written)
throw new IllegalStateException("adding to written ConstantPool");
if (tags.length < wantedSize) {
int newSize = Math.max(tags.length * 2, wantedSize);
int[] tmpints = new int[newSize];
System.arraycopy(tags, 0, tmpints, 0, count);
tags = tmpints;... |
f93de537-a4c2-4fbd-96d4-edaed28fe760 | 9 | @Override
public void onBlockBreak(BlockBreakEvent event) {
if (event.isCancelled()) {
return;
}
List<PlanArea> areas = new ArrayList<PlanArea>(planAreas);
for (PlanArea area : areas) {
if (Config.isFloorInvincible() && area.isFloorBlock(event.getBlock())) {
event.setCancelled(true);
return;
... |
7cad02d7-d4a2-4ac7-8508-f31bf9428c7a | 5 | private void cargarCampos(int numAsiento){
try {
r_con.Connection();
ResultSet rs=r_con.Consultar("select * from borrador_asientos where ba_nro_asiento="+numAsiento);
Asiento asiento=null;
renglon=0;
BigDecimal debeTotal=new BigDecimal(0);
... |
740dc695-46f3-4be2-b3cb-08f9212031cf | 7 | public void createModuleTable() {
try {
moduleNum = Integer.parseInt(numtf.getText());
if (moduleNum < 1 || moduleNum > MAX_MODULE_NUM) {
JOptionPane.showMessageDialog(null, "模块数量超出范围!");
numtf.setText("");
} else {
for (int i = 0; i <= moduleNum; i++) {
for (int j = 0; j < 4; j++) {
m... |
1774ee50-dfcc-43fc-adb9-b6dd17a47efd | 2 | public static void main(String[] args) {
Random num = new Random();
//the array frequency can store 7 indexes.
//but we only want indexes one through six for the dice we roll.
int freq[] = new int[7];
//this just loops this 1000 times.
for(int roll = 1; roll <1000; roll++){
//we are adding one index e... |
81ee4242-f953-4e89-b8b4-b27806eb1a26 | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
bb8d7a01-70ea-4966-b6d7-56f5dc58eaec | 3 | public void runServer() {
while (true) {
try {
final Socket clientSocket = serverSock.accept();
myThreadPool.execute(new Runnable() {
public void run() {
StreamServerHandler handler = streamHandlerFactory.getHandler(serverSock, clientSocket);
try {
handler.handle(clientSocket);
} ... |
c214a0fb-4f00-42b4-a96a-eca1a107c3ba | 1 | public void display() {
//Setting theme
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch(Exception ex) {
logger.warn(ex);
}
SwingUtilities.invokeLater(() -> frame.setVisible(true));
} |
8ca2950a-a7e1-4821-af0a-e2408eb54177 | 0 | public static int sumWithCondition(List<Integer> numbers, Predicate<Integer> predicate) {
return numbers.parallelStream()
.filter(predicate)
.mapToInt(i -> i)
.sum();
} |
e3665955-daf4-49f6-9fc1-624b9cedcb11 | 9 | private static void checkTermRanges(String field, int maxDoc, Terms terms, long numTerms) throws IOException {
// We'll target this many terms in our interval for the current level:
double currentInterval = numTerms;
FixedBitSet normalDocs = new FixedBitSet(maxDoc);
FixedBitSet intersectDocs = new Fix... |
b655b233-45b5-446f-a395-0d13dd251b0e | 1 | private static void addFontStyle(PacketBuilder buffer, char weight, int size) {
if (weight != 'p') {
buffer.writeByte(weight);
}
buffer.writeByte('g');
addSize(buffer, size);
} |
8c3df833-194d-4786-86b9-29d1cb49d879 | 0 | public void setRGB(int red, int green, int blue)
{
this.red = red;
this.green = green;
this.blue = blue;
} |
ad4d7bd5-45e0-462e-b054-b58bf4692363 | 3 | @Override
public ACTIONS act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer) {
double worstCase = 10;
double avgTime = 10;
double totalTime = 0;
double iteration = 0;
int bestAction = -1;
TreeNode root = new TreeNode(stateObs, null);
while(elapsedTimer.remainingTimeMillis() > 2 * avgTime &... |
23b72b4c-6583-4cd8-a626-9f5b25931649 | 9 | public ILevelPack chooseLevelPack(final Integer levelStage) {
if (isLevelStageNotValid(levelStage) || getLevelPacks(levelStage) == null) {
return null;
}
if (getLevelPacks(levelStage).size() == 0) {
return null;
} else if (getLevelPacks(levelStage).size() == 1) {... |
b245db3d-d74c-46ae-89a5-8a7dadaf9595 | 3 | public void increment(int symbol) {
if (symbol < 0 || symbol >= frequencies.length)
throw new IllegalArgumentException("Symbol out of range");
if (frequencies[symbol] == Integer.MAX_VALUE)
throw new RuntimeException("Arithmetic overflow");
total = checkedAdd(total, 1);
frequencies[symbol]++;
cumulati... |
5d18b77e-09d9-40db-a551-322e6cdfd68d | 6 | private void injectMembers(Class<? extends Object> clazz, final Object instance) throws SecurityException, InstantiationException, IllegalAccessException {
Field[] fields = clazz.getDeclaredFields();
for (final Field field : fields) {
if (field.isAnnotationPresent(Selectable.class)) {
... |
8570e9bd-86b1-4523-81bc-01be0d3cff58 | 6 | @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
paintBackground(g);
if (graphComponent != null)
{
// Creates or destroys the triple buffer as needed
if (tripleBuffered)
{
checkTripleBuffer();
}
else if (tripleBuffer != null)
{
destroyTripleBuffer();
}
... |
d3f8e9dd-a0dc-4a45-b981-390524660b38 | 7 | @Override
public void refresh(RefreshEvent event) {
boolean haveToRefresh = false;
Class evClass = event.getClass();
if (evClass == ResizeEvent.class) {
ResizeEvent ev = (ResizeEvent) event;
this.resize(ev.getHeight() * ev.getWidth());
haveToRefresh = fa... |
bc9f7d45-0b99-453a-bb82-fdb2a87b6bf9 | 5 | @Override
public void apply(Person person)
{
if (opponent != null)
{
if (opponent.getHealth() < person.getEquipment().getDamage()*person.getLvlBonus() -
opponent.getEquipment().getStandUp()*opponent.getLvlBonus())
{
opponent.setHealth(0... |
4b859f5b-82a2-49f9-9fea-c3c10db857f3 | 7 | private static <AnyType extends Comparable<? super AnyType>>
void merge( AnyType [ ] a, AnyType [ ] tmpArray, int leftPos, int rightPos, int rightEnd )
{
int leftEnd = rightPos - 1;
int tmpPos = leftPos;
int numElements = rightEnd - leftPos + 1;
// Main loop
while( leftP... |
3f926414-6a1f-4a4c-9ba3-70e21a315bc7 | 3 | public Entity collidedWith(Environment enviro){
int entityAmount = enviro.getEntityAmount();
for(int i = 0; i < entityAmount; i++){
Entity indexedEnt = enviro.getEntity(i);
if(indexedEnt != this){
if(isCollidedWith(indexedEnt)){
return indexedEnt;
}
}
}
return null;
} |
d25dfe0f-0d1b-4fcf-a620-d211bb7d9d9d | 6 | public Unit findTeacher(Unit student) {
if (getSpecification().getBoolean(GameOptions.ALLOW_STUDENT_SELECTION))
return null; // No automatic assignment
for (Building building : getBuildings()) {
if (building.canTeach()) {
for (Unit unit : building.getUnitList()) {... |
1b60b4c2-14d3-483a-8407-61e602fb079d | 4 | private void fillParameterMap(List<UIComponent> components) {
for (UIComponent child : components) {
if (child instanceof UIInput) {
UIInput input = (UIInput) child;
if (!parameterMap
.containsKey(getPropertyNameByUIComponent(input))) {
String propertyName = getPropertyNameByUIComponent(child);
... |
9b3cb06b-7de9-444f-a366-f1408df32a56 | 6 | public FormPanel (){
Dimension dim = getPreferredSize();
dim.width = 250;
setPreferredSize(dim);
nameLabel = new JLabel("Nombre: ");
occupationLabel = new JLabel ("Edad: ");
nacLabel = new JLabel("Nacionalidad: ");
modLabel = new JLabel("ID del campo a modificar");
nameField = new JTextField(10);
... |
7cf7bf3b-0af1-42f1-951e-85d480f44b04 | 5 | @Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cell other = (Cell) obj;
if (x != other.x)
return false;
if (y != other.y)
return false;
return true;
} |
8389725e-f6ee-4cc1-b9a3-ea8cd463718a | 0 | public SHSMemberEntity getAccount() {
return account;
} |
e9f4d084-86f6-434d-abd3-d3bd6d74708c | 0 | public void setStatus(Status status) {
this.status = status;
} |
16c1c02b-9283-4b67-8df4-50bac522b269 | 0 | public LightingSword(){
this.name = Constants.LIGHTING_SWORD;
this.attackScore = 50;
this.attackSpeed = 20; // 20 %
this.money = 4000;
} |
3da2da81-45a3-4d01-bc54-6bd44779f785 | 0 | public void setName(String value) {
this._name = value;
} |
a660456c-5688-49e7-b7a0-0a1eb58f380a | 2 | public void Log (String str) {
if (str.length() > 0) {
try {
cal = Calendar.getInstance();
timestamp = timestampformat.format(cal.getTime());
writer.write(timestamp);
writer.write(str);
writer.newLine();
writer.flush();
} catch (IOException e) {
System.out.println(e.getMessage());
... |
afa364ab-ac99-424f-b534-194aae2c7f6c | 3 | public void readInputStream() {
try {
int buffersize;
if ((buffersize = msgSocket.getSocketInput().available()) != 0) { // is any msg available?
char buffer[] = new char[buffersize];
int count = 0;
while(msgSocket.getSocketInput().available() != 0) {
count = msgSocket.input().read(buffer, ... |
36416494-a4b3-4bb9-a157-549761ca4ff1 | 0 | public String getLicenseDate() {
return licenseDate;
} |
c891af8b-3292-46a5-9389-acef35f49743 | 1 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
if (g == null)
return;
UserControlParsePane userPane = new UserControlParsePane(environment, g);
environment.add(userPane, "User Control Parser", new CriticalTag() {
});
environment.setActive(userP... |
111528e7-0b3e-4bd7-ba5f-46075f7e2320 | 3 | public void addElement(Element element) {
if (element == null)
throw new IllegalArgumentException("Element can't be null!");
if (elements.contains(element))
throw new IllegalArgumentException("The argument is already on the grid!");
if (!validPosition(element.getPosition()))
throw new IllegalArgumentExce... |
a2bbfbd8-6686-4f77-ba88-3d378b79327e | 3 | public PropertySheet(Class[] types, Object[] values)
{
this.values = values;
editors = new PropertyEditor[types.length];
setLayout(new FormLayout());
for (int i = 0; i < values.length; i++)
{
JLabel label = new JLabel(types[i].getName());
add(label);
... |
be1c11d7-e912-4bab-b6a6-bbb44435f117 | 9 | private boolean handleServerStream()
throws IOException , XMLStreamException, XmppException {
// Get the next XML event
int eventType = parser.getEventType();
while ( eventType != XMLStreamConstants.END_DOCUMENT ) {
// Check if the parse event is a XML start tag
if ( eventType == XMLStreamConstants.STA... |
54966932-467b-4c29-beb7-ec7dc47e4745 | 2 | public int count()
{
int count = 0;
try
{
ResultSet set = read("SELECT COUNT(ID) AS COUNT FROM OPERATION");
while(set.next())
{
count = set.getInt("COUNT");
}
set.close();
}
catch(SQLException e)
... |
ea46568b-65fb-4e8f-a1c3-ebe54bd40a25 | 5 | public static boolean is_same(char[] c1,char[] c2){
if(c1==null||c2==null){
return false;
}
if(c1.length!=c2.length){
return false;
}
boolean res = true;
for(int i=0;i<c1.length;i++){
if(c1!=c2)
res = false;
}
return res;
} |
10626d74-9f6d-4a51-ac98-4ab492a76cfe | 0 | @Override
public void windowIconified(WindowEvent e) {
} |
1e200005-769b-4700-bd28-081b5cd97e63 | 8 | private final Bullet setFireImpl(double power) {
if (Double.isNaN(power)) {
println("SYSTEM: You cannot call fire(NaN)");
return null;
}
if (getGunHeatImpl() > 0 || getEnergyImpl() == 0) {
return null;
}
power = min(getEnergyImpl(), min(max(power, Rules.MIN_BULLET_POWER), Rules.MAX_BULLET_POWER));
... |
ad44386d-651a-441a-8dc6-adf51b3b3bbc | 1 | private void addPutstatic0(CtClass target, String classname,
String fieldName, String desc) {
add(PUTSTATIC);
// target is null if it represents THIS.
int ci = classname == null ? constPool.addClassInfo(target)
: constPool.addClassIn... |
b4b38b03-c6ef-4a1a-9d81-098ab5e5382a | 8 | public DisjointSets computeEquivalence() {
computePairs();
if(DEBUG) {
System.out.println("Equivalence table: ");
for(int i = 0; i < nStates; i++) {
for(int j = 0; j < nStates; j++)
System.out.print((table[i][j] ? "1" : "0") + " ");
System.out.println();
}
}
DisjointSets uf = new Dis... |
8bed89c8-9f99-442c-9b91-7b8850683a86 | 6 | public void move() {
List<Field> fieldList = this.getField().getNearByRoads(1);
if (fieldList.size() > 1) {
List<Integer> roadIds = new ArrayList<Integer>();
List<Field> possibleFields = new ArrayList<Field>();
// elagazashoz ertunk
this.getField().execute... |
3a3af897-f0a1-4e0f-965a-db0dd3b33392 | 9 | @SuppressWarnings("unchecked")
public static <T, U, Y extends Collection<T>> Collection<Pair<U, Y>> chunk(Collection<T> c, Function<T, U> f, Class<?>... resultType) {
verifyArguments(c, f);
List<Pair<U, Y>> pairs = (List<Pair<U, Y>>) (resultType.length > 0 ? instantiate(resultType[0]) : new... |
267315db-3d62-43b4-8737-4fa8b9dc864b | 8 | public static void main(String[] args)
{
if (args.length < 1)
{
System.err.println("Usage: newsgroups newsserver [pattern]");
return;
}
NNTPClient client = new NNTPClient();
String pattern = args.length >= 2 ? args[1] : "";
try
{
... |
44c5f2d3-3932-4f6d-a65c-49907c93c9c8 | 5 | private void calculateG(Node node) {
Tile t = MyzoGEN.getOutput().getTile(new Point(node.x, node.y));
if (node.parent != null && t != null) {
int dir = directionFromParent(node);
if (dir == 1)
node.G = roundHeight(t.height);
else if (dir == 0)
node.G = node.parent.G + DIAGONAL_MOVE_COST;
}
if (... |
61228be0-e81f-43f5-b65b-9a889e449b23 | 2 | @RequestMapping(value = {"/EntidadBancaria/{idEntidadBancaria}"}, method = RequestMethod.PUT)
public void update(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @PathVariable("idEntidadBancaria") int idEntidadBancaria, @RequestBody String json) {
try {
ObjectMapper objec... |
5d6852cc-cf95-47c8-a43a-58d53e672f9f | 2 | private void render()
{
switch(menu){
case main:
break;
case Game:
RenderUtil.initGraphics();
RenderUtil.clearScreen();
game.render();
Window.render();
break;
}
} |
52e17c97-a320-40c0-9aa3-2d6043a4d1b4 | 9 | @Override
public int distance(GeneralAIUnit unit, GeneralAI ai) {
// ensure unit can build this guy
if (unit.stats.isBuilding() && !def.is_building) {
if (!unit.stats.getProduce().contains(id)) {
return GeneralAI.DISTANCE_IGNORE; // can't even build
}
} else if (!(unit.stats.isWorker() && def.is_buildi... |
710f8730-007e-403d-bb17-4e682e3ccc4e | 0 | public void setEncryptedValue(EncryptedDataType value) {
this.encryptedValue = value;
} |
e1729251-d281-4476-8b10-9f874bcb9700 | 9 | private void reconstructRing() {
FailureDetectorThread.handleMessage("Send Thread: reconstructRing");
checkFailedServer(); // check the failed servers
// remove failed server from the ring
for (Integer id: this.failedServer) {
if(pingPeers.containsKey(id)){
FailureDetectorThread.handleMessage("server ... |
f6b99e8d-6b33-4297-98f0-41a593f51d25 | 2 | @Override
public void move() {
if (alive) {
if (stomache > 0) {
addGlied();
stomache--;
}
super.move();
invertedBevoreMoves ++;
}
} |
e5961f19-691e-4aaf-b36a-6cb30dca6cb8 | 1 | public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
iXportSMS windo... |
df8e9e4e-2caf-45a8-9202-b45e76aec9c0 | 1 | private void btnannulerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnannulerActionPerformed
//Serialisation
try{
FileOutputStream f = new FileOutputStream("sauvegarde.csv");
ObjectOutputStream s = new ObjectOutputStream(f);
s.writeObject(MainProjet.lesEntreprises)... |
dabfe98f-0e32-44c2-b3d2-2d7a3565a283 | 0 | private String readInput() throws IOException {
return this.keyboard.readLine();
} |
e0ea58c8-8db2-4b46-a707-6f287b17af7d | 3 | @Override
public void execute() {
while (true) {
showMessage();
showCurrencies();
try {
moneyDialog.execute();
currencyDialog.execute("Introduzca la divisa a convertir: ");
this.calculate.execute();
} catch (Exce... |
d7b96187-9c48-4596-8755-2ab520b19e08 | 4 | protected void redo() throws CannotRedoException {
if (insertionPoint >= maxInsertionPoint) {
throw new CannotRedoException();
}
if (insertionPoint < maxInsertionPoint) {
AbstractEdit edit = edits.get(insertionPoint);
edit.redo();
publishEdit(edit)... |
6d3485c3-c659-4a1d-bed8-518b03ad75ae | 5 | public boolean mouseup(Coord c, int button) {
for (Widget wdg = lchild; wdg != null; wdg = wdg.prev) {
if (!wdg.visible)
continue;
Coord cc = xlate(wdg.c, true);
if (c.isect(cc, (wdg.hsz == null) ? wdg.sz : wdg.hsz)) {
if (wdg.mouseup(c.add(cc.... |
290f0153-81a3-4fd6-95c9-f523b56c2a36 | 0 | private BeverageFactory() {
} |
9524bd23-9d65-44f5-95cf-259f50f1e93c | 7 | @Override
public void update(Observable o, Object arg) {
String sender = o.getClass().getName();
String message = (String)arg;
System.out.println("EventLogUI received ["+ arg +"] from ["+ sender +"]");
if (sender.equals("Core.Board"))
{
if (message.startsWith("List added: "))
{
List list = log.ge... |
76d78371-ea27-4b1a-b323-0af6e3505d64 | 1 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int tests = Integer.parseInt(in.readLine());
while (tests > 0) {
stepsToAnagram(in.readLine());
tests--;
}
} |
bc9a1adc-4647-47bf-b4ad-9ad25406d241 | 6 | private void cycleAnnounce(int i, int milli, boolean silent) throws InterruptedException {
if (this.isCancelled()) {
return;
}
if (!silent) {
Bukkit.broadcastMessage(ChatColor.DARK_RED + ">> " + ChatColor.AQUA + "Cycling to " + ChatColor.DARK_AQUA + "[" + rotatedMap.getType().getType() + "] " + rotatedMap... |
a6ab0eb4-c4df-435f-902a-01b80fb83a05 | 4 | public User getUser(String username) {
PreparedStatement statement = null;
Connection connection = null;
try {
try {
connection = data.getConnection();
statement = connection.prepareStatement("SELECT * FROM User WHERE username = ?");
statemen... |
68e81c59-10e0-4034-b71f-8e465a75703b | 3 | public static boolean isNumberType(Class<?> clazz) {
return (clazz == Number.class || clazz.getSuperclass() == Number.class || isPrimitiveNumberType(clazz));
} |
08996c36-757e-4891-8df6-c992668fdb84 | 9 | private Object makeInt()
{
Object result;
String s = image.toString();
int base = 10;
if ( s.charAt(0) == '0' )
base = (s.length() > 1 && (s.charAt(1) == 'x' || s.charAt(1) == 'X'))? 16 : 8;
if ( base == 16 )
s = s.substring(2); // Trim the 0x o... |
3a131c56-9e52-4883-8295-009901e198c1 | 3 | * @return True, if the contents of this statement list changed.
*/
public boolean retainAll(final Collection c) {
boolean changed = false;
if (c == this) {
return false;
}
final Iterator iter = iterator();
while (iter.hasNext()) {
if (!c.contains(iter.next())) {
changed = true;
... |
16876303-68f6-41c6-b3e1-e651d4402930 | 7 | public static void main(String[] args) {
Lista lista = new Lista();
int op;
Scanner lea = new Scanner(System.in);
do{
System.out.println("1- Agregar Nodo");
System.out.println("2- Imprimir");
System.out.println("3- Borrar");
System... |
95234196-f845-435e-bcb6-74ba826331e6 | 7 | public imageEdit(){
super(new BorderLayout());
//frame = new JFrame();
//frame.setLayout(new BorderLayout());
panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.setBackground(colorRGB);
//frame.setVisible(true);
//frame.setSize(500,500);
//
pp = new JPanel();
/*
JLabel orig = new... |
92570e7e-9025-4fd1-8134-ffe9e95d1aab | 0 | public void setValueMAC(byte[] value) {
this.valueMAC = value;
} |
947ce450-139a-4668-b160-06bf0165c09f | 9 | public void cargaArrayAlumno(String nroLegajo , String modo , String nroClase , String nroCurso){ // cargo en un array todos los registros de la tabla alumno.
String qry = "SELECT * FROM alumnos";
if (nroLegajo != null) qry += " WHERE nroLegajo = " + nroLegajo;
if(modo != null && nroCla... |
87124056-2d65-42fb-b619-1def9e32b85d | 7 | public AbstractProductIon(PrecursorIon precursorIon, ProductIonType type, int position, Peptide peptide, int charge) {
//based on DefaultPeptideIon create ProductIon.
super(peptide, charge);
if (precursorIon == null) {
throw new NullPointerException("Precursor ion can not set null!"... |
7a558f12-0b49-416e-81a0-28382b6661b8 | 2 | public static List<CommandeFournisseur> selectCommandeFournisseur() throws SQLException {
String query = null;
List<CommandeFournisseur> Commande = new ArrayList<CommandeFournisseur>();
ResultSet resultat;
try {
query = "SELECT * from COMMANDE_FOURNISSEUR ";
Pre... |
dd8249a0-2fb2-4b96-b5f1-ff6fc99a6b72 | 8 | @SuppressWarnings("unchecked")
@Test
public void testQuestion2() {
Quiz quiz = Quiz.getQuizByQuizName("Bunny Quiz");
ArrayList<Question> questions = Question.getQuestionsByQuizID(quiz.quizID);
assertEquals(questions.size(), 7);
for (int i = 0; i < questions.size(); i++) {
Question question = questions.get(... |
778e54bf-8276-420b-ba9c-d9f72fd0726a | 9 | public void load() throws IOException {
boolean before = SoundStore.get().isDeferredLoading();
SoundStore.get().setDeferredLoading(false);
if (in != null) {
switch (type) {
case OGG:
target = SoundStore.get().getOgg(in);
break;
case WAV:
target = SoundStore.get().getWAV(in);
break;
cas... |
7718b254-5939-427b-b23c-990853ecac50 | 6 | public void moverContinuamente() {
while(!gameOver) {
try {
Thread.sleep(100);
} catch (InterruptedException ex) {}
if(panel.x + panel.diametro > panel.getWidth() ||
panel.x < 0) {
incX *= -1;
}
if(pa... |
a4dccfc4-5b4c-4ea5-82fe-e500146ce12a | 8 | public ArrayList<String> tokenize(String text) {
char[] textContent = text.toCharArray();
ArrayList<String> tokens = new ArrayList<String>();
// Initialize the execution
int begin = -1;
transducer.reset();
String word;
// Run over the chars
for(int i=0 ; i<textContent.length ; i++) {
Signal s = trans... |
d7a1765a-8b96-4442-a081-e12bf08ca06a | 5 | private void createDataset() {
this.gson = new Gson();
Map<?, ?> all = this.transitionsStore.getAll();
Collection<String> allTransitions = (Collection<String>) all.values();
for (String transitionString : allTransitions) {
if(isPending(transitionString) | isACKED(transitionString)){
Object deseri... |
1b4db9e4-281d-4e3e-8f33-7db12307844b | 3 | public static void checkedAnyAttributes(Element element, String[] labels) throws SyntaxException {
for (String label : labels)
if (element.hasAttribute(label))
return;
StringBuilder labelList = new StringBuilder();
for (String label : labels)
labelList.append(label).append(", ");
String labelsAsList =... |
c7c13d10-0ea9-478b-8c74-3d9d58a29ad4 | 2 | @Override
public void add(Credit element) {
//Добавляем запись в список
getList().add(element);
Statement statement = null;
ResultSet result = null;
try {
//Создаем изменяемую выборку
statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_S... |
a6a70f99-b932-4be4-8ccb-15752170da59 | 2 | public static boolean fullName(String name){
String[] temp = name.split(" ");
if(name(temp[0])&&name(temp[1]))
return true;
return false;
} |
eb9496a4-3eef-448d-ad6b-d227c68c4b2b | 3 | public static void choque() {
if (terminochoque){
terminochoque = false;
file = new File(".");
ruta = file.getAbsolutePath();
Thread hilo = new Thread() {
@Override
public void run() {
try {
... |
29825160-a0b1-40f6-9671-0a40ae48b34f | 2 | public boolean retrack(Tracking tracking)
throws AftershipAPIException,IOException,ParseException,JSONException{
String paramRequiredFields = tracking.getQueryRequiredFields().replaceFirst("&","?");
String url = "/trackings/"+tracking.getSlug()+
"/"+tracking.getTrackingNum... |
738cd1d6-ef80-4c11-a645-1b44954ba9d7 | 9 | public float cost(ArrayList<Pair> permutation, int[] container_classes, int[][] communication_matrix) {
//initially consider all nodes to be powered up (then reduced it on encountering [-1,-1]
num_of_powered_nodes = permutation.size();
num_of_collocated_devils = 0;
num_of_collocated_com... |
2ae0a262-3a86-4051-ada1-9a40f29d30a4 | 0 | public synchronized static ConfigManager getInstance() {
return m_instance;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.