method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a51708ed-e50f-437e-8c5f-2d8d4405b203 | 8 | public Set<Class<?>> getAllClassesFromPackage(String basePackage, boolean recursive) {
Set<Class<?>> classes = new LinkedHashSet<Class<?>>();
String packageName = basePackage;
if (packageName.endsWith(".")) {
packageName = packageName.substring(0, packageName.length() - 1);
}
String package2Path = packageN... |
366e46cf-a65f-4c72-9b82-9d120dc8d9b3 | 7 | public Examinador() {
this.tablemap = new HashMap<String, Method[]>();
try {
Method[] ids = new Method[]{
Examinador.class.getMethod("getIdExaminador", new Class<?>[]{}),
Examinador.class.getMethod("setIdExaminador", new Class<?>[]{Integer.class})
... |
26c42011-f4a4-4647-abe5-aca1ed040073 | 9 | private void resetCommunication(Statement statement, boolean structured){
String transactionCode = statement.getTransactionCode();
String communication = statement.getCommunication();
if (transactionCode.equals("402") || transactionCode.equals("404")) {
communication = communication.... |
74b8c5e3-04e0-4e59-b654-b315e4dbdde3 | 6 | public static HashMap<String, String> stMakeData(int dataId,String shname)
{
try
{
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse (new File(".//Data//Data.XML"));
... |
93ba6248-f3df-44eb-a86a-557287369042 | 7 | protected void applyHighlighting(String content, int line)
throws BadLocationException {
int startOffset = m_RootElement.getElement(line).getStartOffset();
int endOffset = m_RootElement.getElement(line).getEndOffset() - 1;
int lineLength = endOffset - startOffset;
int contentLength = content.leng... |
74fa30df-8369-4a12-a2ee-48f590703a02 | 7 | public void deleteSubscribedCategories(int studentid){
ResultSet rs=null;
Connection con=null;
PreparedStatement ps=null;
try{
String sql="DELETE FROM student_category_mapping WHERE s_id=(?)";
con=ConnectionPool.getConnectionFromPool();
ps=con.prepareStatement(sql);
ps.setInt(1, studentid);
ps.ex... |
087cb36d-acef-4a4b-8482-9c21f593f5f9 | 4 | public void paint(Graphics g) {
if (root == null)
return; // No tree to draw.
Graphics2D g2 = (Graphics2D) g;
Dimension d = getSize();
g2.setPaint(Color.white);
g2.fill(new Rectangle2D.Double(0, 0, d.width, d.height));
// Avoid division by zero if only one level in tree.
int depth = (getDepth() == 1 ... |
37dd4f82-a0c8-468b-8744-03787109bc06 | 1 | @Test
public void adicionarMaisDeUmCliente() throws ExceptionGerentePessoa {
Cliente c = setarCliente("João", "000.000.000-00");
Cliente c2 = setarCliente("Carlos","000.000.000-00");
Assert.assertTrue("Era para ter adicionado os clientes", faixada.adicionar(c)&&faixada.adicionar(c2));
} |
44ef0db8-6b03-40e9-8bf3-45055686fd12 | 7 | protected boolean computeCell(int col, int row) {
// Compute whether this cell is alive or dead in the next generation
// using "countNeighbours"
boolean liveCell = getCell(col, row);
int neighbours = countNeighbours(col, row);
boolean nextCell = false;
if (neighbours < ... |
37d737b5-ca6a-4a06-9bb2-17bb12177d72 | 7 | public static int crypto_stream(byte[] c, int clen, byte[] n, int noffset, byte[] k)
{
byte[] inv = new byte[16];
byte[] block = new byte[64];
int coffset = 0;
if (clen == 0)
return 0;
for (int i = 0; i < 8; ++i)
inv[i] = n[noffset + i];
for (int i = 8; i < 16; ++i)
inv[i] = 0;
while ... |
6982b440-610c-4675-82a7-e1be70476fff | 7 | public static void testValidity(Object o) throws JSONException {
if (o != null) {
if (o instanceof Double) {
if (((Double) o).isInfinite() || ((Double) o).isNaN()) {
throw new JSONException(
"JSON does not allow non-finite numbers.");
... |
0465cf97-a96c-4cef-b947-93393973e458 | 0 | public EncryptionPropertiesType createEncryptionPropertiesType() {
return new EncryptionPropertiesType();
} |
bfca90ad-95f3-43cb-ae59-7612b22e1222 | 8 | public static Rend getHangrend(Szo szo) {
boolean mely = false, magas = false;
for (String s : MELY_MAGANHANGZO) {
if (szo.getSzo().contains(s)) {
mely = true;
}
}
for (String s : MAGAS_MAGANHANGZO) {
if (szo.getSzo().contains(s)) {
... |
9279b924-c8c2-4401-8eb5-00553a3a9ff7 | 4 | @Override
public void setElementAt(int row, int column, double value) throws OutOfBoundsException {
if (row > _rowNum || column > _colNum || row < 1 || column < 1) {
throw new OutOfBoundsException();
}
_values[row-1][column-1] = value;
} |
9ff10fdd-e10d-4894-9a96-edb0480a4121 | 5 | public static <GItem> GItem get(final Iterator<? extends GItem> iterator, final int index) throws NullPointerException, NoSuchElementException {
if (iterator == null) throw new NullPointerException("iterator = null");
if ((index < 0) || (Iterators.skip(iterator, index) != 0) || !iterator.hasNext()) throw new NoSuch... |
6b4dc847-7071-41ef-88ad-e07c9de0b938 | 1 | public Set getDeclarables() {
Set used = new SimpleSet();
if (object != null)
object.fillDeclarables(used);
else
used.add(local);
return used;
} |
ccb82611-feeb-4b16-944f-da8acd37d54b | 3 | public void volgendeStapAfgelegdeBaan(){
if(baanTeller < baanPad.size()){
if(baanTeller > 0){
afgelegdeBaan.put(baanPad.get(baanTeller - 1), new PoefBlok());
}
if(afgelegdeBaan.size() == baanPad.size() - 1){
afgelegdeBaan.put(baanPad.get(baanTe... |
18efba8b-1e8b-482e-9300-638a4a63f67e | 0 | public void setSeenFossil(boolean value) {
this.seenFossil = value;
} |
33f750df-93c2-48fe-ac43-7e4a988bbd6e | 9 | @Override
public boolean onReceievedAction(InterfaceController controller, EInterfaceAction binding, SimpleAutoCompleteEntry entry) {
if(binding == EInterfaceAction.Bind_Undo) {
mDocument.undo();
return true;
} else if(binding == EInterfaceAction.Bind_Redo) {
mDocument.redo();
return true;
}
i... |
9bbc3143-766c-4f67-8ae7-d63ff0c6d1a1 | 6 | public Position<T> insertNodeConcised(T value) throws NoEmptyTreeException,
InvalidPositionException {
if (root == null)
return addRoot(value);
BTPosition<T> current = checkPosition(root);
while (true) {
if (comp.compare(current.element(), value) > 0) {// left
if (current.getLeft() == null) {
BT... |
a7bf88cc-bf20-44b8-927e-d8c53bb8da89 | 7 | public Node reverseAlterKNodes(Node head, int k, Boolean even){
int x = k;
Node moving = head;
Node head_prev = null;
Node head_next = null;
if(even){
while(x>0 && moving!=null){
head_next = moving.next;
moving.next = head_prev;
head_prev = moving;
moving = head_next;
x--;
}
if(he... |
21eb3329-6d11-420a-81a3-2612dd540872 | 5 | public ImportResult (Element importResultElem)
{
boolean wasSuccessful = Boolean.valueOf(importResultElem.getAttribute("successful")).booleanValue();
this.setWasSuccessful(wasSuccessful);
NodeList importResChildren = importResultElem.getChildNodes();
for(int i = 0; i < importRe... |
af9f1933-46dc-474c-9dbe-0d17b1e154c2 | 6 | public static String unescape(String string) {
int length = string.length();
StringBuffer sb = new StringBuffer();
for (int i = 0; i < length; ++i) {
char c = string.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < length) {
... |
c8ced539-cc53-4a6b-b996-56035a61f9eb | 8 | @Override
public void updateTick(final EntityHandler caller) {
engineMain = false;
engineRight = false;
engineLeft = false;
if (input.isKeyDown(KeyEvent.VK_UP) || input.isKeyDown(KeyEvent.VK_W)) {
speed += accl;
engineMain = true;
}
if (input.isKeyDown(KeyEvent.VK_LEFT) || input.isKeyDown(KeyEvent.VK... |
3b636533-7eb1-4d7d-950a-e320ce92473f | 8 | public void drawText(float x, float y, int align, String[] lines) {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
float dx, dy;
switch (align) {
case 3: {
float maxWidth = 0f;
for (String s : lines) {
int w = drawFont.getWidth(s);
if (w > maxWidth)
maxWidth = w;
}
d... |
68ba9b5c-b2d1-469e-a4ba-9b091d2a2d05 | 2 | public Connection conectar() {
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + bd, user, pass);
if (con != null) {
System.out.println("**Conectados");
}
} catch (Exception e) ... |
e195f2a7-3082-4c7e-a769-eca16b499f30 | 5 | public static AudioFormat getNetAudioFormat(int nformat) throws UnsupportedAudioFileException {
if (nformat==FORMAT_CODE_CD) {
return new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
44100.0f, // sampleRate
16, // sampleSizeInBits
1,... |
a0cdc20c-24ee-432d-9911-1c4f80788ce3 | 6 | public void useWeapon(int lastKeyPressed) {
try {
int dir = 1;
Point charLoc = new Point(this.getCharacterLocation());
if (!(grid.get(charLoc).returnCharacter().getWeapon() instanceof RangedWeapon)) {
if (lastKeyPressed == KeyEvent.VK_A) {
dir = -1;
} else if (lastKeyPressed == KeyEvent.VK_D) {
... |
d7d19e63-c136-42aa-96a7-29a73227c5df | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
@SuppressWarnings("rawtypes")
Pair other = (Pair) obj;
if (h == null) {
... |
7927fcd9-fc4b-47b2-95a3-73a8df67ce7e | 3 | Client3() throws IOException {
String s;
System.out.println(getCurrentTime() + "::" +"Starting Client ..");
clientSocket = new Socket("localhost", 38000);
serverIn=new DataInputStream(clientSocket.getInputStream());
serverOut=new DataOutputStream(clientSocket.getOutputStream());
/*--------Reading file from ... |
9354ad08-1e06-45cb-a550-5d02c06153a9 | 8 | private boolean jj_3R_501() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(39)) {
jj_scanpos = xsp;
if (jj_scan_token(38)) return true;
}
if (jj_3R_509()) return true;
while (true) {
xsp = jj_scanpos;
if (jj_3R_509()) { jj_scanpos = xsp; break; }
}
if (jj_scan_token... |
bf340809-6dd1-4ffd-a34b-5e389ab5556c | 7 | public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
synchronized (parent.getTreeLock()) {
int n = parent.getComponentCount();
Dimension pd = parent.getSize();
int y = 0;
//work out the total size
for (int i = 0; i < n; i++) ... |
54185374-a88d-49a7-a785-a6e332ff0aae | 1 | public void test_getMillis_long_long() {
assertEquals(0L, iField.getMillis(0L, 567L));
assertEquals(1234L * 90L, iField.getMillis(1234L, 567L));
assertEquals(-1234L * 90L, iField.getMillis(-1234L, 567L));
try {
iField.getMillis(LONG_MAX, 567L);
fail();
} c... |
6365ae82-d37a-4aab-9967-df9b4f991fd7 | 1 | public void parser() {
try {
SAXParserFactory fac = SAXParserFactory.newInstance();
fac.setValidating(true);
SAXParser parse = fac.newSAXParser();
parse.parse(xmlFile, this);
} catch (ParserConfigurationException | SAXException | IOException e) {
... |
8e56d1dc-a443-4426-ada2-d93fea32e047 | 4 | public Solicitud getSolicitudNuevo(SolicitudDTO solicitudDTO) {
Solicitud solicitud = new Solicitud();
solicitud.setId(solicitudDTO.getId());
solicitud.setFecha_solicitud_solicitante(solicitudDTO.getFecha_solicitud_solicitante());
solicitud.setFecha_solicitud_proveedor(solicitudDTO.getFecha_solicitud_proveed... |
a43ea803-0743-4241-9cbd-69a60174e99d | 6 | public void run(boolean updateMode)
{
String buttonName = updateMode ? Language.getLocalizedString("button.update") : Language.getLocalizedString("button.install");
JOptionPane optionPane = new JOptionPane(this, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, new String[] {buttonName,... |
73a758ac-f01a-4c74-93ef-247726dff866 | 3 | public void addLabel(final Label label) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
if (ClassEditor.DEBUG) {
System.out.println(" " + label + " to "
+ System.identityHashCode(this) + ":"
... |
e861e120-3873-4018-aae2-7826e295e0b9 | 7 | private void lca(Node node , int left ,int right){
if(node == null)
return;
if(node.left != null && node.right != null){
if(left < node.value && right < node.value){
lca(node.left,left,right);
}else if(left > node.value && right > node.value){
... |
bd2e104c-aa8e-4b6b-aed8-274f64efbb05 | 0 | public static void main(String[] argv) throws Exception {
/*
RSAcreator crtr = new RSAcreator();
//Both digital signature and confidentiality services may be applied to
//the same message. First, a signature is generated for the message
//and attached to the message. Then the m... |
324c715d-d9d5-4ab3-b5c8-83ef64b863a1 | 2 | public GraphicalUI(IBlackJackController controller) {
this.controller = controller;
this.cardField = new GraphicalUICardField();
this.playerInfo = new GraphicalUIPlayerInfo();
this.options = new GraphicalUIOption(controller);
// observable
controller.addObserver(this);
... |
d257e605-01e5-4a6b-b1d8-caad686bd350 | 3 | public static void render(EU3SaveGame save, int startYear, int endYear,
int interval, int delay, boolean showBorders,
String renderTo, MapMode m, double scale,
boolean showDate)
throws Exception {
... |
c98bea97-9482-480a-a691-a16ff93c04cd | 5 | private JButton getButton(String text) {
for (JButton button : controls) {
String s = button.getText();
if (text.endsWith(s) ||
(s.equals("=") &&
(text.equals("Equals") || text.equals("Enter"))) ) {
return button;
}
}
... |
a4d73de2-f266-493e-8dd4-ca3fe56266fe | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(true);
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
session.removeAttribute("error... |
e4617fe9-01d9-4c6c-a88b-87dd7a9f0cca | 5 | private final void calculateBounds()
{
if (daughterNodes.size() > 0)
for (Node n : daughterNodes)
n.calculateBounds();
if (height < plantY - y)
height = plantY - y;
if ((int) x < minX)
minX = (int) (x - ((int) leafSize / 2));
if ((int) x > m... |
a29d8451-a937-41c2-8241-d5a571471bba | 4 | public static String formatTime(long ns)
{
if (ns > NANOSECONDS_PER_MINUTE) return String.format("%.2f min", ns / (double) NANOSECONDS_PER_MINUTE);
if (ns > NANOSECONDS_PER_SECOND) return String.format("%.2f sec", ns / (double) NANOSECONDS_PER_SECOND);
if (ns > NANOSECONDS_PER_MILLISECONDS)
... |
4f78e84e-0c16-4e76-81b7-6e31102f8f93 | 8 | public void print(PrintWriter out)
throws IOException {
String temp;
int i, j, k, size = 0;
for(i = 0; i < _rows; i++) {
for(j = 0; j < _cols; j++) {
temp = _mat[i][j] + "";
if(temp.compareTo("-0.0") == 0)
temp = "0.0";
if(temp.leng... |
2c81150a-bd7b-4b02-b894-4db46c82b065 | 1 | public void test_appendTimeZoneId() {
DateTimeFormatterBuilder bld = new DateTimeFormatterBuilder();
bld.appendTimeZoneId();
DateTimeFormatter f = bld.toFormatter();
assertEquals("Asia/Tokyo", f.print(new DateTime(2007, 3, 4, 0, 0, 0, TOKYO)));
assertEquals(TOKYO, f.pars... |
a60a2a99-1fc1-4bac-a68f-06a7de403272 | 0 | protected boolean shouldShowStatePopup() {
return false;
} |
34e44551-d2d6-4483-b296-01686ef6c3e7 | 5 | public Comparable getLargestKid(int n)
{
Comparable leftChild = getLeftKid(n);
Comparable rightChild = getRightKid(n);
if (rightChild == null && leftChild == null)
{
return null;
}
if (rightChild == null)
{
return leftChild... |
8fe4e235-06c0-4076-ada6-6c0103e674ce | 9 | @Override
public void run(){
while(true){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
if(!ConnectFourGui.frame.playerRed && ran){
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printSta... |
c880f32d-705b-42a1-8a71-c15f6c46b9f9 | 9 | public File(Object fo) {
Logger.getInstance().debug("Creating File with Obj: " + fo.toString());
try {
HashMap<String, Object> raw = (HashMap<String, Object>) fo;
if (raw.containsKey("index")) {
index = Integer.parseInt(raw.get("index").toStri... |
00ba4b52-24cf-4692-84a7-0d04c5fabf7b | 2 | public static void setOutputLevel(int outputLevel) {
if (outputLevel < 0 || outputLevel > 2) {
Output.printTabLn("Das verwendete Ausgabelevel gibt es nicht: "
+ outputLevel, Output.ERROR);
} else {
getInstance().outputLevel = outputLevel;
Output.setLevel(outputLevel);
}
} |
0b544ea1-7843-4f01-b900-bad438e1304a | 5 | private ResGridlet cancel(int gridletId, int userId)
{
ResGridlet rgl = null;
// Find in EXEC List first
int found = gridletInExecList_.indexOf(gridletId, userId);
if (found >= 0)
{
// update the gridlets in execution list up to this point in time
upd... |
6ce5035b-8948-47f3-9e94-56980ce1d98e | 5 | public void laden()
{
hdPicture.setText("");
headl2.setVisible(false);
geladen=false;
neu=true;
headl.setText(modname);
headl2.setText(modname);
url = "http://www.minecraft-installer.de/Dateien/BilderHQ/"+modname+".jpg";
url = url.replace(" ", "%20");
try {
hdPicture.... |
46c438b4-db82-4480-8a69-faa084570929 | 4 | protected static void initContactTask(BaseUI UI) {
final Sprite flagSprite = CONTACT_MODEL.makeSprite() ;
UI.beginTask(new TargetTask(UI, CONTACT_ICON) {
boolean validPick(Target pick) {
if (! (pick instanceof Actor || pick instanceof Venue)) return false ;
if (! ((Element) pick).v... |
101ff901-bdf3-4ac6-bfd8-cbdd3cb2978f | 4 | public static void main(String args[]) {
try {
int a = args.length;
/* If no command line args are present,
the following statement will generate
a divide-by-zero exception. */
int b = 42 / a;
System.out.println("a = " + a);
try { // nested try block
... |
1920a357-ca1c-4ac0-9d27-84ef6f049233 | 4 | public boolean equals(Object o2) {
if(!(o2 instanceof Message))
return(false);
Message m2 = (Message)o2;
if(m2.blob.length != blob.length)
return(false);
for(int i = 0; i < blob.length; i++) {
if(m2.blob[i] != blob[i])
return(false);
}
return(true);
} |
21ac55e8-c18c-4ff9-989f-87f5c1cf8a2f | 4 | public void setCondition(Expression cond) {
this.cond = cond;
if (type == POSSFOR) {
/*
* We can now say, if this is a for block or not.
*/
if (cond.containsMatchingLoad((CombineableOperator) incrBlock
.getInstruction())) {
type = FOR;
incrInstr = incrBlock.getInstruction();
incrBlock... |
88d30d37-0c77-4a1b-b2e9-b941bade0f4e | 9 | public static void quicksort(int pole[], int start, int konec)
{
int s = start;
int k = konec;
if (konec - start >= 1)
{
int pivot = pole[start];
while(k > s)
{
while(pole[s] <= pivot ... |
3dbd4db2-415a-4232-b09f-2a0c160383cd | 3 | public String createImgFile(String pathName) {
File file = new File(pathName);
if (file.isFile() && file.exists()) {
file.delete();
}
try {
ImageIO.write(buffImg, "jpeg", file);
} catch (IOException e) {
e.printStackTrace();
... |
555af20d-0b9e-4686-834c-aca5b85ee54c | 6 | public void changePost(int id, String newPost) {
boolean exists = false;
Post post = null;
if (newPost.equalsIgnoreCase("manager")) {
post = new Manager(new ArrayList<Integer>());
} else if (newPost.equalsIgnoreCase("worker")) {
post = new Worker();
} else... |
a2b8dc0e-e60b-4767-a008-c89f56351733 | 7 | public static List<Game> getAllOfPlayersGames(long id) {
List<Game> games = new ArrayList<Game>();
PreparedStatement findGame = null;
ResultSet rs = null;
String selectStatement = //logic for prepared statement
"SELECT * FROM Game WHERE (g_player1 = ? OR g_player2 = ?) AND (g_winner = 0 OR g_win... |
0755bd80-2eff-4468-ab3d-e7df993129ae | 4 | private void formalParam() throws Exception
{
if(scan.sym == Token.openparen) {
scan.next();
if(scan.sym != Token.closeparen) {
int argPosition = 0;
Identifier i = ident();
Instruction getArg = new Fetch(i, argPosition);
... |
3f8540ea-0e47-46c2-99e8-ff7720f28770 | 1 | public Server(int port){
this.PORT = port;
try {
server = new ServerSocket(PORT);
clientAccept = new ClientAccept(server);
clientAccept.start();
System.out.println("TankServer");
} catch (IOException e) {
e.printStackTrace();
}
} |
b91be733-d018-4870-914a-78d541492aca | 5 | private static double hue_2_RGB(double v1, double v2, double vH) {
if (vH < 0.0) vH += 1;
if (vH > 1.0) vH -= 1;
if (6 * vH < 1) return ( v1 + (v2-v1) * 6.0 * vH);
if (2 * vH < 1) return ( v2 );
if (3 * vH < 2) return v1 + (v2-v1) * ((2.0/3.0) - vH) * 6;
return v1;
} |
78f51439-ab0a-4b03-bcd2-3bd5bd94e2a6 | 6 | private void loadIdCounts() {
try {
this.idCounts.clear();
if(this.saveHandler == null) {
return;
}
File var1 = this.saveHandler.func_28113_a("idcounts");
if(var1 != null && var1.exists()) {
DataInputStream var2 = new DataInputStream(new FileIn... |
7f8efc17-883c-4a50-a2c4-f751a5e1972b | 1 | public Map<String, Double> getStatusPercent(){
Map<String, Integer> countMap = getStatusFrequency();
Map<String, Double> percentMap = new HashMap<String, Double>();
Integer count = log.getRecords().size();
for(java.util.Map.Entry<String, Integer> status : countMap.entrySet()){
percentMap.put(status.getKey... |
715ed3eb-a68a-4f61-adbc-e5af6e57c3e9 | 8 | public static boolean isXMLValidCharacter(char character) {
// Order the tests in such a sequence that the most probable
// conditions are tested first.
return character >= 0x20 && character <= 0xD7FF || character == 0x9
|| character == 0xA || character == 0xD || character >= 0xE... |
dc0ae128-39c1-4352-b011-38f61301778d | 1 | public final String getCommand() {
Object value = getValue(ACTION_COMMAND_KEY);
return value != null ? value.toString() : null;
} |
cfdf1ea7-bf10-4380-92d0-6d96b30c975f | 6 | public static void alterVolume(float overallVolume){
// Used for the loops
int i;
// Used so that the methods associated with a video player can be accessed.
VideoPlayer currentVideoPlayer;
// Used so that the methods associated with a Audio player can be accessed.
AudioPlayer currentAudioPlayer;
// U... |
fffe6ec3-9a5c-4ebc-ad95-ef0f444c774e | 2 | public String getMIDByPID(Statement statement,String PID)//根据PID获取MID
{
String result = null;
sql = "select MID from Manager where PID = '" + PID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getString("MID");
}
}
catch (SQLException e)
{
Syste... |
72ee022e-3c3e-462c-bef8-3eef1b3ce9c8 | 0 | public static int jaccardDist(int color1, int color2) {
double index = ((double)(color1 & color2 )) / ((double)( color1 | color2 ));
return (int)index * 100000;
} |
98452972-1271-4cce-8bb6-3d598976c0bb | 2 | public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0) {
bytecode = null;
exceptions = null;
}
if (bytecode != null)
bytecode.dropInfo(howMuch);
super.dropInfo(howMuch);
} |
e9129270-2c4a-4f68-9b76-bd3740b71655 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
5c08ee40-a756-403b-b9f3-fbd3fad8d638 | 8 | private void dealJobs(List<T> list) {
if (list == null || list.size() == 0) {
return;
}
List<Thread> threadList = new ArrayList<Thread>();
for (Job temp : list) {
threadList.add(new Thread(temp));
}
for (Thread t : threadList) {
t.start();
}
//
for (;;) {
//强制性关闭
if(!listened){
brea... |
7f00f731-1085-491a-b625-fc7e19045a81 | 9 | public static UnitValue[] parseInsets(String s, boolean acceptPanel)
{
if (s.length() == 0 || s.equals("dialog") || s.equals("panel")) {
if (acceptPanel == false)
throw new IllegalAccessError("Insets now allowed: " + s + "\n");
boolean isPanel = s.startsWith("p");
UnitValue[] ins = new UnitValue[4];
... |
a66f38be-b7a7-416a-894e-ef76be574d48 | 4 | @Override
protected void service(ChannelRequest<HandshakeRequest> request)
throws Exception
{
ByteBuf buffer;
request.getRequest().addDecoders();
if (request.getChannel().pipeline().get(LoginRequestDecoder.class) != null
&& request.getChannel().pipeline()
.get(LoginRequestHandler.class) != null)
... |
a7f09ac6-e806-4662-8f1b-b2da7f621852 | 7 | public static void loadData()
{
if(Config.getConfig().getString("backend.type").equalsIgnoreCase("mysql"))
{
BackendType = Backends.MySQL;
}
else
{
BackendType = Backends.File;
}
if(BackendType.equals(Backends.MySQL))
{
sqlConnection = new MySQL();
try {
sqlConnection.dbConnect();
D... |
fd2f39a2-8f53-45b3-b497-0fa883197eff | 7 | public static void meleeAI(final MeleeEnemy me)
{
// final int attackFrame = me.getAttackFrame();
// final Image [] att = me.getAttackAnimation();
final int attackFrame = 0;
final Image [] att = null;
final int attSpeed = me.getSpeed()/2;//need to test this might need to foul around with this or add another v... |
f63b4c58-d809-4b71-be72-369a858410cc | 7 | static List<Vertex> dfs(Graph g, Vertex start) {
if (g == null) {
throw new IllegalArgumentException("Input graph must not be null.");
}
if (start == null) {
throw new IllegalArgumentException("Input vertex must not be null.");
}
final List<Vertex> retu... |
aa7c6353-ce30-4471-82c0-5a3055ce2a65 | 1 | @Override
public void run() {
try {
example.execute();
} catch (InterruptedException e) {
e.printStackTrace();
}
} |
b93668ea-3ee1-4d87-9983-312c1239a658 | 5 | private void loadImgFile(String f) {
String absPath = IMAGE_DIR + f;
System.out.println("Reading " + absPath);
try {
InputStream in = this.getClass().getResourceAsStream(absPath);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line =... |
33acb611-cffc-4919-a582-21260a56d6ad | 0 | private static byte[] combineByteArrays(byte[] array1, byte[] array2) {
byte[] result = new byte[array1.length + array2.length];
System.arraycopy(array1, 0, result, 0, array1.length);
System.arraycopy(array2, 0, result, array1.length, array2.length);
return result;
} |
f806d8cb-0387-400d-a1e4-ff37fe51d5f3 | 4 | public boolean isFogOfWar(int x, int y) {
return (x > 0 && x < GameGlobals.mapSize && y > 0 && y < GameGlobals.mapSize) ? fog[x][y] : false;
} |
960d8c65-f831-45f5-aa70-c357f91b1ac6 | 2 | public static void main ( String args[]) {
String filename = "time.ser";
Person p = new Person("Cosmin", "Paun");
FileOutputStream fos = null;
ObjectOutputStream out = null;
try {
fos = new FileOutputStream(filename);
out = new ObjectOutputStream(fos);
... |
77e4bae0-d183-484e-9d28-d7e4a6fb4e90 | 9 | private Object execMethod(Object target, Method targetMethod,
Object[] args) {
boolean found = false;
Method[] all = target.getClass().getMethods();
Method foundMethod = null;
for (Method m : all)
//checks the name and the return type of the two methods
if(m.getName().equals(targetMethod.ge... |
d306c90f-9736-4ecb-8a75-3069b30aad1b | 0 | public static void useLowerCaseTypes(boolean lowerCase)
{
GeoJson.isUsingLowerCaseTypes = lowerCase;
} |
584ac933-b674-4bb0-9eb9-a7033e6ecd90 | 7 | private Vertex findVertexBetween(Vertex v1, Vertex v2, List<Vertex> vertices)
{
List<Vertex> pPS = new ArrayList<Vertex>(v1.getPathsCount());
for(int i = 0; i < v1.getPaths().size(); i++)
{
if(!v1.getPaths().get(i).getVisited())
pPS.add(getVertexById(v1.... |
864a35a1-f0a9-47ab-8c35-48d21d6d1522 | 1 | private void send (Object x)
{
try
{
Soutput.writeObject (x);
Soutput.flush ();
}
catch (IOException e)
{
System.out.println ("Error writting to the socket: " + e);
return;
}
} |
691a36a5-ba9e-44dd-95f7-f2529c404e81 | 4 | private void fill_array(RandomNumberGenerator generator)
{
boolean[] is_empty = new boolean[this.max_size];
for (int i = 0; i < is_empty.length; i++)
{
is_empty[i] = true;
}
int index;
while (this.numbers_filled < this.max_size
&& this.numbers_generated < 1000000)
{
index ... |
bd3ee90e-95af-4dcc-a91e-6d26f5c7e8c5 | 8 | public static boolean isAlphaNumOrUnder(String value) {
for (int index = 0; index < value.length(); index++) {
char c = value.charAt(index);
if ((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
c == '_') {
... |
07e70ea1-5f18-4df2-8c33-d962704bf5f0 | 2 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
if (checkLoggedIn(request))
{
//Logged in...
followerList = friendService.getFollowers(user.getEmail());
if (followerList.size() == 0)
request.setAttribute("failureMessage", "Nobo... |
08a71f7a-74fd-4429-98c2-41a2942022db | 5 | public boolean insert(int key) {
// traverse tree - find where node belongs
RBNode node = factory.create();
RBNode temp = getRoot();
while(temp != sentinelNode) { // find Parent
node.setParent(temp);
if ( key == temp.getValue()) {
return false;
} else if (key > temp.getVal... |
63929bad-3150-49b5-8657-a1b60c408a69 | 8 | @Override
public boolean equals(Object spell) {
if(spell instanceof Spell) {
Spell spellToCompare = (Spell) spell;
if((this.name == null && spellToCompare.getName() == null) || (this.name != null && this.name.equals(spellToCompare.getName()))) {
if((this.id == null && spellToCompare.getId() == null) || thi... |
de9b4e07-3abf-4fd6-96ff-974bd7a9204f | 8 | public static void navigate(JoeTree tree, OutlineLayoutManager layout, int type) {
Node node = null;
Node youngestNode = null;
Node oldestNode = null;
switch(type) {
case UP:
youngestNode = tree.getYoungestInSelection();
node = youngestNode.prevSibling();
if (node == youngestNode) {return;}
... |
c7285db7-108a-4012-a16d-a4bdd68411e0 | 4 | private boolean mouseIn(int x, int y, int xOffset, int yOffset) {
if ((mx >= x) && (mx <= x + xOffset) && (my >= y + boxSize) && (my <= y + boxSize + yOffset)) return true;
return false;
} |
de40b671-f347-44e9-ad4f-3391492536a7 | 8 | public boolean objectEqlP(Stella_Object y) {
{ StringWrapper x = this;
if (y != null) {
{ Surrogate ytype = y.primaryType();
if ((ytype == Stella.SGT_STELLA_STRING_WRAPPER) ||
((ytype == Stella.SGT_STELLA_VERBATIM_STRING_WRAPPER) ||
(((!Stella.$CLASS_HIERARCHY_... |
b34e69c8-5e21-404e-866c-13f86b63ac80 | 5 | public static void calculateLEDs() {
// alle LEDs aus
resetColors();
// Neuberechnung
for (int x = 0; x < 12; x++) {
for (int y = 0; y < 12; y++) {
for (int spot = 0; spot < 3; spot++) {
double dist = spots[spot].getDistance(x, y);
double factor = (dist > 2.5) ? 0 : (1 - dist / 2.5);
fact... |
e985b2c1-d168-42e1-8956-39458829d5bd | 5 | public Contact[] searchContacts(String name)
{
//An Contact[] to store search results
Contact[] searchedContacts = new Contact[MAX_CONTACT];
int searchFound = 0; //Counter on how many contacts found
System.out.println("Searching contact[s] contains " + "<< " + name + " >> ...");
//Loop through Contact[... |
89625491-27d1-4889-8c4e-ac30142b6f8e | 9 | public void train(CharSequence cSeq, Classification classification, double count) {
if (count == 0.0) return;
String cat = classification.bestCategory();
int catIndex = getIndex(cat);
// throw if underflow
if (mCaseCounts[catIndex] < -count) {
String msg = "Decrement... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.