method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b6b62e70-886b-4d6f-b623-92eacf2a5b95 | 5 | private void down() {
if ((currentRow + rowOffset) < grid.getNumRows() - 1) {
if (grid.getLineLength(currentRow + rowOffset + 1) <= currentCol
+ colOffset) {
if (colOffset > grid.getLineLength(currentRow + rowOffset + 1)) {
colOffset = grid.ge... |
d5323e6c-19ec-48f2-b310-4e8d0c845464 | 3 | public static void Checkout(Patient currentP,PatientProfilePage profileP){
ArrayList<Integer> prescriptions= new ArrayList<Integer>();
ArrayList<Integer> unpaid= new ArrayList<Integer>();
int Pid= currentP.getPid();
Prescription bean= new Prescription();
bean.setPid(Pid);
prescriptions= DatabaseProcess.g... |
c1c59839-a2ad-4069-869f-ca02bb5e281b | 9 | public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException {
select = visitor.optimize(select, contextItemType);
adoptChildExpression(select);
regex = visitor.optimize(regex, contextItemType);
adoptChildExpression(regex);
flags = visitor... |
7f0edd1f-0364-4926-86ca-ad8f6c8681a7 | 7 | private void findStraight() {
boolean inStraight = false;
int rank = -1;
int count = 0;
for (int i = Card.NO_OF_RANKS - 1; i >= 0 ; i--) {
if (rankDist[i] == 0) {
inStraight = false;
count = 0;
} else {
if (!inStraig... |
df8aa385-b285-4a94-bdda-f482dff49d50 | 4 | private void checkReceived() {
OnDemandRequest onDemandRequest;
synchronized (aClass19_1370) {
onDemandRequest = (OnDemandRequest) aClass19_1370.popFront();
}
while (onDemandRequest != null) {
waiting = true;
byte buf[] = null;
if (clientIn... |
923d5558-d10f-4b9f-a4a1-a21e5fb52ed4 | 4 | public static Employee getEmployeeFromDatabaseById(Integer paramId){
String id = null;
String name = null;
String surname = null;
String dateOfBirth = null;
String salary = null;
String salarytype = null;
Employee employee = null;
try {
resul... |
5d8be4e5-5f43-4f8d-b81b-700a25c08374 | 9 | public static void main(String[] args) throws Exception {
String tmpStr;
String filename;
DataSource source;
Instances data;
int classIndex;
Capabilities cap;
Iterator iter;
if (args.length == 0) {
System.out.println(
"\nUsage: " + Capabilities.class.getName()
+ ... |
0d4602e3-6036-4b58-b831-68c08c7c9f9e | 8 | public void reloadItems(Client c) {
for(GroundItem i : items) {
if(c != null){
if (c.getItems().tradeable(i.getItemId()) || i.getName().equalsIgnoreCase(c.playerName)) {
if (c.distanceToPoint(i.getItemX(), i.getItemY()) <= 60) {
if(i.hideTicks > 0 && i.getName().equalsIgnoreCase(c.playerName)) {
... |
2d34d6e1-98d9-4a89-bb31-1bf7816278ed | 0 | public Month getMonthStored()
{
return monthStored;
} |
1b89cea9-5ac0-4b5e-af6b-c5420471cf8a | 4 | public void registriereFeature(Feature feature)
{
if(feature instanceof TickListener)
_tickListeners.add((TickListener) feature);
if(feature instanceof BefehlAusgefuehrtListener)
_befehlAusgefuehrtListeners
.add((BefehlAusgefuehrtListener) feature);
if(feature instanceof RaumGeaendertListener)
_kon... |
eb888929-93b6-45ba-926d-afd71e660a96 | 7 | public static RedisBigTableKey inflate(byte[] inflate)
{
boolean rowFinished = false;
boolean cfFinished = false;
List<Byte> rowBytes = new ArrayList<Byte>();
List<Byte> cfBytes = new ArrayList<Byte>();
List<Byte> cqBytes = new ArrayList<Byte>();
for (byte b : inflate)
{
if (!rowFinished && b == Utils... |
f4dfe518-7559-440a-add5-67e78bd9de49 | 0 | public int getTailleX() {
return tailleX;
} |
9c122e86-3218-4e33-a36c-3142252d5451 | 3 | @Override
public boolean reachesDestination(Packet p) {
// TODO Auto-generated method stub
Iterator<Edge> edgeIt = p.origin.outgoingConnections.iterator();
GenericWeightedEdge e;
while(edgeIt.hasNext()){
e = (GenericWeightedEdge) edgeIt.next();
if(e.endNode.equals(p.destination)){
etxLink = e.getEtx(... |
94d1a733-7848-474e-8c95-2434ec0948a2 | 6 | public ModifierMatcher forceAccess(int accessModif, boolean andAbove) {
if (andAbove) {
if (accessModif == Modifier.PRIVATE)
return this;
if (accessModif == 0)
return this.and(Modifier.PRIVATE, 0);
ModifierMatcher result = this.and(Modifier.PUBLIC, PUBLIC);
if (accessModif == Modifier.PROTECTED)
... |
9c308846-8f23-4dff-8d39-050d4f7eaa16 | 9 | protected void calcRepulsion()
{
int vertexCount = vertexArray.length;
for (int i = 0; i < vertexCount; i++)
{
for (int j = i; j < vertexCount; j++)
{
// Exits if the layout is no longer allowed to run
if (!allowedToRun)
{
return;
}
if (j != i)
{
double xDelta = cellLoca... |
668f3ce4-262b-4101-96ee-35f170b9185d | 8 | static void afficheFiltre()
{
//On crée un nouveau filtre
Filter filtre = new Filter()
{
//On défini les propriétés du filtre à l'aide
//de la méthode matches
public boolean matches(Object ob)
{
//1 ère vérification : on vérifie que les objets
//qui seront fi... |
381cb411-9374-4ac2-8688-90d8c83dc13e | 3 | public Dimension getMaxDimension() {
int width = 0;
int height = 0;
for(int i=0; i<images.length; i++) {
ImageIcon tempIcon = new ImageIcon(images[i]);
if(tempIcon.getIconWidth() > width) {width = tempIcon.getIconWidth();}
if(tempIcon.getIconHeight() > height) {height = tempIcon.getIconHeight()... |
1c5385da-e49e-48ad-8936-10112d93c992 | 1 | private String getBase64File() {
try {
// return "/9j/4AAQSkZJRgABAQEASABIAAD//gBDRmlsZSBzb3VyY2U6IGh0dHA6Ly9jb21tb25zLndpa2ltZWRpYS5vcmcvd2lraS9GaWxlOlJvb25leV9DTC5qcGf/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKC... |
a5b77db3-be6d-4423-aefc-6c82979d8893 | 1 | public boolean isOver(){
if (length < Time.getTime() - start){
start = -1;
return true;
}
return false;
} |
a4c25c65-1000-4029-94e0-0dc11c95e634 | 4 | public boolean actualizar(String tabla, String campos, String[] valores, String clausula) {
String[] camp = campos.split(",");
int max = camp.length;
String c;
String query = "UPDATE " + tabla + " SET ", aux = "";
if (clausula == null) {
c = "1";
} else {
... |
b990a1b6-f1f6-42ce-9395-46ebcee08c00 | 8 | public boolean canShot(MyObject obj, XY xy, int maxDistance) {
MyObject aim = MODEL.getBoard().get(xy);
if (aim == null) {
MODEL.showError("Нельзя стрелять по пустой клетке!");
return false;
}
if (aim instanceof Tower) {
MODEL.showError("Нельзя стрелят... |
3e45e649-e3f1-4fbf-a1b0-9703305c78b4 | 3 | public static void main(String[] args) {
// Selection Sort
int[] nums = { 8, 2, 5, 6, 1, 9, 10 };
System.out.println("Initial array: " + Arrays.toString(nums));
for (int i = 0; i < nums.length - 1; i++) {
for (int j = i + 1; j < nums.length; j++) {
if (nums[i] > nums[j]) {
int iVal = nums[i... |
65906ad8-bacb-4e4f-b729-517f85692964 | 9 | public static boolean isValid(String cardNumber) {
cardNumber = cardNumber.replace(" ", "");
cardNumber = cardNumber.replace("-","");
String reversedNumber = new StringBuilder(cardNumber).reverse().toString();
char [] reversedDigitArray = reversedNumber.toCharArray();
/*
temporarily holds a single di... |
37a01a78-1b1b-442a-ae99-fad74e77156c | 2 | private void fieldUpdate(){
if (running && field != null)
{
}
} |
d826995b-b84a-44ce-a02f-26b748f52c67 | 9 | public XSLVariableDeclaration bindVariable(StructuredQName qName) {
NodeInfo curr = this;
NodeInfo prev = this;
// first search for a local variable declaration
if (!isTopLevel()) {
AxisIterator preceding = curr.iterateAxis(Axis.PRECEDING_SIBLING);
while (true) {... |
e477f27f-ec19-4cd3-9f57-74dd48dde55b | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((color == null) ? 0 : color.hashCode());
result = prime * result
+ ((dateOfIssue == null) ? 0 : dateOfIssue.hashCode());
result = prime * result + ((model == null) ? 0 : model.hashCode());
result = prime ... |
23edc72c-f2f0-4220-aa44-8a45d3d82874 | 3 | public void setProfile( Profile p ) {
for ( Map.Entry<Achievement, JCheckBox> entry : generalAchBoxes.entrySet() ) {
String achId = entry.getKey().getId();
JCheckBox box = entry.getValue();
box.setSelected(false);
for ( AchievementRecord rec : p.getAchievements() )
if ( rec.getAchievementId().equal... |
d08e76e4-df8e-4180-8d4b-48441cf5cb8f | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ImovelDoCorretor other = (ImovelDoCorretor) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
... |
092034e2-89c6-4fcd-9420-0c493aa0d5b3 | 5 | public Object nextEntity(char ampersand) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... |
912ebe74-fb6c-44bc-a895-c503cd1991e7 | 2 | public static int Str2Int(String str)
{
if (str == null || "".equals(str))
return 0;
return Integer.parseInt(str);
} |
a38d8ec5-a519-4f3b-bd73-95f7a0dfc7c3 | 0 | public double getLuck() {
return luck;
} |
64acdbdb-950d-440a-8226-fd4bacfb6a34 | 4 | public Object invokeConstructor()
{
Class[] types = c.getParameterTypes();
Object[] values = new Object[types.length];
for (int i = 0; i < types.length; i++)
{
values[i] = makeDefaultValue(types[i]);
}
if (types.length > 0... |
3a690c49-72bf-4dbf-ba9b-c0a984b8004b | 2 | public int compare(Entity e0, Entity e1) {
if (e1.y < e0.y) return +1;
if (e1.y > e0.y) return -1;
return 0;
} |
f5c0882e-b6fe-4d22-80fc-bf5783f8384d | 2 | @Override
public void run() {
while (!Thread.currentThread().isInterrupted()) {
try {
generateQuotes();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
} |
8f178499-53d0-4f5a-a66c-9aa7b9c8b897 | 2 | public String toString() {
String tempString = "";
for (Vertex v : adjMap.keySet()) {
for (Vertex w : this.getAdjacentVertices(v)) {
tempString += v + "-" + w + "\n";
}
}
return tempString;
} |
f8296d67-0b07-4bfc-b967-ab0ecc8d818c | 1 | public void send(int clientId, Message msg) {
System.out.println("Sending message to client " + clientId + ": \"" + msg.encode() + "\"");
try {
server.send(clientId, msg.encode());
} catch (CouldNotSendPacketException e) {
System.out.println("Could not send message to client " + clientId + ": " + e.getMessa... |
c80ee87c-c404-423c-b1c4-16e292131500 | 9 | private String next(String string) {
//Primeiro cria o vetor de maximos e o de presencas, que eh igual no inicio
int max[] = new int[26];
int presencas[] = new int[26];
int maxIdx = -1;
for ( int i = 0; i < string.length(); i++ ) {
char chr = string.charAt(i);
int idx = ord(chr);
max[idx]++;
prese... |
2d7f3391-b07b-4aa2-8cb7-2ae143b4732d | 8 | private void showResultVisualization() {
int[] serviceCandidatesPerClass =
new int[serviceClassesList.size()];
for (int i = 0; i < serviceClassesList.size(); i++) {
serviceCandidatesPerClass[i] =
serviceClassesList.get(i).
getServiceCandidateList().size();
}
if (algorithmVisualization != null) {... |
3fac9f38-a508-4448-a31d-6dc467e676e0 | 2 | public Schema.Player match(Schema.Player source) {
for ( Map.Entry<String, String> id : source.id.entrySet()) {
Schema.Player p = find(id.getKey(), id.getValue());
if (null != p) {
return p;
}
}
return PLAYER_NOT_FOUND;
} |
03de3492-2ef7-4a66-8fc1-48a3a3d164d0 | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
04747c1d-6a26-4802-8841-3a44f21cfe4b | 7 | public String reverseWordsII(String s) {
if (s == null || s.length() == 0)
return "";
s = s.trim();
int l = 0, r = 0;
StringBuilder sb = new StringBuilder();
while (r <= s.length()) {
if (r == s.length()) {
sb.insert(0, ' ');
... |
054a1185-bc75-4403-a005-d0171e8c5ac3 | 9 | public void validate(){
if (getUserName()==null||getUserName().length()==0) {
addFieldError("userName", "用户名不能为空");
}else {
LoginRegisterInfo info=new LoginRegisterInfo();
list=info.queryInfo("userName", getUserName());
UserInfoPO ui=new UserInfoPO();
for (int i = 0; i < list.size(); i++) {
ui... |
d162ab65-1952-4331-a632-e3ddd693008f | 1 | @Override
public void draw(List<Row> rows, ViewEventArgs args, int from){
if (from >= rows.size()){
from = 0;
}
this.setRows(rows);
//System.out.println("Scrollable: from: " + from + " rows: " + this.getRows().size());
this.document.draw(rows, args, from);
//System.out.println("AFTER: at decorator:... |
b25e0186-bd77-4126-a596-febfd6800ce1 | 9 | @Override
public String getColumnName(int column){
switch (column){
case 0:
return COLUMN1;
case 1:
return COLUMN2;
case 2:
return COLUMN3;
case 3:
return COLUMN4;
case 4:
return COLUMN5;
case 5:
return COLUMN6;
case 6:
return COLUMN7;
case 7:
return COLUMN8;
case 8:
retu... |
01f1741b-f442-406f-b587-0fb9655d6f57 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ClienteTelefone other = (ClienteTelefone) obj;
if (descricao == null) {
if (other.descricao != null)
return false;
} else if (!descricao... |
342cbe98-062e-4944-9919-30140f23df18 | 5 | public static void test_3a(){
try{
System.out.println("\n\nTestCase-3A\n\n");
TestNetwork n=new TestNetwork(4,4,2);
Paxos p=new Paxos(n);
p.runPaxos();
n.change_DPmode(-1,1);
for(int i=0;i<10;i++) //Block the channel of all processes
n.block_channel(i, 1);
Thread.sleep(500);
... |
967e8aa9-fb4a-4060-a96a-ee3ad848b344 | 0 | private void jButtonQuitterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonQuitterActionPerformed
//Récupération de la méthode contrôleur 'quitter'
this.ctrl.quitter();
}//GEN-LAST:event_jButtonQuitterActionPerformed |
52186334-8270-429f-92ee-919222b6bc2e | 3 | void readProteinFile() {
proteinByTrId = new HashMap<String, String>();
if (proteinFile.endsWith("txt") || proteinFile.endsWith("txt.gz")) readProteinFileTxt();
else if (proteinFile.endsWith(SnpEffPredictorFactoryGenBank.EXTENSION_GENBANK)) readProteinFileGenBank();
else readProteinFileFasta();
} |
3ae00184-60da-4a80-a897-c6d880a3fc1f | 2 | @Override
public boolean contains(Object element)
{
Node currentNode = firstNode;
boolean elementIsInSet = false;
while (currentNode != null)
{
if (element.equals(currentNode.element))
{
elementIsInSet = true;
break;
} else
{
currentNode = currentNode.nextNode;
}
}
return eleme... |
5b0ded7d-3c67-4bbe-91d7-259ad3791bf0 | 1 | public String operandsToString(){
String str = new String();
for(double operand: operandStack){
str = str + (operand + " ");
}
return str;
} |
692136c1-1090-4f38-ae82-9f0d7c1d4566 | 3 | private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
// TODO add your handling code here:
String str="";
Juego j = new Juego();
List Plata = new ArrayList();
str = this.jTextField23.getText();
if(Biblio.contain... |
a049b705-b1c4-4a56-ae67-c3431aaa50c4 | 7 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender.hasPermission("NEC.fbroadcast") || sender.isOp() || sender instanceof BlockCommandSender || sender instanceof ConsoleCommandSender) {
if(command.getName().equalsIgnoreCase("FBroadcast")) {
if(arg... |
85bb1c60-d5f4-4827-8a89-e9c01dccf7dd | 4 | private static int partition(long arr[], byte[] values, int sizeOf, int left, int right)
{
int i = left, j = right;
long tmp;
long pivot = arr[left + random.nextInt(right - left + 1)];
byte[] valueTemplate = new byte[sizeOf];
while (i <= j) {
while (arr[i] < pivo... |
1fdc1990-b8e1-4bd6-9fb8-e33d12567163 | 3 | public PostParameter[] getParameters() throws WeiboException{
List<PostParameter> list= new ArrayList<PostParameter>();
Class<Query> clz=Query.class;
Field[] fields=clz.getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
String fieldName=field.getName();
String firstLetter = fi... |
b75db57f-fad0-4ef2-a509-11319598e3ad | 3 | public String getName()
{
String returnString = type.toString();
returnString = returnString.replace('_',' ');
if ((effect1 == Effect.TM || effect1 == Effect.HM) && type != Type.REDBULL)
{
returnString = returnString + " " + mNo;
}
returnString = returnString + " x" + amount;
return returnString;
} |
276f16bb-94d6-4750-9e9e-f0bdad34be63 | 4 | public int removeBuddy(String username, String buddyname){
try {
String host = "localhost";
socket = new Socket(host, 2001);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true)... |
41c8c040-018a-4013-8ff6-cf65fc45035a | 0 | public byte[] getInfoHash() {
return this.infoHash.array();
} |
227f34e9-bcb7-4ed1-a458-35995c5c01ad | 7 | void executeSystemCmd(String cmd) {
try {
Process p = Runtime.getRuntime().exec(SystemUtils.IS_OS_WINDOWS ? "cmd /C " + cmd : cmd);
// OutputStream out = p.getOutputStream();
// out.write(cmd.getBytes());
// out.flush();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputSt... |
4abfb227-cd82-437a-b060-555ddc328031 | 8 | public FenetreTaillePixel(){
// saisiePixel=new JTextField("",20);
System.out.println("nouvelleee size: "+ConnexionTaillePixel.getArrayy().size());
System.out.println("nouvelleee size2: "+nomShape1.size());
// this.connexion=connexion;
if(FenetreTaillePixel.nomShape1.size()==0){
FenetreTaillePixel.nom... |
4470e84a-9e82-49d4-bc27-26f811dba209 | 3 | public Placeable loadInitialTownHall(int x) {
int mapY = 0;
Placeable placeable = null;
mapY = findFloor(x);
placeable = new Cabin(this, registry, "Placeables/Placed/Cabin", "Placeables/Placed/Cabin", x, mapY, Placeable.State.Placed);
registerPlaceable(placeable);
if (g... |
dda2647e-9b89-4572-831d-28f803825d3e | 8 | public Block getBlock(int x, int z) {
// starting at the top of the map and going down
for(int y = maxHeight - 1; y > 0; y--) {
// if the block reached is visible
if(isBlockSolid(blocks[x][y][z])) {
// h models the first block after all water is traversed
int h = y;
if(blocks[x][y][z] == 8 || blo... |
c5b3dc81-df64-4b12-b8c1-b9040d59e8dd | 0 | public static void main(String[] args) {
System.out.println(Arrays.toString(new int[] {1, 2, 3}));
System.out.println(fill(new ArrayList<String>()));
System.out.println(fill(new LinkedList<String>())); // Queue
System.out.println(fill(new HashSet<String>()));
System.out.println(fill(new TreeSet<String>(... |
a0d345ad-46ee-40a0-9c9c-985e8367bafb | 5 | public static void main(String[] args) {
// run 10 simulations of chicken growth and fox hunting
for (int count = 0; count < 10; count++) {
ParkerPaulFox foxy = new ParkerPaulFox(); // fox that hunts chickens
ArrayList<ParkerPaulChicken> chickens = new ArrayList<ParkerPaulChick... |
b5cbda2d-026b-4899-ad03-15ef8c2bec31 | 3 | @Override
public double evaluate(int[][] board) {
int r1 = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length-1; j++) {
if(board[i][j] < board[i][j+1]) {
r1++;
}
}
}
return r1;
... |
174af715-e721-4ea5-b791-fdd623d44a09 | 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... |
c1928e2e-f164-4f9e-9c9c-523c8f9b2ca9 | 0 | public void register(final MessageListener listener) {
listeners.add(listener);
} |
69837343-64f7-4adf-ad37-44f493675348 | 9 | public void validaComponentePreencheSetor() {
String item = jLabelPeca.getText().trim();
int indice = item.indexOf("-", 4);
item = item.substring(0, indice - 1);
TelaConsultaComponentes tela = new TelaConsultaComponentes(null, true, item.trim(), jFTComponente, jLabelDescricaoComponente... |
9c166494-fcee-4400-b9f7-c1b42190fd02 | 5 | @Override
public Collidable pointCollides(int x, int y)
{
// Negates the transformation
Point negatedPoint = negateTransformations(x, y);
// Returns the object if it collides with the point
// Circular objects react if the point is near enough
if (this.collisiontype == CollisionType.CIRCLE)
{
if (He... |
2d9e6a74-3ee4-4d14-9c98-a38e5e7e8607 | 3 | public void transfer(Account from, Account to, int amount) {
boolean fromLock = false;
boolean toLock = false;
try {
while (!fromLock || !toLock) {
fromLock = from.getLock().tryLock(
(long) (Math.random() * 1000), TimeUnit.MILLISECONDS);
... |
4b26eb86-67ce-413f-9357-f24f261f1d9b | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (request.getHeader("Referer") == null)
response.sendRedirect("error.jsp?m=404");
else {
response.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
HttpSession... |
be221bf4-2cdd-421d-bdc6-79daf8aae6b0 | 3 | public double calculateClusterDistance(Cluster cluster1, Cluster cluster2) {
Instance instance1, instance2;
double distance = 0, tempDist = 0;
for (int i = 0; i < cluster1.size(); i++) {
instance1 = cluster1.get(i);
for (int j = 0; j < cluster2.size(); j++) {
instance2 = cluster2.ge... |
82ba1194-9fc1-49ea-9a90-c935fda90d4d | 6 | public void adjustBeginLineColumn(int newLine, int newCol) {
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin) {
len = bufpos - tokenBegin + inBuf + 1;
} else {
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = 0, columnDiff = 0;
while (i < l... |
4f44e2d3-aee9-4551-9d6b-16d915a14c06 | 9 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (!(e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
if (e.getClickedBlock().getState() instanceof Sign) {
Sign s = (Sign) e.getClickedBlock().getState();
Player p = e.getPlayer();
if (s.getL... |
c7ffcb79-bcee-4c71-a240-8792946ff25b | 5 | public void addQueueIfTooMuchClients(){
Queue addedQueue = null;
int listSize = queueList.size();
boolean permissionToOpenQueue = false;
boolean clientMigration = true;
if(simulationTime == 60) {
queueList.add(queueNr2);
for(int i = 0; i < queueNr... |
11457e47-8a96-4b5a-b152-ec3c4f042f6d | 2 | @Override
public void messageReceived() {
Message received = Comms.receiveMessage();
if (received != null) {
try {
Request request = (Request) received;
Alerter.getHandler().info(
"Received " + request.getClass().getSimpleName() + " from "
+ request.getSource().getHostAddress());
// ... |
0b2c9b87-ed91-4f10-a609-eccf92d31baf | 5 | @Override
public Component getListCellRendererComponent(JList<? extends MessageLevel> jlist, MessageLevel e, int i, boolean isSelected, boolean hasFocus) {
//JLabel label = new JLabel(e.getMessage());
JLabel label = (JLabel) cellRenderer.getListCellRendererComponent(jlist, e.getMessage(), i, hasFocu... |
ac6d7b6e-4216-4517-aa26-c257658da194 | 9 | public void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_W) {
up.toggle(true);
} else if (keyCode == KeyEvent.VK_DOWN || keyCode == KeyEvent.VK_S) {
down.toggle(true);
} else if (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_A) {
... |
a1bdcc55-dd81-485e-a49a-9de185f70dc5 | 9 | private static String convertToneNumber2ToneMark(final String pinyinStr)
{
String lowerCasePinyinStr = pinyinStr.toLowerCase();
if (lowerCasePinyinStr.matches("[a-z]*[1-5]?"))
{
final char defautlCharValue = '$';
final int defautlIndexValue = -1;
char un... |
4cfd949d-456c-4ee6-9660-ca4b077bf195 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Vector3 other = (Vector3) obj;
if (Float.floatToIntBits(x) != Float.floatToIntBits(other.x))
return false;
if (Float.floatToIntBits(y) != Fl... |
245bd174-b28f-43bc-84bb-1de70ed80cfb | 4 | private int getCommentsNum(File file) {
if (!file.exists()) {
return 0;
}
try {
int comments = 0;
String currentLine;
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((currentLine = reader.readLine()) != null) {
if (currentLine.startsWith("#")) {
comments++;
... |
9f99b69c-76df-4c67-ba92-bca2c60089da | 7 | private void processSecurityResultMsg() {
vlog.debug("processing security result message");
int result;
if (cp.beforeVersion(3, 8) && csecurity.getType() == Security.secTypeNone) {
result = Security.secResultOK;
} else {
if (!is.checkNoWait(1)) return;
result = is.readU32();
}
... |
afaf6f48-61f2-48a4-a1b3-c8abfcc86803 | 4 | public static Date min(Date... dates) {
if(dates != null && dates.length > 0) {
Date minDate = dates[0];
for (Date date : dates) {
if(date.before(minDate)) {
minDate = date;
}
}
return minDate;
}
return null;
} |
2abc8e89-fb95-4825-82a9-f025dd5e6ead | 2 | @Override
public int checkScore(){
if(score1 == 2){
return 1;
}
else if(score2 == 2) {
return 2;
}
else {
return 0;
}
} |
2b9e4c91-5968-4353-a428-8329e9b60419 | 0 | @Override
public Query<TElement> toQuery() {
return new Query<TElement>(this._source);
} |
c30ffdd8-52e6-4219-8dd6-4838beb4e96c | 6 | private void setListener() {
cfBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
LookAndFeel look = UIManager.getLookAndFeel();
try {
UIManager.setLookAndFeel(UIManager
.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | Instantiat... |
4234eec3-ecd5-44d9-8543-2aebaa46522f | 6 | public void check(){
String[] inputWords = parser.parse(this.textPane.getText());
if (inputWords == null){
JOptionPane.showMessageDialog(new JFrame(), this.errorConsole.getText(), "Error", JOptionPane.ERROR_MESSAGE);
return;
}
SpellCheckResult[] scResults = new S... |
4e8c3438-23ee-4c44-a75e-3e4ecc253d85 | 3 | public String lire(){
String t="";
try{
t = bf.readLine();
}catch(IOException io){
System.out.println("echec de lecture");
io.printStackTrace();
}
if(debug) { if(!t.equals("")) {System.out.println("Lecture TCP: " + t);} }
return t;
} |
3291f7a5-d473-42ac-9084-03d2466656e7 | 9 | public String menuOptions()
{
System.out.println();
System.out.println("Menu: ");
System.out.println("\tFind a course in the Program of Study (find)");
System.out.println("\tAdd a course to the Program of Study (add)");
System.out.println("\tRemove a course from the Program of Study (remove)");
System.out.... |
9fabd690-65bf-4719-8f76-98f435048a1e | 5 | public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
// Draw Background
g2d.drawImage(BG, 0, 0, null);
tm.Draw(g2d);
... |
11efc622-6cc3-4e8e-9475-c28c30bcae09 | 5 | public void update() {
xa = 0;
ya = 0;
randommovement();
if (anim < 60)
anim++;
else {
anim = 0;
}
// xa++;
// ya++;
if (xa != 0 || ya != 0) {
walking = true;
move(xa, ya);
} else {
walking = false;
}
if (hit) {
if (anim2 < 60)
anim2++;
else {
anim2 = 0;
hit =... |
f3615c95-b5c1-42c9-b7c8-1d02d9537ab3 | 4 | public void commit() throws DatabaseManagerException {
try {
if( conn == null || conn.isClosed() || conn.getAutoCommit() == true ) {
throw new IllegalStateException("Transaction not valid for commit operation.");
}
conn.commit();
} catch(SQLException e) {
throw new DatabaseManagerException("Error co... |
63b31563-2c6d-4ad1-9313-23db2c821dc3 | 6 | private WarMachine platziereWarMachine(WarMachine newWarMachine) {
boolean invalidInput = true;
String input = null;
Koordinate platzKoordinate = null;
Ausrichtung platzAusrichtung = null;
while (invalidInput) {
try {
input = eingabe.getUserInput();
} catch (Exception e) {
e.printStackTrace();... |
b098581e-aae5-44ee-9fbf-ea7648370ef8 | 0 | public void setTeacher1(Teacher1 teacher1) {
this.teacher1 = teacher1;
} |
58b5f17a-33df-4d2e-b6d0-f48431349dca | 8 | public void saveFile(FoodFileBean file) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "insert into foodfile values(foodfile_fileid_seq.nextval,?,?,?,?)";
try {
conn = getConnection();
pstmt = conn.prepareStatement(sql);
pstmt.setString... |
9cc975a2-7e44-4cf2-8cc5-5af62131bdbb | 5 | static final Class142_Sub27_Sub22 method1194(byte byte0, int i) {
Class142_Sub27_Sub22 class142_sub27_sub22 = (Class142_Sub27_Sub22) Class142_Sub21.aClass90_3575.method905(i);
if (byte0 >= -51) {
return null;
}
if (class142_sub27_sub22 != null) {
return class142_s... |
21dedc56-0509-45cb-a278-8c3562a15dc7 | 8 | public static void dfs(int index, int ultimo, String cad) {
if (res)
return;
if (maxStep == index - 1) {
} else {
for (int i = 1; i <= arr.length; i++) {
if (i != ultimo) {
int c[] = new int[ arr.length ];
int temp[] = new int[ arr.length ];
c = arr;
/*
* for (int j = 0; j < ... |
f5584a7a-a454-45df-896c-1d0aa7cb4095 | 0 | public float getSize()
{
return this.size;
} |
ba85b139-5661-4ecd-a06e-79fda54b8292 | 2 | @Override
public void train(Matrix features, Matrix labels) {
if (features.getNumRows() != labels.getNumRows()) {
throw new MLException("Features and labels must have the same number of rows.");
}
if (filterInputs) {
Matrix matrix = trainAndTransform(features);
... |
8c093e8a-447e-4f61-ac65-cf948c37f3e1 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof Card))
return false;
Card other = (Card) obj;
if (cardType != other.cardType)
return false;
if (name == null) {
if (other.name != null)
return false;
} else i... |
def8a322-ed06-4dcc-9823-0b3ec31ce30c | 6 | @Override
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_LEFT:
dir_left = true;
break;
case KeyEvent.VK_RIGHT:
dir_right = true;
break;
case KeyEvent.VK_UP:
dir_up = true;
break;
case KeyEvent.VK_DOWN:
dir_down = true;
break;
case KeyEvent.VK_SPACE:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.