method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
55463f5b-ed9b-436d-8c39-964e705c8cb8 | 9 | @Override
public void writeBytes(byte[] b, int offset, int len) throws IOException {
long freeSpace = dir.maxSize - dir.sizeInBytes();
long realUsage = 0;
// If MockRAMDir crashed since we were opened, then
// don't write anything:
if (dir.crashed)
throw new IOException("MockRAMDirectory wa... |
8ba74cb3-0922-431c-ab46-12618fb12261 | 7 | private void operation() throws SQLException {
System.out
.println("Please choose your operation:\n1 add a new URL"
+ "\t2 delete a URL\t3 display all\n4 update DB\t5 delete table\t6 Exit this application");
try {
int input = sc.nextInt();
switch (input) {
case 1:
add();
break;
case 2:... |
f7c60bd2-d9b3-447b-91ae-49d5d63e1ef5 | 5 | public String arithmetic(String instruction) {
String[] instArray = instruction.split(" ");
Register dest = getRegister(1, instArray);
Register source1 = getRegister(2, instArray);
Register source2 = getRegister(3, instArray);
switch (instArray[0]) {
case "ADD":
return add(dest, source1, source2);
case... |
84df2bda-53cc-4c30-86da-7891cbaae3f8 | 6 | public void bitSwap(double tempurature){
Chromasome child = new Chromasome();
int index = 0;
while (index < child.chromasome.length) {//Copy the current chromasome to the child as a base, before we flip it
child.chromasome[index] = currentChromasome.chromasome[index];
index++;
}
/*int toSwap = ran... |
beb587f6-b51e-4c35-a421-7eb9929f5c25 | 3 | void brushDabsBenchmark(String[] args) {
int iterations = args.length > 1 ? Integer.valueOf(args[1]) : 10000;
int sizeMin = args.length > 2 ? Integer.valueOf(args[2]) : 1;
int sizeMax = args.length > 3 ? Integer.valueOf(args[3]) : 200;
System.out.println("Benchmarking brush dabs size " + sizeMin + "-" + sizeMa... |
bdc75b10-8995-48e6-947d-f999c5e17360 | 0 | public double getX2Coordinate()
{
return x2Coordinate;
} |
0d012a59-c7e0-43e5-b4d2-5d3b9f909ae8 | 4 | @Override
public void onEntityExplode(EntityExplodeEvent event) {
List<Block> blockList = event.blockList();
for (Block block : blockList) {
PlanArea area = BuildingPlanner.plugin.areaManager.getAffectedArea(block);
if (area == null) {
continue;
}
if (area.isCommitted()) {
continue;... |
6214f332-a2cf-401a-8800-6cf3845f84c6 | 2 | public void updateLabels() {
if (Game.getThis() == null) { return; }
// Consecutive Matches
Consecutive.setText(
"<html><div style=\"color: blue; font-weight: bold;\">" +
"Consecutive<br/>" +
"Match Bonus: " +Game.getThis().ConsecutiveRun +
"</div></html>"
);
// Turns
P1_Turns.setText("T... |
0adc0c3a-3bff-4e14-9ebf-af2772869db6 | 0 | public void clear() {
verticesToPoints.clear();
verticesToNeighbors.clear();
} |
3ada61e9-ba30-44e9-a6c6-b5097076eb53 | 4 | private long getCPtrAddRefOfferDataNym(OfferDataNym element) {
// Whenever adding a reference to the list, I remove it first (if already there.)
// That way we never store more than one reference per actual contained object.
//
for(int intIndex = 0; intIndex < elementList.size(); intIndex++)
{
Object theObject =... |
027d3435-c689-4cad-82e5-9aed5ad432f0 | 4 | public Address getAddress(String description) {
if (!localAddresses.isEmpty()) {
Iterator<Address> addressIterator = localAddresses.iterator();
while (addressIterator.hasNext()) {
AddressImpl address = (AddressImpl) addressIterator.next();
if (address.getDescription().equalsIgnoreCase(description)) {
... |
f8f2cdc4-412f-4f1e-a59c-691303a6e6c6 | 0 | public static boolean isCglibRenamedMethod(Method renamedMethod) {
return CGLIB_RENAMED_METHOD_PATTERN.matcher(renamedMethod.getName())
.matches();
} |
45a5c2e1-5201-4702-a55c-1d83465d68c2 | 9 | public static void startupLogicSystem() {
synchronized (Stella.$BOOTSTRAP_LOCK$) {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.systemStartedUpP("stella", "/STELLA"))) {
StartupStellaSystem.startupStellaSystem();
}
}
if (Stella.currentStartupTimePhaseP(1)) {
... |
cda7c180-1305-40bb-9519-2be0fa23695a | 9 | public void temporizacion()
{
/* min (event_list()) */
if (event_list.getA() <= event_list.getL() && event_list.getA() <= event_list.getS() && event_list.getA() <= event_list.getR()){
clock = event_list.getA();
}else if (event_list.getL() <= ... |
88a2ec83-807e-4047-8810-1c530f8afa7c | 0 | public void setjLabelMdp(JLabel jLabelMdp) {
this.jLabelMdp = jLabelMdp;
} |
fad12a1d-6aec-4393-af70-45bfae9d58fc | 7 | public void render(){
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
switch (state) {
case INTRO:
Intro.render();
break;
case OPTIONS:
Options.render();
break;
case MAINMENU:
MAINMENU.render();
break;
case MENU:
Menu.render();
break;
case GAME:
if(world.isLo... |
4252b39b-374f-4484-8f96-efe2b53e5764 | 3 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int num = in.nextInt();
while(num-->0){
int n = in.nextInt();
int k = in.nextInt();
int d1 = in.nextInt();
int d2 = in.nextInt();
System.out.println(n%3==0 && d1+d2<(n/3) ? "yes" : "no");
}
} |
f5773481-a864-4e2e-8fb3-162649d9e30d | 6 | public static void main(String[] args) throws Exception
{
// this file is at
// https://github.com/afodor/metagenomicsTools/blob/master/src/parsers/test/someFasta.txt
File aFile = new File("C:\\Temp\\someFasta.txt");
List<FastaSequence> list = FastaSequence.readFastaFile(aFile);
if( list.size() != 3)... |
7d0a0f8d-272e-456b-9457-d1d7d12c6226 | 2 | public void asleep(long milliseconds) {
long next = System.currentTimeMillis() + milliseconds;
while (System.currentTimeMillis() < next) {
try {
sleep(next - System.currentTimeMillis());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
066d2bba-6e0a-4a7b-8e9a-b54804b7ee88 | 5 | private void btnFinalizarProdActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFinalizarProdActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Deseja Salvar?") == 0){
try {
//Cliente cliente = new Cliente();
//Setando os dados e converte... |
2091b673-3424-420d-a8b7-1507a40780e7 | 0 | public List findBySex(Object sex) {
return findByProperty(SEX, sex);
} |
0358f739-fd45-4286-b35d-4ee03a0ebc2c | 7 | public void testHugeFile() throws IOException {
DenseRAMFile f = new DenseRAMFile();
// output part
RAMOutputStream out = new RAMOutputStream(f);
byte b1[] = new byte[RAMOutputStream.BUFFER_SIZE];
byte b2[] = new byte[RAMOutputStream.BUFFER_SIZE / 3];
for (int i = 0; i < b1.length; i++) {
... |
d7eeb838-14eb-4e09-9e6a-36567eb30c78 | 6 | public static Stella_Object accessGeneralizedSymbolSlotValue(GeneralizedSymbol self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_SYMBOL_NAME) {
if (setvalueP) {
self.symbolName = ((StringWrapper)(value)).wrapperValue;
}
else {
value ... |
2e8b0639-2917-42ee-8067-ccbb3f516cc2 | 7 | @Override
public void actionPerformed(ActionEvent e) {
String tmp = "";
Object source = e.getSource();
if (source == btn) {
tmp = recherche.getText();
System.out.println(tmp);
}
if (tmp.compareTo("") != 0) {
if (tmp.compareTo("play pool")... |
7a90570e-25b2-47e8-8d99-4b28149f019d | 7 | public int countLeftDiagonal(Example e, int currentToken, int numTokensCountingFor){
int height = e.getBoard().height; // 6
int width = e.getBoard().width; // 7
int countOfTokensEncounteredDiagonallyLeft = 0; // counter
int countOfCurrentPlayersNInARow = 0;
// bottom index is (5, 0)
for (int i = height ... |
a9cfe8b9-6d93-4150-aec0-ea60e3400b6e | 7 | public void getDatos(String campo, beansProducto producto){
String descripcion = null, parametro = null;
switch(campo.trim()){
case "nombre":
descripcion = "Nombre del producto ";
parametro = producto.getNombre();
break;
case "codigo":
descripcion = "Codigo del producto ";
p... |
d9c2a605-8d80-42d4-8bd1-2bae5bce4594 | 8 | protected int readJSONArray(JSONArray jsonArray, int startIdx) {
int cnt = this.tokens.size();
int i = startIdx;
for (i = startIdx; i < cnt; i++) {
Token t = this.tokens.get(i);
//System.out.println("In sq open:" + t.getValue());
switch (t.getTokenType()) {
case JSONParserConstants.CURLY_BRACKET_O... |
0c885235-7993-4eff-a8e3-8661a8c33598 | 6 | public int getSample()
{
if (!enabled) return 0;
// Decrement Counter
counter -= psg_cycles;
// Counter Expired
if (counter < 0)
{
// Toggle Amplitude Flip Flop
amplitude_flipflop = !amplitude_flipflop;
// Reload counter
... |
3f84dc00-4e5d-4031-97a9-62a6c1235bcd | 5 | private void list(CommandSender sender, String[] args) {
if (!sender.hasPermission("graveyard.command.list")) {
noPermission(sender);
return;
}
String world = null;
if (args.length > 1) {
world = args[1];
}
commandLine(sender);
... |
5ed5cad1-0f0b-4724-932e-18fa2f9b4b08 | 6 | protected void installListeners() {
super.installListeners();
if (AbstractLookAndFeel.getTheme().doShowFocusFrame()) {
focusListener = new FocusListener() {
public void focusGained(FocusEvent e) {
if (getComponent() != null) {
org... |
8ef20dc3-2baf-43e7-ba50-e9ad4be5ba37 | 1 | @Override
public void tableCheckAndCreate() throws SQLException {
// http://stackoverflow.com/questions/2942788/check-if-table-exists
Statement statement = con.createStatement();
DatabaseMetaData dbm = con.getMetaData();
// check if "employee" table is there
ResultSet tables = dbm.getTables(null, null, TABLE... |
60530e7d-5d92-4f49-9883-1edd94bf9b9b | 0 | public void setWorkPosition(String workPosition) {
WorkPosition = workPosition;
} |
9332219c-f9b6-442f-97c3-e3a794d95685 | 9 | private void affichageErreursAnnonceur(List<Error> erreursAnnonceur) {
for (Error e : erreursAnnonceur) {
switch (e) {
case raisonSocialeVide:
this.labelErreurRaisonSocialeAnnonceur.setText("Veuillez saisir une raison sociale");
break;
... |
21f90ba4-091e-49c9-ba9c-fa18485a6832 | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
53e76a6b-36e6-4309-9bee-6c1d2a966d25 | 9 | public LoadGamesTable(final GameClient client, final ClientWindow window, final LoadGamesTableModel model) {
super(null, model.getHeaders());
setModel(model);
// Set the table styling
setRowHeight(ROW_HEIGHT);
// Create the button column
new ButtonColumn(this, new AbstractAction() {
@Override
public... |
982186aa-a00a-427e-9529-5e54fc02911b | 7 | @Override
protected Order process(Order o) {
// //TODO finalize multiple treatment for each OrderType
Order response = null;
if(o != null){
switch(o.getOrderType())
{
case AUTH :
EngineLog.SERVER.info(
"Recived an Auth permission from "+
o.getParentOrder().getSocketAddress() +
... |
66378c22-e042-4ae6-88ea-5161d87204cd | 2 | protected DateTimeField getField(int index, Chronology chrono) {
if (index == 0) {
return ISOChronology.getInstanceUTC().minuteOfHour();
}
if (index == 1) {
return ISOChronology.getInstanceUTC().millisOfSecond();
}
return null;
... |
13c60dc7-d61b-4d09-90c1-f80f36d16c1a | 8 | private void saleShowButtonActionPerformed() {
if (dataForUpdate.getFromStation() == null || dataForUpdate.getFromStation().equals("")) {
JOptionPane.showMessageDialog(null, "Некорректно введена станция отправления. Повторите ввод.");
return;
} else if (dataForUpdate.getToStation... |
d5084926-7a86-47f8-ad2f-a2549bcf5688 | 4 | protected Behaviour nextResting() {
Target restPoint = this.origin() ;
final Nest nest = (Nest) this.mind.home() ;
if (nest != null && nest.inWorld() && nest.structure.intact()) {
restPoint = nest ;
}
final Action rest = new Action(
this, restPoint,
this, "actionRest",
Action... |
3a08063b-c3d5-45b5-9a80-dd4fdd0f33f8 | 2 | Command getCommand(String name) {
if (StringUtils.isEmpty(name) || !hasCommands()) {
return null;
}
return this.commands.get(name);
} |
9f2778f2-5ccc-45b1-8f95-51331426dccf | 4 | public static void main(String s[] )
{
boolean primes;
k2 = new Scanner(System.in);
System.out.println("enter the first number for range");
int num1=k2.nextInt();
System.out.println("enter the second number for range");
int num2=k2.nextInt();
int i=0;
for( i=num1;i<=num2;i++)
{ primes=true;
... |
4e7594ef-e04c-4d9f-99da-02d3cb7b77c2 | 7 | private void skipToEnd()
throws IOException
{
InputStream is = getInputStream();
if (is == null)
return;
if (chunkLength > 0)
is.skip(chunkLength);
for (int tag = is.read(); tag >= 0; tag = is.read()) {
switch (tag) {
case 'Y':
server.freeReadLock();
... |
1e5f85b4-fbc7-49c6-bed3-718db9a91021 | 0 | public boolean getPartitionValidity()
{
return partitionIsValid;
} |
e0239aee-927e-4a78-a0ef-7f75b2794e72 | 6 | int getHelpArgumentsLength(String longStart, String shortStart){
if (description == null){
return 0;
}
int length = 1;
if (shortStart != null && shortNames.size()>0){
length += 1;
length += shortStart.length();
length += 1;
}
... |
88e411bb-b050-4534-a4bd-ea17b9558088 | 2 | static private void sort(int check, int[] array){
if(index == 5){
index = 0;
return;
}
int cache = averages[index];
int[] cacheArray = bests[index];
if(check > cache){
averages[index] = check;
bests[index] = array;
index ++;
sort(cache, cacheArray);
}else{
index ++;
sort(check, ar... |
28f32e82-a367-4632-af78-c7fe9cab607f | 3 | public static String stringToMD5(String str) {
StringBuffer buffer = new StringBuffer();
MessageDigest messagedigest = null;
if (StringUtil.isNullOrEmpty(str))
return "";
try {
messagedigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmEx... |
a90faf0b-f6f5-480f-9cf9-67c478c87b6f | 1 | private int DecDigit(int number, int pos)
{
int term = 1;
int i;
for (i = 0; i < pos; i++) term *= 10;
return number - term;
} |
5279c405-a582-4e32-a29f-e27985056d19 | 0 | public Object getObjectShape(){
return objectShape;
} |
b2a904c5-07f7-4a59-991e-e85be8333567 | 8 | public String insertProfile(String inJson) {
String retval = new String();
boolean retbool;
int retcode;
try {
JSONObject inJo = new JSONObject(inJson);
JSONObject inPr = inJo.getJSONObject("profiles");
JSONArray inConf = inJo.getJSONArray("configuration");
JSONArray inHost = inJo.getJSONArray(... |
b79a12f0-5ce3-45ab-9bca-f52e59f22195 | 4 | public static String v(int[][] m) {
String ans = "";
if (s(m, -1, -1))
return "OK";
else {
for (int i = 0; i < m.length; i++)
for (int j = 0; j < m.length; j++)
if (s(m, i, j))
return "Change bit (" + (i + 1) + "," + (j + 1) + ")";
}
return "Corrupt";
} |
98d5d2f0-dda2-4898-b5c5-5c2cab4392ba | 1 | private static List<Appointment> findWeeklyByDaySpan(long uid,
long startDay, long endDay) throws SQLException {
List<Appointment> aAppt = new ArrayList<Appointment>();
// select * from Appointment where frequency = $WEEKLY
// and startTime <= $(endDay+DateUtil.DAY_LENGTH)
// and lastDay >= $startDay
Prepa... |
7bf39e88-a314-4c73-9289-c13f1f513b89 | 9 | public void act() {
//If we're not allowed to move the card about, don't do anything
if(!canDrag) return;
MouseInfo mouse = Greenfoot.getMouseInfo();
if(! (mouse!=null && mouse.getActor()==this)) return; //If the mouse isn't used on this card, don't do anything
... |
b3e90888-f1e2-4198-9d68-d1b59712b244 | 3 | public static boolean nextNum(int a, int b)
{
return ((b == 3) && (a == 1 || a == 2))
|| b == a+a;
} |
66f926c8-3d6a-4960-bbb7-8b029da98195 | 8 | public AutoCompletion(final JComboBox comboBox) {
this.comboBox = comboBox;
model = comboBox.getModel();
comboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (!selecting) highlightCompletedText(0);
}
});... |
12a62048-348a-4ff1-b4ae-1f9b46610ef5 | 0 | public String getCity() {
return Address.getCity();
} |
72976e93-e3d6-4cd9-a9e5-8d249cced7b7 | 3 | public void readExternal(ObjectInput paramObjectInput)
throws IOException, ClassNotFoundException
{
this.world = ((World)paramObjectInput.readObject());
this.currentScene = this.world.getCurrentScene();
this.ProgramLibrary = ((OrderedTable)paramObjectInput.readObject());
this.ActiveRobots = ((Vect... |
94d30af0-6f94-41e4-bc81-c574afe621eb | 8 | private Properties tooMuchProp(Positions posi, int maxNofForeigners) {
Properties p = new Properties();
if (posi.age > 27) {
p.bitSet.set(OLDS);
} else {
p.bitSet.set(YOUNGSTERS);
}
if (posi.goalies > 3) {
p.bitSet.set(GOALIES);
}
if (posi.defenders > 8) {
p.bitSet.set(DEFENDERS);
}
if (po... |
731fc9a8-fc66-4bf1-9861-d47383cbe1a3 | 5 | public static <T, N extends ModifiableBinaryTreeNode<T, N>> N predecessor(N t)
{
if (t == null)
{
return null;
}
else if (t.getLeft() != null)
{
N p = t.getLeft();
while (p.getRight() != null)
{
p = p.getRight();
}
return p;
}
else
{
N ... |
3a8fdc2c-fa90-47ce-a552-bd73cb047fb0 | 5 | @Override
public void mousePressed(MouseEvent mouseEvent){
if(!controller.isPlaying())
return;
//To change body of implemented methods use File | Settings | File Templates.
int mX = mouseEvent.getX();
int mY = mouseEvent.getY();
int dX... |
0cfb3e9c-a581-46ed-af5c-e7a987425c59 | 6 | public void insertaAntesDeX(T dato, T x){
Nodo<T> nodoQ = this.inicio;
Nodo<T> nodoT = null;
boolean bandera = true;
if(this.inicio == null){
this.inicio = new Nodo<>(dato);
}else{
while(nodoQ.getInfo() != x && bandera){
if(nodoQ.getLiga() != null){
nodoT = nodoQ;
nodoQ = nodoQ.getLiga();
... |
ef36360a-a425-4c72-a2f9-572e13813323 | 8 | public void mainLoop(boolean[] deactivated, int[] ext_disc_reason,
RDPAdapter adapter) throws IOException, RdesktopException,
OrderException, CryptoException {
int[] type = new int[1];
boolean disc = false; /* True when a disconnect PDU was received */
boolean cont = true;
RdpPacket_Localised data = nul... |
f0fe3a7d-edad-4548-947a-2f74ca6c97c6 | 9 | static boolean authenticate( String username , String hashString, PassthroughConnection ptc ) {
for (int i = 0; i < 5; i++) {
try {
String encodedUsername = URLEncoder.encode(username, "UTF-8");
String encodedHashString = URLEncoder.encode(hashString, "UTF-8");
String authURLString = new String( "h... |
bc9693c4-d838-4380-b088-8a5fa7967662 | 1 | public static double[] sqrtVector(
double[] inVector )
{
int m = inVector.length;
double[] outVector = new double[m];
for ( int i = 0; i < m; ++i )
outVector[i] = Math.sqrt(inVector[i]);
return(outVector);
} |
d5e40d33-3a32-427d-81c2-4703a6df622b | 8 | public EvaluationResult evaluate(EvaluationCtx context) {
EvaluationResult result = null;
// look in the right section for some attribute values
switch(target) {
case SUBJECT_TARGET:
result = context.getSubjectAttribute(type, id,
... |
ee5ae4bd-76a1-46c4-8edd-0599558cb61d | 7 | @EventHandler(priority = EventPriority.MONITOR)
public void onSignPlace(SignChangeEvent event) {
String[] line = event.getLines();
if (line[0].equalsIgnoreCase("[Shop]")) {
String newLine = line[0];
String owner = line[3];
String[] shops = Shops.getShopList();
String shop = null;
for (String s : sho... |
62bd7fc7-8572-49eb-a9b5-8cc2edd1f867 | 5 | boolean isLegalBox (int row, int col, int num) {
int x = (row / 3) * 3 ;
int y = (col / 3) * 3 ;
for( int r = 0; r < 3; r++ ) {
for( int c = 0; c < 3; c++ ) {
if(r != row && c != col) {
if( boardArray[y+c][x+r] == num ) {
return false;
}
}
}
}
return true;
} |
e9887bc5-5d64-4655-aa35-08ce15124431 | 9 | public void log (int level, String category, String message, Throwable ex) {
StringBuilder builder = new StringBuilder(256);
long time = new Date().getTime() - firstLogTime;
long minutes = time / (1000 * 60);
long seconds = time / (1000) % 60;
if (minutes <= 9) builder.append('0');
builder.append(min... |
33ff793d-b77e-4c21-aa08-dd0b7d1017ba | 2 | public void movePlayer(Point dir) {
switch (state) {
case IN_OVERWORLD:
game.mapHandler.movePlayer(dir);
game.player.moveWorld(dir);
game.player.senses.move(dir);
break;
case IN_DUNGEON:
game.dungeonHandler.... |
f6527498-5049-473a-8158-d35e307a31f7 | 8 | private static Type getBoxedType(final Type type) {
switch (type.getSort()) {
case Type.BYTE:
return BYTE_TYPE;
case Type.BOOLEAN:
return BOOLEAN_TYPE;
case Type.SHORT:
return SHORT_TYPE;
case Type.CHAR:
return CHARACTER_TYPE;
case Type.INT:
return INTEGER_TYPE;
case Type.FLOAT:
return F... |
236efcbe-d652-4c46-8499-3f9cd51eb544 | 8 | public int getSelection()
{
if(selectionOvalY == 3)
return 1;
else if(selectionOvalY == 27)
return 2;
else if(selectionOvalY == 51)
return 3;
else if(selectionOvalY == 75)
return 4;
else if(selectionOvalY == 99)
return 5;
else if(selectionOvalY == 123)
return 6;
else if(se... |
17732a6a-8996-41f7-81a1-a0abc3a1e96f | 0 | @Inject public MailChimpApi(final Gson gson, @Named("Authorized") final MailChimpConfig config) {
this.gson = gson;
this.apiKey = config.getApiKey();
this.mailchimpHost = "https://" + config.getSubdomain() + ".api.mailchimp.com/2.0";
this.connTimeout = config.getConnTimeout();
} |
1a45f8e1-72dc-468e-93b7-389202e63886 | 8 | public static ArrayList<MstxHeadImage> getHeadImage(int tid) {//
ArrayList<MstxHeadImage> result = new ArrayList<MstxHeadImage>();
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
ResultSet rs = null;
try {
pstmt = con.prepareStatement("select * from mstx_head where tid=?");
pstm... |
30a240be-637d-481e-ac4c-cff506db3cd5 | 1 | protected void setMessageProperties(Message message) throws JMSException {
for (Entry<String, String> entry : properties.entrySet()) {
message.setStringProperty(entry.getKey(), entry.getValue());
}
message.setJMSMessageID(getId());
} |
67b76c72-f77f-49be-88e3-a3dbefb0e84f | 2 | public void gravarDisciplinasEmArquivo(String nomeArquivo)
throws IOException {
BufferedWriter gravador = null;
try {
gravador = new BufferedWriter(new FileWriter(nomeArquivo));
for (Disciplina disciplina : this.disciplina) {
gravador.write(disciplina.getNome() + "\n");
gravador.write(disciplina.ge... |
d73c4b0e-199b-40b1-81bd-95ab81f52e8b | 2 | public static void main(String[] args) throws InterruptedException {
Thread t1 = new Thread(new Runnable() {
public void run() {
try {
producer();
} catch (InterruptedException ignored) {}
}
});
Thread t2 = new Thread(... |
56286f19-46b7-4d97-b3f1-9348028b00b7 | 4 | public void actionPerformed(ActionEvent e) {
if ("next".equals(e.getActionCommand())) {
update(1);
}
if ("forward".equals(e.getActionCommand())) {
Integer num = new Integer(forwardEpochs.getText());
update(num.intValue());
}
if ("restart".equals(e.getActionCommand())) {
scape.frame.dispose();
... |
f51520d5-dfd3-4d0c-918f-e3f56873bc28 | 1 | public Object clone() {
try {
VerifyInfo result = (VerifyInfo) super.clone();
result.stack = (Type[]) stack.clone();
result.locals = (Type[]) locals.clone();
return result;
} catch (CloneNotSupportedException ex) {
throw new AssertError("Clone not supported?");
}
} |
dee4786d-7cad-4f48-b68f-5cb548d52a4f | 3 | public void getHint()
{
higherCards =0;
lowerCards = 0;
unusedCards = 0;
int c;
int a;
List<Card> d = new ArrayList<Card>();
d = Deck.getD();
for (int i = 0; i < d.size(); i++)
{
c = d.get(i).getValue();
a = actualCard.getValue();
if(c > a){
higherCards++;
}
else if... |
f1eaf467-629e-4912-a06a-132bfb1bc85e | 4 | public Quaternion toQuaternion()
{
float trace = m[0][0] + m[1][1] + m[2][2];
float w = 1;
float x = 0;
float y = 0;
float z = 0;
if( trace > 0 )
{// I changed M_EPSILON to 0
float s = 0.5f / (float)Math.sqrt(trace+ 1.0f);
w = 0.25f / s;
... |
e5ca23b6-c51b-482b-ba86-2a5bb6af39d8 | 1 | public void drawSide(Graphics g) {
for (int i=0; i < edges.size(); i++) {
edges.get(i).drawSide(g);
}
} |
33d5befa-999a-4a16-be0c-04c3dddc07c3 | 4 | public void evaluateFailure()
{
boolean failFlag = false;
this.brakeFailure = train.brakeFailure;
this.engineFailure = train.engineFailure;
this.signalPickupFailure = train.signalPickupFailure;
if(train.brakeFailure)
{
this.brakeFailure =... |
d508d32d-caeb-40cf-807c-73a3d24ae6de | 7 | private ElemIdSimilarityPair[] getKwindow(HashMap<Integer, DataRow> train,
DataRow query, SimilarityCalculator simCal, boolean considerTime,
int columnId, long timeWindow) {
ElemIdSimilarityPair[] kwindow;
if (cache.containsKey(query.getId())) {
kwindow = cache.get(query.getId());
} else {
kwindow = n... |
5eb333d9-1114-49a2-9340-8eb0593bf82d | 5 | public static void main(String[] args) {
boolean[] primesUnder1000 = primeBoolArray(1000);
ArrayList<Integer> possibleB = new ArrayList<Integer>();
for (int i = 0; i < primesUnder1000.length; i++)
if (primesUnder1000[i]) {
possibleB.add(i);
possibleB.add(-i);
}
int maxA = 0, maxB = 0, maxPrime = 0... |
566fef6f-8314-43c8-9005-239ab69d040e | 2 | public String toString(){
if(NetworkID == 0){
String nullString = "0";
return nullString;
}
if(((children.get(0).getChildren()==null) ) ) {
return Global.chars[NetworkID];
}
else {
String s1 = children.get(0).toString();
String s2 = children.get(... |
1bf8e8ce-1755-4b9a-9c38-1400e56883a7 | 3 | private void iterativeParseElement (Element elem, HashMap<String, String> hmap) {
String tagName = elem.getNodeName();
NodeList children = elem.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
short nodeType = node.getNodeTy... |
29144210-6375-4228-b32d-b67cdbf7532e | 0 | public int GetCurrentPacketUsingTheBus(int busNumber)
{
return sequence[busNumber];
} |
a39413de-3c95-4090-a64e-9df366def571 | 4 | @Override
public Object invoke( Object object, Method method, Object[] arguments ) throws Throwable
{
assert object.getClass() == interfaceClass;
assert targetClients != null;
final MethodMeta meta = remoteMethods.get( method );
if (meta != null)
{
final RemoteMethodCall call = new RemoteMethodCal... |
b8e12703-cad2-49fe-a385-68fc0c8fd318 | 4 | public void setPlayer1Score(int score){
boolean test = false;
if (test || m_test) {
System.out.println("Drawing :: setPlayer1Score() BEGIN");
}
m_player1Score.setText("" + score);
if (test || m_test)
System.out.println("Drawing:: setPlayer1Score() - END");
} |
4e67a9ea-ca57-419e-be15-3844670931bd | 5 | private void writeObject(ObjectOutputStream out) throws IOException
{
System.out.println("starting writing mask...");
PathIterator it=area.getPathIterator(null);
double[] coords=new double[6];
while(!it.isDone())
{
int type=it.currentSegment(coords);
out.writeInt(type);
if(type==PathIterator... |
8234392d-d012-42ad-8081-cdc259e71b3c | 8 | protected void populateMenu(String paramString)
{
try
{
Class localClass1 = Class.forName(paramString);
Vector localVector = this.state.getRobotPartPatterns();
OrderedTable localOrderedTable = new OrderedTable();
for (int i = 0; i < localVector.size(); i++)
{
RobotPart ... |
f1f0fb00-f0d6-49ad-bf2c-947713981bca | 2 | private void displayHealth(Unit unit)
{
maximumHealthLabel.setText(String.valueOf(unit.getMaximumHealth()));
currentHealthLabel.setText(String.valueOf(unit.getCurrentHealth()));
healthBar.setMaximum(unit.getMaximumHealth());
healthBar.setValue(unit.getCurrentHealth());
if (unit.getCurrentHealth() < Abili... |
559122fd-4e52-4d37-814b-13daf7a143e2 | 6 | private String getValue(JTextArea textArea, JCheckBox checkBox, String value) {
if (checkBox == null) {
if ((textArea == null) || (textArea.getText().length() == 0)) {
return "";
}
} else if ((textArea == null)
|| ((textArea.getText().length() == 0 && !checkBox.isSelected()))) {
return "";
}
re... |
428594e0-a86a-40a3-aa28-f60ffa7d3ec1 | 1 | public void visitAttribute(final Attribute attr) {
buf.setLength(0);
buf.append("// ATTRIBUTE ").append(attr.type).append('\n');
if (attr instanceof ASMifiable) {
buf.append("{\n");
((ASMifiable) attr).asmify(buf, "attr", labelNames);
buf.append(name).append("... |
5f3b8f19-fd79-4f62-801a-e57be83ea93c | 9 | void walk() {
// try until you find an available move
while (true) {
float r = p5.random(1);
if (r < 0.25f && !p5.visited[x-step][y]) {
x -= step;
break;
}
else if (r < 0.50f && !p5.visited[x+step][y]) {
x += step;
break;
}
else if (r < 0.75f && !p5.visited[x][y-step]) {
... |
c33e81ac-3f92-4453-8ad7-202757c383b5 | 1 | protected E handleParseException(ParseException ex, final boolean shouldReportFailure) {
if (shouldReportFailure) {
ex.printStackTrace();
}
return null;
} |
99e3c1cd-022c-48c2-b6b5-44405b77b83c | 9 | public void guardarTransformador() {
if (puntoLuz.getTransformador().getId() == null) {
verificarSeleccionParametricasTransformador();
transformadorFacade.create(puntoLuz.getTransformador());
} else {
if (puntoLuz.getTransformador().getTipoTransformador().getId() != n... |
557c8c17-b40d-4c0a-813e-3bfc6b06bc71 | 3 | public boolean handleRecord(Core root, GedcomRecord record, GedcomReader reader) {
String tag = record.getTag();
Person person = (Person)root;
if (tag.equalsIgnoreCase("SEX")) {
person.setMale(record.getContent().equalsIgnoreCase("M"));
return true;
} else if (tag.equalsIgnoreCase("FAMS")) {
person.... |
c613eabf-cd79-4603-a4ed-3378879fb398 | 6 | @Override
public double evaluate(AnnotationIndex<Annotation> scores) {
Iterator<Annotation> scoreIterator = scores.iterator();
List<AnswerScore> ansScores = new ArrayList<AnswerScore>();
int numberCorrect = 0;
while (scoreIterator.hasNext()) {
AnswerScore ansScore = (AnswerScore) scoreIterat... |
bcc484f0-c503-40d5-a018-ee2f91503621 | 6 | public void drawVisible(Graphics2D g,Punkt3D p)
{
Punkt2D prot = new Punkt2D((int)(p.getX()/kartskala),(int)(p.getY()/kartskala));
for(int i = (int)prot.getX()-visuellGrad+1;i <= (int)prot.getX()+visuellGrad-1;i++)
{
for(int j = (int)prot.getY()-visuellGrad+1;j <= (int)prot.getY(... |
deb4ef42-7487-47b7-ad99-f6e5fde9a9d6 | 0 | public void setRequiredSkillRatings(List<SkillRating> requiredSkillRatings) {
this.requiredSkillRatings = requiredSkillRatings;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.