method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a11a4a1c-af9a-4ac9-9463-43cca2e973e0 | 6 | public void addLockUnlockUnitsForThread1() {
Iterator unitIt = this.unitChain.iterator();
while (unitIt.hasNext()) {
Unit u = (Unit) unitIt.next();
Stmt s = (Stmt) u;
Iterator boxIt = s.getUseBoxes().iterator();
while( boxIt.hasNext() ) {
final ValueBox box = (ValueBox) boxIt.next();
... |
13d6213a-88e2-46db-97bd-2a80d0b011d8 | 6 | public void generateHardwareSetAlternativesGeneration(int generation) {
hardwareSetAlternatives.clear();
generateDummyHardwareAlternatives();
for (int i = 0; i < Math.min(generation, cpuAlternatives.size()); i++)
for (int j = 0; j < Math.min(generation, hddAlternatives.size()); j++)
for (int k = 0; k < Mat... |
5a276121-0c63-4742-ae25-79357b20d168 | 2 | private void appendDataElement(Node node, StringBuffer buf, String value, String line_ending) {
if (value == null || value.length() <= TEXT_THRESHOLD) {
return;
}
indent(node, buf);
buf.append("\t");
buf.append("<").append(ELEMENT_DATA).append(">");
XMLTools.writeCDATA(buf, value);
buf.append("</").app... |
58eb2436-743b-4cc7-8b67-39e11c55f1fe | 1 | public boolean delete(Libros l){
PreparedStatement ps;
try {
ps = mycon.prepareStatement("DELETE FROM Libros WHERE codigo=?");
ps.setString(1, l.getCodigolibro());
return (ps.executeUpdate()>0);
} catch (SQLException ex) {
Logger.getLogger(LibrosCR... |
a61252c9-c803-44bc-a0a6-2ea51da4ffd6 | 0 | @Test
public void testParseUserAgentString() {
testReferrers(emptyOrNull, Application.UNKNOWN);
testReferrers(hotmail, Application.HOTMAIL);
testReferrers(gmail, Application.GMAIL);
testReferrers(yahooMail, Application.YAHOO_MAIL);
testReferrers(horde, Application.HORDE);
testReferrers(compuserve, Applicat... |
1fcce964-4589-4f97-b92d-a529397610d0 | 1 | public Result Send(Submit submit) {
if (this.LoginResult.ErrorCode == 0) {
return this.pconnect.Send(submit);
} else {
return this.LoginResult;
}
} |
004a5bee-0657-4f54-a683-16205d52e040 | 5 | @Override
public void createNewUser(String username, String password) throws MyEmptyUserNameException, MyEmptyPasswordException, MyUserAlreadyExistException {
if(username == null || username.isEmpty()) throw new MyEmptyUserNameException();
if(password == null || password.isEmpty()) throw new MyEmptyPas... |
f6d64ac1-25c2-4067-8bee-9d0d3765a115 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
55e55c4e-1887-44cf-8670-0413f5ca9735 | 5 | public void detectUnarySign(){
for(int i = 0; i<PIF.size()-2; i++){
String temp1 = PIF.get(i).token;
String temp2 = PIF.get(i+1).token;
String temp3 = PIF.get(i+2).token;
if( PIF.get(i).token.matches("[=\\(\\[\\{<>\\-\\+]") && PIF.get(i+1).token.matches("-") && PIF.get(i+2).code == 1 ){
in... |
5b965079-05a9-4362-8f7d-c46dd15c1988 | 9 | public Expression compile(Executable exec) throws XPathException {
// top level elements in the stylesheet are ignored
if (toplevel) return null;
FixedElement inst = new FixedElement(
resultNameCode,
namespaceCodes,
inherit... |
73b7da7a-ebbc-427d-b4a8-fb72328606b1 | 5 | public static List<String> checkMoney(String p, List<String> itemList) {
List<String> newList = new ArrayList<>();
for(String str: itemList) {
if(!str.startsWith("money ")) {
newList.add(str);
continue;
}
String[] strA = st... |
e6585a97-b910-404d-8ef9-4cdc9cd9108c | 2 | private String readStringAMF0() throws EncodingException
{
int length = (readByteAsInt() << 8) + readByteAsInt();
if (length == 0)
return "";
byte[] data = readBytes(length);
// UTF-8 applicable?
String str;
try
{
str = new String(data, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
... |
acebd179-15df-4414-9b45-557ed5176aea | 6 | public GroupParser(Parameter parameter, Class<?> clazz, List<Parameter> parameters)
{
this.parameter = parameter;
parameter.offer(Properties.GREED, 0);
parameter.offer(Properties.TYPE, clazz);
ArrayList<Parameter> flags = new ArrayList<>();
ArrayList<Parameter> nonPositiona... |
2bce9214-e62f-4fb8-a853-56861dbe5b03 | 1 | public synchronized void startDecompiler() {
if (decompileThread == null) {
decompileThread = new Thread(this);
decompileThread.setPriority(Thread.MIN_PRIORITY);
progressBar.setMinimum(0);
progressBar.setMaximum(1000);
progressBar.setString("decompiling");
progressBar.setStringPainted(true);
dec... |
8341e811-b577-4509-8908-5f34375f0ce3 | 9 | private void addReadingOrderGroup(Element parent, Group group, int index) /*throws XMLStreamException*/ {
String groupElementName;
if (group.isOrdered())
groupElementName = index >= 0 ? DefaultXmlNames.ELEMENT_OrderedGroupIndexed : DefaultXmlNames.ELEMENT_OrderedGroup;
else
groupElementName = index >= 0 ? D... |
71f28345-4074-4027-b73d-8deefd580603 | 4 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel("com.alee.laf.WebLookAndFeel");
} catch (UnsupportedLookAndFeelException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace(... |
a643c2a5-fed1-4ad1-9e29-9a6d4f0f5182 | 4 | public static Boolean getBoolean(Object boo) {
if (boo instanceof Boolean) {
return (Boolean) boo;
} else {
String str = getString(boo);
try {
if (str.toLowerCase().equals("true"))
return true;
else if (str.toLowerCase().equals("false"))
return false;
} catch (Exception ignored) {
}... |
57695220-b770-4620-bb9b-5ba4f97795b8 | 2 | public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
if (filterConfig != null) {
if (debug) {
log("filtroAutenticacion:Initializing filter");
}
}
} |
556b59df-6756-4387-b40e-38290b24611c | 1 | private void handleSaveMenuItemClick() {
JFileChooser fileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("Xml files", "xml");
fileChooser.setFileFilter(filter);
if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
this.controller.onSaveMenuItemCli... |
c09087b7-9bc3-4313-8b99-f7a4ee2f6998 | 2 | public Signaler() {
// Create the socketpair for signaling.
make_fdpair ();
// Set both fds to non-blocking mode.
try {
Utils.unblock_socket (w);
Utils.unblock_socket (r);
} catch (IOException e) {
throw new ZError.IOException(e);
}
... |
a08d9e87-d58e-4f05-81fa-42d29aa37012 | 5 | @Override
public void keyReleased(KeyEvent event)
{
switch(event.getKeyCode())
{
case KeyEvent.VK_UP:
upPress = false;
break;
case KeyEvent.VK_DOWN:
downPress = false;
break;
case KeyEvent.VK_LEFT:
leftPress = false;
break;
case KeyEvent.VK_RIGHT:
rightPress = false;
br... |
4084dba5-4b36-443d-a243-36db813c3ad9 | 1 | public void close() {
if (w != null) {
w.close();
}
} |
c259cb8d-e273-440b-8306-7152d000fdb6 | 8 | public static void main(String[] args) {
Scanner inputScanner = null;
try {
inputScanner = new Scanner(new File(args[0]));
} catch (FileNotFoundException e) {
System.err.println("Invalid input file.");
}
while (inputScanner.hasNextLine()) {
int input = Integer.parseInt(inputScanner.nextLine());
Li... |
f9c2d21f-c681-4fe2-9dc6-fc9c54a8d670 | 6 | public List<Class<? extends Item>> getItems() {
List<Class<? extends Item>> items = new ArrayList<Class<? extends Item>>();
for (Class<? extends Item> genericItem : this.itemGrid) {
if (genericItem == null) {
continue;
}
items.add(genericItem);
... |
28d4ecdf-6942-4c6b-a74f-e6320b3a2a3a | 2 | public void clearDots() {
for (int row = 0; row < NCELLS; row++) {
for (int col = 0; col < NCELLS; col++) {
grid.cells[row][col].removeDot();
}
}
} |
9cbf8de1-7ff5-4e25-8689-02c44fee3630 | 2 | public static FileGenerator createGenerator(String systemType){
if(systemType.equals("windows")){
return new GeneratorCSVFileForWindows();
}else if(systemType.equals("linux")){
return new GeneratorCSVFileForLinux();
}
throw new UnsupportedOperati... |
ca972853-89b6-412c-86c5-89487fad2066 | 7 | public void setUpFile() {
removeAll();
m_fileChooser.setFileFilter(new FileFilter() {
public boolean accept(File f) {
return f.isDirectory();
}
public String getDescription() {
return "Directory";
}
});
m_fileChooser.setAcceptAllFileFilterUsed(false);
try{... |
f6a934ca-2316-44ff-a9fb-f5a1bb1ba208 | 1 | void write(DataOutputStream out) throws IOException {
out.writeShort(name);
out.writeInt(info.length);
if (info.length > 0)
out.write(info);
} |
5db2981c-9460-454e-8d87-3b935b33ebfe | 2 | public boolean isMeasurable(int[] stones, int maxWeight) {
boolean result = true;
boolean[] measurabilities = weighingWithStones(stones, stones.length - 1, maxWeight);
for(int i = 1; i < measurabilities.length; i++){
boolean measurability = measurabilities[i];
result = result && measurability;
}
... |
3829c1f6-f702-4990-8fb8-0c57d63cf3ad | 2 | public FastICAApp( )
{
// initialize main frame
FastICAFrame frame = new FastICAFrame();
// center the frame
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = frame.getSize();
if ( frameSize.height > screenSize.height )
frameSize.height = screenSize.height;
if ( frameSi... |
0b2f37e7-e5dc-47b9-9cc9-55cf16c9d0a2 | 5 | private static void scanSubDirs(File[] files) throws IOException
{
if (files != null)
{
for (File f : files)
{
if (f.isDirectory())
{
File[] subDirectory = f.listFiles();
scanSubDirs(subDirectory);
... |
f31bc6e1-b063-461d-b1e7-6a312c4778aa | 6 | public boolean equals(final Move pRH) {
if (this.mType != pRH.mType) {
if (this.mType != MoveType.MOVE_PLAYER.getInternalValue() &&
pRH.mType != MoveType.MOVE_PLAYER.getInternalValue()) {
//System.err.println("Return from equals false1");
return false;
}
} // End if
if (this.mData.size() != pRH.... |
c701aad4-915d-45ff-8d72-4a3474a6c389 | 6 | private int doubleCompare(double d1, double d2) {
// see if the numbers equal each other
if (d1 == d2) {
// these are not NaNs, and therefore we just need to check that
// that they're not zeros, which may have different signs
if (d1 != 0)
return 0;
... |
0d1b1a29-d1b9-46f9-aff6-4961678b7a39 | 8 | public static void PromptUser() {
for (int i = 0; i < magic.getItems().length; i++) {
if (magic.getItems()[i] != null) {
System.out.println(magic.getItems()[i].toString());
}
}
// Prompt the user, to select an item.
Scanner inputReader = new Scanner(System.in);
System.out.print("What item would y... |
ecaf862c-4f64-4d07-a00f-c01d0a9e7930 | 1 | public static void setScene(EForm scene) {
if(stages.isEmpty())
Model.getIntance().empty(); //Если меняем сцену единственного окна, то обнуляем текущую игру
stage.hide();
stage.setTitle(scene.getTitle());
stage.setResizable(scene.isResizable());
stage.setScene(scene.g... |
9bb31cb4-0462-4e6b-bb40-57d700535cba | 0 | public static Contacts getInstance() {
return contacts;
} |
003b00c0-a845-41cc-b9e3-a7b28ce16cf1 | 4 | public void parseAmmo(String[] temp) {
switch(ammoType) {
case PROJECTILE:
this.speed = Float.parseFloat(temp[15]);
this.distance = Float.parseFloat(temp[16]);
this.piercing = Boolean.parseBoolean(temp[17]);
this.damage = Float.parseFloat(temp[18]);
break;
case HOMING:
this.speed = Float.parseFl... |
55e21d5c-9b0d-4ee8-8344-150afbfe9f8b | 1 | private double getWordScore(String s) {
double score = 0;
for (int i = 0; i < s.length(); i++) {
score += getCharScore(s.charAt(i));
}
return score / s.length();
} |
318cd73d-90ae-4b18-8e97-81f06ef94668 | 4 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
ProxiedPlayer player = (ProxiedPlayer) sender;
if (plugin.blockedTeleports.contains(player.getServer().getInfo().getNa... |
733daba9-b2e6-4863-a9bb-d73db4fe446a | 8 | private static void svm_group_classes(svm_problem prob, int[] nr_class_ret, int[][] label_ret, int[][] start_ret, int[][] count_ret, int[] perm)
{
int l = prob.l;
int max_nr_class = 16;
int nr_class = 0;
int[] label = new int[max_nr_class];
int[] count = new int[max_nr_class];
int[] data_label = new int[l]... |
89ca6dc9-882b-44fd-9d73-e084bcb51930 | 0 | public void setName(String name) {
this.name = name;
} |
2ea215c9-e50a-4959-9555-c83acbeaaf4f | 5 | String show(Genome genome) {
StringBuilder sb = new StringBuilder();
// Genome
sb.append(genome.getVersion() + "\n");
// Chromosomes
for (Chromosome chr : genome)
sb.append(chr + "\n");
// Genes
ArrayList<Gene> genes = new ArrayList<Gene>();
for (Gene gene : genome.getGenes())
genes.add(gene);
... |
1c6bc972-bdd6-4350-b8b0-beb3490b106d | 6 | private boolean didJump(Checker checker, Tile startTile, Tile endTile)
{
if(checker.isRed() || checker.isKing())
{
if((startTile.getY() - TWO_TILE) <= (endTile.getY()) )
return true;
}
else if(checker.isBlack() || checker.isKing())
{
... |
79cc68a2-95b3-4368-a01f-f0e15b19955f | 9 | private final void method1335(ByteBuffer class348_sub49, int i,
byte i_8_) {
anInt2287++;
if (i == 1)
anInt2302 = class348_sub49.getShort();
else if ((i ^ 0xffffffff) == -3)
class348_sub49.getUByte();
else if (i != 3) {
if ((i ^ 0xffffffff) == -5) {
((Class174) this).anInt2289 = class348_sub4... |
9c02dff6-808e-4a91-b427-cebd2029ac79 | 7 | protected boolean equals(Class<?> conParamType, Class<?> paramType) {
if ((conParamType.isPrimitive() && paramType.isPrimitive())
|| !(conParamType.isPrimitive() || paramType.isPrimitive())) {
// return equals if conParamType and paramTypes are all primitive or
// neither of them are primitive
return co... |
35b12618-7c88-4ec3-b97d-073788a20911 | 1 | public void test_add_long_long() {
assertEquals(567L, MillisDurationField.INSTANCE.add(567L, 0L));
assertEquals(567L + 1234L, MillisDurationField.INSTANCE.add(567L, 1234L));
assertEquals(567L - 1234L, MillisDurationField.INSTANCE.add(567L, -1234L));
try {
MillisDurationField.... |
966fe62b-0a71-4160-9816-ee9edaad8280 | 2 | public void onEnable()
{
conf = new ConfigurationValues();
c = this.getConfig();
//Set hooks to other plugins
factionsPlugin = (P) Bukkit.getServer().getPluginManager().getPlugin("Factions");
worldguardPlugin = (WorldGuardPlugin) Bukkit.getServer().getPluginManager().getPlugin("WorldGuard");
//Set de... |
430ab7cb-93e4-4789-afe5-22dce32d064e | 6 | public Imagen getImagenCR(int windowCenter, int windowWidth) {
Imagen imgObj = new Imagen();
int alto = rasterDicom.getHeight();
int ancho = rasterDicom.getWidth();
int minX = rasterDicom.getMinX();
int minY = rasterDicom.getMinY();
imgObj.setFormato("P2");
imgObj... |
71b30be6-715f-4b8c-9eaf-3f9b01260cb6 | 0 | public String setRealSub()
{
System.out.println("This is From Proxy1impl !");
return "Proxy1impl";
} |
e8990ceb-f617-495b-b5af-97c1f23a377e | 6 | void rgbToHsv() {
int r = rgb >> 16;
int g = (rgb >> 8) & 0xff;
int b = rgb & 0xff;
// Value
value = Math.max(r, Math.max(g, b));
// Saturation
int mini = Math.min(r, Math.min(g, b));
if (value == 0) {
saturation = 0;
} else {
saturation = (int) ((float) (value - mini) / (float) value * 255.f)... |
d15cdea2-c2af-4c0d-a7d3-81a8e372e94e | 5 | public void writeMatchAllocationsFile(MatchList mList)
{
// create file writer object
FileWriter matchAllocationsWriter = null;
try
{
try
{
// instantiate file writer object
matchAllocationsWriter = new FileWriter(matchAllocationsFile);
matchAllocationsWriter.write(String.format("%-10s%-14s... |
1bb26ab2-6854-45e7-8fcb-57de15e65814 | 0 | private Combination<Colors> generateAttemptCombination5() {
List<Token<Colors>> attemptTokens = new ArrayList<Token<Colors>>();
attemptTokens.add(new Token<Colors>(Colors.O));
attemptTokens.add(new Token<Colors>(Colors.G));
attemptTokens.add(new Token<Colors>(Colors.B));
attemptTokens.add(new Token<... |
15eddc9d-cfb9-45b7-b1fd-0b29c13a2339 | 8 | public static void print_solution2(int line) {
if(line <= 0) {
return;
}
long[][] array = new long[line][];
for(int i=0; i<line; i++) {
array[i] = new long[i+1];
for(int j=0; j<i+1; j++) {
if(j==0 || j==i) {
array[i][j] = 1;
} else if(i>=1) {
array[i][j] = array[i-1][j-1] + array[i... |
4fdfe0c9-37d1-47b5-a734-8c05e76f805d | 3 | public void init()
{
switch (this.foreground_type)
{
case ResourceId.wood:
this.miningDuration = c_duration_wood;
break;
case ResourceId.stone:
this.miningDuration = c_duration_stone;
break;
case ResourceId.berryFull:
this.miningDuration = c_duration_berry;
break;
}
} |
157a1cb0-40f2-406b-973d-e913533fd02d | 9 | public String toString() {
StringBuffer buf = new StringBuffer("select ");
if(distinct_) buf.append("distinct ");
//buf.append(select_.toString());
int i;
buf.append(select_.elementAt(0).toString());
for(i=1; i<select_.size(); i++) {
buf.append(", " + select_.elementAt(i).toString());
... |
6df4177f-b29b-4ad2-bd13-61c278277d43 | 2 | @Override
public ArrayList<Object> show(int id) {
conn = SQLconnect.getConnection();
ArrayList<Object> tns = new ArrayList<Object>();
try {
String sql = "SELECT * FROM hero_image order by(id) desc limit %d,%d";
sql = String.format(sql, id , id +30);
Statement st = (Statement) conn.createStatement(); ... |
4f47a14d-0b60-4bc6-99be-24cc1ddd22d2 | 2 | public void preparer(int nbrDeCartes){
int nbrDePuissance = (nbrDeCartes / 4);
for (int i = 1; i <= 4; i++){
for(int j=1; j<=nbrDePuissance; j++){
listeDeCarte.add(new Carte(i, j));
}
}
melangerLesCartes();
} |
b4a9c49f-930c-4664-8608-8c80ce64ff0f | 5 | private void aggregate(String hier) {
List<RiskSensitivity> riskByHier;
try{
riskByHier = this.riskSensitivityDao.getRiskByHier(hier);
}catch (ReadTimeoutException e){
LOG.info("Caugh Timeout - continuing");
return;
}
// Run some groupings.
Map<String, Double> pathSensNameMap = new HashMap<String,... |
60342daf-6623-4726-8412-65fa1860a508 | 3 | public boolean isValid() {
return (x >= 0 && x < Board.SIZE && y >= 0 && y < Board.SIZE);
} |
3e6943ed-189e-4e1d-aaea-7ade61ac7bfd | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuilder sb = new StringBuilder();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
89f20a16-68c8-4615-bfb2-40bb78880621 | 6 | @Override
protected void heapHeapify(int nodeIndex) {
int leftIndex = getLeftChildIndex(nodeIndex);
int rightIndex = getRightChildIndex(nodeIndex);
if (rightIndex >= capacity) {
return;
}
/*
To compare nodes with their natural ordering cast them into ... |
7009b8ad-c96f-4e89-83fd-c529675dcc2c | 4 | private static void consumer(){
Random r = new Random();
while (true){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (r.nextInt(10) ==0){
Integer value;
try {
value = que.take();
System.out.... |
b22f0245-2fb5-4db6-b8e9-472ab21ffe4d | 8 | public int getArticleCount(int area) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs =null;
int result = 0;
try{
conn = getConnection();
pstmt = conn.prepareStatement("select count(*) from board where area=?");
pstmt.setInt(1, area);
rs = pstmt.executeQuery()... |
6a93eb2c-3c64-441e-9372-cf593dba123f | 5 | @Override
protected void extraerMetadatos()
{
this.info.open(this.ficheroTemporal);
//>>ASIGNAR METADATOS DE VIDEO GENERAL
//>>3 Duración
Integer segundo = Integer.parseInt(info.get(MediaInfo.StreamKind.Video, 0,"Duration",MediaInfo.InfoKind.Text, MediaInfo.InfoKind... |
d398477a-7bb9-47e8-b197-186c81f8a44d | 8 | public String searchEmployee() throws Exception{
String[] params = new String[3];
if(getType()!=null &&!("".equalsIgnoreCase(getType().trim()))){
params[0]= "%"+getType()+"%";
}else{
params[0]= getType();
}
if(getTitle()!=null &&!("".equalsIgnoreCase(getTitle().trim()))){
params[1]= "%"+getTitle()+... |
f3c82223-e085-4131-a1fb-7a89b11d407e | 6 | private boolean vaihdaJarjestyksessa() {
int montakoLoytyi = 0;
for (Paikka paikka : sitsit.getPaikat()) {
for (Paikka kohdePaikka : sitsit.getPaikat()) {
if (paikka.equals(kohdePaikka) == false) {
if (this.muutosOnTapahtunut = true) {
... |
20521b75-d8f4-4e77-9d69-0cad2c52571b | 3 | public usb.core.Device getDevice (String portId)
throws IOException
{
// hack to work with hotplugging and $DEVICE
// /proc/bus/usb/BBB/DDD names are unstable, evil !!
if (portId.startsWith("\\\\?")) {
synchronized (busses) {
Enumer... |
c36187bc-3829-4ef1-937c-64bc41213a5b | 1 | public boolean isReader() {
return opcode == Opcode.GETFIELD || opcode == Opcode.GETSTATIC;
} |
96ef1d4c-dd6f-4dd5-a030-6898edfaf3a5 | 9 | private void pageView(ResponseHandler respHandle, String incStart, String incEnd) {
try {
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=TemperatureSystemDB;user=JulianL;password=Indrak";
Con... |
17a0fc16-b31c-4e25-8086-066ec9f54450 | 5 | static final void method3253(int i, int i_0_, int i_1_, Class var_class) {
Class357 class357
= Message.aClass357ArrayArrayArray2029[i][i_0_][i_1_];
if (class357 != null) {
for (Class148 class148 = ((Class357) class357).aClass148_4396;
class148 != null;
class148 = ((Class148) class148).aClass148_2038) ... |
1e093513-8b44-4f46-b5b1-4f1c747d213f | 8 | private void findCaps(int width, int height)
{
int xCap = -1;
int yCap = -1;
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
if (level[x][y] == TILE_LEVEL)
{
int roads = 0;
... |
377b2aef-b10d-4281-9baf-c229a52b42c3 | 6 | public ParserContainer (Config_Reader configreader, Logger log)
throws FileNotFoundException, IOException, Exception
{
this.log = log;
if(log_level >= 1) log.log(1, key, "parsing file ...", "\n");
if(log_level >= 2) log.log(2, key, "merge all Files ...", "\n");
allthecode = new MergeFiles(log,... |
268d2c96-ea1d-48e5-8ef5-8cd2a13cb318 | 2 | public void addRestriction(Restriction newRestriction)
{
//Check that it hasn't been added yet
for(Restriction r: restrictions){
if(r.getIdentifier().equals(newRestriction.getIdentifier()))
throw new IllegalArgumentException("There's already a restriction with that identif... |
c90288ff-d012-450b-a373-4102f977e2f1 | 8 | public ResultOfCodeComparison compareWith(Code attemptToGuessTheCode)
{
boolean[] pegsToProcessInCurrentCode = new boolean[NUMBER_OF_PEGS_IN_THE_CODE];
boolean[] pegsToProcessInAttempToGuessTheCode = new boolean[NUMBER_OF_PEGS_IN_THE_CODE];
for (int pegNumber=0; pegNumber<NUMBER_OF_PEGS_IN_THE_CODE; pegNumber... |
4f0f4192-9b4c-4509-9de4-9090b2ff9882 | 1 | protected void setStock(int stock) throws Exception{
if(stock<0){
throw new Exception("El stock tiene que ser superior a 0.");
}else{
this.stock = stock;
}
} |
36445708-bf4b-47f7-873d-18e35e27ea26 | 9 | public void appendPath(String p_addToPath) throws MalformedURIException {
if (p_addToPath == null || p_addToPath.trim().length() == 0) {
return;
}
if (!isURIString(p_addToPath)) {
throw new MalformedURIException(Messages.getString("URI.pathContainsInvalidCharacterShort")); //$NON-NLS-1$
}
... |
4da37c16-577a-41ad-8c30-2b2c16ee90f5 | 8 | private double [] calculateRegionProbs(int j, int i) throws Exception {
double [] sumOfProbsForRegion =
new double [m_trainingData.classAttribute().numValues()];
for (int u = 0; u < m_numOfSamplesPerRegion; u++) {
double [] sumOfProbsForLocation =
new double [m_trainingData.classAttribute... |
f0f67b3f-9c0e-4ac1-885e-656c7e8bc0b6 | 4 | public static void main(String[] args) {
Library myLibrary = new Library();
MySQLBookDAO bDao;
initializeDB(myLibrary);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
/*
//myLibrary = new Library();
myLibrary = new Library("input.csv");
... |
1187732a-c0d4-435a-98dd-68166d2c4d1c | 9 | @Override
protected Integer val09(Double val) {
if(val<30) return 1;
if(val<60) return 2;
if(val<80) return 3;
if(val<100) return 4;
if(val<120) return 5;
if(val<150) return 6;
if(val<200) return 7;
if(val<450) return 8;
if(val<1000) return 9;
return 10;
} |
0f6c4742-824d-499b-be33-0bdef9827484 | 3 | @Override
public void actionPerformed(ActionEvent e) {
DocumentInfo docInfo = ((RecentFilesListItem) e.getSource()).getDocumentInfo();
// Get the protocol from the FileProtocolManager by using the protocolName
String protocolName = PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PROTOCOL_N... |
7a2453d7-131b-4bfe-a099-f1f0d354f530 | 7 | public static void modifyAccountNames(List<Account> accountList, Accounts accounts) {
if (!accountList.isEmpty()) {
for (Account account : accountList) {
String oldName = account.getName();
boolean retry = true;
while (retry) {
Stri... |
95b63e80-1b1f-4b21-b776-f24230f508d7 | 6 | public Reference_devices readReferenceDevices(JsonReader reader) throws IOException {
Number fridge = null;
Number hvac = null;
Number lightning = null;
Number main = null;
Number otemp = null;
reader.beginObject();
while (reader.hasNext()) {
String key = reader.nextName();
... |
857e7923-6b3b-49b2-99ed-ffea51b59e60 | 0 | public void stop() {
super.stop();
midiPlayer.close();
soundManager.close();
} |
a9d14b73-0301-458e-915d-e8d7680ba4ea | 9 | @Override
public String toString() {
final String deliciousnessStr;
final String typeStr = this.type.toString();
final String shellStr = hardShell ? "hard" : "soft";
final String crunchinessStr;
if (this.deliciousness < 0.25f)
deliciousnessStr = "not very delish"... |
ba5aeeeb-b225-488e-af19-f9ba79550a26 | 8 | public vector2d getCloserPosition(vector2d _pos,double sizeX,double sizeY){
double dist1,dist2,dist3,dist4;
double dist11,dist22,dist33,dist44,dist00 ;
vector2d close;
double bestDist;
dist1=this.getSDistance(_pos);
dist2=this.getSDistance(_pos.getVec().add(new vector2d(sizeX,0)));
if (dist1... |
79cb172f-72da-4b0d-b6e4-4e5e4e113421 | 4 | Image fontImage (Font font) {
Image image = new Image (display, IMAGE_SIZE, IMAGE_SIZE);
GC gc = new GC(image);
Rectangle bounds = image.getBounds();
gc.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
gc.fillRectangle(0, 0, bounds.width, bounds.height);
gc.setBackground(display.getSystemColor(SWT.CO... |
f28a4b07-c66e-45ab-86e3-519fb029354d | 8 | final FEMFunction _compileFrame_() throws IllegalArgumentException {
this.skip();
int count = 0;
while (true) {
if (this._compileType_() < 0) throw this._illegal_(null, "");
final String name = this._compileName_();
if (name != null) {
if (this._compileIndex_(name) >= 0) throw this._illegal_(null, " ... |
1d2ade38-4199-4f59-8980-0d970554313a | 6 | void stringSetup(String str) {
StringBuilder buffer = new StringBuilder();
int len = str.length();
for (int i = 0; i < len; i++) {
char ch = str.charAt(i);
if (ch == '\\') {
// get next character
ch = str.charAt(++i);
if (Character.isDigit(ch)) {
int endPos = i;
// check the next two... |
3bb4f664-5c5b-462f-81c9-46d078d44547 | 3 | @Override
public void run() {
try {
getStreams();
while (true) {
String msg = input.readLine();
if (msg == null) {
System.out.println("Lost connection to client!");
break;
}
proces... |
5ac16ebc-e96d-40de-8516-a52a6dab8e9f | 6 | public void setBrandingPosition(Position position) {
if (position == null) {
this.branding_position = UIPositionInits.BRANDING.getPosition();
} else {
if (!position.equals(Position.TOP) && !position.equals(Position.LEFT) && !position.equals(Position.RIGHT)
&&... |
f726dfd9-5788-4b7b-a527-959452d712cf | 5 | public static boolean hasTool(Player player, ItemStack tool)
{
if(tool == null) return true;
for(ItemStack i : player.getInventory().getContents())
{
if(tool.isSimilar(i))
{
return true;
}
}
for(ItemStack i : player.getInven... |
8b7f5c85-c3a1-4817-b190-56264ea1201f | 3 | public LogController(int logNum, String logFormat, int abnormalRandomValue) {
int threadNum;
int logNumThread = logNum;
if ((logNum % threadDivide) != 0) {
threadNum = (logNum / threadDivide) + 1;
} else {
threadNum = logNum / threadDivide;
}
//ConsoleUI bar = new ConsoleUI(logNum, "Log Load Genera... |
d81ff5dd-415b-494e-a494-23281269274b | 1 | @Test
public void testClearAll() {
irFile.loadIR(0, testInstr); //Load testInstr to index 0
irFile.loadIR(1, testInstr); //Load testInstr to index 1
irFile.loadIR(2, testInstr); //Load testInstr to index 2
irFile.clear(); //Should clear all indexes
for (int i = 0; i < 3; i++) {
assertNull(irFile.read(i... |
81f1a5fd-e4a5-4cff-af28-13b324ae842e | 7 | private List<Path> depthFirstSearch(String start, String end, List<String> pathSoFar, List<Path> paths, Collection<Road> city) {
String currentNode = pathSoFar.get(pathSoFar.size() - 1);
for (Road r : city) {
String nextNode = null; // Declare this in here so it nulls every time
// currentNode is Neighborhood... |
2d3275de-dcb2-470b-88a6-fe5040bb11d3 | 2 | private static char [] zzUnpackCMap(String packed) {
char [] map = new char[0x10000];
int i = 0; /* index in packed string */
int j = 0; /* index in unpacked array */
while (i < 124) {
int count = packed.charAt(i++);
char value = packed.charAt(i++);
do map[j++] = value; while (--co... |
b1d3f61e-d7bc-45e0-943a-63543426900d | 0 | public int getWest(){
return this.west;
} |
8e5dd3be-3c5e-4ae6-80e6-1a86d3c26dba | 4 | public Twister(String[]chosenKeys, Gui copy)
{
gui = copy;
for(int x=0; x<10; x++)
{
if(chosenKeys[x].compareTo("") == 0)
{
//empty entry
altMod[x] = false;
ctrlMod[x] = false;
keyNumber[x] = -1;
}
else if(chosenKeys[x].substring(0,1).compareTo("A") == 0)
{
altMod[x] = true;... |
9b161d25-d35d-4f2f-bb4c-6f99a737fa57 | 0 | public void setContent(byte[] content) {
mContent = content;
} |
b2c96b71-5829-448d-b560-16e5d89a0e7a | 2 | public static String getString(ByteBuf packetPDU) {
String value = "";
byte nextChar = -1;
while ((nextChar = packetPDU.readByte()) != SEPARATOR) {
value += ((char) nextChar);
}
return value.isEmpty() ? null : value;
} |
cc53c0a3-6fce-4abd-9459-c11691426ac0 | 7 | public static Integer eq(Object o1, Object o2){
if (o1 == null && o2 == null){
return 1;
} else if ((o1 == null && o2 != null) || (o1 != null && o2 == null)){
return 0;
} else {
return o1.equals(o2) ? 1 : 0;
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.