method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
22f72b6d-b6a9-4d65-ae56-d6eb837a30a5 | 8 | public void merge(int[] myList, int low1, int mid, int low2, int high)
{
/* check if stopButton has been selected */
if(stopFlag == true)
{
return;
}
/* create a temp array to hold the sorted ints, initialize iterators etc. */
int[] tempArray ... |
ed4f3308-ff84-436b-86d4-d12c96d782e5 | 4 | public void movimiento(){
while(carro.getCaminoEnSeguimiento().darPrimerNodo()!=null)
{
if(carro.evaluarSiguienteMovimiento()){
try {
sleep(movingTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
carro.avanzarEnCamino();
}
else
{
try {
sleep(waitingTime)... |
e1cd1dc9-1326-46f1-bf53-9be4e3c73bad | 3 | public Object getValueAt(int row, int col) {
if (row > -1 && col > -1 && data != null) {
return data[row][col];
} else {
return null;
}
} |
580fb6d2-3d7e-41d4-a1cd-fa17e9d6d06c | 3 | public static void main(String[] args) {
try {
Socket sk = new Socket("192.168.1.220",9090);
sk.getOutputStream().write("GET /echo HTTP/1.1\r\n".getBytes("utf-8"));
sk.getOutputStream().write("Upgrade: websocket\r\n".getBytes("utf-8"));
sk.getOutputStream().write("Connection: Upgrade\r\n".getBytes("utf-8"... |
8f803041-25c2-4322-b38e-6971f4dd1af5 | 3 | private static ArrayList<Double> loadFunctionData( String filename ){
ArrayList<Double> fnData = new ArrayList<Double>();
try
{
java.io.InputStream in = Wavelet.class.getResourceAsStream(filename);
CSVReader reader = new CSVReader(new InputStreamReader(in));
List<String[]> myEntries = reader.... |
30f03f6e-3761-4e9c-8a91-937584506a63 | 1 | public String getData() {
if (data == null)
return null;
return data.toString();
} |
3ba52e67-7faa-47ba-85ab-4e88b56c1bb7 | 3 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return motherLangWordList.get(rowIndex);
}
if (columnIndex == 1) {
return translationList.get(rowIndex);
}
if (columnIndex == 2) {
return idList.get... |
8ada5606-0b74-485d-8999-5a1b776bbc0b | 4 | public static void main(String args[]){
int i=0;
int j=0;
for(i=1;i<10;i++){
for(j=1;j<10;j++){
totalarray[i][j] = cross;
}
}
for(i=1;i<4;i++){
for(j=1;j<4;j++){
subarray(i,j);
}
}
finalwin = checkarray(bigarraydecision,zero);
finalwin = checkarray(bigarraydecision,cross... |
654cc7f5-007e-4782-88c3-b834fa4afcbc | 8 | public static <T> T fromJson(final String inJson, Class<T> objClass) {
try {
boolean errorFound = false;
// if API returned errors or warnings
if (GsonErrors.class.isAssignableFrom(objClass)) {
GsonErrors gsonErrors = gson.fromJson(inJson, GsonErrors.class);
if (gsonErrors != null) {
// print er... |
592b7838-3582-4276-805a-62d8dde08e56 | 8 | protected List<Exit> findExits(Modifiable M,XMLTag piece, Map<String,Object> defined, BuildCallback callBack) throws CMException
{
try
{
final List<Exit> V = new Vector<Exit>();
final String tagName="EXIT";
final List<XMLLibrary.XMLTag> choices = getAllChoices(null,null,null,tagName, piece, defined,true);... |
c6e77843-c22a-4b1d-a31d-95e3777bdcd7 | 4 | public static void main(String[] args) {
// Initialization
Deck playDeck = new Deck();
playDeck.shuffle();
Hand playerHand = new Hand();
playerHand.drawNewHand(playDeck);
Hand computerHand = new Hand();
computerHand.drawNewHand(playDeck);
// Playing the game
playerHand.evaluate();
int[] playerSco... |
8acf0cfe-de7d-4599-a473-91c87f0ba194 | 4 | @Override
public void run() {
Object value = null;
RoomInfo roomInfo;
String resultString;
try {
oIn = new ObjectInputStream(new BufferedInputStream(
socket.getInputStream()));
value = oIn.readObject();
try {
roomInfo = getByEvent((String) value);
if(roomInfo!=null)
{
r... |
2dff91ce-02fc-4fd4-8be3-0b9e3971c509 | 2 | public static <T, E> T getKeyByValue(Map<T, E> map, E value) {
for (Map.Entry<T, E> entry : map.entrySet()) {
if (value.equals(entry.getValue())) {
return entry.getKey();
}
}
return null;
} |
7a18d780-22a9-4fd2-af50-aa837c6635dc | 5 | @Override
public boolean equals(Object obj) {
if (obj instanceof BulkItem) {
BulkContainer objBulk = (BulkContainer) obj;
if (objBulk.food == this.food && objBulk.amount == this.amount
&& objBulk.unit == this.unit && objBulk.container == this.container)
return true;
else
return false;
}//if... |
8553deb0-90f8-4160-8f3f-c99bfeaf3d05 | 5 | public void keyReleased(KeyEvent evt){
switch(evt.getKeyCode()){
case KeyEvent.VK_W:
upPress = 0;
break;
case KeyEvent.VK_S:
downPress = 0;
break;
case KeyEvent.VK_A:
leftPress = 0;
break;
case KeyEvent.VK_D:
rightPress = 0;
break;
... |
09863ab0-4cdc-4507-9c53-885db253784e | 3 | public TeaNode getNode(String[] valuesCombination) {
String[] strValues = new String[2];
strValues[0] = valuesCombination[0];
strValues[1] = valuesCombination[2];
Double sugar = valuesCombination[1] == null ? 0
: Double.parseDouble(valuesCombination[1]);
for (TeaNode node : this.nodes()) {
if(ArrayUtil... |
5407c070-a12f-42c2-88bb-9d3af8b94e92 | 7 | private static boolean
backrefMatcher(REGlobalData gData, int parenIndex,
char[] chars, int end)
{
int len;
int i;
int parenContent = gData.parens_index(parenIndex);
if (parenContent == -1)
return true;
len = gData.parens_length(parenIndex)... |
0a69e7bb-092c-4ae4-9afb-f070acbf8259 | 2 | public List<infoNode> getInfo() {
ArrayList<infoNode> info = new ArrayList<infoNode>();
NodeList infoNodes = node.getChildNodes();
for (int i = 0; i < infoNodes.getLength(); i++) {
Node node = infoNodes.item(i);
if (node.getNodeType()... |
b87e26d6-9457-40ae-ba77-19d0ffaf26f3 | 7 | private boolean initialize()
{
CommPortIdentifier portID = null;
Enumeration ports = CommPortIdentifier.getPortIdentifiers();
System.out.println("Trying ports:");
while(portID == null && ports.hasMoreElements())
{
CommPortIdentifier testPort = (CommPortIdentifier) ports.nextElement();
System.out.printl... |
f4ae39ed-584f-4bdb-8de8-29379738bf4b | 3 | public void report_error(String message, Object info) {
StringBuffer m = new StringBuffer("Error");
if (info instanceof java_cup.runtime.Symbol) {
java_cup.runtime.Symbol s = ((java_cup.runtime.Symbol) info);
if (s.left >= 0) { ... |
167bf9d7-7935-4fc7-92c0-65aebe64e1a0 | 3 | private void makePacks(List<Card> cardList) {
for (Card.Suit suit : Card.Suit.values()) {
//No kings.
for (int i = 0; i < Card.Rank.values().length - 1; i++) {
cardList.add(new Card(suit, Card.Rank.values()[i], true));
}
//No kings or aces.
... |
b99a72b7-8610-4677-b71b-363072528e2d | 7 | private void jBt_IngresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBt_IngresarActionPerformed
// TODO add your handling code here:
ButtonModel bm = this.bGr_Motivo.getSelection();
if(bm!=null){
if(this.jRb_Archivo1.isSelected()) // Si es ingreso manual, pasa... |
bf4388df-6c57-4566-8485-ea1c1739cc55 | 3 | private void paintOnScreen() {
try {
graphics = buffer.getDrawGraphics();
graphics.drawImage( bi, 0, 0, null );
if( !buffer.contentsLost() )
buffer.show();
Thread.yield(); // Let the OS have a little time...
} finally {
// release resources
if( graphics != null )
graphics.dispose();
... |
9cf13000-8296-4b7b-a50b-150e3cbac583 | 4 | @Override
public void collideWith(Element e) {
if (e instanceof PlayerCTF) {
final PlayerCTF playerEntered = (PlayerCTF) e;
// You have to enter your own StartingPosition
if (player.equals(playerEntered)) {
final PlayerFlag inventoryFlag = playerEntered.getInventory().findFlag();
if (inventoryFlag !... |
e08bd7c0-aaf8-4f70-9fa9-5eae1a1dfe82 | 1 | public boolean matchesAndOneAbove(Card other) {
return (other.getSuit() == this.suit && this.rank.ordinal() == other.getRank().ordinal() + 1);
} |
87de58c0-5476-4c0a-b371-d2ac3f98a92c | 7 | public boolean SurviveVisions(int[] inTargets, byte[] inVisions){ // returns true if this set of visions is compatible
// with this GameState. In the boolean array, 1 means innocent, 2 means wolf, 0 means no target.
boolean output = true;
for(int n = 0; n < NumPlayers; n++){
if(this.playerTest(n+1) == 2){
... |
e57b4c47-fdaa-4a7d-b8b8-725bf4aa19ec | 5 | private void preprocessDataTwo(double commonError){
// Check row and column lengths
this.numberOfRows = this.values.length;
this.numberOfColumns = this.values[0].length;
for(int i=1; i<this.numberOfRows; i++){
if(this.values[i].length!=this.numberOfColumns)throw new Illeg... |
b96bd4c8-065a-4fc6-8c8a-1664ef07c097 | 9 | SlotAction parseSlotAction (Model model, Set<String> variables) throws Exception
{
String operator = "";
if (t.getToken().equals("-") || t.getToken().equals("<") || t.getToken().equals(">")
|| t.getToken().equals("<=") || t.getToken().equals(">="))
{
operator = t.getToken();
t.advance();
}
Symbol s... |
89088105-3067-4e02-a192-f0447b1db7a2 | 7 | public void generate(int files, int payments) {
int x;
int y;
int total = 0;
try {
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
for (x = 0; x < files; x++) {
Document doc = docBuilder.newDocument();... |
beb362d6-9941-4a4a-a18a-8d15621d1c7e | 0 | public int GetTravelTime()
{
//return the travel time
return this.offBusTicks - this.onBusTicks;
} |
3a3698e8-d4b2-49f3-8a8a-786f63002283 | 7 | public void disconnect() {
try {
if(sInput != null) sInput.close();
}
catch(Exception e) {} // not much else I can do
try {
if(sOutput != null) sOutput.close();
}
catch(Exception e) {} // not much else I can do
try{
if(socket != null) socket.close();
}
catch(Exception e) {} // not much... |
7640ffde-d054-45cd-96fa-bc16bae097cc | 2 | protected boolean canHaveAsElement(Position pos, Element elem) {
return elem != null && pos != null && grid.getElementsOnPosition(pos).isEmpty();
} |
6b066ea2-1b65-408f-9a47-e00f8f2756ad | 4 | public static double binaryShannonEntropyDit(double p) {
if (p > 1.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be less than or equal to 1");
if (p < 0.0) throw new IllegalArgumentException("The probabiliy, " + p + ", must be greater than or equal to 0");
double entropy = 0.0D;
if (p... |
df7a066c-dfc2-4767-91c2-2cf5d6e33266 | 6 | protected void avoid(mxCellState edge, mxCellState vertex)
{
mxIGraphModel model = graph.getModel();
Rectangle labRect = edge.getLabelBounds().getRectangle();
Rectangle vRect = vertex.getRectangle();
if (labRect.intersects(vRect))
{
int dy1 = -labRect.y - labRect.height + vRect.y;
int dy2 = -labRect.y... |
23dd34ad-123b-428a-a112-814ffa6473e3 | 0 | public State getState()
{
return state;
} |
880b8764-fb04-47ac-9b05-5580e6c4dab1 | 5 | public void draw(Graphics2D g) {
int w = getWidth();
int h = getHeight();
RoundRectangle2D box = new RoundRectangle2D.Float(
0, 0, w, h, 20, 20);
g.setColor(background);
g.fill(box);
GradientPaint paint;
/*
GradientPaint paint = new GradientPaint(
... |
fe319c99-5c8f-4786-a11d-594e31bcdff7 | 5 | @Override
public String get(long i)
{
if (ptr != 0) {
short strLen = stringLengths.getShort(i);
if (strLen < 0) return null;
long offset = sizeof * i * maxStringLength * CHARSET_SIZE;
for (int j = 0; j < strLen; j++) {
byteArray[j] = Utilit... |
08200660-2ac9-4a46-b000-854a3bddaffb | 5 | public void sortBySuit() {
// Sorts the cards in the vHand so that cards of the same suit are
// grouped together, and within a suit the cards are sorted by value.
// Note that aces are considered to have the lowest value, 1.
Vector vNewHand = new Vector();
while (vHand.size() > 0... |
1c5bbdb7-9d6b-4f52-89e9-58ad851c78ca | 4 | public static void main(String[] args) {
ArrayList<Commands> inputCommands;
ArrayList<Commands> outputCommands;
ArrayList<Commands> sorted;
Scanner inputText = new Scanner(System.in);
String text;
String path = "";
System.out.println("Enter path-name or l... |
07df19ce-1709-42ca-b15e-3c4491ea05c5 | 8 | public String getRecommendListForPreferentialAttachment() {
String recommend = "";
try {
Class.forName("com.mysql.jdbc.Driver");
connect = DriverManager.getConnection("jdbc:mysql://localhost/NETWORK_TEST?"
+ "user=root&password=root");
connect.setAutoCommit(false);
statement = connect.cr... |
2d1484ed-d879-4432-83b0-c38276a0fbd7 | 3 | public Route geefRoute(Knooppunt start, Knooppunt stop) throws IllegalArgumentException {
if(knooppuntOpMuur(stop) == true || knooppuntOpMuur(start) == true) throw new IllegalArgumentException("start en/of stop mogen niet op een muur vallen");
if (start.equals(stop)) {
Route routeNaarZelfde... |
da652ec3-f87a-4800-8da4-c9ab2619fd15 | 5 | private boolean cargarProductosVendidos(int idVenta, LinkedList<Pair> productos, LinkedList<BigDecimal> preciosFinales) {
boolean resultOp = true;
Iterator itr = productos.iterator();
Articulo prod;
Pair par;
BigDecimal cant;
Venta v = Venta.findById(idVenta);
if ... |
a3a5df9e-d28b-476f-bfe1-0828f242a2ea | 8 | public boolean mousedown(Coord c, int button) {
if (folded) {
if (!c.isect(Coord.z, isz.add(cl.sz())))
return false;
if (c.isect(Coord.z.add(cl.sz()), isz))
return true;
}
if (awnd != null)
awnd.setfocus(awnd);
else
... |
548aee4c-a2d7-42a2-afdc-a74531998442 | 4 | public static void closeDB() {
try {
if (connection != null) {
connection.close();
}
if (statement != null) {
statement.close();
}
if (rs != null) {
rs.close();
}
} catch (Exception e) {
e.printStackTrace();
}
} |
9b922529-460a-4d9a-89a7-fdffdee40760 | 8 | protected void gmcpSaySend(String sayName, MOB mob, Environmental target, CMMsg msg)
{
if((mob.session()!=null)&&(mob.session().getClientTelnetMode(Session.TELNET_GMCP)))
{
mob.session().sendGMCPEvent("comm.channel", "{\"chan\":\""+sayName+"\",\"msg\":\""+
MiniJSON.toJSONString(CMLib.coffeeFilter().fullOut... |
c24f237a-453c-401b-84e4-148a2bc9a9f1 | 8 | private static Relationshiptype setBeanProperties(ResultSet resultset) {
Relationshiptype relationshiptype = new Relationshiptype();
try {
relationshiptype.setId(resultset.getInt("id"));
relationshiptype.setName_a_b(resultset.getString("name_a_b"));
relationshiptype.s... |
124edb82-46c2-47fd-9e06-1fcb76816b6e | 5 | @Override
public Extension[] getChildren()
{
NodeList children = configEntry.getChildNodes();
if(children != null) {
Extension[] res = new Extension[children.getLength()];
int newIndex = 0;
for(int i = 0; i < children.getLength(); i++) {
Node entry = children.item(i);
// make sure that i... |
9ec432a7-3698-4b7c-98f3-6038e1267d0b | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for (int t = 1; t <= T; t++) {
int N = sc.nextInt();
int[] arr = new int[N];
for (int i = 0; i < N; i++) {
arr[i] = sc.nextInt();
}
... |
ad225496-ff3e-4987-be78-86f331c4b4c3 | 2 | @Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((dir == null) ? 0 : dir.hashCode());
result = prime * result + ((hexLoc == null) ? 0 : hexLoc.hashCode());
return result;
} |
32e1683d-8624-4854-8247-bcf3f916f910 | 6 | @Override
public boolean halt(Event lastEvent, OurSim ourSim) {
boolean halt = true;
List<Job> finishedJobsList = new LinkedList<Job>();
for (ActiveEntity entity : ourSim.getGrid().getAllObjects()) {
if (entity instanceof Broker) {
Broker broker = (Broker) entity;
List<Jo... |
5666e055-baba-442a-8ff3-0d4f6e00d2b9 | 5 | public void declareWinner() {
int white, black;
white = black = 0;
String string;
for(int i = 0 ; i < board_row; i++) {
for(int j = 0; j < board_col; j++) {
ChipColor color = board_array[i][j].getChipColor();
if(color == ChipColor.WHITE)
... |
dd9e3478-1e9b-4ccf-9f0e-610f3ee387a4 | 1 | public void save() throws IOException {
JSONObject json = new JSONObject();
json.put("startYear", startDate.getYear());
json.put("startMonth", startDate.getMonth());
json.put("startDay", startDate.getDay());
json.put("username", username);
json.put("displayName",... |
e71a7e0b-1320-4d20-87df-61a454d0b7ce | 6 | public boolean getBoolean(String key) throws JSONException {
Object object = this.get(key);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equals... |
78e14ddb-1373-457c-a52c-9a5e8cbf4782 | 3 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if(string != null) {
for(int i=0;i<string.length;i++) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FontRenderContext frc = g2.getFontRende... |
e8e53820-43bf-4ec1-a42c-4d603987a586 | 0 | public Object getInternal() {
return internal;
} |
6197774b-4c44-4615-8676-23063731fd15 | 9 | private String readByteArray() {
StringBuffer buf = new StringBuffer();
int count = 0;
char w = (char) 0;
// read individual bytes and format into a character array
while ((loc < stream.length) && (stream[loc] != '>')) {
char c = (char) stream[loc];
byte... |
455eb04c-8a53-4440-ab3d-e65bec9d9581 | 5 | private void AITurn() throws CloneNotSupportedException {
Coordinates toHit = new Coordinates();
do {
// first time hit any ship
if (strategie == null && lastAttackResult == true) {
strategie = new AttackStrategie(lastAttack);
toHit = strategie.g... |
4c0cabc7-4f2d-4f05-8199-380e6ee65492 | 1 | public String convert(HashMap<String, Integer> dv) {
// El mensaje debe ser en la forma IP:costo para cada elemento del dv en vez del espacio como separador del vector
StringBuilder result = new StringBuilder();
result.append("From:");
result.append(Setup.ROUTER_NAME);
result.ap... |
dd673224-90cc-4b61-aa4a-2f6ef1b91341 | 6 | public void monitorFileModify(Path file) {
try {
if(file.startsWith(sourceDir) &&
!Files.isDirectory(file)){
Path subPath = sourceDir.relativize(file);
for(Path targetDir : targetDirs){
Path newPath = targetDir.resolve(subPath);
if(!newPath.toFile().exists() || !FileUtils.content... |
96869205-b5a2-4bb9-bb5a-9474fc15d7d0 | 1 | public void setDescriptor(String desc) {
if (!desc.equals(getDescriptor()))
descriptor = constPool.addUtf8Info(desc);
} |
aaf5fe16-436b-4293-950d-dd729cd9fe58 | 7 | @Override
public JSONObject addPUserPollActivity(String userId, String name,
String option) throws JSONException {
boolean isSuccess=false;
JSONObject mainobj=new JSONObject();
try {
pm = PMF.get().getPersistenceManager();
Query query = pm.newQuery(Poll.class, ":p.contains(pollName)");
List<Poll> res... |
e57e7f68-413c-4445-b977-83205d9128ea | 8 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
MInterface other = (MInterface) obj;
if (operations == null) {
if (other.operations != null)
return false;
} else if (!operations... |
966c13bd-5eaa-45ec-bdca-669f76bdddff | 9 | public String getSchemeSpecificPart() {
StringBuffer schemespec = new StringBuffer();
if (m_userinfo != null || m_host != null || m_port != -1) {
schemespec.append("//"); //$NON-NLS-1$
}
if (m_userinfo != null) {
schemespec.append(m_userinfo);
schemespec.append('@');
}
if (... |
352837e5-8af5-4a1c-a51b-621c739c947f | 9 | private void export() {
if(modelCompareShipping == null) return;
Integer columnCount = jTableReport.getColumnCount() == 0 ? 1 : jTableReport.getColumnCount();
Integer rowCount = jTableReport.getRowCount() + 5;
Object[][] data = new Object[rowCount][columnCount];... |
7b47c578-5adc-4d23-bf09-a9eff34abadc | 0 | public String getAddressDetail() {
StringBuilder addressDetail = new StringBuilder();
addressDetail.append(getStreetName() + "\n" + getCityName() + ", "
+ getStateName() + "\n" + getCountry() + "\nPin: "
+ getZipCode());
return addressDetail.toString();
} |
0732985e-1b96-4359-b03b-1cacbab3b3d2 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder out = new StringBuilder();
fillFibo(45);
int testCases = Integer.parseInt(in.readLine().trim());
for (int t = 0; t < testCases; t++) {
int n = Integer.parseInt... |
9d0c1c48-0307-4e11-8584-7014612b485c | 1 | public static Packet01JSON decode(byte[] data) throws IOException {
ByteArrayInputStream stream = new ByteArrayInputStream(data);
try {
stream.reset();
return new Packet01JSON(mapper.readValue(stream, Map.class));
} catch (Exception e) {
System.out.println("od... |
38c2fdab-5446-4cfd-b2fe-37415f143a2a | 5 | public void run() {
try {
Telnet.writeLine(cs, "<fggreen> >>> Welcome to AdaMUD <<< <reset>");
Telnet.flushInput(cs);
while((player = s.getPlayerDB().login(cs, s)) == null);
player.look();
while (true) {
System.out.println("Waiting for message");
String message = Telnet.readLine(cs).tri... |
ee14d1c3-78cf-4672-ba95-ce8f08a7f107 | 3 | public static int uniforme(double... probas) {
// TODO à revoir
double p = rand.nextDouble();
// System.out.println("p : " + p);
boolean stop = false;
int i = 0;
double proba = 0;
while (!stop && i < probas.length) {
// System.out.println("i : " + i);
... |
a2cd5444-e5ff-4b56-89cf-f168aaf0a485 | 3 | public short deinitialize()
{
exit.set(true);
// Stop the packet sniffing
MsgAnalyzerCmnDef.WriteDebugSyslog("De-initialize the SerialReceiver object\n");
short ret = serial_receiver.deinitialize();
if (MsgAnalyzerCmnDef.CheckFailure(ret))
return ret;
// Notify the worker thread of analyzing serial data to... |
56f1f144-b108-4943-bcb4-59a40100f4f9 | 5 | public int Problem41() {
for (int n=9;n>=1;n--) {
int[] digits = new int[n];
for (int i=0;i<digits.length;i++) {
digits[i]=i+1;
}
int result=-1;
do {
if(Utility.isPrime(Utility.toInteger(digits))) {
result = Utility.toInteger(digits);
}
}while (Utility.nextPermutation(digits));
i... |
c0e70e8d-0df4-4bb7-8413-971d0527e8e3 | 2 | private Cmds getCommand(String message) {
int begin = message.indexOf(' ') + 1;
int end = message.indexOf(' ', begin);
if(end == NOT_FOUND)
end = message.length();
String cmd = message.substring(begin, end).toUpperCase();
try {
return Cmds.valueOf(cmd);
... |
4c3d18fc-a989-4350-8ade-df3728540792 | 8 | private void assignGamePoints() {
// Get our card points and game value.
int curCardPoints = countCardPoints(declarerIndex);
int curGameValue = gameValue();
// Grab our player and tricks won pile for them.
PlayerInfo player = players[declarerIndex];
Pile pile = player.getTricksWonPile();
// There ar... |
adf9b02c-d4fe-4da8-b2e3-e7227be839e9 | 6 | public static boolean isValid(MouseEvent e, Canvas c, Palette pal)
{
if (pal != null && pal.getSelectedColor(e.getButton()) == null) return false;
Point p = e.getPoint();
if (p.x < 0 || p.y < 0) return false;
Dimension d = c.getImageSize();
if (p.x >= d.width || p.y >= d.height) return false;
retur... |
3f12c3d5-21d4-46a8-b24c-f085ff82c9d8 | 1 | private VappClient createVApp(IControllerServices controllerServices, String vCloudUrl, String username, String password, String orgName, String vdcName, String vAppName, String catalogName, String templateName, String network) throws ConnectorException
{
VappClient vCloudApp = new VappClient(controllerServices);
... |
b4659d75-e296-4b2d-a758-6cd15767bf41 | 0 | @Override
public void loadRcon() throws DataLoadFailedException {
Map<String, Object> data = getData("server", "name", "rcon");
load(PermissionType.RCON, "rcon", data);
} |
441dfbf3-0206-4d49-ad42-abd3fd5c3738 | 2 | public final synchronized void close(){
if(fileFound){
try{
input.close();
}catch(java.io.IOException e){
System.out.println(e);
}
}
} |
42254c1b-2448-4083-b3f0-98c64e4461cb | 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... |
908f2815-6c66-422d-a63e-a7ec36545781 | 5 | /* */ public void checkFire()
/* */ {
/* 114 */ for (int i = 0; i < Core.barricades.size(); i++) {
/* 115 */ Barricade b = (Barricade)Core.barricades.get(i);
/* 116 */ if (this.hitCheck.intersects(b.getBox())) {
/* 117 */ this.autoFire = false;
/* */ }
/* */ }
/* 12... |
5ac075d6-dca3-4a96-8922-0f3c7cad258b | 4 | public static ArrayList<Model3D> clone(ArrayList<Model3D> l) {
ArrayList<Model3D> models = new ArrayList<Model3D>();
Model3D model;
for (Model3D m : l) {
model = new Model3D();
for (Face f : m.getFaces()) {
model.getFaces().add(new Face(new Point(f.p1.x, f.p1.y, f.p1.z), new Point(f.p2.x, f.p2.y, f.p2.z... |
fe3d8265-fd41-425d-bf0b-fb040bf5dbd6 | 2 | static List<Language> getLanguages(Path languageProperties) throws IOException {
if (!FileUtil.control(languageProperties)) {
throw new IOException();
}
if (languages == null) {
readLanguageProperties(languageProperties);
}
return languages;
} |
5d94d710-7c38-4351-ac9e-f019bc7b15d2 | 7 | public void applyUpdate(Contact update) {
if (update == null) return;
if (update.getId() != 0 && update.getId() != this.getId() )
throw new IllegalArgumentException("Update contact must have same id as contact to update");
// Since title is used to display contacts, don't allow empty title
if (! isEmpty( upd... |
29770267-dd95-4985-bb80-79e75fa28426 | 5 | int skipCommentsAndQuotes(char[] expressionChars, int position) {
String[] startSkip = getStartSkip();
for (int i = 0; i < startSkip.length; i++) {
// 判断表达是否和注释的起始标识匹配
if (expressionChars[position] == startSkip[i].charAt(0)) {
boolean match = true;
for (int j = 1; j < startSkip[i].length(); j++) {
... |
b359c438-3f91-4de4-b558-47b109daf10c | 9 | protected synchronized void refreshDicWords(String dicPath) {
int index = dicPath.lastIndexOf(".dic");
String dicName = dicPath.substring(0, index);
if (allWords != null) {
try {
Map/* <String, Set<String>> */temp = FileWordsReader
.readWords(dicHome + dicPath, charsetName);
allWords.put(dicName,... |
4e54782c-519a-47c3-a8c9-63f02d62caee | 8 | @Override
public void process(WatchedEvent event) {
System.out.println("[" + Thread.currentThread() + "event : "
+ event);
switch (event.getType()) {
case None:
switch (event.getState()) {
case Disconnected:
... |
076e789f-e3a0-4f62-ac8a-32d8ff401354 | 0 | public void mouseReleased(MouseEvent event) {
adapter.mouseReleased(event);
} |
40ade1b7-0d9b-474e-af0c-957ce8777539 | 3 | public static DatarateProperty createSoftRequirement(int bandwidthKBitSec, double percentageMinimalRequired)
{
if(percentageMinimalRequired > 1) percentageMinimalRequired = 1.0d;
if(percentageMinimalRequired < 0) percentageMinimalRequired = 0;
// do we require 100% of requested at minimum?
if(percentageMinima... |
c6c40703-bf7d-49c1-ac94-65a8df230df2 | 6 | private double getHeightScalingConstant(){
double s = 0.0;
if(!maxWeightMap.isEmpty() && !davidAvgGVC){
for(Map.Entry<String, Double> entry : maxWeightMap.entrySet()){
s += entry.getValue();
}
} else if (!averageAttributeWeights.isEmpty() && davidAvgGVC) {
for (Map.Entry<Strin... |
54b21990-bb20-4e55-a002-b4d5ddfec36e | 5 | public Collection<ProvinciaDTO> buscarPorDepartamento (int iddepa)
{
Connection con = null;
PreparedStatement pstm = null;
ResultSet rs = null;
try {
con = UConnection.getConnection();
String sql = "SELECT p.* "
+ "FROM ub... |
6acb70f4-f32f-4a38-ae5e-adf69c14236d | 1 | public void Display_store() {
final Iterator iter = IndStore.values().iterator();
while (iter.hasNext()) {
final Swizzler indswz = (Swizzler) iter.next();
System.out.println("\nIV: " + indswz.ind_var() + " tgt: "
+ indswz.target() + "\narray: " + indswz.array()
+ " init: " + indswz.init_val() + " ... |
fe410b6a-591b-4251-94b8-99b8439efc3b | 5 | @EventHandler(priority=EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
if(isPlaying.contains(event.getPlayer().getName())) {
if(event.getPlayer().getItemInHand() != null) {
if(event.getPlayer().getItemInHand().getType().equals(Material.MUSHROOM_SOUP)) {
if(event... |
2ec76d68-46f5-4825-b840-66861d10c9c1 | 1 | public void eatMeat(int meat) {
this.meat -= meat;
if (this.meat <= 0) {
this.timeOfInertion = 0;
}
} |
a57e0bbc-6c8e-4cbf-a0d2-f2140daaa6ba | 3 | private int jjMoveStringLiteralDfa23_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjMoveNfa_0(0, 22);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
return jjMoveNfa_0(0, 22);
}
switch(curChar)
{
case 45:
return jjMoveStringLiter... |
4080b403-3f90-476e-bdca-b8bc4d1e07ff | 4 | public boolean tablanvan(){
if(hovaakar1>-1 && hovaakar2>-1 && hovaakar1<8 && hovaakar2<8)
return true;
else {
logger.info("A lépés nem a táblán van!");
return false;
}
} |
16103abb-f716-4524-9048-2724847aef5d | 2 | @Override
protected void updateShareRate(Share share)
{
List<Long> history = historyData.get(share.name);
if(history != null && flag < history.size()){
share.setActualSharePrice(history.get(flag));
}else{
flag = 1;
}
} |
3e05858e-5137-4caf-81eb-483ae4ae9c65 | 0 | @Test
public void delMinReturnsCorrectValueAfterSingleInsert() {
h.insert(v);
assertEquals(v, h.delMin());
} |
b0b11984-3423-430b-9392-10c65b6da7e3 | 4 | public String getToken() {
cadtmp = null;
for (int x = this.getBegin(); x < this.getCad().length(); x++) {
chartmp = this.getCad().charAt(x);
this.setBegin(x);
if (chartmp != ' ') {
if (Pattern.matches(this.getMatchValue(), chartmp + "")) {
... |
abd6d65c-816c-4983-a890-3c5880c4daab | 3 | private static byte[][] ShiftRows(byte[][] state) {
byte[] t = new byte[4];
for (int r = 1; r < 4; r++) {
for (int c = 0; c < Nb; c++)
t[c] = state[r][(c + r) % Nb];
for (int c = 0; c < Nb; c++)
state[r][c] = t[c];
}
return state;
} |
6d5d3de8-1955-46bd-8347-232bf6856a46 | 1 | public void setUse(String ID, boolean use)
{
int row = getIndex(ID);
if (row == -1)
return;
rows.get(row)[USE] = new Boolean(use);
} |
3cc9b928-e88c-40cb-9802-67114e9688d5 | 8 | public static Graph randomTree4() {
int depth = 6;
Graph graph = new Graph(depth * 100, depth * 50);
int a = 0;
int b = 1;
int c = 0;
graph.addVertex(new Vertex(c++, 25, 25 + 25 * (depth - 1)));
for (int i = 1; i < depth; i++) {
for (int j = 0; j <= i; j++) {
graph.addVertex(new Vertex(c++, 25 +... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.