method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6c980c40-187a-45fe-9c40-b3d05d1f5a1e | 9 | private void evaluateInput(String message) throws Exception {
// Parse the input message
Matcher matcher = pattern.matcher(message);
if (matcher.matches() == false) {
throw new IllegalArgumentException(
"Syntax error: " + message);
}
... |
c10b474c-f897-4243-92a2-627480fdc33b | 3 | public void connect(Message m) {
String message = m.getMessage();
if (message.startsWith(Protocol.CONNECT)) {
message = message.replace(Protocol.CONNECT, "");
if (!message.equals("")) {
if (!users.containsValue(m.getIClient())) {
m.getIClient()... |
7a31fcd4-e1dc-4934-9b83-39a151598dac | 3 | @Override
public ArrayList<? extends Object> getOptions() {
if (options == null) {
options = new ArrayList<Source>();
for (Source s : Source.values())
options.add(s);
}
return options;
} |
9a544aae-5465-4f75-a637-2e83de5e5e38 | 6 | public static void main(String[] args) {
logger.setLevel(Level.SEVERE);
ConsoleHandler handler = new ConsoleHandler();
handler.setLevel(Level.SEVERE);
logger.addHandler(handler);
if (args.length == 0) {
logger.warning("Invalid arguments count.");
return;
... |
c9e12ba6-29f6-424e-9458-6582f926f4e0 | 6 | @EventHandler
public void PlayerHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPlayerConfig().getDouble("Player.Hunger.D... |
fc2f0c6a-e6ea-49af-9186-cf5ea60d6ea3 | 7 | @Override
public State run(final String program, final State s) {
Map<String, Integer> methodMap = Utils.getMethods(program);
ClassWriter cw = new ClassWriter(0);
MethodVisitor mv;
final String stateClass = Type.getInternalName(s.getClass());
cw.visit(V1_6, ACC_PUBLIC + ACC_... |
cecdd609-f699-4971-b5d4-a96a90cabafa | 8 | @SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
// sprawdza czy to inventory tego pluginu
if(event.getInventory().getName().equalsIgnoreCase(this.plugin.dInvName)) {
... |
adcf56fc-20b5-4a0f-8396-7151834ba6ee | 5 | public static void main(String[] args)
{
if (args.length == 1)
{
try
{
echoTCP(args[0]);
}
catch (IOException e)
{
e.printStackTrace();
System.exit(1);
}
}
else if... |
0f841a1a-a0aa-4ee8-9d57-5346327d78d9 | 9 | public static void dump(DataInputStream ios, int length) {
try {
String s;
String a = "";
for (int i = 0, j = 0; i < length; i++) {
int val = ios.read();
if (val < 0) System.exit(0);
if (j == 0) {
System.out.println(" " + a);
... |
10182c71-a086-4fd3-bc54-c36604aab0e6 | 0 | protected int processRecord (int recordCounter, byte[] recordData, short recordAttributes, int recordUniqueID)
{
// TBD
// if (Outliner.DEBUG) { System.out.println
// ("\tStan_Debug:\tPdbReaderWriter:processRecord for record #" + (recordCounter+1)); }
return SUCCESS ;
} // end protected method ... |
536f0543-daa3-41fa-a7b3-17385f1c5484 | 7 | public Integer insert(ProductosBeans producto) throws DAOException {
PreparedStatement pst = null;
ResultSet generatedKeys = null;
try {
pst = con.prepareStatement(sql.getString("INSERT_PRODUCTOS"),
Statement.RETURN_GENERATED_KEYS);
pst.setString(1, producto.getNombreP());
pst.setString(2, p... |
d89293f3-3880-4f3a-9ff8-b5492b0a6b45 | 0 | public void talk(String msg) {
System.out.println(msg + "!你好,我是" + username + ",我年龄是" + age);
} |
a7be51b6-b5c1-4f01-b9f9-1a5b5ac852d2 | 3 | public void addBuilding(CastleBuilding b)
{
if (b.type == null || b.type == type) {
if (!buildings.contains(b)) {
buildings.add(b);
b.buyBonus(Mission.getLastInstance().getActivePlayer(), this);
System.out.println("ADD BUILDING: "+b.name);
}
}
} |
b217350f-6fac-499e-a4b5-fb07bbfbe9de | 4 | protected java.util.List<ThreeTuple<Vector2, Vector2, Vector2>> parse(BufferedImage image) {
ArrayList<ThreeTuple<Vector2, Vector2, Vector2>> ret = new ArrayList<ThreeTuple<Vector2, Vector2, Vector2>>();
int imageWidth = image.getWidth();
int imageHeight = image.getHeight();
// boolean v... |
5c0ac082-6fac-4e03-98ec-c040b27479ad | 2 | public static void printList(ListNode x) {
if(x != null){
System.out.print(x.val + " ");
while (x.next != null) {
System.out.print(x.next.val + " ");
x = x.next;
}
System.out.println();
}
} |
f8d6a6f8-a087-4748-85f0-0a755da6253e | 3 | public void update() {
for (int i = 0; i < players.size(); i++) {
players.get(i).update();
}
for (int i = 0; i < entities.size(); i++) {
entities.get(i).update();
}
for (int i = 0; i < projectiles.size(); i++) {
projectiles.get(i).update();
... |
822a074b-e1d1-43fe-81c5-c95f37242649 | 2 | public boolean subComponentOf(GUIComponentGroup componentGroup) {
if (this == componentGroup) {
return true;
}
if (this.superGroup == null) {
return false;
}
return this.superGroup.subComponentOf(componentGroup);
} |
f5e74571-a063-4cd6-8c05-1946ca2a7a08 | 9 | private void init() {
this.x.set(0.);
/*
* Set up y for the first Lanczos vector. y and beta1 will be zero
* if b = 0.
*/
this.r1 = this.b.copy();
this.y = this.minv == null ? this.b.copy() : this.minv.operate(this.r1);
i... |
5e13a6d6-b512-433d-9e4b-0fdd69351414 | 7 | static final public void operadores_aritmetico() throws ParseException {
trace_call("operadores_aritmetico");
try {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ATRIBUICAO:
jj_consume_token(ATRIBUICAO);
break;
case ADICAO:
jj_consume_token(ADICAO);
break;
... |
2ab145f6-4c8b-45a6-9177-1aaba0553b70 | 1 | @Override
public void batimentToFarm(Farm farm, List<Batiment> batiments) {
for(Batiment batiment:batiments){
batiment.setFarm(farm);
em.persist(batiment);
}
} |
0db2c022-2a90-42f7-a397-7279745d79f9 | 1 | public String toString() {
if (comment != null) {
return "label_" + index + " (" + comment + ")";
} else {
return "label_" + index;
}
} |
15b4adfb-3175-485f-b31d-181ab0ba0a48 | 6 | public static String numberToString(Number number) throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
if (string... |
f5f829e5-39e7-4ae2-9352-5944b9a68d1a | 5 | private void switchProcess() {
Process process = cpu.getActiveProcess();
if(process != null){
process.leftCpu(clock);
cpu.addProcess(process);
process.enterCpuQueue(clock);
statistics.nofForcedProcessSwitch++;
}
process = cpu.startNextProcess();
if(process != null){
process.enterCpu(clock);
... |
d6a8a675-4ee7-4652-b757-72ddd4d6feda | 0 | private Supervisor(){} |
3a3f60bf-bcfa-4fbc-87ee-4f27fd62533b | 1 | public Boolean eliminarProducto(String producto){
if(!this.stock.containsKey(producto)){
return false;
}
this.stock.remove(producto);
return true;
} |
13972dc9-18f4-4223-a3db-65f886dd39de | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
88944186-2f3b-4819-a108-19c6af55c687 | 2 | public void cleanOldNatives() {
File root = new File(mcPath, "versions/");
//this.launcher.println("Looking for old natives to clean up...");
IOFileFilter ageFilter = new AgeFileFilter(System.currentTimeMillis() - 3600L);
for (File version : root.listFiles((FileFilter) Director... |
e0f4e28e-e105-4879-8ea0-55167d770c4b | 7 | void executePlayerCommand(PlayerCommand pc, int playerNumber)
{
int command = pc.command;
Player p;
if (playerNumber == 1)
p = server.gameState.player1;
else
p = server.gameState.player2;
switch (command)
{
case PlayerCommand.PRESS_RIGHT : p.run_right();
... |
bb861cb3-dcbe-4b97-b78c-3634e87a8ce3 | 8 | public void act() {
if(debut) {
debut = false;
ActionFactory.wait(10000, "end", true);
}
if(!clawsMoving) {
if(attente) {
ActionFactory.wait(500, "claws", true);
}
else {
clawsMoving = true;
ActionFactory.useClaws(nextclawsOpenure, true);
}
}
if(!robotMoving) {
robotMoving = t... |
b34c086a-4294-4f14-9678-b9804fd10019 | 1 | public Organism getRepresentOrganism() {
if (getOrganisms().isEmpty()) {
System.err.println(this.toString());
}
return getOrganisms().get(representativeIndex);
} |
8c1ded7f-00db-47ce-9c18-48bd04bd61f7 | 9 | @Override
public double[] calculateJulia3DWithoutPeriodicity(Complex pixel) {
iterations = 0;
Complex tempz2 = new Complex(init_val2.getPixel(pixel));
Complex[] complex = new Complex[3];
complex[0] = new Complex(pixel);//z
complex[1] = new Complex(seed);//c
... |
2150a5d3-87ad-4aec-970a-9edf5fbac8b6 | 4 | @Override
public Set<DeliveryOption> call() throws Exception
{
Set<DeliveryOption> xs = new HashSet<>();
String city_name = null;
Region r;
if(rx.delivery != null)
while((r = rx.delivery.getRegion()) != null)
if(r.getType() == RegionType.CITY)
{
city_name = r.getName();
break;
}
if... |
68573f07-5b87-4ed6-a9d0-f5e85f6f7b36 | 6 | private static MaNode makeNode(Composante c) {
Type t = c.getType();
switch (t) {
case RESISTANCE:
int image = MaNode.NODE_RESISTANCE;
Resistance resis = (Resistance) c;
if (resis.isBurned()) {
image = MaNode.NODE_BURNED;
... |
7540e367-1e75-4d50-8bad-7e793ba0bef1 | 8 | @Override
public void affectCharState(MOB mob, CharState state)
{
super.affectCharState(mob,state);
if(mob.baseCharStats().getCurrentClass().ID().equals(ID()))
{
Ability A=null;
for(int a=0;a<mob.numAbilities();a++)
{
A=mob.fetchAbility(a);
if((A!=null)
&&((A.classificationCode()&Ability.AL... |
aa08c33d-35f6-4097-bced-7f560d41e5b1 | 4 | public static String getRepeatString(int repeatTime, String metaString)
{
String repeatString = null;
if ((repeatTime > 0) && (metaString != null)) {
int intMetatStringLength = metaString.length();
if (intMetatStringLength == 0) {
repeatString = "";
} else {
StringBuffer temp... |
c1b5436f-1844-4ad1-8f63-01fac5dd670d | 7 | public static void startupGoalCaches() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((M... |
22089c01-e26b-4287-83b9-8f5cb53f6904 | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0
... |
f351df05-ead8-457f-9e1f-85200652d18b | 2 | private Meeting getMeetingFromID(int id) {
Iterator meetingIterator = allMeetings.iterator();
Meeting nextMeeting;
while(meetingIterator.hasNext()) {
nextMeeting = (Meeting) meetingIterator.next();
if(nextMeeting.getId() == id) {
return nextMeeting;
... |
6a8792aa-3970-4264-92e3-86f665f2396a | 2 | public void getMoveTarget() {
if(Application.get().getLogic().getGame().getSector(currentSector) != null) {
EnemyLocation loc = Application.get().getLogic().getGame().getSector(currentSector).getBossLocation();
if(loc != null) {
targetX = loc.x();
targetY ... |
0c318bef-0f0b-4f78-a6e7-39e247479dcb | 5 | public static int[] decompileNumberInFactors(int numToDecompile){
if (isNumberFirst(numToDecompile)){
return new int[]{numToDecompile};
}
List<Integer> list = new ArrayList<Integer>();
int divisor = 0;
while (divisor < numToDecompile){
divisor++;
... |
1321969f-7683-4483-8579-d621c4f9ebd8 | 5 | public void mouseDragged(MouseEvent e) {
if (!editable)
return;
if (!boardBox.contains(e.getPoint()))
return;
if (lastLineStart == null)
lastLineStart = e.getPoint();
else if (lastLineStart != null
&& e.getPoint().distance(lastLineStart) > 3) {
lastLine = new Line2D.Double(Board.fromScreenSpace(... |
3fd9cf84-c3ed-4307-abea-216ade653eaa | 8 | @Test public void testUpgradeWriteDeadlock() throws Exception {
System.out.println("testUpgradeWriteDeadlock constructing deadlock:");
LockGrabber lg1Read = startGrabber(tid1, p0, Permissions.READ_ONLY);
LockGrabber lg2Read = startGrabber(tid2, p0, Permissions.READ_ONLY);
// allow read locks to acquir... |
70f45b85-64b8-486b-8c07-4881d887c171 | 9 | public String getValueAsString() {
if (value == null)
return null;
logger.debug("field is " + this.getName() + " and val is |" + value + "|");
switch (type) {
case DAOutils.STRING_TYPE:
if (this.getHtmlType() == DAOutils.Y_OR_N) {
return ((String) value).trim().equalsIgnoreCase("Y") ? "Y" : "N";
... |
69c11da7-dc0f-400e-9554-415cad4325c6 | 4 | public void flush(){
LinkedList<PlayerReinforcement> toSave = new LinkedList<PlayerReinforcement>();
LinkedList<PlayerReinforcement> toDelete = new LinkedList<PlayerReinforcement>();
for (PlayerReinforcement pr : pendingDbUpdate) {
if (pr.getDbAction() == DbUpdateActi... |
657ea795-ed57-41aa-b476-bbdc2d14114f | 5 | @Override
public void afterPhase(PhaseEvent event) {
// TODO Auto-generated method stub
System.out.println("Inside phase listner");
FacesContext facesContext = event.getFacesContext();
String currentUser = facesContext.getViewRoot().getViewId();
boolean isLoginPage = (currentUser.lastIndexOf("index.jsp") > ... |
558c67d9-06f0-4c09-92ab-c1d692c6c9f2 | 2 | private static void loadFinished(HashSet<Long> finished) throws Exception {
ArrayList<File> finishedList = new ArrayList<File>(Arrays.asList(new File("./Finished/").listFiles()));
int cnt = 0;
for (File file : finishedList) {
BufferedReader buff = new BufferedReader(new FileReader(file));
String id;
int ... |
255f5b54-4d38-4236-9cb1-10d1ffb60ffc | 6 | @Override
protected void xMovement(double time) {
if (!xObstacleAhead(time)) {
if (currentCoord.getX() + 30 > 800) {
if (AppFrame.incFrameNumber()) {
currentCoord.setX(0);
} else {
gameOver = true;
}
... |
4384904a-d080-4896-943c-b197ac914b10 | 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://... |
2b408c93-3d83-4252-a136-4c3346aaf152 | 4 | private void onOpen() {
logger.fine("socket open");
this.readyState = ReadyState.OPEN;
Socket.priorWebsocketSuccess = WebSocket.NAME.equals(this.transport.name);
this.emit(EVENT_OPEN);
this.flush();
if (this.readyState == ReadyState.OPEN && this.upgrade && this.transport... |
7fd25b02-cb48-4ccd-bcf6-c39469e853cd | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Piece other = (Piece) obj;
if (canCastle != other.canCastle)
return false;
if (color != other.color)
return false;
if (x != other.x)
... |
681b57c6-98ad-4471-aafd-edd2d274bb2f | 9 | static public OTAMessageIntf recv(DataInputStream input) throws Exception{
OTAMessageIntf msg = null;
int ret = 0;
try {
byte [] header_temp = new byte[header_size];
ret = input.read(header_temp);
if(ret == -1)
throw new Exception ("Socket read failed - header");
OTA... |
ceab581c-9850-47a3-87a9-44283e255ffc | 8 | public static Stella_Object uMinusConstraint(IntegerWrapper missingArgument, DimNumberLogicWrapper x1, DimNumberLogicWrapper x2, DimNumberLogicWrapper x3) {
{ Stella_Object value = null;
switch (missingArgument.wrapperValue) {
case -1:
value = (Stella_Object.eqlP(((DimNumber)(x1.wrapperVal... |
d34fe03e-59c0-4c1a-b329-d470463a4c16 | 3 | public RPC() {
setupEventListeners();
/**
* Thread will endlessly call executeNext() method
*/
// TODO: Move out from RPC
thread = new Thread(new Runnable() {
@Override
public void run() {
while (true) {
... |
115dd7fc-c608-4198-aac3-8a79a73fa456 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Projet)) {
return false;
}
Projet other = (Projet) object;
if ((this.num == null && other.num != null) || (this... |
83746b3f-a5d2-4f11-a5c4-376e6f382da4 | 7 | public void act() {
jMan.act(this);
jMan.setActed(true);
// Make every other piece act.
for (int i= 0; i < width; i= i+1){
for (int j= 0; j < height; j= j+1){
Piece p= board[i][j];
if (p != null && !p.hasActed()){
... |
dbd49a24-7de6-45e9-9daa-cdce22aad5a2 | 7 | private boolean objectSelection(FrameBuffer buffer) {
PhysObject3D obj;
SimpleVector objCenBuf;
SimpleVector objBound;
SimpleVector shiftCenObj;
Enumeration<PhysObject3D> objs = gameWorld.getWorld().getObjects();
... |
008b90ca-007c-4dd2-a48f-2ef4cab64492 | 3 | private static void readXmlData() {
setXmlFolder();
accountings = new Accountings(xmlFolder, xslFolder, htmlFolder);
if(!xmlFolder.exists()){
xmlFolder.mkdirs();
}
File subFolder = new File(xmlFolder, Accountings.ACCOUNTINGS);
if(!subFolder.exists()){
... |
c3b601ca-e13c-4765-a216-c0d0c1283016 | 9 | private synchronized void check(MarketState ms) throws InvalidMarketStateTransition {
if (state == MarketState.CLOSED) {
if (ms == MarketState.OPEN) {
throw new InvalidMarketStateTransition("InvalidMarketStateTransition: Market cannot go directly from CLOSED to OPEN.");
}... |
7de5d448-a5f2-4b33-8314-2863c406ff52 | 8 | public Dumper(InputStream cramIS, ReferenceSource referenceSource, int nofStreams, String fastqBaseName,
boolean gzip, long maxRecords, boolean reverse, int defaultQS, AtomicBoolean brokenPipe)
throws IOException {
this.cramIS = cramIS;
this.referenceSource = referenceSource;
this.maxRecords = maxReco... |
71e5c1cd-3179-4879-9f0f-de701f335336 | 1 | public static void main(String[] args) {
Path zipFile = Paths.get("/home/xander/test/zippy.zip");
Path jarFile = Paths.get("/home/xander/test/zippy.jar");
try (FileSystem zipFileSys = FileSystems.newFileSystem(zipFile, null)) {
Files.deleteIfExists(Paths.get("/home/xander/test/passa... |
cf0468f2-2acf-4597-af35-617cb145233f | 1 | @Override
@Command
public MessageResponse readQuorum() throws IOException {
if(initRMI()) return proxyRMI.readQuorum();
else return new MessageResponse("Cannot connect to Proxy via RMI");
} |
4e8fcb68-edcc-41bd-98ae-6c5413f0b912 | 1 | private double[] calculateCognitiveVelocity(int particle, double r1) {
double[] cognitiveVelocity = new double[position[particle].length];
for(int k = 0; k < cognitiveVelocity.length; k++){
cognitiveVelocity[k] = cognitiveConstant * r1 * (personalBest[particle][k] - position[particle][k]);
}
return cognitive... |
132e9372-8397-4c2a-a667-6f90e8a64c80 | 2 | @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onEntityRegainHealth(EntityRegainHealthEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Player) {
xAuthPlayer xp = plyrMngr.getPlayer(((Player) entity).getName());
if (plyrMngr.isRestricted(xp, event))
... |
27ee06d1-6ba0-43d6-8495-0303fe679275 | 8 | private void handleAction() {
if (actionButton.getText().equals("Find IP")) {
Integer ip = dnsDB.findIP(nameText.getText());
if (ip == null) {
JOptionPane.showMessageDialog(GUI.this,
"Could not find an IP address with host name: "
+ nameText.getText());
} else {
ipText.setText(DNSDB.IPT... |
7c7e5a4a-3bc4-4d88-9280-972dd3b2d2e9 | 8 | public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, IOException {
if(args.length == 0) {
Updater.update();
} else {
new File("Updater.jar").delete();
}
os = System.getProperty("os.name").toLowerCase().con... |
b6b2df7d-7961-401b-a369-762905016662 | 5 | public final double grad(int par1, double par2, double par4)
{
int j = par1 & 15;
double d2 = (double)(1 - ((j & 8) >> 3)) * par2;
double d3 = j < 4 ? 0.0D : (j != 12 && j != 14 ? par4 : par2);
return ((j & 1) == 0 ? d2 : -d2) + ((j & 2) == 0 ? d3 : -d3);
} |
533e532f-8398-47e0-87f4-5a22f98517c4 | 2 | public ArrayList<ObjectMap> listeObjet (){
ArrayList<ObjectMap> l = new ArrayList<ObjectMap>();
for(int i = 0 ; i < this.personne.size(); i++){
l.add((ObjectMap)this.personne.get(i));
}
if(this.objet != null){
l.add(this.objet);
}
return l;
} |
9f6dc405-6b41-45e5-a01e-687227223750 | 9 | @Override
public void update() {
Action action = this.ctrl.action(this.game);
d.rotate(action.turn*STEER_RATE*Constants.DT);
//calc new v
v.add(d, MAG_ACC*Constants.DT*action.thrust);
v.mult(LOSS);
s.add(v, Constants.DT);
s.wrap(Constants.WORLD_WIDTH, Constants.WORLD_HEIGHT);
if (acti... |
f273e7d3-bcde-41a6-ac73-1bd4b875ad4d | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
4a25fa75-320d-4d2f-9b8d-46c64ef7577f | 4 | public static Matrix createSubMatrix(Matrix matrix, int excluding_row, int excluding_column) {
int rows = matrix.getRowDimension();
int columns = matrix.getColumnDimension();
Matrix subMatrix = new Matrix(rows - 1, columns - 1);
int r = -1;
for (int i = 0; i < rows; ++i) {
... |
e17463f4-6453-4800-9afb-bcca6e8f7bfa | 5 | public void characters(char buf[], int offset, int len) throws SAXException {
String s = new String(buf, offset, len);
if (!s.trim().equals("") && importType == "STRANGEBREW") {
// SBWin uses gr instead of g, fix it:
if (s.trim().equalsIgnoreCase("gr"))
s="g";
sbCharacters(s.trim());
}
else if (... |
4432e615-d80f-4441-a01e-a5125c73da71 | 0 | public final int getBits() { return bits; } |
a8683024-34b5-4e64-9d2a-953997bd301e | 2 | public ItemList() {
setTitle("Item List");
setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
setBounds(100, 100, 325, 500);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout... |
78852a3a-eb52-43bd-8a22-2f79b76d236a | 0 | @Override
public void gameRenderMobs() {
} |
8b04e4d9-f355-4eaf-937c-a4540c7e4254 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
GeoPoint geoPoint = (GeoPoint) o;
if (Double.compare(geoPoint.lat, lat) != 0) return false;
if (Double.compare(geoPoint.lon, lon) != 0) return ... |
3bfadb0d-832c-4da7-87a4-be9c62de7054 | 2 | public Object clone() {
try {
VariableSet other = (VariableSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new alterrs.jode.AssertError("Clone?");
}... |
3a828dce-3626-4db1-a2e4-2f67d1a2e063 | 4 | public void addControlLogic() {
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (commandPanel != null) {
String filter = commandPanel.getCommandLine();
chainPanel.addFilter(filter);
}
}
});
insertAboveButton.addActionListener(new ActionList... |
426b6307-6f51-4317-8778-9a16ce8fa3fe | 3 | private void runRouteCalculation()
{
if (fromNode != null && toNode != null)
{
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
wGraph.runDij(fromNode, toNode, isFastestRoute);
if (wGraph.hasRoute(toNode))
{
mapComponent.setRouteNodes(wGraph.calculateRoute(toNode));
printRoute.setEnab... |
5331cebf-73e4-441f-a551-c587b50bdc7c | 0 | public void setCount(Integer count) {
this.count = count;
} |
06c41513-3fff-4a67-adaa-969d68bf79e0 | 7 | StringBuilder makeTotalScoreLine() {
StringBuilder stringBuilder = new StringBuilder();
calcScore();
if (nowFrame == 0) {
if (frameList.get(nowFrame).isFirstShotStrike())
stringBuilder.append(makeEachFrameScore(nowFrame));
else if (frameList.get(nowFrame)... |
c005567a-a9dc-498d-84dc-2e519a5e3731 | 2 | private static void createAndShowGUI() {
// GUI Look And Feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ignored) { }
JFrame frame = new JFrame("JCount");
frame.setLayout(new GridLayout(NUM_PANELS, 1));
for (int i = 0; i < NUM_PANELS; i++) {
JC... |
285f2495-afe3-47a9-a236-6af71c2f67bc | 4 | public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
System.out.print("Geef de maand die onderzocht wordt (getal van 1 tot 12)");
int maand = scanner.nextInt();
if (maand >= 1 && maand <= 12) {
try (Connection connection = ... |
ed176e54-e607-4c85-bfab-8385a94c4224 | 3 | private double arrondir(double nombre) {
if(nombre != Double.NEGATIVE_INFINITY && nombre != Double.POSITIVE_INFINITY && nombre != Double.NaN){
double n = nombre * Math.pow(10, arrondissement);
n = Math.round(n);
n = n / Math.pow(10, arrondissement);
return n;
... |
33ff66fd-9d60-439c-8e0f-16f50276b135 | 8 | private int animationToInt(AllEnum.AnimationCommands commands){
if(commands == AllEnum.AnimationCommands.PUNCH1){
return 1;
}
if(commands == AllEnum.AnimationCommands.PUNCH2){
return 2;
}
if(commands == AllEnum.AnimationCommands.KICK1){
... |
9444fb2e-055f-4bca-9cbf-d846a707a3c4 | 9 | @DataProvider(name = "neighbors")
public Object[][] neighborsData() {
List<Object[]> neighbors = new ArrayList<Object[]>();
for (int a = 0; a < 2; a++) {
for (int b = 0; b < 2; b++) {
for (int c = 0; c < 2; c++) {
for (int d = 0; d < 2; d++) {
for (int e = 0; e < 2; e++) {
for (int f = 0;... |
24a5f7cf-6f38-4c76-917e-e3108c201265 | 1 | private boolean judgeConverge (int color) {
Matrix[] lambdaMat = lambda.getMatrix();
Matrix[] diagMat = diag.getMatrix();
Matrix[] residueMat = residue.getMatrix();
double diff = reshapedProductUVBaseMat[color].times(diagMat[color]).plus(residueMat[color]).minus(stackedToOneColMat[color... |
8b945000-340a-4459-937b-f745a95a6a15 | 3 | public TuringTrimmingTester(String filename)
{
int index=0;
Scanner sc;
prods=new Production[42];
try {
sc = new Scanner(new File(filename));
while (sc.hasNextLine())
{
String line=sc.nextLine()+" ";
String[] aa=line.split("->");
Production p=new Production(aa[0], aa[1]);
prods[index]=... |
dab7bf3c-7cfa-4bc2-8abc-6f84ba2ea5b6 | 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 fe... |
7e47e95e-496a-4071-a8cb-8e36d5e70cd1 | 8 | public Boolean process() {
// Admin permission
if(!plugin.permission.canCreate(player)) {
noPermission();
return true;
}
// Valid command format
if(args.length == 2) {
// List slot machines
if(args[1].equalsIgnoreCase("slots")) {
sendMessage("Registered slot machines:");
for... |
305b8862-a810-4652-96de-4b72048ea96d | 2 | public MiniXMLToken getTokenAttributeName(MiniXMLToken oMiniXMLToken) {
oMiniXMLToken.setType(tAttrName);
while (true) {
if (!isNameChar(testNext()))
return oMiniXMLToken;
oMiniXMLToken.append(getNext());
}
} |
9f7a6893-cfe5-4690-9001-4f5afb0227d5 | 7 | public void rotarAtrasDerecha() {
if (direccion.equals(Direccion.derecha)) {
rotar(tipoTrans.enZ, -45);
} else if (direccion.equals(Direccion.adelante)) {
rotar(tipoTrans.enZ, -135);
} else if (direccion.equals(Direccion.atras)) {
rotar(tipoTrans.enZ, 45);
... |
7aac81ce-c01c-4182-a712-1dad3b19bf49 | 0 | private static CategoryDataset getDataSet() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(100, "北京", "苹果");
dataset.addValue(100, "上海", "苹果");
dataset.addValue(100, "广州", "苹果");
dataset.addValue(200, "北京", "梨子");
dataset... |
bb873dc5-a4ba-4e2c-b7fd-458329e2a6e9 | 0 | public String getContent(){
return this.content;
} |
e956af83-bbc9-4fcd-8446-862639542aec | 7 | private MyGraph greedyCoverRandom(MyGraph network, double factor) {
ArrayList<MyEdge> candidateEdges = new ArrayList<MyEdge>(
network.getEdges());
for (MyEdge edge : candidateEdges) {
double w = edge.getWeight() + factor;
edge.setWeight(w);
}
ArrayList<MyEdge> chosenEdges = new ArrayList<MyEdge>();
... |
0b3c240a-f8a2-4b44-9f60-5e194d36b783 | 3 | public String getNewVariableThatBelongsInLambdaSet(Grammar grammar,
Set lambdaSet) {
String[] variables = grammar.getVariables();
for (int k = 0; k < variables.length; k++) {
if (!isInLambdaSet(variables[k], lambdaSet)
&& belongsInLambdaSet(variables[k], grammar, lambdaSet))
return variables[k];
}
... |
2e72bbc1-c326-4de7-bb26-254f83402681 | 8 | @Override
public void keyPressed(KeyEvent ke) {
switch (ke.getKeyCode()) {
case KeyEvent.VK_UP:
keyState[KeyCode.UP.ordinal()] = true;
break;
case KeyEvent.VK_DOWN:
keyState[KeyCode.DOWN.ordinal()] = true;
break;
case KeyEvent.VK_LEFT:
keyState[KeyCode.LEFT.ordinal()] = true;
break... |
dfd9e4bf-ad9e-4a64-8e0d-167c996787ab | 6 | static boolean isBoolean( String var ) {
if(
var.equalsIgnoreCase("true") ||
var.equalsIgnoreCase("false") ||
var.equals("1") ||
var.equals("0") ||
var.matches("^[tT].*$") ||
var.matches("^[fF].*$") ) {
return true;
}
return false;
} |
4f83e928-fe67-4c5b-ad7a-ede84cd689cb | 3 | public static BiCubicSpline[] oneDarray(int nP, int mP, int lP){
if(mP<3 || lP<3)throw new IllegalArgumentException("A minimum of three x three data points is needed");
BiCubicSpline[] a =new BiCubicSpline[nP];
for(int i=0; i<nP; i++){
a[i]=BiCubicSpline.zero(mP, lP);
}
... |
0fa09617-ad16-40bf-88e9-02600717747c | 9 | public void processPacket(String received) {
stringParts = received.split(" ");
try {
// auction- ended- notification
if (stringParts[0].equals("!auction-ended")) {
String describtion = "";
// user is the highest bidder
if (username.equals(stringParts[1].trim())) {
for (int i = 3; i < st... |
81c9c377-4247-4105-8632-459e58b9a6a4 | 7 | public void setDefinition(String definition) {
// JavaMetadata will extract all modifiers for us
JavaMetadata metadata = new JavaMetadata(definition);
modifier = metadata.getModifier();
definition = metadata.getClassName();
context.getImports().addImports(metadata.getImports());
// Add any generics extra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.