method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
522c1824-82f3-4ca1-a96b-91208b380c61 | 7 | protected final short get_action(int state, int sym)
{
short tag;
int first, last, probe;
short[] row = action_tab[state];
/* linear search if we are < 10 entries */
if (row.length < 20)
for (probe = 0; probe < row.length; probe++)
{
/* is this entry labeled with our S... |
09bda170-e5bf-4027-855a-1c672dbbc842 | 5 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX-houseW&&X<viewX+houseW+300&&Y>viewY-(houseH)&&Y<viewY+houseH+300)
{
if (chimney)
{
G.setColor(Color.black);
G.fillRect((int)(houseX+(houseW/1.5))-viewX, (int)(houseY-(... |
607e7aec-4991-4f77-ab05-d48f2b430bd3 | 7 | private void triFusion(int debut, int fin) {
// tableau o� va aller la fusion
int[] tFusion = new int[fin - debut + 1];
int milieu = (debut + fin) / 2;
// Indices des �l�ments � comparer
int i1 = debut,
i2 = milieu + 1;
// indice de la prochaine case du tableau tFusion � remplir
int... |
cd579c71-24eb-4b06-a430-3ed18f67eda7 | 9 | public Model getInventoryModel(int amount) {
if (stackableIds != null && amount > 1) {
int stackableId = -1;
for (int i = 0; i < 10; i++)
if (amount >= stackableAmounts[i] && stackableAmounts[i] != 0)
stackableId = stackableIds[i];
if (stackableId != -1)
return getDefinition(stackableId).getInv... |
58cdb13d-a8db-409a-adaf-61c6d87e0af9 | 8 | @Override
public void run() {
while (!stop) {
try {
selector.select(1000);
Set<SelectionKey> selectionKeys = selector.selectedKeys();
Iterator<SelectionKey> it = selectionKeys.iterator();
SelectionKey key;
while (it.hasNext()) {
key = it.next();
it.remove();
try {
handleIn... |
e1fb46b3-ca8d-447e-9ec0-c39b10405528 | 4 | public static void main(String[] args) {
// vytvorit vlakno serveru a klienta
String name = args[0];
int port = Integer.parseInt(args[1]);
String file = (args.length > 2) ? args[2] : null;
try {
Thread serverTh;
InetAddress localhost = InetAddress.getLoc... |
4c662828-8122-42b5-b113-fca13535ba0d | 4 | public frmVenda() throws ErroValidacaoException, ParseException {
initComponents();
dao = new VendaDao();
pgdao = new PagamentoDao();
pdao = new ProdutoDao();
cdao = new ClienteDao();
fdao = new FuncionarioDao();
//============
List<Pagamento> pag... |
0fbafeeb-41ae-48aa-9e25-f6b624e28459 | 2 | public Object get(int index) {
if (index < 0 || index >= instructionCount)
throw new IllegalArgumentException();
return get0(index);
} |
f17065b9-8c80-4b9e-a881-ba5b205edadb | 5 | protected void move(final int x, final int y, final Piece piece) throws InvalidMoveException{
if (0 <= x && x <= Board.DIM && 0 <= y && y <= Board.DIM && canMove(x, y, piece)) {
cells[x][y].addPiece(piece);
} else {
throw new InvalidCellException();
}
} |
873efda8-9972-453e-bee6-4f13c03763f1 | 6 | private void ajout_dispoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ajout_dispoActionPerformed
// TODO add your handling code here:
int n;
switch(etat){
case Intervenant:
this.intervenant = new Intervenant(this.nom.getText(),this.prenom.getText(... |
58c21d35-539b-411f-b0ae-a2882d6aad28 | 3 | private void addFileAppender(String appenderName, String level) throws IOException {
if ((config.getLoggerName() == null) || (config.getLoggerName().equals("log4j"))) {
RollingFileAppender fileAppndr = (RollingFileAppender)Logger.getRootLogger().getAppender(appenderName);
if (fileAppndr != null) {
... |
8ea29096-c122-4938-a717-ae56296a9bcd | 2 | @Override
public boolean extensionExists(String ext) {
Iterator it = getExtensions();
while (it.hasNext()) {
String key = (String) it.next();
if (ext.equals(key)) {
return true;
}
}
return false;
} |
5c150d89-8829-4ffa-91fd-b4ca259997fc | 1 | public void notifyObservers() {
for (Observer observer : mObservers) {
observer.update();
}
} |
8e3d6766-f744-452b-9421-8dc67b9021f1 | 8 | private LinkedList<String> parseInfix(LinkedList<String> input){
LinkedList<String> stack= new LinkedList<>();
LinkedList<String> outputQueue= new LinkedList<>();
input.stream().forEach(
token ->{
if(token.equals("(")){
stack.push(token);
}else if(... |
cde5bf06-8f4d-419a-aad2-50e82fca53fb | 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... |
97514f5b-c8eb-4811-ac13-db697df428d3 | 3 | @Override
public void drawPanel(Graphics g) {
g.drawRect(position.width-width/2, position.height-height/2, width, height);
Font font = g.getFont();
int posX = position.width - font.getSize()*operator.toString().length()/4;
int posY = position.height + font.getSize()... |
837c8c4a-1293-40d7-a1cf-e2a79513a7c2 | 7 | protected static Font setFont(Font font, boolean bold, boolean italic) {
if (font == null) {
return null;
}
if ((font.getStyle() & Font.BOLD) != 0) {
if (!bold) {
return font.deriveFont(font.getStyle() ^ Font.BOLD);
}
} else {
if (bold) {
return font.deriveFont(f... |
e4d40a93-502e-430c-90c1-97827cfbfe07 | 0 | public String goToAdminProductDetails() {
this.product = this.userFacade.getProductById(this.id);
return "adminProductDetails";
} |
2054eb4b-fcef-4af0-82aa-4aa6a0b072c9 | 7 | private void recTree(int[][] processingField_prievious, int depth, int depth_current, Node currentNode, int player) {
int[][] processingField_current;
// End-Kondition für Rekursion. Dann wird aktuelle Node mit ihrem Tiefenwert und Score bestückt
if (depth == depth_current) {
proce... |
30b8daa3-a2c6-47f0-bc04-f23e8ee56833 | 5 | public void setProfession(Profession newProf)
{
resetExp();
switch (newProf)
{
case Warrior:
getEquipment().сhangeWeapon(Equipment.StandartEquipment.Weapons.Sword);
getEquipment().сhangeArmor(Equipment.StandartEquipment.Armors.MediumArmor);
... |
16ad29c4-ce8a-42a9-a03a-592c796a55de | 0 | public Player(boolean isWhite) {
this.isWhite = isWhite;
} |
b01b8764-708c-4059-ba83-5219d0ce6c5e | 6 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof Names) {
Names other = (Names) obj;
return this.firstName.equals(other.firstName)
&& this.lastName.equals(oth... |
86037736-5a55-4db2-a244-d38daa16b031 | 8 | private void loadFile(String fileName) throws CWRCException {
childrenFound = false;
file = new File(fileName);
if (file.exists()) {
} else {
try {
FileOutputStream fileOut = new FileOutputStream(file);
XMLStreamWriter out = XMLOutputFactory.n... |
274a280d-550c-464f-ac41-13c489851772 | 3 | @SuppressWarnings("unchecked")
@Override
public Boolean compareAnswer(Object input) {
HashMap<Integer, Integer> inputMap;
try{
inputMap = (HashMap<Integer, Integer>) input;
}catch(ClassCastException e){
return false;
}
for (Integer key: inputMap.keySet()){
if (!inputMap.get(key).equals(answer.get(k... |
2614c024-c0ac-4400-8cee-4f9570085505 | 2 | public static String applyRelativePath(String path, String relativePath) {
int separatorIndex = path.lastIndexOf(FOLDER_SEPARATOR);
if (separatorIndex != -1) {
String newPath = path.substring(0, separatorIndex);
if (!relativePath.startsWith(FOLDER_SEPARATOR)) {
newPath += FOLDE... |
edb64dbe-32f4-4418-8dd4-1d9d562a66ae | 0 | @RequestMapping(value = "/createEntity", method = RequestMethod.GET)
public ModelAndView welcome() {
ModelAndView mav = new ModelAndView("create-entity");
EntityForm entityForm = new EntityForm();
mav.addObject(entityForm);
return mav;
} |
415f578d-809a-4401-b663-14d26a018104 | 0 | @Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {
LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
lef.setDataSource(dataSource);
lef.setJpaVendorAdapter(... |
248969de-1eb1-4fdd-91ec-306ea644204d | 2 | public static int parseSize(String value) throws ParseException{
Pattern p = Pattern.compile("\\s*(((?<mb>[1-9][0-9]*)\\s*(M[Bb])?)|((?<gb>[1-9][0-9]*)\\s*G[Bb]))\\s*");
Matcher m = p.matcher(value);
if (m.matches()){
String mb = m.group("mb");
String gb = m.group("gb");
if (null != mb){
retur... |
3c16b0d9-3c1f-43e5-adcc-aa9d67c3a608 | 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... |
a7db0ece-529e-4742-9171-c8720660209d | 8 | private ArrayList<DayEvents> readStats(String eventStatsFile, String ijStatsFile) {
ArrayList<DayEvents> dayEventsList = new ArrayList<DayEvents>();
ArrayList<double[]> eventRateStatsList = new ArrayList<double[]>();
ArrayList<double[]> ijStatsList = new ArrayList<double[]>();
int ijDyadsWithNoEdges = 0;
... |
c675050e-a524-4249-ba30-be6fa513eea2 | 8 | private boolean isTwoByteVal(int valCode) {
switch (valCode) {
case ValCodes.LITERAL:
return true;
case ValCodes.POINTER:
return true;
case ValCodes.atA_plusLiteral:
return true;
case ValCodes.atB_plusLiteral:
return true;
case ValCodes.atC_plusLiteral:
return true;
case ValC... |
1f87f0ff-ff68-41ee-9c0e-6fcfd97275de | 3 | public float ms_per_frame() // E.B
{
if (h_vbr == true)
{
double tpf = h_vbr_time_per_frame[layer()] / frequency();
if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2;
return ((float) (tpf * 1000));
}
else
{
float ms_per_frame_array[][] = {{8.707483f, 8.0f, 12.0f},
... |
1afb56ba-a2d9-4daa-b277-e96fa8b72942 | 1 | public void startLoops(){
timer = new Timer();
new Timer().schedule(new TimerTask() {
public void run() {
gameLoop();
if(!running){cancel();}
}
}, 0, (long) (1000*period));
} |
a083d73f-0c06-4558-ad2e-54d6aec4c23b | 2 | public boolean containsValue(Object value) {
for (Iterator iter = map.keySet().iterator(); iter.hasNext(); ) {
Object key = iter.next();
Object val = map.get(key);
if (val.equals(value)) {
touch(key);
return true;
}//if
}//for iter
return false;
}//containsValue |
7e730cd4-d643-490a-9833-bd44eea661a5 | 5 | public static ArrayList<DyeParent> getDyeParents() throws SQLException {
ArrayList<DyeParent> dyeParents = new ArrayList<DyeParent>();
Statement stm = conn.createStatement();
ResultSet rs = stm.executeQuery("select d.name_dyeparent, d.price_dyeparent, dt.name_dyetype from DyeParent d " +
... |
44271003-3788-40ad-841b-d6bcad9d0762 | 9 | public Position getMovePosition() {
if (this.getWorld() == null)
return null;
double bestAngle = this.getAngle();
double bestDistance = 0;
Position bestPos = this.getPosition();
for (double currentAngle = this.getAngle() - 0.7875; currentAngle <= this.getAngle() + 0.7875; currentAngle += 0.0175) {
doubl... |
adaafbd6-efcf-4ee6-ad6f-5d9869c0d8ab | 2 | public int add(sols.Model.SubSection subSection){
int generated_Subsec_ID=-1;
StringBuffer sql=new StringBuffer();
sql.append("INSERT INTO SubSection");
sql.append("(`SubSection_ID`,");
sql.append("`Section_ID`,");
sql.append("`SubSection_Name`)");
sql.ap... |
f318d63f-e091-4993-882d-b3c19dad7a5e | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
63d8c7f7-e1b0-48d4-afac-fc0f52570b00 | 0 | public boolean isAlive() {
return alive;
} |
7c83560e-fd8b-4f1a-ad1d-aa4818eeead0 | 7 | private static void reboot() {
String jarLocation = System.getProperty("java.class.path");
if (IS_MAC) {
jarLocation = ModelerUtilities.validateJarLocationOnMacOSX(jarLocation);
}
else if (System.getProperty("os.name").startsWith("Windows")) {
jarLocation = "\"" + jarLocation + "\"";
}
String maxHeap ... |
cc9df154-d870-415e-8e27-d387a818ce20 | 1 | @Override
public void actionPerformed(ActionEvent event) {
PrintProxy proxy = getTarget(PrintProxy.class);
if (proxy != null) {
print(proxy);
}
} |
7963ca16-423d-4720-ac7b-915a2b09e563 | 7 | public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("ANNOTATION= {");
java.util.Enumeration keys = entries.keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = entries.get(key);
sb.append(key... |
4b652c04-f83d-4bb2-8ab9-86655a2b4295 | 0 | protected void execute() {} |
16102810-1c23-4b26-9343-d4d7968f96bb | 1 | public String[] dequeStringArray() {
Deque<String> dequelist = new ArrayDeque();
dequelist.add("equity");
dequelist.addFirst("Derivative");
dequelist.addLast("commondities");
Iterator<String> iter = dequelist.iterator();
String[] tmp = new String[dequelist.size()];
... |
62cd2110-bd3a-4c50-832e-287aca97b69f | 6 | private Object parseArray() throws StreamCorruptedException {
int arrayLen = readLength();
indexPlus(1);
Map<String, Object> result = new LinkedHashMap<String, Object>();
Object resultObj;
for (int i = 0; i < arrayLen; i++) {
Object tmp = parse();
String key = "";
try {
key = tmp.toString();
... |
159b6522-41e6-484a-b747-47b7134b9e2c | 0 | public Game(GameMaster master, Board board) {
this.master = master;
this.board = board;
attemptsCount = 0;
targetFound = false;
gameid = UUID.randomUUID();
} |
d85480dd-b7ca-4592-9fb3-883099247ef8 | 9 | public void draw(Object obj, Component comp, Graphics2D g2, Rectangle rect)
{
Color color = (Color) AbstractDisplay.getProperty(obj, "color");
if (color == null && obj instanceof Color)
color = (Color) obj;
Color textColor = (Color) AbstractDisplay.getProperty(obj, "textColor");
... |
89048fba-c9bd-45e7-b6a0-fb1c4d48a660 | 6 | public void drawObjectsWithID(BufferedImage canvas, boolean fill)
{
BufferedImage image = new BufferedImage(_width, _height, BufferedImage.TYPE_INT_RGB);
Graphics2D g = image.createGraphics();
g.drawImage(VisionUtils.convert2grey(canvas), 0, 0, null);
g.setFont(new Fo... |
2dfde3b1-4edf-40d9-9f7a-8e2c130366b0 | 5 | @EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
System.out.println(tracks);
Block b = event.getBlock();
Player p = event.getPlayer();
if (builderList.containsKey(p.getName())) {
Track t = getTrack(builderList.get(p.getName()));
if (b.getType() == Material.WOOL) {
Wool wool = new Wool(... |
5cc87d3d-b196-4fa6-aafc-43c8f34b35d2 | 5 | private Component getHeader() {
JButton jbSaveOutput = new JButton("<html>Save<br>output</html>");
jbSaveOutput.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
String outputText = getParsedText("\n");
if (outputText.lengt... |
3354e341-d03a-4b78-b116-c647f7c15928 | 0 | @Override
public JSONObject main(Map<String, String> params, Session session)
throws Exception {
long newTimestamp = Long.parseLong(params.get("timestamp"));
TimeMachine.setNow(newTimestamp);
JSONObject rtn = new JSONObject();
rtn.put("rtnCode", this.getRtnCode(200));
return rtn;
} |
06d2cb01-58d4-4b2a-8030-57a53faa235a | 4 | @Override
public boolean bajaDepartamento(int id)
{
EntityManager em = null;
boolean correcto = false;
try {
EntityManagerFactory ef = Persistence.createEntityManagerFactory("MerkaSoftPU");
em = ef.createEntityManager();
em.getTransaction().begin();
... |
57747e9b-27db-4be3-923a-a2ad5262ebca | 8 | public boolean isMatched(TreeNode T1, TreeNode T2) {
if (T2 == null && T1 == null)
return true;
else if (T2 == null && T1 != null)
return false;
else if (T1 == null && T2 != null)
return false;
else if (T1.value != T2.value)
return false;
else
return isMatched(T1.leftChild, T2.leftChild) && isM... |
9f5569bd-3feb-43a9-b773-60edbe6b26df | 6 | public Object transform(String input) {
String[] split = StringUtils.split(input, " ");
// Single provided argument (cannot be split) which is the word 'status'
// - return status of all lines
if (split.length == 1 && input.equals("status")) {
log.info("Request [" + input + "] resulted in a status reques... |
66f2d16e-9434-4106-a22a-b055f456f98d | 2 | public void mouseWheelMoved(MouseWheelEvent e) {
if(Global.isRunning) { return; } // block mouse input while simulating
int clicks = e.getWheelRotation();
if(clicks < 0) {
gui.zoom(1.08); // zoom In
} else {
gui.zoom(1.0 / 1.08); // zoom out
}
} |
adfe4200-c9c9-445d-93d8-3486fb8fa5c6 | 7 | public boolean onoff(Model2D model) {
float power = powerSource.getPower();
if (power == 0)
return false;
boolean refresh = false;
float t = 0;
if (thermometer != null) {
t = thermometer.getCurrentData();
} else {
Rectangle2D bounds = powerSource.getShape().getBounds2D();
t = model.getTemperatur... |
b0c19204-2d7c-4c64-b749-686e9b7cf4cc | 7 | @Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
if (!super.equals(o))
return false;
PSkill pSkill = (PSkill) o;
return skill == pSkill.skill &&
... |
50198b0c-5775-40e2-92b8-619a1f3de165 | 1 | public void checkProduction(Production production) {
if (production.getLHS().length() == 0) {
throw new IllegalArgumentException(
"The left hand side cannot be empty.");
}
} |
7eccdb23-8adc-49b7-8b48-9634096bf225 | 1 | private int evalState(State s) {
if (me.equals("red"))
return s.getnRed() - s.getnBlue();
return s.getnBlue() - s.getnRed();
} |
724a412e-396e-4fd6-95ed-1b0523f04054 | 3 | static void preprocess(char[] p) {
int i = 0, j = -1, m = p.length;
b = new int[p.length + 1];
b[0] = -1;
while (i < m) {
while (j >= 0 && p[i] != p[j])
j = b[j];
i++;
j++;
b[i] = j;
}
} |
6b9de019-e2f2-4d48-b5f7-6b66319e96f0 | 5 | private void button10MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button10MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("1");
}
if(numberofpins == 1)
{
Login_form.setString2("1");
}
if(numberofpins == 2)
{
Logi... |
f3d29242-c61f-4079-b042-59efae421cde | 7 | private void resolveLine(Node parentNode) {
validateTagsOnlyOnce(parentNode, new String[]{"datasource", "color", "legend", "width"});
String datasource = null, legend = null;
Paint color = null;
float width = 1.0F;
Node[] childNodes = getChildNodes(parentNode);
for (Node ... |
15302171-90a8-45e7-aec6-1cebec6ef630 | 8 | public boolean isSameTree(TreeNode p, TreeNode q) {
if(p == null && q == null) return true;
if(p == null && q != null) return false;
if(p != null && q == null) return false;
if(p.val == q.val) {
return isSameTree(p.left, q.left) && isSameTree(p.right, q.right);
} else {
return false;
... |
0c2d9617-3a66-4971-8461-7cd4529a7d84 | 8 | private HashSet<String> loadFile(String name) {
HashSet<String> words = new HashSet<String>();
FileReader reader = null;
BufferedReader br = null;
File file = new File(this.getDataFolder(), name);
if(!file.exists())
{
try {
file.createNewFile();
} catch (IOException e) {
logger.severe("... |
675597ad-42c9-4d52-9f6f-5f0211bde7f2 | 2 | public void onMessage(Message inMessage) {
TextMessage msg = null;
try {
if (inMessage instanceof TextMessage) {
System.out.println("onMessage received in SHSMessageBean.java");
msg = (TextMessage) inMessage;
Thread.sleep(100);
... |
c201fa6a-8faa-4cb9-a2f6-acc895276226 | 2 | public EncryptedCommunityCards requestDecryptComCards(
EncryptedCommunityCards encComCards, final User usr)
throws InvalidSubscriptionException, IOException,
InterruptedException {
final Subscription encSub = elvin.subscribe(NOT_TYPE + " == '"
+ DECRYPT_COM_CARDS_REPLY + "' && " + GAME_ID + " == '"
... |
7eb23be5-649b-41b3-97fc-202fcb4d51b6 | 5 | private long toHours() {
switch (type) {
case SECONDS:
return value / 3600;
case MINUTES:
return value / 60;
case HOURS:
return value;
case DAYS:
return value * 24;
case MILLISECONDS:
... |
dff5509f-950b-478a-bd85-388a8ec84ddb | 2 | static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} |
09bc6249-f065-4e23-9b7b-c0efa051dcd7 | 1 | public String getUrl() {
if ( this.url == null )
return "";
return url;
} |
21f734cc-51e6-4344-a3fb-9f2d0efb4c41 | 7 | GF256Poly(GF256 field, int[] coefficients) {
if (coefficients == null || coefficients.length == 0) {
throw new IllegalArgumentException();
}
this.field = field;
int coefficientsLength = coefficients.length;
if (coefficientsLength > 1 && coefficients[0] == 0) {
// Leading term must be non... |
4e6b94a8-a507-4c04-b971-c00e3a0aa32a | 4 | public List<ProductManagerDto> getProductManagerDtos(){
List<ProductManagerDto> productManagerDtos=null;
PreparedStatement stmt = null;
ResultSet rs = null;
try {
stmt = conn
.prepareStatement("select mgrName,phoneNumber from ProductManager");
rs = stmt.executeQuery();
String mgrName = "";
... |
8a126984-f07c-4ce5-825d-0182cafe5d47 | 2 | @Override
public int compareTo(Arbre otherArbre) {
return (this.poids < otherArbre.getPoids()) ? -1: (this.poids > otherArbre.getPoids()) ? 1:0;
} |
1c5160d7-c0a1-47d3-a8c2-6ad5e90d5b77 | 2 | public String select(String whereClause, String... columns) {
String format = null;
if (null == whereClause || whereClause.isEmpty()) {
format = String.format("SELECT %s FROM `%s`.`%s`", wrap(columns), schema, table);
} else {
format = String.format("SELECT %s FROM `%s`.`%s` WHERE %s", wrap(columns), schema... |
228aaca0-bc2f-4299-8f4e-ceab07f054d2 | 4 | private void completeFinalBuffer(ByteBuffer buffer) {
if(finalBuffer.position() == 0)
return;
while(buffer.remaining() > 0 && finalBuffer.remaining() > 0) {
finalBuffer.put(buffer.get());
}
if(finalBuffer.remaining() == 0) {
transform(finalBuffer.array(),0);
finalBuffer.rewind();
}
} |
c29804fb-6099-4a63-b7e2-a7fd3e6a4277 | 0 | public void setCityName(String cityName) {
this.cityName = cityName;
} |
0448b281-23d3-462f-842e-6e8fc91230c6 | 8 | private static void begin() {
Scanner sc = new Scanner(System.in);
int noTestCases = Integer.parseInt(sc.nextLine());
for (int t = 0; t < noTestCases; t++) {
Map<Integer, String> table = new HashMap<Integer, String>();
int noTurtles = Integer.parseInt(sc.nextLine());
... |
c408afb3-61dd-4cf5-854e-f97301614afd | 5 | private DoubleDoors getDoor(int id, int x, int y, int z) {
for (DoubleDoors d : doors) {
if (d.doorId == id) {
if (d.x == x && d.y == y && d.z == z) {
return d;
}
}
}
return null;
} |
20198822-5222-4867-a5a0-a9b516ee2632 | 8 | public Grammar parseGrammarFromFile(String filePath) throws IOException {
//Create new Grammar and set up file to be read
parsedGrammar = new Grammar();
BufferedReader reader = (BufferedReader) GrammarReader.readFromFile(filePath);
//Create boolean flag to indicate if the file is currently in the first few l... |
bc48797d-1be2-4108-8b43-41baa9710f4f | 9 | private void button14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button14ActionPerformed
if (order2code3tf.getText().equals("1001"))
{
o2c3destf.setText("Chicken Nugget");
}
if (order2code3tf.getText().equals("1002"))
{
o2c3... |
7290a6c4-e47b-450e-8358-4ad76419a3f1 | 8 | public static String preprocessWikiText(String text) {
if (text==null) return "";
text=text.trim();
int length=text.length();
char[] chars=new char[length];
text.getChars(0, length, chars, 0);
StringBuilder sb=new StringBuilder();
boolean blankLine=true;
StringBuilder spaces=new StringBu... |
bdfc06d4-212a-4820-a59e-28b7967ebe32 | 2 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
mv.visitMultiANewArrayInsn(desc, dims);
if (constructor) {
for (int i = 0; i < dims; i++) {
popValue();
}
pushValue(OTHER);
}
} |
14e3938b-265a-4f67-84e3-b2ee8d64cda5 | 8 | public int characterAt(int at) throws JSONException {
int c = get(at);
if ((c & 0x80) == 0) {
return c;
}
int character;
int c1 = get(at + 1);
if ((c1 & 0x80) == 0) {
character = ((c & 0x7F) << 7) | c1;
if (character > 0x7F) {
... |
fb30f086-2daa-405b-9f47-7e8eb87db184 | 3 | private void acao143() throws SemanticError{
numeroParametrosAtuais++;
if(contextoExpressao == ContextoExpressao.PARAMETROS_ATUAIS)
verificarParametro();
else if(contextoExpressao == ContextoExpressao.IMPRESSAO)
if(tipoExpressao == Tipo.BOOLEANO)
throw new SemanticError("Tipo inválido para impressão"... |
b948f489-d95f-4e0a-86e1-035fd0e40868 | 3 | public List<Message> fetchUserFriendMessages(User user)
{
initConnection();
String preparedString = null;
PreparedStatement preparedQuery = null;
List<Message> messageList = null;
try
{
/* Union query produces a list of email addresses -
the logged-in user for plus all people he'... |
5fe75692-2f2f-4ea2-832a-8d54cdc27a17 | 9 | private void doFirePropertyChange(PropertyChangeEvent event)
throws PropertyVetoException {
String propName = event.getPropertyName();
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
if (newValue != null && oldValue != null && newValue.equals(ol... |
3e356b2f-da83-4302-bdef-013b827b7598 | 2 | public void printNodesStack() {
for (int i = 0; i < topOfStack; i++) {
System.out.print((nodesStack[i] + 1) + " ");
if (i % 100 == 0)
System.out.println();
}
} |
baa3869c-45b1-4d46-a136-c5c6d6739201 | 5 | @SuppressWarnings ("unchecked")
protected final void update(final BaseItem item) throws NullPointerException, IllegalStateException, IllegalArgumentException {
switch (item.state()) {
case Item.REMOVE_STATE:
case Item.CREATE_STATE:
if (!this.equals(item.pool())) throw new IllegalArgumentException();
th... |
c4b7f9ec-bab7-4451-a155-d86284f7c9ae | 1 | public JPanel getUsertileImageMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.usermenuImageMenu;
} |
c3278b6a-347d-43d0-a25f-7ec18fd1734e | 1 | public void enol(int... overlays) {
for (int ol : overlays)
visol[ol]++;
} |
582c9326-2cb6-4354-9d47-307fd06d6063 | 0 | public List<IrcUser> getUsers(){ return Users; } |
e706c4a3-3025-45f5-9f79-ab647d1788d5 | 1 | private boolean jj_3_2() {
if (jj_3R_20()) return true;
return false;
} |
a3ae52f0-f220-4a5e-bc16-b800426b7d4e | 8 | public String getOutputKeyword() {
Dialog currentDialog = DialogManager.giveDialogManager().getCurrentDialog();
switch((KitchenAssistance)getCurrentState()) {
case KA_ENTRY:
setQuestion(true);
return "<" + currentDialog.getCurrentSession().getCurrentUser().getUserData().getUserName() + ">";
case KA_EXIT:
... |
fc9bfaaa-34cb-4014-a3e7-08a533e7a1d2 | 4 | @Test
public void testConstructor() throws SQLException, IOException,
ClassNotFoundException
{
// Make new clean database
new File("testConstructor.db").delete();
Timeflecks.getSharedApplication().setDBConnector(
new SQLiteConnector(new File("testConstructor.db"), true));
ArrayList<File> files = new A... |
68445f02-9d18-4e20-be29-59a463053263 | 1 | public int totalNQueens2(int n){
List<Integer> perm = new ArrayList<Integer>(n);
for (int i = 0; i < n; ++i) perm.add(i);
totalNQueens2Rec(0, perm);
return res;
} |
0ae521a6-9692-4008-9725-670dc62214ae | 8 | private double functionVal(MinimaxNode node)
{
Player[] players = node.getGame().getPlayers();
double functionVal = 0;
boolean hasWon = true;
for(Player enemy : players)
{
if(enemy.getLoyalty() != player.getLoyalty())
{
if(!enemy.isDefeated())
{
hasWon = false;
}
}
}
if... |
31e29103-9801-4ada-a079-c8cd17f9eadb | 9 | public boolean doTransformations() {
if (instr == null)
return false;
/*
* Do on the fly access$ transformation, since some further operations
* need this.
*/
if (instr instanceof InvokeOperator) {
Expression expr = ((InvokeOperator) instr).simplifyAccess();
if (expr != null)
instr = expr;
... |
189cd885-da53-48da-adf6-9cc2ec0a17a4 | 1 | public void draw(Graphics2D g, TreeNode node) {
g.fill(NODE_SHAPE);
Color c = g.getColor();
g.setColor(Color.black);
g.draw(NODE_SHAPE);
MinimizeTreeNode m = (MinimizeTreeNode) node;
g.setColor(c);
drawBox(g, getStateString(m), new Point2D.Float(0.0f, 0.0f));
g.setColor(c);
drawBox(g, m.getTerminal()... |
89aa1159-b93a-4c81-a66f-4f00f2f4f801 | 7 | public void radixSort(int[] data){
int max = data[0] , radix = 1;;
for (int i = 0; i < data.length; i++) {
if(max < data[i]){
max = data[i];
}
}
Node[] bucket = new Node[10];
for (int i = 0; i < bucket.length; i++) {
bucket[i] = new Node();
}
while( max/radix > 0 ){
for (int i = 0; i < ... |
f61481c9-00d6-4403-960a-2136596ced9e | 6 | protected synchronized void parserNode(Node node, WebPage wp) throws Exception {
if (node instanceof TextNode) {// 判斷是否是文本結點
// srb.addText(((TextNode) node).getText());
} else if (node instanceof Tag) {// 判斷是否是標籤庫結點
Tag atag = (Tag) node;
if(wp.getCharSet().equalsIgnoreCase("ISO-8859-1")){
//抓此連結的 ... |
fe28c3fd-3402-4948-8c90-923db37a399a | 5 | public static Carte getCarte (Label label, Couleur couleur) {
Carte carte;
switch (label) {
case JOKER:
carte = new Joker();
break;
case PLUS2:
carte = new Plus2(couleur);
break;
case PLUS4:
carte = new Plus4();
break;
case SINT:
carte = new SensInterdit(couleur);
break;
case CH... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.