method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
5aa5f148-fc7b-4b37-b302-5b5dd56131dc | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TabelKeyAccount other = (TabelKeyAccount) obj;
if (!Objects.equals(this.kodeKa, other.kodeKa)) {
... |
6013fe44-16ea-4ecb-b45a-4e1bdd1693e7 | 8 | static void lengthLimitedCodeLengths(Cookie cookie, int[] frequencies, int maxBits,
int[] bitLengths) {
cookie.resetPool();
int n = frequencies.length;
int nn = 0;
Node[] leaves = cookie.leaves1;
for (int i = 0; i < n; i++) {
if (frequencies[i] != 0) {
leaves[nn] = cookie.node(fr... |
94c2841e-ac22-4cc0-bac9-eed60d257033 | 0 | @Id
@GeneratedValue
public int getId() {
return id;
} |
ff8840a1-e63c-4f43-a3a6-fa06e56a0e91 | 0 | public int getGraphX() {
return graphX;
} |
5d64f762-1cd2-4203-ad32-0901764111df | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
return false;
} catch (UnsupportedAudioFileException e) {
return false;
} catch (LineUnavailableException... |
4cf26eab-512d-4cbb-b855-add113de64c2 | 1 | @SuppressWarnings("unchecked")
private static final Object[] decodeList(byte[] bencoded_bytes, int offset) throws BencodingException
{
ArrayList list = new ArrayList();
offset++;
Object[] vals;
while(bencoded_bytes[offset] != (byte)'e')
{
vals = decode(bencoded_b... |
dd67c726-2052-4fdf-92bd-b6c7483531d4 | 1 | public ArrayList<Integer> encodage(String motACoder)
{
tailleMot = motACoder.length();
trieTableur(motACoder);
ArrayList<Integer> code = new ArrayList<Integer>();
//Ajout de la position du mot de depart
//code.add(String.valueOf(positionChaine).charAt(0));
leC... |
08e80458-95c3-451f-8d84-3c9647ea47bc | 4 | public boolean createLocalRC()
{
// if a local RC already exists
if (localRC_ != null)
{
System.out.println(super.get_name() + ".setLocalRC(): Warning - " +
"a local Replica Catalogue entity already exists.");
return false;
}
// if a ... |
dcee829d-6644-494a-b303-2f0471165a14 | 5 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// Create Offer
try {
if (jTextField1.getText().trim().equals(jTextField3.getText().trim())) {
JOptionPane.showMessageDialog(this, "Asset and currency type id canno... |
2994ba3d-3c9d-4234-ae97-bee75c912e38 | 6 | public static void main(String[] args)
{
// Load frame from disk
byte[] frameBytes = new Frame("data/token.plain").bytes;
// Setup analyzers
List<AbstractAnalyzer> analyzers = new LinkedList<>();
analyzers.add(new StringAnalyzer());
analyzers.add(new TimestampAnalyzer());
// Run analyzers
for (Abs... |
5b6fc52a-3e5f-4236-ae30-db00c4c74824 | 5 | protected void paintFocusIndicator(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect, boolean isSelected) {
if (tabPane.isRequestFocusEnabled() && tabPane.hasFocus() && isSelected && tabIndex >= 0 && textRect.width > 8) {
g.setColor(AbstractLookAnd... |
912b8221-6e26-4047-b6bc-c27c06ba48e4 | 8 | public final String toString() {
final StringBuffer result = new StringBuffer();
boolean comma = false;
result.append("\n[");
for (Method method : this.getClass().getMethods()) {
final String methodName = method.getName();
if ((methodName.startsWith("get") || meth... |
dd29ec97-c5db-407c-9cb3-b3d7208b9d37 | 6 | @Override
public void actionPerformed(ActionEvent ae) {
if(currX == newX && currY == newY)
timer.stop();
// Check for infinite slope
if(newX != currX) {
slope = (newY - currY) / (newX - currX);
// Moving to the left
if(newX < currX) {
currX--;
currY -= slope;
}
// Moving to t... |
e3a55e32-80d6-4e65-a857-623336bcbf2e | 8 | @Override
public void swapRaces(Race newR, Race oldR)
{
for(final Enumeration<Room> e=CMLib.map().rooms();e.hasMoreElements();)
{
final Room room=e.nextElement();
for(int i=0;i<room.numInhabitants();i++)
{
final MOB M=room.fetchInhabitant(i);
if(M==null)
continue;
if(M.baseCharStats().ge... |
4637e127-5dc1-4578-931f-f01640db9ec8 | 6 | @Override
public Iterator<BxTreeEntry> find(final int key, final boolean includeKey) {
int size = getSize();
if(size == 0) {
return Utils.emptyIterator();
}
return new Iterator<BxTreeEntry>() {
private LeafNode nextNode = LeafNode.this;
private Iterator<BxTreeEntry> currentBaseIter = null;
private ... |
64743ad0-07c8-444b-95be-5bf38a364a47 | 1 | @Override
public String getDataAsText(Column column) {
switch (column.getID()) {
case 0:
return getName();
default:
return getSecond();
}
} |
c285f7e4-13cc-4e1a-aef7-63182d31e245 | 0 | public Grafika produkujemyGrafike(){
return new GrafikaDlaLaptopa();
} |
7038fa0d-0f85-4fde-9631-71c7f1570726 | 5 | private boolean receiveDataGridlet(DataGridlet dg) {
if (dg == null) {
return false;
}
// get a list of required files
LinkedList list = (LinkedList) (dg.getRequiredFiles()).clone();
int serviceLevel = dg.getNetServiceLevel(); // get priority
// for each fil... |
3d7c66ff-58e0-47a2-9113-7a9bbeda3ecb | 3 | public static String convertLineEndings(String text) {
if (line_ending.equals("unix")) {
return convertToUnix(text);
} else if (line_ending.equals("pc")) {
return convertToPC(text);
} else if (line_ending.equals("mac")) {
return convertToMac(text);
} else {
return text;
}
} |
cc8ea14c-6ccf-4b54-aa24-65a64a440d7a | 2 | public static Image convert(Image image) {
if (image.isRgb())
return convertToHsv((RgbImage) image);
else if (image.isHsv())
return convertToRgb((HsvImage)image);
return null;
} |
95631331-686e-44a3-8472-b8cf3b39d833 | 6 | public void removeEntry(Stella_Object key, Stella_Object value) {
{ KeyValueList self = this;
{ KvCons cursor = self.theKvList;
KvCons previouscursor = null;
if (cursor != null) {
if (Stella_Object.eqlP(cursor.key, key) &&
Stella_Object.eqlP(cursor.value, value)) {
... |
99053034-af4e-4287-9490-74684a93f5b0 | 0 | public Route getRoute() {
return this._route;
} |
1b9a975f-c7ac-4e1d-9b71-b3c378fbb8f7 | 3 | void doReceive(final File file, final boolean resume) {
new Thread() {
public void run() {
BufferedOutputStream foutput = null;
Exception exception = null;
try {
// Convert the integer address to a proper IP address.
... |
d4e8fbee-c5e9-49ff-9841-8866041b9408 | 2 | public DataBase(){
this.driver = "org.apache.derby.jdbc.EmbeddedDriver";
this.url = "jdbc:derby:"+db_name+";create="+create+";user="+user+";password="+pass;
try{
Class.forName(driver);
this.con = DriverManager.getConnection(this.url);
if(... |
c516fbd6-16ed-4bf4-84ce-af5fc276ebe7 | 5 | public String recieveMsg(String msg) {
if(msg.contains(LOGIN) || msg.contains(REGIS)) {
String[] authentication = msg.split(",");
if(authentication[0].equalsIgnoreCase(LOGIN)) {
if(authentication.length == 3) return authentication(authentication[1], authentication[2]);
else return "LOGIN_FAILED";
}el... |
8e97df52-0e04-4df4-88f1-93bbdbf00e18 | 3 | public String printAST()
{
StringBuilder ret = new StringBuilder();
if(((Terminal)rhs.get(0)).Name == "IF"){
ret.append("if (");
ret.append(((Expr)rhs.get(2)).printAST());
ret.append(")\r\n");
switch(rhs.size())
{
case 5:
ret.append(((Stmt)rhs.get(4)).printAST());
break;
case 7:
re... |
13e60af3-b25e-4fa6-a73d-24cbc61ab836 | 8 | private void parseNow(int parseDepth) throws XMLException {
data = new Hashtable<String,Object>();
types = new Hashtable<String,String>();
Iterator<?> it = elt.getChildren().iterator();
while( it.hasNext() ) {
Element key = (Element) it.next();
if( !key.getName().equals("key"))
throw new XMLExcepti... |
8e4ecd46-f148-48aa-bfbd-4fef3843c475 | 8 | public int compare(Sprite s0, Sprite s1) {
if (s0.y + s0.x < s1.y + s1.x) return -1;
if (s0.y + s0.x > s1.y + s1.x) return 1;
if (s0.x < s1.x) return -1;
if (s0.x > s1.x) return 1;
if (s0.y < s1.y) return -1;
if (s0.y > s1.y) return 1;
if (s0.z < s1.z) return -1;
if (s0.z > s1.z) return 1;
re... |
13c1f90a-79d1-4d69-8c3c-0b213a290178 | 0 | public boolean hasMoved() {
return moved;
} |
318603f3-a578-4b0c-aabf-22db0dee1f8f | 8 | public static void main(String[] args) {
int totalPage = 7;
int currentPageNo =10;
int pad = 6;
if (currentPageNo > totalPage) {
currentPageNo = totalPage;
}
if (currentPageNo <= 0) {
currentPageNo = 1;
}
System.out.println("上一页: " + (currentPageNo - 1));
if (currentPageNo - pad > 2... |
ff22433b-55f8-46cd-83b6-e990f6a373a4 | 7 | public void service(HttpServletRequest hreq,HttpServletResponse hres)
{
try
{
if(hreq.isRequestedSessionIdValid())
{
con.setAutoCommit(true);
String text=hreq.getParameter("ctext");
HttpSession hs=hreq.getSession(false);
System.out.println("entered into commadd");
String uname=(String)hs.getAttribute("uname");
String t... |
05909410-6aba-43a3-b2c8-ed698f8abc53 | 9 | public void solveEquation(String equation) {
WAEngine engine = new WAEngine();
engine.setAppID(appid);
engine.addFormat("plaintext");
WAQuery query = engine.createQuery();
query.setInput(equation);
try {
// For educational purposes, print out the URL we are about to send:
System.out.println("... |
a107e172-0810-47f5-991d-fdf2f03a0c04 | 1 | private ItemDAO(){
try{
session = HibernateUtil.getSessionFactory().openSession();
}catch(ExceptionInInitializerError e){
JOptionPane.showMessageDialog(null, "Sorry can't connect to database",
"Error", JOptionPane.ERROR_MESSAGE);
logger.error("Cant connect to database");
System.exit(1);
}
} |
89eef7f7-2dcb-469c-9f1f-6831f90f63cb | 8 | String getClassForParameter(String object, String field, boolean type) {
for (KVP def : comps.entries) {
if (object.equals(def.getKey())) {
String clname = def.getValue().toString();
clname = getComponentClassName(clname);
Class c;
try {
c = getClassLoader().loadClass(clname);
} catch (Cla... |
3fade0cb-b11e-4149-ac12-c6825479ae42 | 2 | static List<Card> getTopCards(List<List<Card>> sets) {
Card topA;
Card topB;
Card top;
List<Card> tops;
List<Card> setA;
List<Card> setB;
setA = sets.get(0);
setB = sets.get(1);
topA = null;
topB = null;
tops = new ArrayLis... |
537a7e09-493d-4c49-aef4-14e887b8bf53 | 8 | public String toDiagonalString(){
StringBuilder sb = new StringBuilder();
int m = columns;
int n = rows;
for (int slice = 0; slice < m + n - 1; slice++) {
int z1 = slice < n ? 0 : slice - n + 1;
int z2 = slice < m ? 0 : slice - m + 1;
for (int j = slice - z2; j >= z1; --j) {
sb.append(boardArray[j]... |
642c2a35-ea8c-497c-a399-74b599e63fdb | 8 | private boolean deprecated_acquireOverheadData_WINDOWS(BufferedReader brSocket, PrintWriter pwSocket)
{
this.dataAcquisitionComplete = false;
try
{
sendCommand_RAW_ToAgent("hostname");
this.myHostName = brSocket.readLine();
sendCommand_RAW_ToAgent("echo %username%");
this.myUserNa... |
3cb74520-32c9-48f3-8cfa-ffa6c3f196ab | 4 | private int readFully(byte[] b, int offs, int len)
throws BitstreamException
{
int nRead = 0;
try
{
while (len > 0)
{
int bytesread = source.read(b, offs, len);
if (bytesread == -1)
{
while (len-->0)
{
b[offs++] = 0;
}
break;
//throw newBitstreamException(UNEX... |
6d90079c-2266-4de0-9104-6582f307bb42 | 7 | public void merge(AirNowDataSite site){
if (site.getLatitude() != 0 || site.getLongitude() != 0 || site.getElevation() != 0){
setLatitude(site.getLatitude());
setLongitude(site.getLongitude());
setElevation(site.getElevation());
}
AirNowDataPoint[][] dataPoints = site.getDataPoints();
for (AirNowDataPo... |
df818233-13b3-4d35-97dd-85ce421b2ccf | 9 | @Get
public String represent()
{
try
{
host = (getRequestAttributes().get("host") == null) ? host :
((String) getRequestAttributes().get("host")).trim();
port = (getRequestAttributes().get("port") == null) ? port :
Integer.parseInt(((String) getRequestAttributes().get("port")).trim());
... |
f6c101cc-eaff-4f4a-9c72-42d57f3fede3 | 0 | public AutomatonDrawer getDrawer() {
return drawer;
} |
bb257af0-e23d-4a6f-a5a6-0f263ac80f88 | 1 | @Override
public void printAnswer(Object answer) {
if (!(answer instanceof String)) return;
System.out.print((String)answer);
} |
30929c63-bb79-4cd5-981e-5194e8fd5a78 | 6 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
showHelp(sender);
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("list")) ... |
118188b4-c7f9-417a-be7d-55f0ec94a796 | 2 | public static void main(String args[]) {
long begin = System.currentTimeMillis();
int total = 475748;
int limit = 31716;
ExecutorService executorService = Executors.newFixedThreadPool(total
/ limit);
for (int i = 0; i <= total / limit; i++) {
String name = "T" + i;
executorService.execute(new SetTF(... |
8052f299-3377-45e2-b3fd-3017092d28a6 | 4 | private void getStartFiles() {
try {
dataFolder.mkdir();
info("Downloading changelog and readme...");
downloadFile("https://raw.github.com/GetPerms/GetPerms/master/Changelog.txt", changeLog);
downloadFile("https://raw.github.com/GetPerms/GetPerms/master/ReadMe.txt", readMe);
info("The changelog and rea... |
f873c0e7-d430-4a52-b1ab-48b32d37ff10 | 7 | public static void Command(CommandSender sender, String[] args)
{
if(sender.hasPermission("gm.survival.others"))
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
if (target.getGameMode() != GameMode.SURVIVAL)
{
target.setGameMode(GameMode.SURVIVAL);
if(sender instanceof ... |
7ce932ed-631e-417c-a9dc-8304274adf39 | 6 | public void changeChannels(String newChannel) {
if (listening.contains(channel.toLowerCase()))
listening.remove(channel.toLowerCase());
channel = newChannel.toLowerCase();
listening.add(channel.toLowerCase());
// create it if it doesn't exist
ChatChannel chan = ChannelManager.getChannel(channel.toLowerCas... |
3e4efdd4-7aef-47dd-985c-5170ad5beb42 | 1 | public List<String> inOrderWithInformation(BinaryNode<K,V,W> root)
{
if(root != null)
{
inOrderWithInformation(root.left);
inOrderWithInformation(root.right);
l.add(root.address.toString());
}
return (l);
} |
5e0b2208-da86-44c1-82fa-ce99d035b38b | 6 | private void classify() throws TooManyDendritesException {
final int MINPOINTS = 2;
if (this.classiferEnabled) {
//prepare the incoming data
LinkedList<Double> dendriteValues = new LinkedList<Double>();
for (AbstractNode d : this.getDendrites()) {
dendriteValues.add((double) d.getAxon());
}
... |
7b15bbfb-f284-4dac-93db-cef37c1e8ae2 | 2 | public String value() {
if (position >= 0 && position < items.length) {
return items[position];
} else {
return null;
}
} |
7ed88545-53f1-4ebf-b2a7-b11fe6240813 | 1 | public static void main(String[] args){ //The actual program
progress.setStringPainted(true); //So the progressbar can have text on it
progress.setString("Click download to begin"); //Info on the bar
list.setEditable(false);
list.setLineWrap(true);
dir.setEditable(f... |
3a7537f3-8231-44cd-8f16-da83c8a02dfa | 7 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String lable,
String[] args) {
if(cmd.getName().equalsIgnoreCase("setJob")){
Player p = (Player) sender;
String Job = args[1];
String name = args[0];
if(!plugin.isPlayer(name)){
p.sendMessage(red + name + " is not a pl... |
0347adba-be12-4e82-bd23-22c3091c06ac | 4 | @Subscribe
public void login(LoginEvent event) throws SQLException {
String player = event.getConnection().getName();
if(player==null){
return;
}
String connection = event.getConnection().getAddress().getAddress().toString();
if(!plugin.getUtilities().playerExists(player)){
plugin.getUtilities()... |
a1e56f31-cc06-42f1-8266-78a4917be153 | 6 | public static void startupDescribe() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (... |
a3e58b03-d5f4-4eed-920a-26b6417ae5d0 | 5 | public void visitCallStaticExpr(final CallStaticExpr expr) {
if (expr.method() != null) {
print(expr.method().declaringClass());
}
print(".");
if (expr.method() != null) {
print(expr.method().nameAndType().name());
}
print("(");
if (expr.params() != null) {
for (int i = 0; i < expr.params().len... |
0c04faf0-f13b-4863-a96e-982318d02d69 | 1 | @Override
public String getAnswerText() {
return isKeyword ?
String.format("\"%s\" is Java key word.", word) :
String.format("\"%s\" is NOT Java key word.", word);
} |
18649ea1-7de3-4cc9-9379-c57d2426f597 | 9 | public void run() {
while(true) {
long then = System.currentTimeMillis();
for (int j = 0; j < DDT; j++) {
for (int i = 0; i < agents.length; i++)
agents[i].control(agents, null);
shuffle(agents);
for (int i = 0; i < agen... |
ea513549-d778-4dc2-a2be-a29db34d96d0 | 7 | public ByteBuffer getData() {
ByteBuffer buf = ByteBuffer.allocate(getLength());
// write the header
buf.putShort(getFormat());
buf.putShort((short) getLength());
buf.putShort(getLanguage());
// write the various values
buf.putShort((short) (getSegme... |
0ce2f857-8128-4dad-81b7-c703a592a5db | 1 | @Override
public List<Integer> update(Criteria beans, Criteria criteria, GenericUpdateQuery updateGeneric, Connection conn) throws DaoQueryException {
List paramList1 = new ArrayList<>();
List paramList2 = new ArrayList<>();
StringBuilder sb = new StringBuilder(UPDATE_QUERY);
String ... |
c318a656-790e-4122-b7f6-72ee77cdec22 | 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://downl... |
5b642ae5-e993-4ccd-9439-42433a24cde7 | 6 | public void assertObject(Handle factHandle, PropagationContext propagationContext, WorkingMemory wm) {
try {
Object object = factHandle.getObject();
Class clazz = object.getClass();
Method method = clazz.getMethod("get"+fieldName);
Object result = method.invoke(ob... |
b51b7289-0858-441b-811e-8136a11daf7a | 3 | public void setLastName(String lastName) throws Exception{
if (lastName.length() < MIN_INT_VALUE || lastName.toString() == null || lastName.length() > MAX_CHAR){
throw new IllegalArgumentException(NAME_ERR);
}
this.lastName = lastName;
} |
58d7229e-501f-40cf-ac5c-f8fd80af559d | 2 | public AccountManagerHandler(AccountManager target){
try {
logger.addHandler(new java.util.logging.FileHandler());
// logger.addHandler(new java.util.logging.ConsoleHandler());
} catch (SecurityException e) {
logger.warning(e.toString());
} catch (IOException e... |
ba49a931-bee6-45f5-bf30-18c4a902c33b | 2 | @Test
public void testShortCoding() {
Debugger.tc(() -> {
byte[] buf = null;
for (int s = Short.MIN_VALUE; s <= Short.MAX_VALUE; s++) {
buf = BytesUtils.encodeShort((short) s);
short bs = BytesUtils.decodeShort(buf, new Offset());
if (bs != s) {
System.err.println(String.format("Wrong with %d ... |
4b4fcf9a-ea28-4a69-b5fb-06e2f04a2be5 | 0 | public SqlSelector(Connection connetion) {
this.connetion = connetion;
} |
0f0d8af9-5f5c-441e-a3d5-faecdea1dfd8 | 2 | public BitSet getAvailablePieces() {
BitSet availablePieces = new BitSet(this.pieces.length);
synchronized (this.pieces) {
for (Piece piece : this.pieces) {
if (piece.available()) {
availablePieces.set(piece.getIndex());
}
}
}
return availablePieces;
} |
6122c43f-9b0e-4bb2-bdc9-9bf09e7d292c | 7 | @Override
public StatusType getInput(Object object){
StatusType gameStatus = StatusType.PLAYING;
do {
try{
this.display(); // display the menu
// get commaned entered
String command = this.getCommand()... |
398a004e-1db4-4df6-9657-b2680bac7fe0 | 4 | public void setState(int newState) {
if(state != null) state.dispose();
if(newState == SPLASH) {
state = new PlayState(this);
}
if(newState == TITLE) {
state = new TitleState(this);
}
if(newState == PLAY) {
state = new PlayState(this);
}
} |
69c5b2d6-2135-405b-b95c-420af2b84bfa | 9 | public Object getValueAt(Object o, int i) {
Conflict c = (Conflict) o;
switch (i) {
case 0:
return c.getRelativeId();
case 1:
return c.getType();
case 2:
return c.getActual() == null ? "" : c.getActual().getUserFriendlyValue();
case 3:
return c.getReference() == null ? "" : c.getReference().g... |
9b176f57-d202-4ee2-9700-e870e5435c83 | 3 | private int getIndexToWrite() { //returns the first empty particle array index, and if none exist returns the location of the "oldest" particle instead
int oldestParticleAge = 0;
int oldestParticleIndex = 0;
for (int particleIndex = 0; particleIndex < particleArray.length; particleIndex... |
3aa582bd-6370-4962-ba94-c37dc54cae28 | 3 | static TreeInfo recurseDirs(File startDir, String regex) {
TreeInfo result = new TreeInfo();
for (File item : startDir.listFiles()) {
if (item.isDirectory()) {
result.dirs.add(item);
result.addAll(recurseDirs(item, regex));
} else // Regular file
if (item.getName().matches(regex))
result.files.... |
b50b4bc1-5246-425a-b778-c60d45bfdc5f | 2 | public void editLocation() {
World<T> world = parentFrame.getWorld();
Location loc = display.getCurrentLocation();
if (loc != null) {
T occupant = world.getGrid().get(loc);
if (occupant == null) {
MenuMaker<T> maker = new MenuMaker<T>(parentFrame, resources, displayMap);
... |
4e5be5b6-a6f5-4e33-a777-130446a6bc63 | 5 | public void saveRecord(String name){
if( name == null || name.equals(""))
name = "未命名存档";
int score = Game.enemy_killed * 100 + Game.propScore ;
PreparedStatement pstmt = null ;
try{
pstmt = ConnectionUtil.getInstance().prepareStatement(""
+ "insert into t_record(id, time, stage, score, name) valu... |
9f17e552-56e0-4536-bc73-b59506c538a5 | 8 | private void RcodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RcodigoActionPerformed
vtexto = Ctexto.getText();
DefaultTableModel tr = (DefaultTableModel)tabla.getModel();
try
{
Statement s = cone.getMiConexion().createStatement();
... |
76a46994-8417-4349-9247-0eebc2ffd849 | 9 | private Object getMultiArray(Class<?> prototype) {
int start = _next;
int type = nextType(CLASS_MULTI_ARRAY, CLASS_REREF);
if (type == CLASS_REREF) {
_next = start;
Object array = get(null, null);
if (array == null || array.getClass().isArray()) {
... |
09ee536a-8bb0-42ef-9329-d41d636dc6bb | 9 | @Override
protected void paintComponent(Graphics gg) {
Graphics3D g = Graphics3D.create(gg);
w = (getWidth() - (leftGap + gap * hand.size())) / hand.size();
int h = getHeight() - 2 * gap;
int x = leftGap;
int y = gap;
Font font = new Font("Arial", Font.BOLD, 50);
for (Json card : Lists.... |
648df7c1-14a7-4a73-9f7f-edb02706417f | 2 | public static void find2Methods(Object self, String superMethod,
String thisMethod, int index,
String desc, java.lang.reflect.Method[] methods)
{
synchronized (methods) {
if (methods[index] == null) {
methods... |
57a8a2be-7199-49f8-b8e1-a9f0e28c7147 | 2 | public int getIdAmount(String id) {
int amount = 0;
for(int i=0;i<identity.size();i++) {
if(identity.get(i).contains(id)) {
amount++;
}
}
return amount;
} |
c1feb8b1-da99-440e-a35e-576655a4409a | 5 | public MainWindow() {
this.eventHandler = new MainEventHandler();
// TODO don't do this, create a real package
PackageManager.getInstance().registerCommand(
SafeResourceLoader.getString("COMMAND_SHUTDOWN",
"com.ikalagaming.omega.core.resources.PackageManager",
"shutdown"), Editor.getInstance());
... |
d9f00340-b3f2-4919-88b9-8497fb83bce6 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
BigInteger zero = BigInteger.ZERO;
while ((line = in.readLine()) != null && line.length() != 0) {
String[] data = ... |
1119ec4c-b8c6-4074-a477-605c3ee6dc13 | 2 | public boolean canHaveAsLightGrenade(LightGrenade lg) {
for (Element e : elements) {
if (e.getPositions().contains(lg.getPosition()))
return false;
}
return true;
} |
128c9c49-8314-4b50-b12e-8401326689f9 | 8 | @Override
public void process(JCas aJCas) throws AnalysisEngineProcessException {
//get incoming text
String inText = aJCas.getDocumentText();
//split lines
String[] lines = inText.split("\n");
Token token;
int indexCount=0;
int dummy=0;
int q_a=0;
int countLine=1;
Sy... |
71579433-c543-4fd3-9e6e-a05a2fae0120 | 9 | /* */ @EventHandler
/* */ public void onPlayerInteract(PlayerInteractEvent event)
/* */ {
/* 185 */ if (Main.getAPI().isSpectating(event.getPlayer()))
/* */ {
/* 187 */ if (Main.getAPI().isReadyForNextScroll(event.getPlayer()))
/* */ {
/* 189 */ if (Main.getAPI().ge... |
e811ee57-1665-4b4e-bf15-5dc3e677631a | 3 | private String getCommaStringFromArrayList(ArrayList<String> a)
{
if (a.size() == 0)
{
return "";
} else
{
String s = "";
for (int i=0;i<a.size();i++)
{
if (i != a.size()-1)
s = s + a.get(i) + ",";
... |
8f7ce02b-c947-49ea-a23c-1b8b3e64de50 | 0 | @Test
public void test_get_file_missing()
{
Assert.assertNull(getFile("bogus_key!"));
} |
30038aba-5bbc-4966-ab75-01617168be1d | 9 | @EventHandler
public void onInteract(PlayerInteractEntityEvent event) {
Player player = event.getPlayer();
String worldName = player.getLocation().getWorld().getName();
// We do not have to check on this world.
if (plugin.getAPI().isDisabledWorld(worldName))
return;
// Ignore creative?
if (plugin.... |
9596f72e-3f2c-4b9c-9970-bd4a09e590a8 | 5 | static boolean isElevatedTile(int x, int y) {
anInt1332++;
if (x < 0 || (y ^ 0xffffffff) > -1 || x >= Class348_Sub33.settingFlags[1].length || (Class348_Sub33.settingFlags[1][x].length ^ 0xffffffff) >= (y ^ 0xffffffff))
return false;
if ((Class348_Sub33.settingFlags[1][x][y] & 0x2) != 0)
return true;
retu... |
e4895d2f-2468-44cd-be41-f8c1a2dd80ce | 7 | public void spaceHorizontal(FastVector nodes) {
// update undo stack
if (m_bNeedsUndoAction) {
addUndoAction(new spaceHorizontalAction(nodes));
}
int nMinX = -1;
int nMaxX = -1;
for (int iNode = 0; iNode < nodes.size(); iNode++) {
int nX = getPositionX((Integer) nodes.elementAt(iNode));
if (nX < nM... |
5d1ded2e-ded2-47b6-965a-2a46ffc702e5 | 0 | public FrameProcessCalculate(){
initialize();
} |
e44b8026-5f19-4d3f-89d5-57a01cb953cc | 6 | public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
input = container.getInput();
GameState state = game.getCurrentState();
if (!(state instanceof World)) return;
prevVelocity.set(velocity);
invMass = 1F / size;
... |
11d15c2b-996b-4cee-8e0d-ae53be8c9da7 | 8 | private void resolveSummonProperties(SummonableService instance_, Class<?> clazz_)
{
//System.out.println("Summon.resolveSummonProperties(): " + clazz_.getName());
Field[] fields = clazz_.getDeclaredFields();
// Property fields
for (Field field : fields)
{
// allow to change private fie... |
77107407-93c2-43cd-aa09-09c33e6f3183 | 5 | int alignmentConstant (String align) {
if (align.equals("LEFT")) return SWT.LEFT;
if (align.equals("RIGHT")) return SWT.RIGHT;
if (align.equals("TOP")) return SWT.TOP;
if (align.equals("BOTTOM")) return SWT.BOTTOM;
if (align.equals("CENTER")) return SWT.CENTER;
return SWT.DEFAULT;
} |
68eba07f-1e9b-4474-b82b-2a6ba38d2f0c | 1 | @Override
public void pause(int objectId) {
AudioChannel channel = channels.get(objectId);
if (channel != null) {
alSourcePause(channel.source);
}
} |
de0434ad-87ab-4651-a0f6-9edd679f42ff | 0 | public void setTarget(String value) {
this.target = value;
} |
1c652031-1635-4551-b514-5cd93eb3894b | 4 | public Rectangle2D.Float getBounds() {
// lazy load the bounds as the calculation is very expensive
if (bounds == null) {
// word bounds build from child word bounds.
for (WordText word : words) {
if (bounds == null) {
bounds = new Rectangle2D.... |
5a41d7d2-54ac-472f-9d79-71d48aeac44c | 3 | private void itmMnuProjetoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itmMnuProjetoActionPerformed
// Menu - Cadastro > ItemMenu - PROJETO
DepartamentoBO depBO = new DepartamentoBO();
Departamento DEPexistente = null;
try {
DEPexistente = depBO.SelectDeparta... |
6f4f6265-5b39-4530-8a9a-a4538692f16f | 6 | private synchronized void changeBid(int auction, Bid bid, Bid newBid) {
Bid activeBid = getBid(auction);
if (activeBid != null) {
if (activeBid.same(bid)) {
bids[auction] = newBid;
} else {
Bid child;
while ((child = activeBid.getReplacing()) != null && !child.same(bid))
{
activeBid = chi... |
00676a57-1316-470a-909d-413c9f2c268a | 5 | public static void recDFS(Vertice v) {
for (Aresta a : v.getArestas()) {
// checa se a aresta do v entrada ja foi visitada
if (!a.checkVisitado()) {
// tmp == vertice de destino
Vertice tmp = a.getDestino();
if (!tmp.checkVisitado()) {
a.visitar();
tmp.visitar();
if (go) {
Syst... |
959e9fb9-c82f-4157-93d5-7ba462868225 | 9 | private void getData(){
try {
cbSubject.removeAllItems();
cbObject.removeAllItems();
cbVerb.removeAllItems();
cbLocation.removeAllItems();
cbLocationObject.removeAllItems();
ConnectDatabase cdb = new ConnectDatabase();
ResultSet result = cdb.st.executeQ... |
50bd97d8-15b1-451a-9bc6-cee3fb80d4fb | 4 | public double averageBytes() {
int runs = runs();
double[] sizes = new double[runs];
int retries = runs / 2;
final Runtime runtime = Runtime.getRuntime();
for (int i = 0; i < runs; i++) {
Thread.yield();
long used1 = memoryUsed(runtime);
int number = create();
long used2 = memoryUsed(runtime);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.