method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7a29538c-73b4-4942-add4-fff9585a0fe1 | 5 | public CheckResultMessage check23(int day) {
int r1 = get(2, 5);
int c1 = get(3, 5);
int r2 = get(39, 5);
int c2 = get(40, 5);
BigDecimal b = new BigDecimal(0);
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
b = getValue(r1 + 1... |
23be8914-9ffc-497c-b38d-14a64d1027da | 5 | public void render(){
buffer.setColor(Color.RED);
if(xfond+fond.getWidth(null)>0)
buffer.drawImage(fond,(int)xfond, 0, null);
buffer.drawImage(fond,(int)xfond+fond.getWidth(null), 0, null);
if(xfond+fond.getWidth(this)*2<=800)
xfond=0;
buffer.setColor(Color.WHI... |
27f182b3-5be9-4146-ab8b-4ffb32a5feda | 1 | public void valider(){
// récupération du login et mot de passe pour vérification
String login = vue.getjTextFieldLogin().getText();
String mdp = vue.getjPasswordFieldMdp().getText();
//vérification vers la bdd oracle en JPA
connexion = DaoVisiteurJPA.verifierLo... |
a92b820d-dd1f-42f9-a158-f3b6d8e9e549 | 9 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
PrintWriter out = new PrintWriter(System.out);
long n = in.nextLong(),
a = in.nextLong(),
b = in.nextLong();
long smin = n * 6;
long s = a * b;
if (s... |
02597cb6-3683-450c-b7be-7b009fa755e5 | 5 | private static boolean testGenotypesfileCaption(String s, int homolog) {
if (s==null || s.length()<3) return false;
if (s.charAt(s.length()-2) != HOMOLOG_SEPARATOR) return false;
try {
int p = Integer.parseInt(s.substring(s.length()-1));
if (p != homolog) return false;
... |
df6fc985-33b9-4cf6-b00f-96248351de10 | 8 | public BCNode[] normalizeData(BCNode[] input){
BCNode[] normalized = new BCNode[input.length];
double high;
double low;
for(int i = 0; i < input[0].getNumAttributes();i ++){ //for each dimension of the data points
low = 0;
high = 0;
for(int j = 0 ; j < input.length; j ++){ //find the min and max value... |
ae6068b3-26ae-4ebb-9096-b83278698eb9 | 0 | @Basic
@Column(name = "SOL_FECHA_DESDE")
public Date getSolFechaDesde() {
return solFechaDesde;
} |
95bb659c-2c47-4503-b303-94a0bf269ff3 | 8 | @SuppressWarnings("unchecked")
public SumResult<T> extendedSum(double p) throws SumOutOfRangeException {
SumResult<T> result;
if (_bins.getBins().isEmpty()) {
throw new SumOutOfRangeException("Cannot sum with an empty histogram.");
}
if (Double.isNaN(p)) {
throw new SumOutOfRangeExce... |
e1922db6-9b92-4081-9261-99b042e0b399 | 0 | private static User createOneFromResultSet(ResultSet result) throws SQLException {
User rtn = new User();
rtn.id = result.getLong("id");
rtn.username = result.getString("username");
rtn.passwordHashed = result.getString("passwordHashed");
rtn.isRemoving = result.getInt("isRemoving")==1;
rtn.isAdmin = result... |
df5d3797-c284-4b3d-9637-633e5fd7285a | 9 | public Type intersection(Type type) {
if (type == tError)
return type;
if (type == tUnknown)
return this;
int mergeTypes;
int mergeHints = 0;
if (type.typecode != TC_INTEGER)
mergeTypes = 0;
else {
IntegerType other = (IntegerType) type;
mergeTypes = possTypes & other.possTypes;
mergeHint... |
920acc02-e0c2-44ec-b2c5-43e970002550 | 6 | @Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON2){
//remove item
}
if (time + 100 < System.currentTimeMillis() && e.getButton() == MouseEvent.BUTTON1){
time = System.currentTimeMillis();
switch (state){
... |
f21eed2a-6736-462b-aa73-bd92cbc7c3fa | 2 | private static int getSuperTypes(int types) {
int result = 0;
for (int i = 0; i < NUM_TYPES; i++) {
if (((1 << i) & types) != 0)
result |= superTypes[i];
}
return result;
} |
1f0e55d3-c491-4786-ab2b-8de77a6aee4d | 8 | private List<NodeRelationship> getNodeRelationship(ORASSNode node1, ORASSNode node2){
List<NodeRelationship> nodeRels = new ArrayList<NodeRelationship>();
String table1 = node1.getName();
String table2 = node2.getName();
//logger.info("get relationship between " + table1 + " and "+table2);
if(node1.hasRelatio... |
2f830bb1-3af9-482a-bb85-eccdaa889d43 | 7 | private boolean insertElem(BinaryTreeNode<E> current, E elem)
throws ValueException {
if (elem == null) {
throw new NullPointerException("Given element is null.");
}
if (current == null) {
BinaryTreeNode<E> newNode = new BinaryTreeNode<E>(elem);
root = newNode;
counter++; // counter for the elemen... |
334fc5a1-bec6-4734-ba2a-b579552b8a0c | 8 | public List<List<Integer>> combine(int n, int k) {
List<List<Integer>> list = new ArrayList<>();
if (n < k) {
return list;
}
int[] idxes = new int[k];
for (int i = 0; i < k; i++) {
idxes[i] = i;
}
do {
if (idxes[k - 1] < n) {... |
9c1512ec-3b9f-46ee-aa00-8979f21ee9ba | 0 | public String getEmail() {
return Email;
} |
664044b2-c3d0-4f04-949a-26c245fc4e57 | 2 | private static boolean buscaVenta(int indice, HashMap<Integer, Ventas> tablaVentas)
{
boolean encontrado = false;
int key;
Set<Entry<Integer,Ventas>> s = tablaVentas.entrySet();
Iterator<Entry<Integer, Ventas>> it=s.iterator();
Entry<Integer, Ventas> m = null;
while (it.hasNext()) // Buscamos la ven... |
57da15d0-2e29-4b16-8515-65c2dc0c48fd | 7 | private void runwayJListSelectionChanged(ListSelectionEvent listSelectionEvent)
{
if(runwaysJList.getSelectedIndex() >= 0){
try{
Runway theRunway = (Runway)runwaysJList.getSelectedValue();
currentData.setCurrentRunway(theRunway);
currentData.cleaf... |
3027e88a-fe38-4af4-a174-c0959a4b7254 | 7 | public int compareTo(TerminalTableRowEntry r2) {
if (sorting == 0)
return (isSortAsc ? 1 : -1) * (identifer - r2.identifer);
if (sorting == 1) {
if (time.compareTo(r2.time) == 0)
return (isSortAsc ? 1 : -1) * (identifer - r2.identifer);
return (isSortAsc ? 1 : -1) * time.compareTo(r2.time);
}
... |
5de1bee6-ffaf-41b7-9ac6-85b1c31efc68 | 4 | public synchronized String getGameScore() {
if (game == null)
throw new IllegalStateException();
String result = "score=\"" + "Round " + game.getCurrentRound()
+ ":\nPlayer : Score";
boolean teams = (Boolean) (game.getParameter(GameSocketServer.TEAMS));
for (int i = 0; i < playerCount; i++) {
result ... |
04048faf-21a5-4b12-9d77-a718070575da | 9 | public static void openURL(String url) throws IOException {
// Plan A: try to open the URL using the Java 6 Desktop class
if (Desktop.isDesktopSupported()) {
Desktop desktop = Desktop.getDesktop();
if (desktop.isSupported(Desktop.Action.BROWSE)) {
try {
desktop.browse(new URI(url));
return; // ... |
8d317d9a-6a1d-44c6-bb62-8ee1fdcde90b | 6 | private boolean serverSupportsUnderscoreInTubeName(Client client) {
assertNotNull(client);
String serverVersion = client.getServerVersion();
assertNotNull(serverVersion);
String[] tokens = serverVersion.split(VERSION_DELIMITERS);
assertTrue(tokens.length >= 2);
int majorVersion = Integer.parseInt(tokens[0... |
0094774e-1340-435a-8cef-d7435fbb7337 | 9 | public void testFailoverWithMultipleThreadsSendingMessages() throws Exception {
adjustConfiguration(a,b,c); // removes FD/FD_ALL and MERGE protocols
final int num_senders=5;
MyReceiver rb=new MyReceiver("B"), rc=new MyReceiver("C");
b.setReceiver(rb); c.setReceiver(rc);
// ins... |
e3f0c8b6-42c5-4a7f-9980-843ee6b14197 | 2 | public static String[] removeEmptyStrings(String[] data)
{
ArrayList<String> result = new ArrayList<String>();
for(int i = 0; i < data.length; i++)
if(!data[i].equals(""))
result.add(data[i]);
String[] res = new String[result.size()];
result.toArray(res);
return res;
} |
294427f4-60f1-4008-9b0c-6ff55a862fbd | 1 | public static void main(final String[] args) throws Exception {
final String data = getDefaultDataFile();
try {
call(data);
} catch (final Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} |
3d8eb644-f110-4e3b-8153-d1e45ca82e3a | 5 | public ArrayList<OpinionCluster> calculateOpinionClustersByPopulation() {
ArrayList<OpinionCluster> clusters = new ArrayList<OpinionCluster>();
boolean isNewOpinionCluster;
for(Agent a: agents) {
isNewOpinionCluster = true;
for(OpinionCluster o: clusters) {
if(a.getOpinion() > o.opVal - Constants._ep... |
72b038c3-4db6-4e97-a848-355bef259eee | 2 | private void scanFile(File file) {
try {
String line;
BufferedReader reader = new BufferedReader(new FileReader(file));
while((line = reader.readLine()) != null) {
TEXT.add(line);
}
} catch (Exception e) {
... |
0216a8b7-61fc-4bf3-b141-0a4d89d1bca5 | 0 | public String getSourceName() {
return sourceName;
} |
fe8ffb8a-1538-491e-8623-69eaa6406c4f | 2 | @Override
public void setChartPanels(Map<IChart, ITesterGui> chartPanels) {
if(chartPanels != null && chartPanels.size() > 0){
IChart chart = chartPanels.keySet().iterator().next();
Instrument instrument = chart.getInstrument();
setTitle(instrument.toString() + " " + chart.getSelectedOfferSide() + " " + ch... |
6c603b0e-21bc-4de5-ab3b-760b1aa57e06 | 1 | public Person createPerson( int id, String name ) throws Exception {
Transaction tx = graphDb.beginTx();
try {
Node newPersonNode = graphDb.createNode();
personRefNode.createRelationshipTo( newPersonNode, A_PERSON );
// lock now taken, we can check if already exist in... |
fec83e04-3946-4c9a-ac05-1e55b377d30f | 2 | public Builder name(String receivedName) {
if (receivedName == null || receivedName.equals("")) {
log.warn("Wrong Name. receivedName ={}", name);
throw new IllegalArgumentException("Name must be not null. Received value =" + receivedName);
}
this.name ... |
4d562b45-512a-4fad-8a89-eb5f66b45fd6 | 6 | public static float[] loadTranform(File file) throws IOException {
String line;
BufferedReader in = new BufferedReader(new FileReader(file));
float[] newTransform = new float[16];
int pos = 0;
try {
while (pos < newTransform.length && (line = in.readLine()) != null) ... |
4df09129-cda5-4f05-9958-79d5c1760756 | 8 | public boolean compareExpressions(Statement s1, Statement s2) {
if(s1.baseOperation.equals(s2.baseOperation)) {
switch (s1.baseOperation) {
case BINATY_OPERATION: {
BinaryOperationStatement bos1 = (BinaryOperationStatement)s1;
BinaryOperationSt... |
39d303e4-c745-487b-862b-dcee28cbb8a6 | 9 | ClosedArea append(LineSegmentInt other) {
if (isClosed()) {
throw new IllegalStateException();
}
if (getSegments().contains(other)) {
throw new IllegalArgumentException();
}
final ClosedArea result = new ClosedArea();
for (LineSegmentInt seg : segmentsList) {
result.addSegment(seg);
}
if (resul... |
6000bbbd-341a-46e7-9b17-c7f34b6308d0 | 2 | public int getIndex(String s){
int index=0;
for (Item i: items){
if(i.getName().equals(s)) return index;
index++;
}
return -1;
} |
5ae23342-85e6-4770-899b-59236b42022a | 4 | @Override
public void keyPressed(KeyEvent key) {
// TODO Auto-generated method stub
if (key.getKeyCode() == KeyEvent.VK_LEFT) {
//System.out.println("left presssed");
//System.out.println(model.getPaddleX()+"this is left key");
double paddlex = model.getPaddleX();
//System.out.println(paddlex);
//mo... |
91f2ba59-0682-4ebf-87b0-44984fc6421f | 8 | private static void printItem(Map<String, AttributeValue> attributeList) {
if(attributeList!=null) {
for (Map.Entry<String, AttributeValue> item : attributeList.entrySet()) {
String attributeName = item.getKey();
AttributeValue value = item.getValue();
... |
5e1166f0-c26e-4e90-a17a-f815e583bad1 | 0 | public boolean isInCheckMove(Piece piece, Field from, Field to) {
boolean inCheck = false;
Move move = this.getMove(this.window.board, from, to, piece);
move.execute();
inCheck = this.window.board.inCheck(this.playersTurn);
move.undo();
return inCheck;
} |
caaf0d40-4f93-45db-8f68-bd838224b33e | 1 | public String toString(){
String str=this.name + " : " + this.data_type.name;
if(this.data_type instanceof ArrayType){
ArrayType at = (ArrayType) this.data_type;
str +=" RANGE ( "+ at.starting_index + " "+ at.indexing_scheme + " "+ at.ending_index + " );";
}
return str;
} |
7af0b370-338e-4650-8f01-94997e90ec2e | 2 | public V delete_min() {
HeapNode minNode = ar[1];
ar[1] = ar[heap_size];
heap_size--;
ar[1].setIndex(1);
heapify(1);
this.resizeArray();
HeapIndex hind = null;
try {
hind = (HeapIndex) minNode.getValue();
} catch (Exception ex) {
... |
468d8249-87ec-461a-ba23-4d30858be7fe | 9 | public String toString() {
String ret = super.toString();
//
// Determine winning hand
//
// System.out.println("Checking for winning hand...");
if(isRoyal()) {
ret += "(ROYAL FLUSH)";
} else if(isStraightFlush()) {
ret += "(STRAIGHT FLU... |
f3e4e7d6-827e-4fb8-b49c-9bc88ba134c7 | 7 | public SeqTask(final String name, final Iterable<? extends Task<?>> tasks)
{
super(name);
List<Task<?>> taskList = new ArrayList<Task<?>>();
for(Task<?> task : tasks)
{
taskList.add(task);
}
if (taskList.size() == 0)
{
throw new IllegalArgumentException("No tasks to sequence!"... |
507bc308-1f58-4d99-8500-4d1708345d8e | 1 | public void addRecord(final String data) throws Exception {
Record rec = new Record(data);
if (isNameExists(rec.name)) {
remove(rec.name);
nb_txt.remove(rec.name);
throw new Exception("This name already exists.");
}
notebookCache.put(rec.name, rec);
... |
92ff2f14-cdc0-4cbf-bdf9-017be6670818 | 6 | private void updateAutoCompleteOptions() {
String txtArea = getAllText();
if ((getCaretLocation() - 1 >= 0) && (cmdStartPos < getCaretLocation())
&& (getCaretLocation() <= txtArea.length())) {
if (getAllText().charAt(getCaretLocation() - 1) == '\\') {
cmdStartPos = getCaretLocation() - 1;
}
if (cmd... |
984b7cbc-0a5b-46c9-b191-d33a463d3e33 | 4 | @Override
public void update(String event) {
if (event.equalsIgnoreCase("marked")) {
this.imageViever.setImage(set.get("markedIcon.jpg"));
}else if (event.equalsIgnoreCase("errorMarked")) {
this.imageViever.setImage(set.get("errorMarkedIcon.jpg"));
... |
85682056-5407-49a3-a5e7-6ed31b070fae | 1 | public void visitEnd() {
// Compares TryCatchBlockNodes by the length of their "try" block.
Comparator comp = new Comparator() {
public int compare(Object o1, Object o2) {
int len1 = blockLength((TryCatchBlockNode) o1);
int len2 = blockLength((TryCatchBlockNode) o2);
return len1 - len2;
}
pri... |
124ccf50-5f44-4943-abe8-177aefc369f1 | 6 | public String getAttributeName(int i) {
switch (i) {
case 0:
return "STR";
case 1:
return "DEX";
case 2:
return "CON";
case 3:
return "INT";
case 4:
return "WIS";
... |
c0c7196f-58ee-49c4-bb49-dbb25ce6b1f6 | 2 | public FilmBean getFilm(int filmID) {
try {
//ResultSet rs = this.db.read("select * from filme where id = " + filmID + " limit 1;");
String queryString = "select * from filme where id = ? limit 1;";
PreparedStatement statement = this.db.createStatement(queryString);
... |
13bac968-fb10-4a6e-8efa-a33d9b92c55a | 0 | public static void exportFile(String filename, OutlinerDocument document, FileProtocol protocol) {
saveFile(filename, document, protocol, true, MODE_EXPORT);
} |
54fea80c-111e-4815-a35a-9e663d32edc0 | 4 | public void makeFile(PrintWriter out)
{
VgerBibDataGenerator generator;
VgerBibData bibData;
Document output;
Element root;
Element element;
Transformer identity;
Result result;
generator = new VgerBibDataGenerator();
generator.setDbName( getDbName() );
generator.setBibID( get... |
7c1f08c5-3ab8-4e1c-895d-d0da532ac814 | 0 | public void setValue(String value) {
this.value = value;
} |
8c5ac6ed-f315-4ad9-b5f3-a5d56faacaee | 8 | private void JTreeContaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JTreeContaMouseClicked
DefaultMutableTreeNode node = (DefaultMutableTreeNode) JTreeConta.getLastSelectedPathComponent();
if (node == null){
return;
}
else{
if (this.op... |
c304f8cf-0781-414f-aa9b-d7b24d75acf6 | 3 | @Override
public void serialize(ByteWriter bw) throws IOException {
bw.write4bytes(size);
bw.write4bytes(signature);
byte[] b = variable.getBytes();
bw.writeBytes(b);
for (int i=0; i<260-b.length; i++)
bw.write(0);
for (int i=0; i<variable.length(); i++)
bw.write2bytes(variable.charAt(i));
for (int... |
43b9d316-162f-416d-923a-4ee44af4cf59 | 7 | @Override
public void run() {
LOG.info("Ready to fly.");
loop : while (true) {
Message message = null;
while( (message = this.messagesQueue.poll()) != null ){
LOG.info(message.toString());
switch (message.getType()) {
case SHUTDOWN: {
LOG.warn("Shutdown signal receveid.Abor... |
63f359f5-e97d-41d4-acbf-346b7083b0b7 | 4 | void simple (){
for (int i = 2; i < 30; i++) {
boolean state = true;
for (int j = 2; j < i; j++) {
if (i % j == 0) {
state = false;
break;
}
}
if (state) {
System.out.print(i +... |
8876f6fd-45ad-4f49-8fa7-e5c844d50be1 | 9 | private static void printAttributes(AttributeHolder attr, Element elm) {
for(String a : attr.getAttributeNames()) {
Object o = attr.getAttribute(a);
if(o == null) continue;
String type = o instanceof Number ? "real" : "string";
Element e = new Element("att");
if(o.toString().contains("[") && o... |
e87d6cfb-f9e6-4997-af0d-ac2d50e05eea | 9 | private static char[] getReplacementChars( char ch ) {
char[] replacement = null;
if( ch == '"' ) {
replacement = QUOT_CHARS;
} else if( ch == '\\' ) {
replacement = BS_CHARS;
} else if( ch == '\n' ) {
replacement = LF_CHARS;
} else if( ch == '\r' ) {
replacement = CR_CHARS;
... |
0c540879-fea3-4e7b-8945-30b4ef7ba492 | 7 | static Symbol resolveSymbol(Symbol sym){
//already qualified or classname?
if(sym.name.indexOf('.') > 0)
return sym;
if(sym.ns != null)
{
Namespace ns = namespaceFor(sym);
if(ns == null || ns.name.name == sym.ns)
return sym;
return Symbol.intern(ns.name.name, sym.name);
}
Object o = currentNS().getMa... |
99f9de65-08da-42aa-882c-6fbbb536f9a4 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!(obj instanceof HSV)) return false;
return ((HSV) obj).h == h && ((HSV) obj).s == s && ((HSV) obj).v == v;
} |
467d6aa5-17ab-4191-953f-712dae29aeb2 | 8 | private Element generateTableJustInFile(Document doc, TableInfo tbl) throws ParserConfigurationException {
/** Пример того что должно получится на выходе
* <Table place="file">
* <sTableName>CMS_WF_STATUS</sTableName>
* <sOwner>
* <file>CRM_DAILY</file>
* ... |
b2a0066b-f151-41a0-8b37-71e5975d84e0 | 9 | public void setInfos(int i) {
String ch = "";
switch(i) {
case 0:
ch = "Selectionnez la couleur désirée, puis choisissez une figure à tracer.";
break;
case 1:
ch = "Cliquez 2 fois.";
break;
case 2:
ch = "Cliquez 3 fois.";
break;
case 3:
ch = "Cliquez 4 fois.";
break;
case 4:
ch ... |
e86ab9fb-3f07-4b0a-9cb1-ed7d50590645 | 9 | public JSONObject processPacket(JSONObject message) {
PacketTypes type = PacketIdentifier.identifyPacket(message);
JSONObject response = new JSONObject();
try {
switch(type) {
case REGISTER_DEVICE:
System.out.println("Registering Device");
Device device = new Device(message);
TilistyModel.getIns... |
2eb541f8-7dc6-4ee9-b23f-e3862f6f7635 | 3 | public void setExpLogica(PExpLogica node)
{
if(this._expLogica_ != null)
{
this._expLogica_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.par... |
62375e2b-9d7b-4fd0-bc87-c480ae0004fa | 3 | public void init(Session session,
byte[] V_S, byte[] V_C, byte[] I_S, byte[] I_C) throws Exception{
this.session=session;
this.V_S=V_S;
this.V_C=V_C;
this.I_S=I_S;
this.I_C=I_C;
// sha=new SHA1();
// sha.init();
try{
Class c=Class.forName(session.getConf... |
4b851807-1dd0-4dd2-b452-ac9302367f1c | 8 | private boolean readUntilMatch(byte[] match, boolean withinBlock) throws IOException {
int i = 0;
while (true) {
int b = fsin.read();
// end of file:
if (b == -1) {
return false;
}
// save to buff... |
b4e5707d-894b-42a3-9d81-27f5b5759fc4 | 0 | @Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
} |
1e74adfa-5e59-4b89-9276-5fe1e0d676cc | 0 | public void tick() {
} |
a116df0b-376e-413a-aaf9-61aaab6203ac | 2 | @SuppressWarnings("deprecation")
public void StopReading() {
reader.stop();
try {
serverSocket.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
reader.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printS... |
244183b7-3da2-41cb-88ea-39cd55d44bb2 | 8 | public void p_Username_abusive_Playforfun(
LinkedHashMap<String, LinkedHashMap<String, String>> credentials) {
autoutil.openBrowser(dataSheet(credentials,"url","url"));
autoutil.waitTime(8000);
autoutil.clickButton(dataSheet(credentials,"button","sign"),propFile("link"));
autoutil.waitTime(3000);
for... |
ae31069b-3b9f-4c38-85b4-9800573e99c6 | 7 | public void recursivelyAddKeyListener(JComponent jC)
{
if(jC == null)
return;
for(int i = 0; i < jC.getComponentCount(); i++)
{
if((jC instanceof JPanel) || (jC instanceof JTabbedPane) || (jC instanceof JScrollPane) || (jC instanceof JTextArea) || (jC instanceof JViewport))
((JComponent)jC.getCompon... |
41bb9e41-cd9b-4af8-a8d4-dd91d1c9d8c5 | 4 | private static boolean modifyPrescription(Prescription bean, PreparedStatement stmt, String field) throws SQLException{
String sql = "UPDATE prescriptions SET "+field+"= ? WHERE presc_id = ?";
stmt = conn.prepareStatement(sql);
if(field.toLowerCase().equals("dose"))
stmt.setString(1, bean.getDose());
i... |
26b99471-eebe-41a3-a15f-c3444b292ead | 3 | public boolean restoreInventory(Player player) {
if (OSE.hasOfflineStorage(player.getName())) {
OSE.loadOfflineStorage(player,player.getName());
if (SE.hasStorage(player)) {
PlayerStorage pStorage = SE.getStorage(player.getName());
SE.removeStorage(pStorage);
}
return true;
}
PlayerStorage pSt... |
1bf325c6-83a6-469c-8892-043858d6831c | 2 | public void healPokemon()
{
repaint();
messageBox=new ErrorWindow();
messageBox.addMessage("Hi! I'm going to heal your Pokemon for you!","Pokemon Center");
messageBox.repaint();
while(messageBox.isVisible())
{
try
{
repaint();
Thread.sleep(10);
}
catch(Exception e){e.printStackTrace();... |
9433c01c-062d-4420-b90b-88f3d70de70a | 2 | private String getFolderFromPath(String fileStr) {
int pos = 0, lastPos = 0;
while (pos != -1) {
pos = fileStr.indexOf('/', lastPos);
if (pos != -1)
lastPos = pos + 1;
}
return fileStr.substring(0, lastPos);
} |
4dcc11ca-6623-4648-9cd2-3891914ab04f | 5 | public static float hostility(Actor actor) {
Plan p = null ;
for (Behaviour b : actor.mind.agenda()) if (b instanceof Plan) {
p = (Plan) b ;
break ;
}
if (p instanceof Combat) {
return 1.0f ;
}
if (p instanceof Dialogue) return -0.5f ;
if (p instanceof Treatment) return -1.... |
8ddb6485-6a27-46bc-b752-b4a494c0ba8d | 5 | public void typingPressed(KeyEvent e)
{
int key = e.getKeyCode();
if (key == KeyEvent.VK_BACK_SPACE)
{
chatBox.backSpace();
}
else if (key == KeyEvent.VK_SPACE)
{
chatBox.addToCurrent(" ");
}
else if ((char) key >= '0' && (char) key <= 'z')
chatBox.addToCurrent((char... |
8cb7e408-4dd9-49ab-8915-6a3b334624fd | 5 | public static String numberToOrdinal(int number) {
if (number % 100 < 4 || number % 100 > 13) {
if (number % 10 == 1) return number + "st";
if (number % 10 == 2) return number + "nd";
if (number % 10 == 3) return number + "rd";
}
return number + "th";
} |
b2aa4130-e630-4bfd-80f5-92ae1d6d5f39 | 5 | public static void abilityEffect(AbilityType type, Point position, int skill) {
switch (type) {
case abil_tar_heal:
break;
case abil_aim_fire:
Actor actor = GlobalGame.game.worldHash.getActor(position);
if (actor != null) {
... |
73827a64-8f2d-4058-a68a-fc80fcb0bc53 | 2 | private List<Integer> parseResult(HashMap<Integer,Integer> heightMap,int min){
List<Integer> list=new ArrayList<Integer>();
for(Map.Entry<Integer,Integer> entry : heightMap.entrySet()){
if(entry.getKey().equals(min)){
list.add(entry.getValue());
}
}
... |
0f6d983c-d857-4cc2-80ed-370ea8d2caeb | 5 | @SuppressWarnings("unused")
private void checkSelectedDirectory() {
System.out.println("getCurrentDirectory(): " + this.selectDirectoryDialog.getCurrentDirectory());
System.out.println("getSelectedFile() : " + this.selectDirectoryDialog.getSelectedFile());
final File[] selectedFiles = this.selectDirectoryDial... |
650aa880-b035-4e0e-a8c3-6439eae0dbea | 8 | @Override
public void tick() {
if (targetMob != null && !targetMob.isDead()) {
if (Math.abs(targetMob.x - x) < RANGERADIUS && Math.abs(targetMob.y - y) < RANGERADIUS) {
targetMobInRange = true;
} else {
targetMobInRange = false;
}
if (targetMobInRange) {
double angle = Math.toDegrees(Math... |
c49d3b5b-263e-4c3c-9b6f-cf2ae5c21f2e | 3 | public void run()
{
if(socket == null)
{
ServerHelper.log(LogType.ERROR, "ServerSocket wurde nicht erstellt");
return;
}
while(!socket.isClosed())
{
try
{
Socket s = socket.accept();
ServerHelper.... |
9bf4e5eb-b79e-4c8c-9c5f-a03e5a185036 | 7 | public List<Ability> returnOffensiveAffects(MOB caster, Physical fromMe)
{
final MOB newMOB=CMClass.getFactoryMOB();
final MOB newerMOB=CMClass.getFactoryMOB();
final Vector<Ability> offenders=new Vector<Ability>(1);
final CMMsg msg=CMClass.getMsg(newMOB,newerMOB,null,CMMsg.MSG_LOOK,null);
for(int a=0;a<fro... |
14f50da8-161d-469b-abf2-e3dc9e6af161 | 3 | private void intersect(ArrayList<Long> filterList)
{
if (ids == null)
{
ids = filterList;
return;
}
for (int i = ids.size()-1; i>=0; i--)
{
if (!filterList.contains(ids.get(i)))
{
ids.remove(i);
}
}
} |
481662a7-af5b-4d7c-99b0-9c6e3bf3d403 | 1 | @SuppressWarnings({ "unchecked", "rawtypes" })
public NewEmployeePage(Gui frame){
GridBagConstraints c = new GridBagConstraints();
JLabel picLabel=new JLabel();
picLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/phms_se/resources/img/bg.jpg")));
this.add(picLabel);
picLabel.setLayout(n... |
6fa82c4f-bb64-48be-8d53-f0a413d90361 | 8 | public static void main(String[] args) throws Exception{
NameGenerator nGen = new NameGenerator();
List<Pair<String, String>> actors = new ArrayList<>();
List<Pair<String, String>> directors = new ArrayList<>();
int ratingLength = ratingEnumerators.length;
int categoryLength = c... |
cef7714d-b907-4131-afcd-0731e94bf1c7 | 0 | public static void init() {
errorNumber = 0;
} |
1a129493-dbfb-41df-845c-a6d7b46c8c3f | 7 | public DeviceGUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 544, 402);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 542, 373);
c... |
96345ef9-0c54-492b-a576-64f2bacc1e1a | 5 | @Override
public void initialize(URL location, ResourceBundle resources) {
mLock = new ReentrantLock();
model = CGService.getInstance();
EventDispatcher.getInstance().subscribe(this,
ApplyFilterEvent.class.toString());
EventDispatcher.getInstance().subscribe(this,
ChangeEvent.class.toString());
Event... |
829a1133-bc72-475a-a45d-ba7415b7e907 | 7 | private void clockAPUFourStepMode() {
// we clock envelope on step 1,2,3,4 in either mode
clockEnvelope();
clockTriangleLinearCounter();
if(internal_step == 2 || internal_step == 4) {
clockLengthCounter();
clockSweepUnits();
if(internal_step == 4) {
if(!_inhibitInterrupt) {
... |
b232ca1f-6444-43db-9331-96ced14b7c2d | 5 | @Override
public void startElement(String uri, String localName, String qName,
Attributes attributes) throws SAXException {
if(qName.equalsIgnoreCase(ELEMENT_SCHEMA))
mLayerNamespace = attributes.getValue("targetNamespace");
else if(qName.equalsIgnoreCase(ELEMENT_SEQUENCE))
mWithinSequence = true;
... |
e24e22fb-1b1a-4185-be4e-b719fe30c9de | 8 | public void setCam(int xCam, int yCam)
{
int xCamD = this.xCam - xCam;
int yCamD = this.yCam - yCam;
this.xCam = xCam;
this.yCam = yCam;
g.setComposite(AlphaComposite.Src);
g.copyArea(0, 0, width, height, xCamD, yCamD);
if (xCamD < 0)
{
i... |
92674407-a9b4-4ed9-9b6d-fe1f1ebffdb6 | 9 | public void dump(Class bean) {
results.setText("");
BeanInfo bi = null;
try {
bi = Introspector.getBeanInfo(bean, Object.class);
} catch (IntrospectionException e) {
print("Couldn't introspect " + bean.getName());
return;
}
PropertyDescriptor[] properties = bi.getPropertyDescriptors();
for (int i... |
5821d78a-5476-4ef7-b5bf-a09a57fedd2e | 7 | @Override
public boolean isTerminal(GameState gameState) {
boolean[][] bitSets = gameState.getOccupancyMatrix();
boolean isDraw = true;
for(int i=0; i<bitSets[0].length;i++){
if(gameConfig.findTopIndex(bitSets, i)!=-1)
isDraw = false;
}
if(isDraw)
return true;
List<boolean[]> list = new Linked... |
aa7d4762-fb5e-4ee7-9da4-f5482e84f7e8 | 1 | public final void setAlias(String name) {
if (name != null) {
Identifier rep = getRepresentative();
rep.wasAliased = true;
rep.alias = name;
}
} |
ed579fd1-9d3e-4f9b-95f3-de75c1d2d3b2 | 2 | public MultivariateFunction interpolate(Points points, int numberOfSpheres) {
int length = points.getXVal().length;
double[][] fVals = new double[length*length][2];
double[] values = new double[length*length];
int c = 0;
for (int i = 0; i < length; i++) {
for (int j ... |
8a712fa5-b4b1-473b-8184-a7e14661102a | 4 | public Coord getCoordFromValue(int value) {
Coord c = null;
for (int i = 0; i < width; ++i) {
for (int j = 0; j < height; ++j) {
if(getSquareValue(i, j) == value) {
if(c != null) {
System.out.println("There is multiple occurences of... |
4728968d-514e-4f67-af3f-57b6e99e2d74 | 4 | static public CycConstant lookupSeason(final String season) {
if (season.equals("SU")) {
return SUMMER;
} else if (season.equals("SP")) {
return SPRING;
} else if (season.equals("FA")) {
return FALL;
} else if (season.equals("WI")) {
return WINTER;
} else return null;
} |
84f0490b-09b8-41b9-b34c-b43726f36b5a | 8 | @EventHandler
public void onPlayerVelocityEvent(PlayerVelocityEvent event) {
Player player = event.getPlayer();
if (master.getMBWorldManager().isBoxel(player.getWorld())[0]) {
int maxBoxelSize = master.getConfig().getInt("max-boxel-size", 0);
if (maxBoxelSize == 0)
return;
Location targetLoc... |
bd4483e0-85db-4f5b-b71c-7a6c76420989 | 1 | public void accept(final MethodVisitor mv) {
mv.visitTryCatchBlock(start.getLabel(), end.getLabel(), handler == null
? null
: handler.getLabel(), type);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.