method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f325675d-0645-401f-b531-f7a910d0f106 | 3 | public static String getMemberID(){
try {
ResultSet rs=DB.myConnection().createStatement().executeQuery("select max(MemberID) from members");
while(rs.next()){
maxid=Integer.toString(rs.getInt(1)+1);
}
} catch (ClassNotFoundExceptio... |
f06c76bc-c6f8-4033-a3c2-8e1bacc19101 | 9 | private void skipWhitespace() {
// if we are EOF, return
if (numChars == -1)
return;
// read whitespace
while (true) {
// if we are at the end of the buffer, read more
if (pos == numChars)
readMore();
// if we are EOF, r... |
2e957445-0e6d-4d89-8fb9-f7844cb2f637 | 2 | @SuppressWarnings("unchecked")
@Override
public T rowToObjec(ResultSet rs) throws SQLException {
assert(rs.getMetaData().getColumnCount() == 1);
T o = (T) JdbcUtil.getResultSetValue(rs, 1, type);
if (o != null && type.isInstance(o)) {
return o;
} else {
throw new RuntimeException(
"failed to get re... |
25773fc4-22a9-4c2d-a140-e300e9497b5e | 0 | public MethodComparer(Method method) {
this.method = method;
parseMethodNameAndParameters();
} |
00015aae-4282-4fe3-a523-9f9035af6e8b | 9 | @SuppressWarnings("unchecked")
private void readAppenderParams(String[] args, String val)
{
String name = args[2].trim();
if (name.isEmpty())
{
throw new ConfigException(
"Cannot find logger appender's name, which is empty.");
}
Appender ap... |
216d7a4f-c9da-4f41-b4b3-476fb32f076c | 0 | public void initaliseWorldMap(World w, int matchNum, int totalMatches) {
hexgrid.initGame(w, matchNum, totalMatches);
} |
d4db4455-a808-40d9-824f-bcb71ecf5029 | 3 | public void quit() {
int reponse = JOptionPane.showConfirmDialog(getParent(), "Do you want to save before exiting ?", "Exit", JOptionPane.YES_NO_CANCEL_OPTION);
if (reponse == 0 || reponse == 1) {
if (reponse == 0) {
manager.saveMap();
}
this.removeAll();
guiParent.putToSleep(false);
this.dispose... |
3c8f9471-902a-4bb9-804b-a2324a21e0ce | 1 | private void setBalance(BigInteger balance) throws IllegalArgumentException {
if (! this.canHaveAsBalance(balance))
throw new IllegalArgumentException();
this.balance = balance;
} |
de79e061-bcfb-453a-871a-6667c425be55 | 7 | public List<InetAddress> discoverHosts (int udpPort, int timeoutMillis) {
List<InetAddress> hosts = new ArrayList<InetAddress>();
DatagramSocket socket = null;
try {
socket = new DatagramSocket();
broadcast(udpPort, socket);
socket.setSoTimeout(timeoutMillis);
while (true) {
DatagramPacket packet ... |
1a55a213-c5c1-435d-b5af-353e5ba1a9be | 2 | public boolean verify(Person P1) {
boolean check = true;
for (int i = 0; i < Persons.size(); i++) {
if (Persons.get(i).getID().equals(P1.getID())) {
check = false;
}
}
return check;
} |
5a51dba2-ca23-478b-a4e5-642f0c55713e | 8 | private INDIElementAndValue[] processINDIElements(INDIProperty property, Element xml) {
String oneType;
if (property instanceof INDITextProperty) {
oneType = "oneText";
} else if (property instanceof INDIBLOBProperty) {
oneType = "oneBLOB";
} else if (property instanceof INDINumberProperty)... |
ab97f18d-4aa0-4c24-a275-667e13ef7912 | 9 | public WorldFrame(World<T> world)
{
this.world = world;
count++;
resources = ResourceBundle
.getBundle(getClass().getName() + "Resources");
try
{
System.setProperty("sun.awt.exception.handler",
GUIExceptionHandler.class.getName... |
940ee3a9-0fe0-4a16-b7ef-79b845ba157d | 1 | public static ParkManage getInstance() {
if(main == null) {
main = new ParkManage();
}
return main;
} |
f59616b2-4c15-46c4-9c6a-d5d94cb93ad3 | 8 | @SuppressWarnings("empty-statement")
public static String berlekamp_massey(int[] array) {
String s = new String();
String suc = new String();
final int N = array.length;
int[] b = new int[N];
int[] c = new int[N];
int[] t = new int[N];
int cont = 0;
... |
66b80893-09f2-4040-97ce-1a30cedf336d | 2 | @Override
public Character get(int id) {
Character p = null;
try {
getById.setInt(1, id);
ResultSet rs = getById.executeQuery();
while(rs.next())
{
p = new Character();
p.setId(rs.getInt("id"));
p.setDescription(rs.getString("description"));
p.setName(rs.getString("name"));
}
}... |
aaf1fbbb-3460-43d8-bbbd-600e967b651a | 5 | public void pushBack( int c ) throws IOException {
if( debug ) {
if( c == 0x0a ) {
System.out.print("(<0x0a)");
} else if( c == 0x0d ) {
System.out.print("(<0x0d)");
} else if( c == 0x09 ) {
System.out.print("(<0x09)");
... |
a85313c3-e7d5-41fa-9931-cdd1363842f4 | 6 | private boolean _jspx_meth_c_choose_0(PageContext _jspx_page_context)
throws Throwable {
PageContext pageContext = _jspx_page_context;
JspWriter out = _jspx_page_context.getOut();
// c:choose
org.apache.taglibs.standard.tag.common.core.ChooseTag _jspx_th_c_choose_0 = (org.apache.taglibs.stand... |
046d359d-7353-4000-94f9-4a044d07fbb6 | 5 | @Override
public void run() {
while (this.running) {
try {
if (this.socket != null && this.socket.isBound()) {
readFromSocket();
} else {
bind();
}
Thread.sleep(500);
} catch (IOException e) {
e.fillInStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
... |
2a437bf8-6247-4cb1-915b-6361ef3e61fb | 0 | public static void main(String[] args) throws Exception {
OutputStream os = new FileOutputStream("1.txt");
//缓冲输出流
BufferedOutputStream bos = new BufferedOutputStream(os);
bos.write("http://www.google.com".getBytes());
bos.close();
//
// os.close();
} |
91d1470d-dd61-4102-b587-f30016259f76 | 8 | private static String initialise(Token currentToken,
int[][] expectedTokenSequences,
String[] tokenImage) {
String eol = System.getProperty("line.separator", "\n");
StringBuffer expected = new StringBuffer();
int maxSize = 0;
for (int i = 0; i < expe... |
9f18d923-a015-4e77-b4f4-b5736abc65bd | 4 | public Content() throws DataException {
File file;
try {
file = new File(getClass().getResource("/resource/Vragen.xml").toURI());
} catch (Exception e1) {
throw new DataException("Het vragenbestand kan niet worden gevonden.");
}
try {
doc = new Builder().build(file);
} catch (ValidityException e) ... |
b602173f-f1f1-43dc-a39e-c0a08f32c916 | 2 | private void LoadSyntaxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoadSyntaxActionPerformed
if (Cerrar()) {
JFileChooser fileChooser = new JFileChooser();
fileChooser.setMultiSelectionEnabled(false);
fileChooser = setFilters(fileChooser, true, "text wi... |
a6a6e51b-e4a4-4ef8-8cba-20ed9ed37b3e | 7 | public void insert (T i) {
if(i == null)
return;
if(contains(i))
return;
if(root == null) {
root = new Node<T>(i, null, null);
size++;
return;
}
Node<T> cur = root;
if(!cur.getElement().shorter(i)) {
root = new Node<T>(i, null, cur);
cur.setPrev(root);
size++;
return;
}
... |
35efa69f-3647-4376-8c3d-1f5fef4d36bd | 8 | private Set<Cell> getValidNeghbors(Cell cell, FixedCell fixedCell,
Map<Cell, Set<Cell>> validNeighborsCache) {
Set<Cell> result = validNeighborsCache.get(cell);
if (result == null) {
final Board board = cell.getBoard();
result = new CellSet(board.getNeighborsSet(cell));
// remove those ... |
7db466f5-6178-4ea8-aedc-a982db8d302f | 7 | public void renderSheet(int xp, int yp, SpriteSheet sheet, boolean fixed) {
if (fixed) {
xp -= xOffset;
yp -= yOffset;
}
for (int y = 0; y < sheet.HEIGHT; y++) {
int ya = y + yp;
for (int x = 0; x < sheet.WIDTH; x++) {
int xa = x + xp;
if (xa < 0 || xa >= width || ya < 0 || ya >= height) conti... |
c27b55e4-2fc6-4dec-9f8c-19cbe99f75cc | 9 | */
public Direction navigateToDestination() {
if(destination==null || br.curLoc.equals(destination))
return null;
Direction dir = Direction.NONE;
switch(mode) {
case RANDOM:
dir = navigateRandomly(destination);
break;
ca... |
8d9ab577-f239-43aa-93be-f076a6c631f3 | 4 | final void method200ms() {
long timeMillis = System.currentTimeMillis();
while (true) {
if (System.currentTimeMillis() > timeMillis + 200)
return;
for (int i = 0; i < 10_000; i++) {
// busy wait
if (i == 10_000)
break;
}
}
} |
05844079-bb62-4156-8d1d-34c92b10a244 | 7 | private static void setPropertyFromString(String line) {
line = line.trim();
/* ignore blank lines */
if (line.equals("")) return;
/* ignore comments */
if (line.startsWith("//")) return;
if (line.startsWith("#")) return;
/* ignore lines that do not have a space in them */
if (line.indexOf(" ")... |
5a475467-7c66-4411-8c67-661ad80854e6 | 7 | private void sshLogToFile( String logStr )
{
if ( !sshLog.exists() )
{
// 创建文件
try
{
if ( !sshLog.createNewFile() )
{
RTTestLog.logToConsole( "log文件创建失败", LogCollector.ERROR );
isTestReady = false;
return;
}
RTTestLog.logToConsole( "log文件创建成功。\n", LogCollector.INFO );
}
... |
23ba02a8-8a5b-4bff-a691-7f8979e07010 | 5 | private ListNode merge(ListNode left, ListNode right){
ListNode result = new ListNode(-1);
ListNode current = result;
while(left != null || right != null){
int lval = left == null ? right.val + 1 : left.val;
int rval = right == null ? left.val + 1 : right.val;
if(lval < r... |
741be44c-42ea-4d93-b0b3-ddd20437208f | 6 | public static Command parse(String commandAsStr) {
commandAsStr = commandAsStr.trim();
if ("".equals(commandAsStr)) {
return new Command(Commands.UNKNOWN, "unknown command");
}
String commandName = getCommandName(commandAsStr);
List<String> args = getArgs(commandAsSt... |
4f47b9c1-29e5-4e27-ab5f-2688ef661621 | 5 | protected static Ptg calcJIS( Ptg[] operands )
{
if( (operands == null) || (operands[0] == null) )
{
return new PtgErr( PtgErr.ERROR_VALUE );
}
// determine if Excel's language is set up for DBCS; if not, returns normal string
WorkBook bk = operands[0].getParentRec().getWorkBook();
if( bk.defaultLanguag... |
ad6ef9c2-f921-4e4f-acfd-89d619bd3f0a | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
61f0b3c6-abb8-48d2-b529-d3c921449975 | 0 | public PdbBFReaderWriter () {
super() ;
// in case we ever do native interface code to hide some details ....
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\tPdbBFReaderWriter:constructor:DLL is loaded? " + bNativeInterfaceCodeLoaded); }
// if (Outliner.DEBUG) { System.out.println("\tStan_Debug:\t... |
ee6e8370-d79e-4351-afc1-8d2455885df4 | 2 | private boolean metodoImplement(String metodo) {
int metodoDefinido = 0;
while (metodoDefinido < metodos.length) {
if (metodos[metodoDefinido].equals(metodo)) {
return true;
}
metodoDefinido++;
}
return false;
} |
a7876bda-047a-4d58-9a2a-d14322b6f632 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BookstoreAlbumEntity that = (BookstoreAlbumEntity) o;
if (albumid != that.albumid) return false;
if (Double.compare(that.price, price) != 0) re... |
2cdbc4f4-12fc-45d3-9d2d-150266a4e1ae | 7 | public boolean canSelect(Unit selected)
{
lockSelect = cSelect != null && (cSelect.hasMoved() || cSelect.isMoving()) && !cSelect.isDone();
return !lockSelect && selected != null && !selected.isMoving() && !selected.hasMoved() && window == null;
} |
ced6a8cd-716d-48cb-a05b-01ad87708c37 | 0 | public void setLineNumber(int lineNumber) {
this.lineNumber = lineNumber;
} |
bb618cdf-9d89-4027-9c55-b8cbb5c6164c | 1 | public List<String[]> getAttributes(){
List <String[]> l = new ArrayList<String[]>();
String[] s = new String[2];
// if (refCatastral != null){
// s = new String[2];
// s[0] = "catastro:ref"; s[1] = refCatastral;
// l.add(s);
// }
if (cultivo != null){
l.addAll(cultivoParser(cultivo));
}
s = new... |
7447e5d5-ff23-43cb-bca8-00596ab6685e | 7 | public Vector<Recommendation> chooseRandomRecommendation(Vector<Recommendation> recommendations, HashMap<String, String> contextInformation){
//stores all recommendations. needed if all recommendations were displayed more than "maximumDisplayCount" times in the last "historyCleanupInterval" minutes.
Vector<Recom... |
48ac11ed-d915-4dac-b30f-89a3b53b8d2a | 5 | public void showWallToFile(FileWriter f) throws IOException {
allPosts = new ArrayList<TimedPosts>();
for (int i = 0; i < this.posts.size(); i++) {
String newPost = this.name + ": " + this.posts.get(i).getPost();
Long time = posts.get(i).getTime();
allPosts.add(new T... |
058f3b1f-0416-4332-a279-70d12fbe50aa | 8 | public static int getYfromString(String location) {
if ((location.charAt(1) == '1')) {
return 0;
}
if ((location.charAt(1) == '2')) {
return 1;
}
if ((location.charAt(1) == '3')) {
return 2;
}
if ((location.charAt(1) == '4')) {
return 3;
}
if ((location.charAt(1) == '5')) {
return 4;
... |
04da800a-1ea1-415b-a638-4c041dc10bae | 5 | public String[][] getLocationJSON(){
@SuppressWarnings("unchecked")
ArrayList<String>[] temp = new ArrayList[4];
for (int i = 0; i < temp.length; i++){
temp[i] = new ArrayList<String>();
}
String time = "" + (System.currentTimeMillis() / 1000.0);
for (AirNowDataSite site : dataSites){
if (site.getLati... |
564153bd-17c1-4dd0-af20-e1c60eca874f | 6 | public void executeInstruction() throws ProgramException {
short instruction = rom.getValueAt(PC.get());
boolean pcChanged = false;
if ((instruction & 0x8000) == 0)
bus.send(rom, PC.get(), A, 0);
else if ((instruction & 0xe000) == 0xe000) {
computeExp(instruction... |
6490676c-8802-4867-b5b7-d8e84c8db88d | 5 | private boolean handleKeyPress(RailLogic var1) {
if (this.isConnectedTo(var1)) {
return true;
} else if (this.connectedTracks.size() == 2) {
return false;
} else if (this.connectedTracks.isEmpty()) {
return true;
} else {
ChunkPosition var2... |
d1073070-258d-4db0-8db8-3ae23e4e113c | 7 | public void chooseAction(){
if(game.findRowNumOfBottomFence()>(game.getBoard().getLength()-1)/2 +1
&& game.findRowNumOfTopFence()<(game.getBoard().getLength()-1)/2 -1){
int topGap = game.findRowNumOfTopFence()-0;
int bottomGap = game.getBoard().getLength() - game.findRowNumOfBottomFence();
if(topGap > bo... |
a7fbdb2c-90b3-4b53-806e-59f99aae4e27 | 9 | public void update() {
time++;
if (time % (random.nextInt(50) + 30) == 0) {
xa = random.nextInt(3) - 1;
ya = random.nextInt(3) - 1;
if (random.nextInt(4) == 0) {
xa = 0;
ya = 0;
}
}
if (walking) animSprite.update();
else animSprite.setFrame(0);
if (ya < 0) {
animSprite = up;
dir = ... |
1676fc3a-0f95-4dc2-ab07-fb1cb0ef6ab9 | 9 | private int ParseGameState(String s) {
planets.clear();
fleets.clear();
String[] lines = s.split("\n");
for (int i = 0; i < lines.length; ++i) {
String line = lines[i];
int commentBegin = line.indexOf('#');
if (commentBegin >= 0) {
line = line.substring(0, commentBegin);
}
if (line.trim().len... |
b9093283-e4aa-4461-9277-a2f1e10430e3 | 1 | public static void main(String s[])
{
Integer a[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
RSelect<Integer> rselect = new RSelect<>();
for (int rank = 1; rank < 9; rank++)
{
System.out.println("Element with rank " + rank + " "
+ rselect.select(a, 1, 0, a.length - 1));
}
} |
c8987ba3-4f36-4ac5-9b4d-f56f6ba44f93 | 2 | public Expression simplify() {
if (value == 1) {
int op = (getOperatorIndex() == OPASSIGN_OP + ADD_OP) ? INC_OP
: DEC_OP;
return new PrePostFixOperator(getType(), op, getLValue(), isVoid())
.simplify();
}
return super.simplify();
} |
f23b26ab-6b9e-445a-be9f-b66768ca8db8 | 7 | public boolean verifyInput(){
//Sanitize input
name = name.replace("'","");
location = location.replace("'","");
if(mainMenu_id < 0 || vegMenu_id < 0 || client_id < 0){
return false;
}
if(numGuests < 0 || totalLengthOfEvent < 0){
return false;
}
if(!status.matches("pending") && !status.ma... |
96b5113c-9266-44b1-b0fc-d065037d5b89 | 2 | public void render() {
BufferStrategy bs = getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
requestFocus();
return;
}
if (activeComponent != null)
activeComponent.render(screen);
Graphics g = bs.getDrawGraphics();
g.drawImage(image, 0, 0, getWidth(), getHeight(), null);
... |
7619cac4-d742-4f32-81f6-2a86d1cdc2f3 | 7 | public void show(Component invoker, int x, int y) {
if (atom == null)
return;
if (!((MolecularModel) atom.getHostModel()).changeApprovedByRecorder())
return;
char[] code = null;
if (atom.isAminoAcid()) {
if (atom.getCodon() != null)
code = atom.getCodon().toCharArray();
}
if (code == null)
r... |
54852c0c-8481-49ad-a914-09306fb24c03 | 9 | private void compareRoot(CVSRoot root, String method, String user,
String password, String host, int port, String repository) {
if (!(method == root.getMethod())) {
fail("Bad connection method is parsed: '"+root.getMethod()+"', expected was '"+method+"'");
}
... |
6fcef9f3-198b-40aa-a889-de7eb80682e5 | 0 | public static int getDest_port() {
return dest_port;
} |
36f0c473-1088-477d-90f3-18bc359e039e | 4 | @Override
public Object canonicalizeValue(final Object value) {
if (isValidValue(value)) {
return value;
} else if (value == null) {
throw new RuntimeException("Got invalid boolean value " + value);
} else if (value.toString().equals(CycObjectFactory.nil.toString())) {
return false;
... |
f9189a63-fb6a-4f34-bbe2-6f98dfaaa219 | 3 | public static HardwareAlternative selectCheapest(List<HardwareAlternative> hardwareAlternatives) {
HardwareAlternative cheapest = hardwareAlternatives.get(0);
HardwareComponent cheapestComponent = hardwareAlternatives.get(0).getHardwareComponents().get(0);
for (HardwareAlternative hardwareAlternative : hardwareAl... |
32807d0c-f6f1-433e-9e33-6f3d4a8a1a29 | 1 | public void refreshView() {
if(OptionsManager.getInstance().isNotifyViewRefresh()) {
log.logp(Level.FINEST, getClass().getSimpleName(), "refreshView()", "Refreshing...");
}
panel.repaint();
statusBar.setText(getStatusBarText());
model.getShop().update();
} |
66ad3e21-f6e3-495b-b954-fd452fe67c67 | 6 | private static Image getImage(String filename) {
// to read from file
ImageIcon icon = new ImageIcon(filename);
// try to read from URL
if ((icon == null) || (icon.getImageLoadStatus() != MediaTracker.COMPLETE)) {
try {
URL url = new URL(filename);
... |
33ae2a3c-f1b1-46c8-8e85-9912b4f4d2ac | 5 | void roll(float dir) {
if (dir != 0) {
//turning
roll += dir;
if (roll > ROLL_STEPS)
roll = ROLL_STEPS;
if (roll < -ROLL_STEPS)
roll = -ROLL_STEPS;
} else {
//roll level
if (roll > 1) {
... |
1872881d-4e55-47e5-bf80-2862d007d786 | 2 | private static byte[] getBytes(String sTag, Element eElement) {
String str = getTagValue(sTag, eElement);
if (str == null) {
return null;
}
byte[] tab = new byte[str.length() / 2];
for (int i = 0; i < str.length() / 2; i++) {
tab[i] = (byte) Integer.pa... |
99078785-8037-4b75-9b27-46f677a4cfe3 | 1 | public void visitEnd() {
checkEnd();
end = true;
if (av != null) {
av.visitEnd();
}
} |
0ac31931-6ff1-4a73-95ae-6fff4145f2a7 | 6 | public boolean is_Last() {
boolean flag = false;
boolean first = true;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
if ((board[i][j] == 0) && (!first)) {
flag = false;
return flag;
}
if ((board[i][j] == 0) && first) {
flag = true;
first = false;
}
}
}
r... |
25cfc394-d823-4978-b0ae-5d1288adb966 | 7 | public void paintHealth(Graphics g, Pokemon pokemon, int CenterX, int CenterY)
{
//g.drawImage(battleImages[3],480,360,20,20,this);//Draws Slash
g.drawImage(battleImages[3],CenterX,CenterY,20,20,this);//Draws Slash
//Health Draw
if (pokemon.health < 0)
paintPokeFont(g,"0",CenterX - 24,CenterY,18);
if (poke... |
dfa6d2ed-fcc3-4691-a357-1ff6a83ea4ee | 1 | private void expression1()
{
expression2();
while (accept(NonTerminal.OP1))
{
expression2();
}
} |
7168bca6-81bf-4706-8833-6e41ce7bdf7b | 0 | public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext(
"applicationContext.xml");
CollectionBean collectionBean = (CollectionBean) context
.getBean("collectionBean");
log.debug(collectionBean.toString());
} |
ae9955f9-c349-4e4e-9115-dc683311a182 | 7 | public int compute(int direction, float f) {
if (direction == 0) {
float f1 = unity[0] + (unity[1] - unity[0]) * f;
f1 *= 0.003051758F;
_invUnity = (float) Math.pow(0.10000000000000001D, f1 / 20F);
invUnity = (int) (_invUnity * 65536F);
}
if (pairCount[direction] == 0)
return 0;
float _mag = adap... |
6f3c8abd-a51c-4a99-9817-7df9bcc4a9ea | 8 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
/*
* Don't question this code, only accept that it works
*/
int i, rl;
String spacing = " ";//Length: 8 +1 for null termination.
for (rl = 0; rl <= 2; rl++) {
sb.append(spacing.substring(0, rl * 3));
for (i = 0; i ... |
61a33858-aeb1-4b8c-8a0d-cff7d77abe79 | 9 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("text/html");
PrintWriter out = response.getWriter();
//out.println("<html><body>");
// Retrieving Data from the Ajax Post ... |
6f3cbf2e-8c41-4c65-b488-dd3d3fa42aa2 | 0 | public double getThreshold()
{
_read.lock();
try
{
return _threshold;
}
finally
{
_read.unlock();
}
} |
025d35aa-1c0b-429b-b7b0-ee068ac77278 | 1 | public boolean kontroliertAustralien(Spieler s) {
boolean res = true;
if(!s.fraktion.equals(laenderGraph.getLaenderList().getLandByID(5).getOwner())) {
res = false;
}
return res; } |
3883a96d-d7f5-4bb5-bb03-234a47162008 | 1 | public ConnexionUDP(String adresse, int portEcoute, int portEnvoi) {
this.portEcoute = portEcoute;
this.portEnvoi = portEnvoi;
this.adresseIP = adresse;
try { socket = new DatagramSocket(portEcoute); }
catch (SocketException e) { e.printStackTrace(); }
} |
6ad18460-3b86-4342-b1ac-982df8eea872 | 8 | @Override
public void update(GameContainer gc, StateBasedGame game, int delta)
throws SlickException {
map.update(gc, delta);
if (gc.getInput().isKeyPressed(Input.KEY_UP)) {
selection--;
if (selection < 0) selection = 2;
} else if (gc.getInput().isKeyPressed(Input.KEY_DOWN)) {
selection++;
i... |
f0c37859-c8b9-4b0e-b519-4e5cc0d93538 | 0 | public CheckResultMessage check6(int day) {
return checkReport.check6(day);
} |
b58ac398-58f3-438b-a050-f9523a2c0cc4 | 2 | public void addRow(Row row) {
if (row == null) {
throw new NullObjectInsertionException();
}
// if (row.getRoom() != null && row.getRoom().equals(this)) {
// throw new ReassignObjectException("This row already assigned to another room");
// }
if (exists(row)) {
throw new... |
bb767f2c-ae80-474c-bad6-a431cdc45626 | 9 | public void removerControle(){
if ( this.num_controles == 0 ){
System.out.println("\nNão existe nenhum controle ainda.");
}
else{
System.out.println("\nQual dos consoles você gostaria de remover? "
+ "[ 1 - " + this.num_controles + " ]");
int ... |
9a72b862-a3bc-4c6d-99b5-944b2a4a5b56 | 0 | public Date getFecha() {
return fecha;
} |
9936f633-dea2-4bb7-aa64-ab2e227fe39c | 2 | public static void update()
{
for(int i = 0; i < NUM_KEYCODES; i++)
lastKeys[i] = getKey(i);
for(int i = 0; i < NUM_MOUSEBUTTONS; i++)
lastMouse[i] = getMouse(i);
} |
f7a23d6e-255a-4544-a10a-334c52ec5475 | 0 | private boolean hasCollision(byte[] schedule, int slot) {
int content = extractSlot(schedule, slot);
return content != footprints[slot];
} |
091f29b0-e7b0-4da5-ae9d-aa57f2c97bc3 | 4 | private int partitionListIntoTwo(List<T> list, int leftIndex, int rightIndex) {
// Choose the right most position of the list as the pivot. This will
// remain fixed until the very end when it will be swapped if necessary.
int initialPivotIndex = rightIndex;
// As long as the left index pointer does no... |
f409ce4f-b508-469e-a2b0-d0f8d0f61e38 | 5 | public static int insertMstxCol(String mid, String uid, String comment) {
int result = 0;
Connection con = DBUtil.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = con.prepareStatement("insert into mstx_col(mid,uid,comment) values(?,?,?)");
pstmt.setString(1, mid);
pstmt.setString(2, uid);... |
ad1fe940-97ed-4e75-9c7d-7aba1a7952d6 | 1 | public ReadFile(String file)
{
try {
reader=new BufferedReader(new InputStreamReader(new FileInputStream(file)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} |
d1db7d7e-3982-4709-863b-18f509a29c03 | 9 | public final Registry getRegistry() {
if (m_mainRegistry == null) {
try {
Registry reg = Registry.loadForClass(JWP.class, rv);
if (reg.sizeOf("USER") == 0) {
reg.initGroup("USER", new String[][]{
{"open.blank.default", "true", "boolean"},
{"max.file.hi... |
ce259973-b611-47c7-aaf3-c47e4ccffe57 | 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... |
2bfc15e0-1bfc-4bde-9c9b-e29a3bdc8a63 | 6 | public void stateFillSelect(){
/* State Fill Option
* 0 = Regular fill
* 1 = Checker Board pattern
* 2 = Randomized
* 3 = Randomized/Checker Board
* 4 = Clear state
* 5 = Invert state
*/
statefillflag = true;
switch(sfo){
case 0: stateFill(); break;
... |
a2d1198b-ba4b-493a-ae9c-4bd4203a109e | 3 | public void tick() {
int dt = (int) (System.currentTimeMillis() - st);
int animlength = (Config.fastFlowerAnim) ? 0 : ms;
if (dt < animlength)
s = (double) dt / animlength;
else
s = 1;
if (dt >= animlength)
end();
tick2();
} |
8c119b50-645f-4b24-b593-209176888aa8 | 2 | private static void add(ArrayList list, TypeData td) {
int n = list.size();
for (int i = 0; i < n; i++)
if (list.get(i) == td)
return;
list.add(td);
} |
84870fe6-b932-4471-a389-72e5ccc6ae05 | 3 | private void appendDivisor(StringBuilder sb, Puzzle p) {
sb.append("|");
for (int c = 1; c < p.getSide(); c++) {
if (c > 0 && c % p.getBoxSize() == 0) {
sb.append("---+");
} else {
sb.append("--");
}
}
sb.append("---|\n");
} |
dd1a66d4-790f-43e7-969b-cbb3dd07e24a | 1 | private static void dateDirLog() throws Exception{
Date date = new Date();
//создание папки месяца
try{
String myDate = dateDirFormat.format(date);
File myDateDir = new File(LogDir + "/" + myDate);
myDateDir.mkdir();
dateDir = myDateDir.getAbsolute... |
20338a9e-ccee-444a-b572-7dd233ae9ec5 | 3 | public void add(Product prod, double unitValue){
if(unitValue < 0) throw new IllegalArgumentException("unitValue cannot be negative.");
if(prod == null) throw new IllegalArgumentException("Product must not be null.");
if(products.containsKey(prod)){ // Check if the product exists in the HashMap
products.put... |
1b62777e-498d-4757-bfdc-1d404e4f52cd | 8 | private Component cycle(Component currentComponent, int delta) {
int index = -1;
loop : for (int i = 0; i < m_Components.length; i++) {
Component component = m_Components[i];
for (Component c = currentComponent; c != null; c = c.getParent()) {
if (component == c) {
index = i;
break loop;
}
... |
00695c8c-2e0e-474e-96e2-1dc78ce15263 | 2 | public static void main(String[] args) {
Man man = new Man();
BlackMan blackMan = new BlackMan();
int r = man.compareTo(blackMan);
Man[] men = new Man[10];
BlackMan[] blackMen = new BlackMan[10];
// Man min = min(men);
// BlackMan min2 = min(blackMen);
ManContainer<Man> c1 = new ManContainer<Man>... |
08fe4c9d-85b0-436c-8829-e01e416bea96 | 2 | private static void addLdcW(CodeAttribute.LdcEntry ldcs, ArrayList jumps) {
int where = ldcs.where;
LdcW ldcw = new LdcW(where, ldcs.index);
int s = jumps.size();
for (int i = 0; i < s; i++)
if (where < ((Branch)jumps.get(i)).orgPos) {
jumps.add(i, ldcw);
... |
2345f840-af07-44b7-a48e-71ceb7a97e28 | 1 | public void addSubClass(ClassIdentifier ci) {
knownSubClasses.add(ci);
for (Iterator i = virtualReachables.iterator(); i.hasNext();)
ci.reachableReference((Reference) i.next(), true);
} |
04c8c460-fc8d-4b2f-8c95-f6a9821f974b | 8 | public String preReportByMark() {
List<ClassObj> lstClass = mdClass.getAll();
List<ObjectiveObj> lstObjective = mdObjective.getAll();
List<TopicObj> lstTopic = new LinkedList<TopicObj>();
if(lstObjective.size() > 0){
lstTopic = mdTopic.getByObjective(lstObjective.get(0).getOb... |
f86cc7b6-4599-4856-a21c-ce8118a06b9a | 4 | public static HashMap<String, Double> sortByValue(HashMap<String, Double> map) {
List<Map.Entry<String, Double>> list = new LinkedList<Map.Entry<String, Double>>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<String, Double>>() {
public int compare(Map.Entry<Stri... |
dd23741a-b942-4f21-ad95-81cb82bb9fd9 | 1 | public Users getUser(int id)
{
String sql = "Select id,login,pass,email,age,sexe,valide from Users where id = ?";
SqlRowSet R = this.montemplate.queryForRowSet(sql,id);
Users u = new Users();
while (R.next())
{
u.setId(R.getInt("id"));
u.setAge(R.getInt("age"));
u.setEmail(R.getString("email"));
... |
fc559566-441a-407b-82d3-2535b247340b | 0 | public int getAge() {
return age;
} |
05cfcf0f-9600-470d-8283-d9ff789d76ef | 2 | private boolean checkThreeConsecLetters(String number) {
int[] consecLetters = new int[9];
for (char c : number.toCharArray()) {
consecLetters[getIndex(c)]++;
if (consecLetters[getIndex(c)] > 3) {
statusCode = 2;
return false;
}
... |
d0174ddf-8c40-405d-910c-b75a5fac38fd | 4 | @Override
public boolean equals(final Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (!(obj instanceof Entry)) return false;
final Entry e = (Entry) obj;
return e.name.equals(name) && e.area.equals(area);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.