method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b9cd2e7d-06a8-425b-8ccf-24ee8e229f24 | 0 | public int getOrthoWidth() {
return 800;
} |
94ef0306-a8f9-49fe-84bf-eff999242603 | 2 | @Override
public void updateScreen() {
if (isSlowLoad) {
//TODO
} else {
manager.removeScreen(this);
for (GameScreen g : screens) {
manager.addScreen(g);
}
}
} |
a43cbd34-ca62-4b7a-b932-a61ebb0073bb | 9 | @Override
public void processing() throws IOException {
DataInputStream reader = new DataInputStream(inputStream);
PrintStream writer = new PrintStream(outputStream);
String line = null;
while(!suspending){
switch(step) {
case 0:
if((line = reade... |
53f78dde-c9fc-420e-ad47-c92372e14b71 | 1 | public static void main(String[] args) {
SharedObject counter = new SharedObject();
System.out.println("Main thread started: "
+ Thread.currentThread().getName() + ", id="
+ Thread.currentThread().getId());
// t.setDaemon(true);
for (int i = 0; i < 10; i++) {
Thread t = new Thread(new NamePrinter(cou... |
81ff70f1-e799-42f8-926e-6fe42a94ec61 | 8 | public static double[][] readMatrix(Path path, HamaConfiguration conf,
int rows, int columns, int blockSize) {
int finalRows = getBlockMultiple(rows, blockSize);
int finalCols = getBlockMultiple(columns, blockSize);
double[][] matrix = new double[finalRows][finalCols];
SequenceFile.Reader reader = null;
... |
704f3cff-6669-4bf7-9578-c674d6387a9c | 4 | private static void algorithmPrompt(Graph g) {
String algorithmChoice;
if (!g.hasNegativeWeights()) {
while (true) {
System.out.println("Which algorithm to use?");
System.out.println(" b - Breadth-first search");
System.out.println(" d - Dijk... |
e4335dd7-e6bc-4459-9e86-c4162bf81e79 | 9 | public Element writePropertyNode(Element parent, Object o, String name) throws Exception {
Element node;
PropertyNode pnode;
Vector children;
int i;
Element child;
// for debugging only
if (DEBUG)
trace(... |
fd3c289a-b42c-407a-b2a2-a0200b9a6005 | 5 | @Override
public void execute(CommandSender sender, String worldName, List<String> args) {
this.sender = sender;
if (worldName == null) {
error("No world given.");
reply("Usage: /gworld timefrozen <worldname> <true|false>");
} else if (!hasWorld(worldName)) {
reply("World not found: " + worldName);
... |
6533034a-dc5d-4c4b-8831-e21ee069e4bd | 7 | public void validacion(String dni, String apellidoPaterno, String apellidoMaterno, String nombre, String email, String telefono, String celular, String fechaContacto ) throws BusinessException
{
String mensaje = "";
if (apellidoPaterno==null || apellidoPaterno.isEmpty())
mensaje += "\nEl... |
ac8d111a-7976-4431-a9fa-bd024342612a | 5 | public static Map<String, String> getAttirbutes(String str) {
Map<String, String> result = new HashMap<String, String>();
StringTokenizer eTokens = new StringTokenizer(str, "=");
if(!eTokens.hasMoreTokens()) {
return result;
}
String rest = eTokens.nextToken();
while (eTokens.hasMoreTokens()) {
if (re... |
11386b56-dec8-4fdd-9322-7c970ac4b155 | 0 | public boolean calculateChances(int p) {
int percent=p;
int r = numGen.nextInt(100);
return r<=p;
} |
96d1c503-265d-493f-9511-a9cfeae623f6 | 6 | public static int minDepthOf(Node root) {
if(root == null)
return -1;
if(root.left == null && root.right == null)
return 0;
else if(root.left == null)
return 1+minDepthOf(root.right);
else if(root.right == null)
return 1+minDepthOf(root.left);
else
return (minDepthOf(root.left)>minDepthOf(ro... |
2fe1e7c4-de40-4c6a-93b7-f5c02bdc1088 | 0 | @Override
public String getBirth() {
return super.getBirth();
} |
d4b848d5-68eb-48e6-9ede-c645144562e3 | 1 | public String toString() {
if (Type.PRINT_TRUNCATED) {
return (Type.truncatedName(this));
} else {
return desc;
}
} |
2f72521b-325d-4ed5-8aad-e0a5c88be0cf | 2 | private int getDistanceToNearestOpponent() {
nearestOpponent = null;
int distance = LONGDISTANCE;
Opponent[] opponents = getOpponents();
for (int i=0; i<opponents.length; i++) {
int d = (int)Vector3D.getDistance(getLocation(), opponents[i].getLocation());
if (d < distance) {
distance = d;
nearestO... |
edb9947d-f49a-4da5-81e7-c2daa4adc58e | 3 | public void crearInvasores(){
Invasor.setnTotalVivos(0);
int colum = juego.getnColum();
int filas = juego.getnFilas();
int nivel = juego.getNivel();
//Aquí controlaremos que la velocidad nunca sea mayor a 20 <-~->
while(nivel >= 20){ nivel -= 20; }
... |
e461916a-41d3-45e5-a7b6-c996a4b4d2ae | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Pflanze other = (Pflanze) obj;
if (bodenart != other.bodenart)
return false;
if (hoehe != other.hoehe)
return false;
if (name == null) ... |
f7c518f0-53fe-4652-ba41-93dd65750184 | 3 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onBorderTeleport(PlayerTeleportEvent event) {
Player player = event.getPlayer();
User user = EdgeCoreAPI.userAPI().getUser(player.getName());
if (user == null)
return;
if (event.getCause().equals(TeleportCause.ENDER_... |
510a4431-3e7c-495c-8030-5adf3515e468 | 7 | public static String getMapName(int id) {
switch(id) {
case 1:
return "Summoner's Rift (Summer)";
case 2:
return "Summoner's Rift (Autumn)";
case 3:
return "The Proving Grounds";
case 4:
return "Twisted Treeline (Original)";
case 8:
return "The Crystal Scar";
case 10:
return ... |
a3c6bdab-2afc-4764-9c1f-d232bdfcf186 | 1 | protected Replacer(BufMgr javamgr)
{
mgr = javamgr;
int numbuf = javamgr.getNumBuffers();
state_bit = new STATE[numbuf];
for(int i=0; i<numbuf; i++) {
state_bit[i] = new STATE();
// Original code forget to set state
// state_bit[i].state = Available;
}
head = -1;
} |
b888ce81-5e22-45e0-90e7-a4c5d3feba4d | 9 | private void downloadFile() {
BufferedInputStream in = null;
FileOutputStream fout = null;
try {
URL fileUrl = new URL(this.versionLink);
final int fileLength = fileUrl.openConnection().getContentLength();
in = new BufferedInputStream(fileUrl.openStream());
... |
7d8a26c2-1974-4b65-b4b5-36b649f22d98 | 8 | public Game(int gameSize, int winLength) {
int rand;
this.gameSize = gameSize;
this.winLength = winLength;
if (gameSize >= 3 && winLength >= 3) {
field = new EField[gameSize][gameSize];
for (int i = 0; i < gameSize; i++)
for (int j = 0; j < gameSi... |
865a00dc-64fd-46d3-b421-baa759b5637a | 8 | private static void readPairsTable( byte[] data, int p,
int dataTableOffset, MVD mvd ) throws Exception
{
// record any pairs declaring themselves as parents
HashMap<Integer,Pair> parents = new HashMap<Integer,Pair>();
HashMap<Integer,LinkedList<Pair>> orphans =
new HashMap<Integer,LinkedList<Pair>>();
... |
b625a3bf-bf7d-490f-981f-b5840e8b552a | 5 | public ServerHeartbeatManager() {
logger.info("Loading ServerHeartbeatManager...");
config = Config.getInstance();
serverId = config.getInt("server.id");
// create server record if it doesn't exist
Connection dbConnection = DbHelper.getMainDb().getConnection();
if (dbConnection == null) {
throw(new Ru... |
4ce2a815-9f4c-4f56-b7d8-8fd7dc6590da | 3 | private void addBadColorToMap(TreeMap<Integer, TreeSet<Integer>> badColors, TreeMap<Integer, TreeSet<Integer>> newBadColors)
{
for(Map.Entry<Integer, TreeSet<Integer>> entry : newBadColors.entrySet())
{
TreeSet<Integer> tmp = badColors.get(entry.getKey());
if(tmp == null)
{
tmp = new TreeSet<Integer>(... |
9d32a94a-c871-4d7d-af0d-b0082c8eb111 | 6 | private void restart() {
try {
String java = System.getProperty("java.home") + RestartDemo.SEPARATOR + "bin" + RestartDemo.SEPARATOR + "java";
List<String> args = ManagementFactory.getRuntimeMXBean().getInputArguments();
StringBuffer jvmArgs = new StringBuffer();
for (String arg : args) {
// -agentli... |
3868d341-3ac1-4b45-a2ae-aecd500ac35c | 1 | public boolean realizaMovimiento(HttpServletRequest request) {
HttpSession sesion = request.getSession();
String movimiento = request.getParameter("movimiento");
System.out.println(movimiento);
String fecha = request.getParameter("fecha");
String login = (String) sesion.getAttrib... |
6b8551a6-bf8a-4a65-b9a3-607b1e1932e8 | 6 | @SuppressWarnings("unchecked")
public void print() {
System.out.println("** Metadata **");
for (final Map<String, Object> m : _data) {
System.out.println(" + ALBUM");
for (final String key : m.keySet()) {
final Object o = m.get(key);
// Most stuff is string, we can just dump that out.
if (o inst... |
229e0b58-2f1b-434d-b2fa-f3d1eff347d2 | 5 | private void initBuses(List<Bus> buses, String filePath) {
try {
File file = new File(filePath);
if (file.isDirectory()) {
System.out.println(file.getAbsolutePath());
String[] filelist = file.list();
for (int i = 0; i < filelist.length; i++) {
File readfile = new File(filePath + "/" + filelist[... |
f4c0424a-2964-409e-a37c-c23e5e1d479e | 5 | public HashMap<Integer, Integer> selectPertinence(ArrayList<Integer> lint) {
HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
if (lint.size() != 0) {
Map<Integer, Integer> res = new HashMap<Integer, Integer>();
String listint = new String();
listint = "... |
c40dff17-f2c6-4ae4-95be-73d35f959017 | 3 | public String[] sortList(String[] names) {
String tempName;
boolean complete = false;
while(complete) {
complete = true; // assume that you done
for (int i = 0; i < names.length-1; i++) {
int compareResult = names[i].compareTo(name... |
34346a16-8461-4e4a-a071-67af63f086b0 | 3 | public ArrayList<Rectangle2D> getAllFlatBoxes() {
if(noChildren()) {
ArrayList<Rectangle2D> tempBoxes = new ArrayList<Rectangle2D>();
if(this.flat)
tempBoxes.add(this.box);
return tempBoxes;
} else {
ArrayList<Rectangle2D> tempBoxes = new ArrayList<Rectangle2D>();
for(int x = 0; x < this.chil... |
6793005b-c55f-4f22-8b6e-442f3a463073 | 5 | public static void init(String[] args) {
try {
// Initial Parameter Check
boolean dev_mode = false, log_mode = false;
if (args != null) {
for (String a : args) {
if (a.equals("DEV_MODE")) dev_mode = true;
if (a.equals("LOG_ENABLED")) log_mode = true;
}
}
UtDebug debug = new UtDebug(d... |
3e85c575-d661-44f3-984e-9f4797671754 | 2 | public boolean isComplete() {
return (this.started) && (this.remainingFiles.isEmpty()) && (this.remainingThreads.get() == 0);
} |
61250b66-54ba-4deb-a1b7-199918b3a227 | 7 | private String[] inputParse(String string) {
char lastChar = string.charAt(0);
String s = string + " ";
boolean insideString = false;
String word = "";
LinkedList<String> input = new LinkedList<String>();
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == '\"') {
insideString = !insideString... |
665570ad-a4a9-41eb-893c-0b606a3a7dcc | 6 | public void intArrayToLevel(int[][] array) {
if(array.length < 1 || array[0].length < 1) return;
if(array.length != width || array[0].length != height) {
width = array.length;
height = array[0].length;
tiles = new Tile[width][height];
}
width = array.length;
height = array[0].length;
for (int y = 0... |
f3d8778b-1968-45fd-81c0-5d291e038d97 | 7 | void removeChild (Node child)
{
if (_occurs_ == child)
{
_occurs_ = null;
return;
}
if (_occursTo_ == child)
{
_occursTo_ = null;
return;
}
if (_number_ == child)
{
_number_ = null;
... |
12a2fe23-45d2-4706-a689-fd52ab30b1ee | 0 | public void buildComponents() throws IOException {
initEffects();
makePaths();
makeParticle();
paths = new Group(path, path2, path3, path4, path5);
paths.setOpacity(0.6);
// progress.setFill(Color.WHITE);
message = new Text(loadingMessage);
message.setFont(Font.font("Arial", FontWeight.BOLD, 20));
... |
694a10fb-bba3-4863-be5d-77caafe09b56 | 6 | public Mobile pickedMobile(final HUD UI, final Viewport port, Base base) {
//
// You may want to use some pre-emptive culling here in future.
Mobile nearest = null ;
float minDist = Float.POSITIVE_INFINITY ;
for (Mobile m : mobiles) {
if (m.indoors() || ! (m instanceof Selectable)) continue ;... |
252dec22-089a-446e-9c28-1ab7481f5b00 | 5 | private void computerVsComputerSetUp(int numberOfTimes){
int compOneScore = 0;
int compTwoScore = 0;
for(int i = 0; i < numberOfTimes; i++){
ComputerPlayer computer1 = new ComputerPlayer(stateValues, "1");
ComputerPlayer computer2 = new ComputerPlayer(stateValues, "2");
Random random = new Random();
P... |
19ca4c7e-fcd3-40d3-85d0-a4d14578cbc0 | 4 | ConnectionLoggerImpl(final File log_dir, final String route_name, final Integer connection_id) {
// System.out.debug("ConnectionLoggerImpl.<init>(" + log_dir + ", " + route_name + ", " + connection_id + ")");
if (!log_dir.exists())
{
log_dir.mkdirs();
}
if (!log_dir.exists())
{
throw new E... |
37e17399-0606-4cc0-8df2-1738bf63f2d9 | 1 | public void visit_invokeinterface(final Instruction inst) {
final MemberRef method = (MemberRef) inst.operand();
final Type type = method.nameAndType().type();
pop(type.paramTypes().length);
pop(); // Pop receiver
if (type.returnType() != Type.VOID) {
push(inst);
}
} |
06c11d39-d26c-4f64-a4f3-05e245868182 | 1 | public boolean opEquals(Operator o) {
return (o instanceof OuterLocalOperator && ((OuterLocalOperator) o).local
.getSlot() == local.getSlot());
} |
675edb2d-7790-4cc0-8f42-1891299cb039 | 4 | public static int task4() {
int largest = 0;
for (int i = 999; i >= 100; i--) {
for (int j = 999; j >= 100; j--) {
final int product = i * j;
if ((product > largest) && (validPalindrome(product))) {
largest = product;
}
}
}
r... |
79ddb278-fa86-477a-9ea4-8af434b695a6 | 6 | private void initonce() {
if (initedonce)
return;
initedonce = true;
try {
Resource.addurl(new URL("https", getCodeBase().getHost(), 443, "/res/"));
} catch (java.net.MalformedURLException e) {
throw (new RuntimeException(e));
}
if (!Co... |
7967481a-a74c-423a-965b-d969903081b3 | 5 | @Override
public List<Projeto> Buscar(Projeto obj) {
String sql = "select a from Projeto a";
String filtros = "";
if(obj != null){
if(obj.getId() != null){
filtros += "a.id = " + obj.getId();
}
if(obj.getTitulo() != null){... |
75afb62f-6803-49b9-9008-b86b74258c10 | 1 | public void Debug(String data) {
if (DebugEnabled) {
logger.info("[BirthdayGift] DEBUG: " + data);
}
} |
57879b04-3762-4b29-97f7-48aa3f643444 | 1 | public void setEventEnabled(String event, boolean enabled) {
String value = enabled ? "true" : "false";
rootElement.xpath("events/" + event).attr("value", value);
} |
f6db6c15-417a-4eeb-8330-aadab94f1f0f | 7 | public static void generateSchedule(LoanAccount loanAccount)
throws Exception {
if (loanAccount.getPlafond().compareTo(BigDecimal.ZERO) != 1) {
throw new Exception("Plafond harus lebih besar dari 0.");
}
if (loanAccount.getTenure() <= 0) {
throw new Exception("Tenure <= 0. Seharusnya > 0.");
}
if (... |
3869d3d1-c92c-4b09-b2af-575dbf6871f9 | 9 | public void renumber() {
boolean[] used = new boolean[Settings.num_districts];
for( int i = 0; i < used.length; i++) {
used[i] = false;
}
int[] renumbering = new int[Settings.num_districts];
for( int i = 0; i < renumbering.length; i++) {
String s = JOptionPane.showInputDialog("Enter new district number ... |
38599f7a-eccb-4117-a5d6-6a0089d5f3d8 | 4 | @Test
public void testRapportagesMaken() throws Exception {
File f = new File("C:/Users/Jacky/Dropbox/Themaopdracht 4/CSVTestdata/RapportagesMakenTest.csv");
if (f.exists() && f.isFile()) {
String hoogstebtwperproduct;
String gemiddeldebtwperproduct;
String hoogstebtwpertransactie;
String gemiddeldebtw... |
ffa3b1d8-e13b-4946-9d66-d31f7e7599b8 | 3 | public static boolean insideBounds(Tile[][] grid, Point start, Point end)
{
return (start.x < grid.length && start.y < grid[start.x].length
&& end.x < grid.length && end.y < grid[end.x].length);
} |
d66d1913-0a9f-4085-8e25-2a99944e548a | 3 | private static void printAngle(double x, DecimalFormat formatDegrees, DecimalFormat formatMinutes, DecimalFormat formatSeconds,
PrintStream ps, boolean hasSign) {
char signum = (x < 0.0) ? '-' : '+';
if (x < 0.0)
x = -x;
int xd = (int) x;
x -= (double) xd;
x *= 60.0;
int xm = (int) x;
... |
425dd5b3-4342-4844-aed2-75894fc89a5e | 1 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int jarCount = in.nextInt();
int iterations = in.nextInt();
long sum = 0;
while (iterations > 0) {
long a = in.nextInt();
long b = in.nextInt();
long k = in.nextInt();
// As same amount is added, it is just simple m... |
adcbf49f-2af5-4e29-9cea-3bbc0db26827 | 7 | private synchronized void receiveAd(Sim_event ev)
{
if (super.reportWriter_ != null) {
super.write("receive router ad from, " +
GridSim.getEntityName(ev.get_src()) );
}
// what to do when an ad is received
FloodAdPack ad = (FloodAdPack) ev.get_data();
... |
c3eaf50a-97e7-4e14-a81b-3cb273cda89b | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelProdSubCategory other = (TabelProdSubCategory) obj;
if (!Objects.equals(this.subCategoryId, other.su... |
e10aa512-71f1-45c2-ae31-a85a022be4d1 | 1 | public List<FieldVisitMeasurement> getFieldVisitMeasurement() {
if (fieldVisitMeasurement == null) {
fieldVisitMeasurement = new ArrayList<FieldVisitMeasurement>();
}
return this.fieldVisitMeasurement;
} |
7e44e68e-bd5c-474f-a7b4-7052cacf0770 | 3 | public static String[] askHashSet(String msg) {
LinkedList<String> res = new LinkedList<String>();
boolean carryOn = true;
System.out.println(msg + " (empty line to finish) :");
while (carryOn) {
String aux = ask();
if (aux.equals(""))
carryOn = false;
else if ( Draft.isHash(aux) )
res.add( aux... |
39df6e0d-e40e-49ba-95cc-9b15acbec471 | 7 | public final void gestionEtat(final Etat e) {
switch (e) {
case INIT_JSON_XML:
jTextArea1.setText("");
jTextArea2.setText("");
jTextFieldPathIN.setText("");
jTextFieldPathOut.setText("");
jButtonParcourirIN.setEnabled(true);
jButtonValider.setEnabled(true);
jTextFieldPathIN.setEnabled(true);
... |
098af9b6-1d67-4eb8-8c3d-c35536264975 | 2 | public boolean checkObjective(UQuest plugin, Location point, String type, String name){
//system.out.println(type + " _____ " + name);
//system.out.println(this.objectiveTypes.contains(type + ":" + name));
if(this.objectiveTypes.contains(type + ":" + name)){
Objective obj = this.getObjectiveFromTypes(type, nam... |
f6faee61-dc2c-44af-8899-8e18a24717a8 | 5 | public static String toString(int numPrev){
String retStr = "";
if (numPrev <= 0 || numPrev > history.size()){ // Prevent index out of range error
numPrev = 1;
}
Object[][] deltaBoard = history.get(history.size() - numPrev);
retStr += "History #: " + history.size() + "\n";
for (int y = 0;y < 8;y++) {
... |
18338c49-014a-448b-9580-cc94e4d425ab | 0 | public void setCsaValorTotal(Double csaValorTotal) {
this.csaValorTotal = csaValorTotal;
} |
f6dc039c-84f4-4e6a-8461-93cf2db232e7 | 7 | private static void clipBoundary(final S2Polygon a,
boolean reverseA,
final S2Polygon b,
boolean reverseB,
boolean invertB,
boolean addSharedEdges,
S2PolygonBuilder builder) {
S2PolygonIndex bIndex = new S2PolygonIndex(b, reverseB);
bIndex.predictAdditionalCalls(a.getNumVerti... |
b2bed17a-5b0c-4eaf-abf9-843693a50ac3 | 2 | private int initSpeed() {
int resSpeed = 0;
String vitesse = jTextField3.getText();
try {
resSpeed = Integer.parseInt(vitesse);
if (resSpeed < 300) {
jTextField3.setText("300");
resSpeed = 300;
}
} catch (NumberFormatExc... |
e6fa904c-c023-488f-ae63-4b94948aac4c | 7 | public int[] recoverMath(int level, int con, int inte, int wis, int str, boolean isHungry, boolean isThirsty, boolean isFatigued, boolean isSleeping, boolean isSittingOrRiding,boolean isFlying,boolean isSwimming)
{
/* # @x1=stat(con/str/int-wis), @x2=level, @x3=hungry?1:0, @x4=thirsty?1:0, @x5=fatigued?0:1 # @x6=asl... |
3318fcbf-76b2-496d-a1e5-51b56990e864 | 8 | private void setPieceToMove(ChessPiece p)
{
if ((p == null) || (p.getColor() != turn))
return;
// if there was a previous set of moves,
// reset the UI from it
this.removeMoveHighlights();
moves_from = p.nextMoves(this);
if (moves_from == null)
{
System.out.printf("No valid moves for piece a... |
261ccc9d-3016-4b27-b464-bdb55803601e | 0 | public RoundsLabel()
{
RoundManager.getInstance().addListener(this);
setText(INIT_TEXT + 1);
setFont(DefaultUIProvider.getQuestionPriceFont());
} |
b99d1967-4a83-4171-a636-9e971763b9cd | 8 | public static void startCast() {
if (!skill && target == null) {
target = getTarget(range);
}
if (skill && !aiming) {
aiming = true;
}
if (stopAiming)
aiming = false;
if (!aiming) {
if (!skill) {
if (target != null) {
isCasting = true;
cast = 0;
}
} else {
stopAiming ... |
d7268494-e18f-418d-ad14-a067d71bb3d6 | 7 | private void validarDatos(String nombre, String descripcion, String permisos) throws BusinessException {
String mensaje = "";
if(nombre == null || nombre.isEmpty())
mensaje += "Identificacion no puede ser nula o vacia\n";
if(descripcion == null || descripcion.isEmpty())
m... |
f2f905bb-1473-4ffe-a6b5-93aad8b33f33 | 2 | public static void main(String[] args) throws Exception {
ObjectInput in = new ObjectInputStream(new FileInputStream(new File(".", "X.file")));
Object mystery = in.readObject();
in.close();
System.out.println(mystery.getClass());
//Reflection
Method[] methods = mystery.g... |
c22a8f90-85e8-47b4-b293-25630d0c35d7 | 5 | public static void main(String[] args)
{
// 驱动程序名
String driver = "com.mysql.jdbc.Driver";
// URL指向要访问的数据库名zjwdb_173271
String url = "jdbc:mysql://182.18.22.37:3306/Ak610152753";
// MySQL配置时用户名
String user = "Ak610152753";
// Java连接MySQL配置时的密码
String password = "Ak610152753";
try
{
// 加载驱动程序
... |
f727bc19-cbe6-49c7-99c4-fad1eb11dbf6 | 7 | private void mainMenuBorrower() throws Exception {
int input;
Boolean valid = false;
while (!valid) {
System.out.println("");
System.out.println("===========================");
System.out.println("What do you want to do ?");
System.out.println(" ... |
8ec1d282-8cba-44f3-85a6-3fb1dbfcc0c4 | 1 | private void algorithmButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_algorithmButtonActionPerformed
try{
double cool = Double.parseDouble(coolRateField.getText());
s = dc.MetropolisAlgorithm(s, cool, Integer.parseInt(maxStudentsField.getText()));
fit... |
4de5a8a5-c0b6-41bc-92f6-bf7f1966b3e9 | 8 | public ArrayList<Human> array_query(LinkedList<Human> toCheck) {
// Создадим массив для тех кто проходит фильтры
ArrayList<Human> answer = new ArrayList<Human>();
// В исходном массиве перебираем все элементы и каждый проверям, если
// подходит - добавляем в результирующий массив
for (Human human : toCheck)... |
d367c99c-ef36-40e8-9f43-feb2e0e32b8a | 7 | public String getfirstStreamFromURL(String streamURL) {
String url = "";
String tmp = "";
Boolean breakLook = false;
try {
// create URL
URL stream = new URL(streamURL);
// create Stream and open it to url
readStream = stream.openStream();
// create an buffered reader
bw = new BufferedReade... |
055dc7e2-d98c-4a92-be91-8aa38a94d5c2 | 4 | public static void setBaseViewPath(String baseViewPath) {
if (baseViewPath == null)
throw new NullPointerException("the baseViewPath can not be null");
if ("".equals(baseViewPath)) {
throw new IllegalArgumentException("the baseViewPath can not be blank");
}
baseViewPath = baseViewPath.trim();
if (!ba... |
2be2e25b-3065-4928-8b39-55bb3d58f059 | 2 | public double variance_as_Complex_ConjugateCalcn() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
Complex[] cc = this.getArray_as_Complex();
double variance = Stat.varianceConjugateCalcn(cc)... |
51b7706b-f554-451a-a094-bf9f051e901c | 4 | public static int[] selectSort(int[] arr) {
int swapCount = 0;
for (int i = 0; i < arr.length; i++) {
int temp = i;
for (int j = i + 1; j < arr.length; j++) {
if (arr[j] < arr[temp]) {
temp = j;
}
}
if (t... |
79094161-b56e-41f1-9de8-15164f8c0acb | 6 | public void update() {
// 重力で下向きに加速度がかかる
vy += Map.GRAVITY;
// x方向の当たり判定
// 移動先座標を求める
double newX = x + vx;
// 移動先座標で衝突するタイルの位置を取得
// x方向だけ考えるのでy座標は変化しないと仮定
Point tile = map.getTileCollision(this, newX, y);
if (tile == null) {
// 衝突するタ... |
cca68a6e-b6d3-4435-a149-a1af81dace48 | 2 | public static OpenMRSDataProperties getInstance() throws IOException {
if (instance == null) instance = new OpenMRSDataProperties();
String propertyFile = System.getenv("OPENMRS_PROP_FILE");
if (propertyFile == null) throw new IllegalArgumentException("Environment variable OPENMRS_PROP_FILE mis... |
c7cf375b-7b45-4b47-b89e-904c15afc435 | 9 | static void lsp_to_curve(float[] curve,
int[] map, int n, int ln,
float[] lsp, int m,
float amp, float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0;i<m;i++)lsp[i]=Lookup.coslook(lsp[i]);
int m2=(m/2)*2;
i=0;
while(i<n){
int k=map[i];
float p=.7071067812f;
f... |
18466172-8487-4620-88cd-f75a97a6c575 | 1 | public boolean InsertarArea(Area p){
if (p!=null) {
cx.Insertar(p);
return true;
}else {
return false;
}
} |
95b18f66-270c-4c74-97d4-32d3940074e5 | 8 | public boolean search(int[] A, int target) {
if (A == null) {
return false;
}
int start = 0;
int end = A.length;
boolean result = false;
while (start < end) {
int mid = start + (end - start) / 2;
if (A[mid] == target) {
result = true;
break;
}
if (A[start] < A[mid]) {
if (A[start]... |
063da58e-226c-4c8a-b7d8-489e27b38732 | 3 | public float[] fromCIEXYZ(float[] colorvalue) {
float x = colorvalue[0];
float y = colorvalue[1];
float z = colorvalue[2];
float[] mask = new float[1];
if (Math.round(x) > 0 || Math.round(y) > 0 || Math.round(z) > 0) {
mask[0] = 1;
} else {
... |
63cfba32-0130-46b6-b9a8-669353d3f69a | 7 | public static boolean isPrime(int n){
if(n<2 || (n>2 && n%2==0) || (n>3 && n%6%4!=1)) return false;
for(int i=3; 1L*i*i<=n; i+=2) if(n%i==0) return false;
return true;
} |
0b36f861-b5a9-4ed5-9bd8-ca50bc3d6500 | 3 | private void loadProperties() {
InputStream is = new Object() {
}.getClass().getEnclosingClass().getResourceAsStream(Constants.PROPERTIES_FILE.toString());
try {
properties.load(is);
LOG.info("Validator Properties are successfully loaded.");
} catch (IOException e) {
LOG.error("Failed to load Validator... |
0b98df22-f654-4fc3-88a7-423a2477c6d6 | 0 | public void addStep()
{
StepCounter++;
} |
d0613c75-9fd5-4e01-b346-45020e77cad9 | 0 | public int getY() {
return y;
} |
c1a735f3-720f-4c2b-af72-995262b55679 | 0 | public boolean isIntelligentCellAlive() {
return getCellAt(intelligentX, intelligentY);
} |
1fc0d5f3-29f3-4bee-87a4-750354882a9e | 9 | public static Object getValueClass(char ch)
{
switch (ch)
{
case '@':
return PatternOptionBuilder.OBJECT_VALUE;
case ':':
return PatternOptionBuilder.STRING_VALUE;
case '%':
return PatternOptionBuilder.NUMBER_VALUE;
... |
11758b7c-bca9-4974-989e-47173a2e09b4 | 9 | public static Stella_Object accessStellaHashTableSlotValue(StellaHashTable self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == Stella.SYM_STELLA_SIZE) {
if (setvalueP) {
self.size = ((IntegerWrapper)(value)).wrapperValue;
}
else {
value = IntegerWrapper... |
5b2a2c58-4c5d-431b-960f-e0e3d1e7a6ee | 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();
... |
f4e55f28-2833-48f2-9ec3-2ad92df3273d | 0 | public String getServiceID() {
return ServiceID;
} |
cc8483d1-564c-44ea-b9c2-6949512ae681 | 5 | void combinationSum2Rec(int [] num, int target, int start, Deque<Integer> deque){
if(target == 0){
res.add(new ArrayList<Integer>(deque));
return;
}else if(target < 0) return;
for(int i = start; i < num.length; ++i){
// note that i > start makes sure the firs... |
9328fba9-a72a-4f8d-b5cb-e958d3fbdea7 | 7 | private void processPolyLine(RdpPacket_Localised data,
PolyLineOrder polyline, int present, boolean delta) {
if ((present & 0x01) != 0)
polyline.setX(setCoordinate(data, polyline.getX(), delta));
if ((present & 0x02) != 0)
polyline.setY(setCoordinate(data, polyline.ge... |
9c1d0348-7605-4891-8135-70165cc7fe76 | 7 | @Override
public String getMixedString(UnicodeSet localeAlphabet, int length) {
if(length == 0) {
return "";
} else if(length < 0) {
throw new IllegalArgumentException("Length must be greater than 0.");
}
ArrayList<int[]> alphabets = this.getCharacterSetList();
if(localeAlphabet != null) {
alpha... |
d09801ec-f677-47fb-90e6-56bb6269dfe7 | 6 | @Override
public void keyTyped(KeyEvent e) {
JTextField f = (JTextField) e.getSource();
// Only accept numbers and decimals in the average mark JTextField
if ( (!Character.isDigit( e.getKeyChar() )) && (e.getKeyChar() != '.') ) {
e.consume();
// Set and display a helpful tooltip
f.... |
52cefb49-9e9e-44d3-9ac7-b54c5abdba8b | 8 | private Node procedureCall() throws ParserException {
enterRule(NonTerminal.PROCEDURE_CALL);
expect(TokenKind.COLON);
expect(TokenKind.COLON);
Token functTok = expectRetrieve(TokenKind.IDENT);
Symbol decSym = symbolTable.inParentScopes(functTok.getLexeme(), "procedure");
if (decSym == null) p... |
c14978af-f13b-4b0b-9117-270fe59e3b33 | 8 | final public void updateColumn() throws ParseException {
/*@bgen(jjtree) updateColumn */
SimpleNode jjtn000 = new SimpleNode(JJTUPDATECOLUMN);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
columnAndAlias();
jj_consume_t... |
a9652094-c639-4379-90d8-e47aa9d5eb5b | 9 | private void printImage(int width, int height, PrintWriter outP) {
// out = "";
if (width < height) {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (i == width - 1 && j == height - 1) {
// out += toString(image[j][i]);
outP.print(toString(image[j][i]));
} else ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.