method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b9e899a1-20da-4d92-8be5-bc886b06a7c8 | 1 | public Move chooseMove(State s) {
MyList moves = s.findMoves();
if (moves.size() == 0) // no moves possible
return null;
return (Move) moves.get(r.nextInt(moves.size()));
} |
3c371428-7471-4b66-955f-686fc252fec8 | 3 | @EventHandler
private void onPlayerDropItem(PlayerDropItemEvent event) {
if(!(ColoredArmor.config.getBoolean("Check.allow-drop"))) {
Player player = event.getPlayer();
if(!(player.hasPermission("ca.check.drop.bypass"))) {
if(Armor.isArmor(event.getItemDrop().getItemStack())) {
player.sendMessage(pre +... |
ae8eacc4-cba8-433a-9485-0d6208cd1fed | 0 | public String getPostNote() {
return postNote;
} |
11b073d8-33f3-4f3e-b0da-8b103af6a4bd | 6 | final void method3049(ByteBuffer class348_sub49, int i, int i_0_) {
anInt9450++;
if (i_0_ != 31015)
anInt9451 = -15;
int i_1_ = i;
while_211_:
do {
do {
if ((i_1_ ^ 0xffffffff) != -1) {
if (i_1_ != 1) {
if (i_1_ == 3)
break;
break while_211_;
}
} else {
anInt9451 = c... |
d75ac0f9-9665-43ab-ab52-5f6547867f26 | 1 | public void visitMultiANewArrayInsn(final String desc, final int dims) {
minSize += 4;
maxSize += 4;
if (mv != null) {
mv.visitMultiANewArrayInsn(desc, dims);
}
} |
f0d34768-40a1-4dcc-8d21-593cced863e8 | 6 | public static String numberToString(Number number)
throws JSONException {
if (number == null) {
throw new JSONException("Null pointer");
}
testValidity(number);
// Shave off trailing zeros and decimal point, if possible.
String string = number.toString();
... |
b2684714-5376-4fa3-9219-f135a6db0b24 | 1 | private void noSuccessor() {
if (compute == FRAMES) {
Label l = new Label();
l.frame = new Frame();
l.frame.owner = l;
l.resolve(this, code.length, code.data);
previousBlock.successor = l;
previousBlock = l;
} else {
currentBlock.outputStackMax = maxStackSize;
}
currentBlock = null;
} |
ab4db504-bdfa-4110-8fdc-60ee41eaf913 | 1 | public void newFrameAt(int offset) {
if (runStack.size() - offset >= 0) {
framePointers.add(runStack.size() - offset);
}
} |
8b25f970-bf40-44c5-9cb2-fa98cfb9564e | 8 | static public int compareWildcardString(String a,String b) {
if(a==null && b==null)
return 0;
//else
if(a==null)
return -1;
//else
if(b==null)
return 1;
int wca=a.indexOf("*");
int wcb=b.indexOf("*");
if(wcb>=0... |
e752244a-c291-41fb-b7e3-abf9815cb7d8 | 7 | @Override
public void createTerrain(Tile[][] gameTiles) {
ThirdPartyFractalGenerator fractalGen = new ThirdPartyFractalGenerator();
for (int i = 0; i < GameConstants.WORLDSIZE; i++)
{
for (int j = 0; j < GameConstants.WORLDSIZE; j++)
{
Position pos = new Position(i,j);
if(fractalGen.getLandscapeAt... |
fc3be3b7-cd34-4cd2-ae64-e2c556f95383 | 7 | public void retryQuery(String query) {
boolean passed = false;
Connection connection = open();
Statement statement = null;
count = 0;
while (!passed && count < timeout) {
try {
statement = connection.createStatement();
statement.executeQuery(query);
statement.close();
connection.close();
... |
1f83d113-7445-407f-b0f8-84ea2b67ec19 | 4 | @Override
public void handle(HttpExchange exchange) throws IOException {
System.out.println("In Offer Trade handler");
String responseMessage = "";
if(exchange.getRequestMethod().toLowerCase().equals("post")) {
try {
String unvalidatedCookie = exchange.getRequestHeaders().get("Cookie").get(0);
... |
cf49a298-3b4b-468f-b21e-4e0c979f62a7 | 6 | public void update() {
spawnZombies();
for (int i = 0; i < items.size(); i++) {
items.get(i).update();
}
for (int i = 0; i < backgroundParticles.size(); i++) {
backgroundParticles.get(i).update();
}
for (int i = 0; i < entities.size(); i++) {
entities.get(i).update();
}
for (int i = 0; i < p... |
eb8fb0be-4f02-4348-9d27-89e1d49cffe3 | 4 | private void actionAnalyse( )
{
DefaultMutableTreeNode
selNd = getSelectedNode();
if ( selNd != null )
{
int[] selIdxs = getNodeIndexList(selNd);
if ( selIdxs.length == 1 )
{
LinkedList<double[]> audioList = audioVectors.get(selIdxs[0]);
int m = audioList.size();
if ( m > 0 )
{
NumberDialog n... |
962806ac-accc-4c52-9179-d5f1521af946 | 6 | private void kingTopRightPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 0 && y1 >= 0) && (x1 <= 6 && y1 <= 6))
{
if(board.getChessBoardSquare(x1+1, y1+1).getPiece().getPieceType() != board.getBlankPiece().getPieceType())
{
... |
51592a9b-ffab-4bd4-8206-1f5aca0fd349 | 7 | private static void testInvalidNode(ListNode p) {
System.out.println("p.isValidNode() should be false: " + p.isValidNode());
try {
p.item();
System.out.println("p.item() should throw an exception, but didn't.");
} catch (InvalidNodeException lbe) {
System.out.println("p.item() should throw... |
23969dcc-3201-4f18-840a-b20ea0509071 | 3 | public int[] findPosForNewPlayer() {
//TODO make sure to handle when the map is full and there is no space for new players
// maybe place then on a waiting queue but will still need to listen for other players because this will pause.
System.out.println("Finding a place for a new player...");
... |
8da15cb6-c6b1-4f86-83a5-555768e020a2 | 2 | public void setValue(Object self, Object value) {
Object field = property.getValue(self);
if (field == null) {
try {
field = property.getType().newInstance();
property.setValue(self, field);
} catch (Exception ex) {
ex.printStackTra... |
4e01470d-28ce-4aaf-97e7-fe8dfe61efe6 | 7 | public void update(Entity entity) {
if(props.contains(entity) || container.intersects(entity.getBox())) {
if(!container.intersects(entity.getBox())) {
props.remove(entity);
} else if(container.intersects(entity.getBox()) && !props.contains(entity)) {
props.add(entity);
}
if(!noChildren()) {
... |
5ae5fdbb-3f48-472d-ab50-6c4cd30c61b8 | 9 | @Override
public GameState use(Game game) {
List <Npc> npcs;
npcs = game.getCurrentRoom().getNpcs();
Killable killablenpc = null;
for(Npc creature : npcs){
if(creature instanceof Killable){
killablenpc = (Killable) creature;
... |
1a9b23fb-3fca-4988-898b-7c7b18ed51b5 | 2 | private static void startProjects(JSONObject json, ProjectConf defConf, Gui gui) throws BadConfig {
//JSONArray paths = (JSONArray) json.get("watch");
JSONObject projects = toJSONObject("projects", json.get("projects"), true);
for (Object o : projects.keySet()) {
String name = (String) o;
JSONObject p = toJ... |
3accf9e6-d6ec-433e-8bb4-c4bd664e4a4f | 4 | public static TreeMap<String, String> property2TreeMap(String xmlFilename){
java.util.Properties props = new java.util.Properties();
try {
props.loadFromXML(new FileInputStream(xmlFilename));
} catch (InvalidPropertiesFormatException e) {
e.printStackTrace();
} catch (FileNotFoundE... |
30892c0b-eb6e-4bd6-a9a8-1d995ef60518 | 4 | @Override
public void setInt(long i, int value)
{
if (value < 0 || value > 1) {
throw new IllegalArgumentException("The value has to be 0 or 1.");
}
if (ptr != 0) {
Utilities.UNSAFE.putByte(ptr + i, (byte) value);
} else {
if (isConstant()) {
... |
3d3d9ff9-06b2-435d-930b-ab6505a081aa | 1 | public static void main(String[] args) throws ParseException {//TO CONVERT 10:48:49.082 UTC Mon Apr 28 2014
final SimpleDateFormat dateFormat = new SimpleDateFormat("k:mm:ss.SSS z E MMM yyyy ");
final Date date = new Date();
final String t = "Anis";
/*SimpleDateFormat dateFormat;
... |
c35f499c-5d50-4341-9307-a47c3607968d | 2 | public static boolean isTypeList(Class<?> type) {
return (type != null && isAssignable(type, List.class));
} |
b00ff0c4-4212-4f99-974f-7233015074e6 | 8 | private static boolean isValidTime(String time) {
if (time.length() != 4)
return false;
Integer hour, min;
try {
hour = Integer.parseInt(time.substring(0, 2));
min = Integer.parseInt(time.substring(2, 4));
} catch (Exception e) {
return false;
}
if (hour == null || min == null) {
return fa... |
33281336-1e8e-4f7a-b473-916b729ee3d9 | 6 | public static void popUpGame(final LeagueModel thisLeague){
final JFrame gameDialog = new JFrame();
String[] teamNames = new String[thisLeague.getTeamModels().size() + 1];
//generate array of Strings
for(int i=1;i<teamNames.length;i++){
teamNames[i] = thisLeague.getTeamModels().get(i-1).getName();
}
... |
6bd49f48-2e31-4f41-9182-3baf99a3b915 | 6 | public List<ConversionMessage> run(PageLayout layout, boolean checkOnly) {
List<ConversionMessage> messages = new ArrayList<ConversionMessage>();
//Regions
for (ContentIterator it = layout.iterator(null); it.hasNext(); ) {
Region reg = (Region)it.next();
//Primary and secondary Script
if (reg.getT... |
776d3294-ce93-4361-aa07-7816cd66bc6c | 7 | public static void merge(Node a, Node b){
Node p;
if(a.data > b.data){
p = new Node(b.data);
b = b.next;
} else{
p = new Node(a.data);
a = a.next;
}
Node t = p;
while(a.next != null && b.next != null){
if(a.data > b.data){
t.next = b;
b = b.next;
}else{
t.next = a;
a = a.ne... |
50f0e2e2-b93e-4a44-a649-ad602fb2d6ab | 2 | @Override
public ArrayList<String> getColumnsName(String strTabla, String strDatabase) throws Exception {
try {
ArrayList<String> vector = new ArrayList<>();
Statement oStatement;
oStatement = (Statement) oConexionMySQL.createStatement();
//String... |
72215da5-e3f1-4090-b0d0-e6c77411a727 | 1 | public static void main(String[] args){
try {
AppGameContainer container = new AppGameContainer(new Button(name));
container.setDisplayMode(GAME_WIDTH, GAME_HEIGHT, false);
container.setMinimumLogicUpdateInterval(1000/60);
container.setShowFPS(false);
container.setIcon("res/but... |
6803b1f0-9ce6-4cc3-a4d0-117a0d6690cc | 4 | private void saveStock(Product product) throws IOException, ClassNotFoundException{
ArrayList<Product> products = new ArrayList<>();
try
{
FileInputStream fis = new FileInputStream("myfile");
ObjectInputStream ois = new ObjectInputStream(fis);
products ... |
de096ab1-759e-4b7a-806c-6a97d9e7ded6 | 7 | public void commitTask(String jobID, String taskID, int id, Global.STAGE stage) {
Boolean retry;
String domainName;
//managing hashing --d3
if ( taskID.hashCode()<0 )
domainName = dbManagerDomain + (-taskID.hashCode())%Global.numSDBDomain;
else
domainName = dbManagerDomain + (taskID.hashCode())%Globa... |
c47b86cf-0482-4e1f-994d-9f0f0fe55351 | 2 | public static void update(){
while(Keyboard.next()){
processKeyEvents();
}
while(Mouse.next()){
processMouseEvents();
}
} |
40ad0073-4ecc-4dfc-98fd-8520e1509540 | 4 | public Boolean initialiseGrid() {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: initialiseGrid() BEGIN");
}
m_gridArray = new Game.PlayerTurn[m_gridObj.getGridWidth()][m_gridObj.getGridHeight()];
if (test || m_test) {
System.out.println("... |
6b8ef832-3f2b-481c-89d5-82224b6b8a81 | 5 | public void launch() {
LOGGER.info("Launching main class " + mainClass + " ...");
try {
File file = new File(Launcher.class.getProtectionDomain().getCodeSource().getLocation().toURI());
List<String> arguments = new ArrayList<String>();
arguments.add(System.getPrope... |
88ee52a2-86e8-4c1d-aa0f-5255188ccc99 | 8 | public boolean isInField(Vector2d coord) {
if ((coord.x>=position.x && coord.x<=position.x+widthHeight.x) || (coord.x<=position.x && coord.x>=position.x+widthHeight.x)) {
if ((coord.y>=position.y && coord.y<=position.y+widthHeight.y) || (coord.y<=position.y && coord.y>=position.y+widthHeight.y)) {
return tr... |
79b079be-ded4-435c-8123-e5ff636205f8 | 4 | public String setPort(String port) {
if (port.length() == 0 || port.equals(Integer.toString(getPort())))
return null;
for (Character c : port.toCharArray())
if (!Character.isDigit(c)) {
return "Invalid port: " + port;
}
this.port = Integer.parseInt(port);
return "Changed port to: " + port;
} |
57a1509f-4e5f-418e-b566-1dde98ad8366 | 3 | public void menucadastrarInteressesProfessor(String matricula,
String codigoDisc, int nivelI) {
try {
sistemaFrontEnd.cadastraNivelDeInteresseDeProfessorPorDisciplina(
matricula, codigoDisc, nivelI);
front.exibirMsg("Preferencia cadastrada com sucesso!!");
} catch (PreferenciaInvalidaException e2) {
... |
1eb8cb6d-0002-4f35-bed0-b83226ab2a83 | 4 | private void fixBounds() {
if(x < xmin) x = xmin;
if(y < ymin) y = ymin;
if(x > xmax) x = xmax;
if(y > ymax) y = ymax;
} |
afb66401-655d-49b5-8b1a-9a7db29edd32 | 7 | @Override
public void receive(Envelope anEnvelope) throws Exception {
LocalMessageEnvelope local = (LocalMessageEnvelope) anEnvelope;
Message message = local.message();
Actor actor = local.receiverAgent().actor();
boolean asking = local.isAsking();
boolean stores = true;
if (actor.wantsFilteredDeliver... |
4116231b-5565-4706-8089-229e590bf7a5 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserRole userRole = (UserRole) o;
return !(role != null ? !role.equals(userRole.role) : userRole.role != null) && !(user != null ? !user.equals(userRol... |
66688ea1-0b5e-46f2-9cdf-259c0168c766 | 1 | private static Ticket TicketObject(ResultSet rs) {
Ticket newTicket = null;
try {
newTicket = new Ticket(rs.getInt(rs.getMetaData().getColumnName(1)),
rs.getInt(rs.getMetaData().getColumnName(2)),
rs.getInt(rs.getMet... |
b14eb762-749e-40ac-b59d-1ab8314e811e | 4 | public synchronized void mouseMoved(MouseEvent e) {
// this event is from re-centering the mouse - ignore it
if (isRecentering &&
centerLocation.x == e.getX() &&
centerLocation.y == e.getY())
{
isRecentering = false;
}
else {
int dx... |
d6858107-1652-4f02-bc42-5546690416b9 | 8 | public static void generateTableToProgramsMapping(File file) throws IOException {
//HashMap<Table, ArrayList<Program>> tables = new HashMap<Table, ArrayList<Program>>();
FileWriter fstream = new FileWriter(Constants.CSVOUTPUTFILE);
BufferedWriter out = new BufferedWriter(fstream);
out.write("Table;C;R;U;D;Pr... |
c0985eaf-8306-44aa-a689-b691f3f8de72 | 0 | public static void setGraph(Graph g) {
GraphInterface.g = g;
} |
9395d3bf-3252-457d-92a0-b53ca3684cb1 | 8 | int readUtah(int row, int column, int numRows, int numColumns) {
int currentByte = 0;
if (readModule(row - 2, column - 2, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(row - 2, column - 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<=... |
00bfb71d-0493-448b-ad63-25ae622d2a5f | 9 | private void setFlagCharacters() {
/* '-+ #0 */
thousands = false;
leftJustify = false;
leadingSign = false;
leadingSpace = false;
alternateForm = false;
leadingZeros = false;
for ( ; pos < fmt.length(); pos++) {
char c = fmt.charAt(pos);
if (c == '\'') th... |
43a7f564-c6dd-4465-8044-085fb0df8fea | 8 | public void atualizarArvore() throws Exception
{
if (norteOeste instanceof Corpo)
{
atualizaPosicaoCorpo((Corpo) norteOeste);
}
else if(norteOeste instanceof ArvoreQuadLocal)
{
((ArvoreQuadLocal) norteOeste).atualizarArvore();
}
if (norteLeste instanceof Corpo)
{
atualizaPosicaoCorpo((Corp... |
b94a48a1-38a4-43a7-a025-4d37001fb026 | 7 | private NameValuePair[] buildHttpInvokationParameters(Object[] invokationData) throws ServiceDefinitionException, ServiceInvocationException{
NameValuePair[] httpParams = null;
try {
int invokationDataLength = (invokationData == null) ? 0 : invokationData.length;
Serial... |
94499fb4-0713-4671-a8fb-9a8f296b2277 | 4 | public static int[] merge(int[] A, int p, int q, int r) {
int n1 = q - p + 1;
int n2 = r - q;
int[] L = new int[n1+1];
int[] R = new int[n2+1];
for (int i = 0; i < n1; i++) {
L[i] = A[p + i - 1];
}
for (int j = 0; j < n2; j++) {
R[j] = A[q + j];
}
L[n1] = R[n2] = Integer.MAX_VALUE;
int i ... |
e9b4a5de-2156-443c-a45b-12234ffba3db | 2 | public JSONObject putOpt(String key, Object value) throws JSONException {
if (key != null && value != null) {
this.put(key, value);
}
return this;
} |
653dcf6e-ea67-4e63-b2ab-62303a73ef98 | 8 | public static void main(String[] args) {
System.out.println("start...");
new Config();
ConfigEntity entity=Config.entity;
if(entity.getUploadFlag()!=0){
//为true表示是在生产机执行更新操作
System.out.println("将执行更新操作:uploadFlag=1表示仅备份不更新,2表示仅更新,3表示先备份再更新:"+entity.getUploadFlag(... |
7845d3fa-6010-4764-abf9-bb8d4c9b1b05 | 0 | @Basic
@Column(name = "LOG_ID_ELEMENTO")
public int getIdElemento() {
return idElemento;
} |
ab261cb3-554c-4127-a293-27e80ff002dd | 6 | public MapObject getObjectNear(int x, int y, double zoom) {
Rectangle2D mouse = new Rectangle2D.Double(x - zoom - 1, y - zoom - 1, 2 * zoom + 1, 2 * zoom + 1);
Shape shape;
for (MapObject obj : objects) {
if (obj.getWidth() == 0 && obj.getHeight() == 0) {
shape = new... |
f6b86f25-94e6-4096-b97d-ad59219e1906 | 9 | @SuppressWarnings("AssignmentToForLoopParameter")
private static boolean isQuoted(final StringBuilder sbString,
final int pos) {
boolean isQuoted = false;
for (int curPos = 0; curPos < pos; curPos++) {
if (sbString.charAt(curPos) == '\'') {
isQuoted = !isQuot... |
c790def3-1599-4c65-92f1-93369e8f1d80 | 3 | public String get(String key, String... args) {
String entry = entries.get(key);
if (entry != null) {
int i = 0;
for (String arg : args) {
i++;
if(arg != null){
entry = entry.replace("&v" + i, arg);
} else {
entry = entry.replace("&v" + i, "null");
}
}
}
return entry;
} |
299873ac-ffe4-40c0-9bc9-59ff90b665ba | 7 | public static void MethodSimpson()
{
double integral=0;
double integralprev = 0;
double sum = 0;
do {
MethodOfSimpson.iterCount++;
integral = function(a) + function(b);
xi = a;
sum = 0;
for (int i = 1; i < n; i++) {
... |
26f6ea75-d5be-4bd0-ab58-750f28dab28a | 0 | public void setDepartmentId(int departmentId) {
this.departmentId = departmentId;
} |
12cca7ec-063e-4a91-8bae-c0c27a56f9ad | 4 | private static List<String> getInsertPositions(int count) {
int[] elems = new int[count];
for (int m = 0; m < count; m++) {
elems[m] = m + 1;
}
int length = elems.length;
int countOfCombination = (int) Math.pow(2, length) - 1;
List<String> results = new ArrayList<String>();
// add whole word
resul... |
7c825894-69e6-4aff-9191-5ffa28b420d0 | 8 | public void process(RdpPacket data) throws RdesktopException, IOException,
CryptoException {
int type, status;
int length, format;
type = data.getLittleEndian16();
status = data.getLittleEndian16();
length = data.getLittleEndian32();
if (status == CLIPRDR_ERROR) {
if (type == CLIPRDR_FORMAT_ACK) {
... |
73eb10d5-70f7-4b3e-87fb-385e577f2e62 | 2 | public void append( Framedata nextframe ) throws InvalidFrameException {
ByteBuffer b = nextframe.getPayloadData();
if( unmaskedpayload == null ) {
unmaskedpayload = ByteBuffer.allocate( b.remaining() );
b.mark();
unmaskedpayload.put( b );
b.reset();
} else {
b.mark();
unmaskedpayload.position( ... |
216d34a7-235d-4b89-9aa4-bf256e1e7714 | 1 | @Override
public void mouseClicked(MouseEvent e) {
if (JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(null,
"Main changes are:\n" +
update.getChanges() +
"\n\nFull list of changes can be viewed on our site,\nDo you want to see full list... |
1628685e-944e-4508-9877-d00d5a1cb486 | 8 | protected Figure createFigure(Point[] points, int numPoints, boolean closed) {
ContainerFigure container = new ContainerFigure();
if (closed && settings.commonFillType != ToolSettings.ftNone && numPoints >= 3) {
container.add(new SolidPolygonFigure(settings.commonBackgroundColor, points, numPoints));
}
if (!... |
7d2667e7-7dce-4368-bbfc-b8d8bff33dac | 4 | public int gridletStatus(int gridletId, int userId)
{
ResGridlet rgl = null;
// Find in EXEC List first
int found = gridletInExecList_.indexOf(gridletId, userId);
if (found >= 0)
{
// Get the Gridlet from the execution list
rgl = (ResGridlet) gridletI... |
cfcb5bde-ed72-4eae-962f-e4dfa1520abb | 7 | @Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (qName.equals("killsYesterday"))
response.setKillsYesterday(getInt());
else if (qName.equals("killsLastWeek"))
response.setKillsLastWeek(getInt());
else if (qName.equals("killsTotal"))
response.setKills... |
0a7c44d7-d417-4ce3-9451-9f6c53f08dff | 6 | private static boolean init() { //return true if successful
database = new PPCDB();
Vector<Vector<Double>> etalonMatrix;
ArrayList<DyeParent> dyeParents;
ArrayList<Dye> dyes = new ArrayList<Dye>();
ArrayList<Lakk> lakks = new ArrayList<Lakk>();
ArrayList<Metal> met... |
25a033de-8fc9-4e12-b253-e9494559680b | 1 | private boolean fileBetween(char file, char startFile, char endFile) { // Is file a file between start file and end file?
return file > Math.min(startFile, endFile) && file < Math.max(startFile, endFile);
} |
16749a8a-f264-4707-8a4e-00af36b5d90c | 8 | public void drawLine(int x1, int y1, int x2, int y2, Graphics g) {
// get screen bounds
int xoffset = getWidth();
int yoffset = getHeight();
// relocate line within screen bounds
int mx = clampToCircle(x1, xoffset) - x1;
int my = clampToCircle(y1, yoffset) - y1;
... |
e29d4228-e22c-4f07-9f7f-ca6d177360d5 | 6 | public void getList(int rep,String searchText)
{
String tempQuery = "";
if(rep==0) {
tempQuery = DEFAULT_QUERY;
}
else if(rep==1) {
tempQuery = "Select memberid,lastname,firstname,midinit,member.contactno1,member.contactno2,member.email,compname from member in... |
aabbd78c-7d67-402e-b795-597aa7ab7733 | 5 | public boolean viabilidade() {
//--Pontua o Doc. ANALISE
if (VControle.projetoAtivo.getNivelDocumentacaoAnalise() >= 50) {
viabilidade += 10;
} else {
viabilidade -= 10;
}
//--Pontua o Doc. PROJETO
if (VControle.projetoAtivo.getNivelDocumentacaoPro... |
7367ad14-b069-4a2b-9a99-0624fff8193c | 8 | public static void main(String[] args) throws UnsupportedEncodingException, XMLStreamException {
if (args.length < 1) {
usage();
}
//user input arguments
String relations;
String attributes = null;
String fileName = null;
relations = args[0];
for (int ... |
7eeab61e-7137-43d2-b77c-10a9f0d4a4c7 | 7 | public static boolean isPrime(long value){
if(2==value){//the first factor is 2
return true;
}
if(3==value){//the second factor is 3
return true;
}
if(value%2==0){
return false;
}
if(value%6!=1&&value%6!=5){
return f... |
a52bc044-cfec-4e39-850c-c9a176455aff | 9 | @Override
public boolean removeItem(int quantity, MasterDataEntity masterData) {
String type = masterData.getId();
System.out.println("Type from masterData: " + type);
for (int i = 1; i < 4; i++) {
try {
Rack rack = (Rack) manager.get("R" + i);
... |
7ccedf6f-e192-4f37-a43c-994ca7871254 | 4 | public static void main(String[] args) {
List<String> progLangs1 = new ArrayList<>(asList("c#", "java", "python", "scala"));
List<String> progLangs2 = new ArrayList<>(progLangs1);
// old way
for (Iterator<String> it = progLangs1.iterator(); it.hasNext(); ) {
String s = it.next();
if (s.length() < 3 || ... |
f689e65b-41a6-473f-a668-6fcfeed8e0e9 | 1 | @Test(expected = IllegalArgumentException.class)
public void testGetFutureMeetingAsPast()
{
Calendar fDate = Calendar.getInstance();
fDate.setTime(new Date());
fDate.add(Calendar.SECOND, 1);
int meetID = cmInst.addFutureMeeting(testContactSet, fDate);
try {
Thread.sleep(1100);
} catch (InterruptedExce... |
4c436aa4-c3d3-4fca-bcad-41c4a0e986c6 | 8 | protected String parseHeader(String input) {
String[] lines = input.split("\r?\n", -1);
StringBuilder result = new StringBuilder();
boolean readingHeader = true;
boolean foundHeader = false;
for (int i = 0; (i < lines.length) && (readingHeader); i++) {
String line = ... |
405860ac-1fce-4aca-8367-fd4a221208ae | 0 | public synchronized String peekUnsearchList(){
return peekUrl(unarchedSitesFilePath);
} |
bd71ccc0-77eb-4157-897f-823dad360ef4 | 1 | public Integer interpret(Context con) {
try {
return left.interpret(con) / right.interpret(con);
} catch (ArithmeticException ae) {
System.out.println("被除数为0!");
return -11111;
}
} |
303d2fca-9f79-4ab0-b627-d2f5b069cde5 | 4 | public void validate() {
if (this.monthMap == null || this.monthMap.isEmpty()) {
throw new IllegalStateException("Month Map is required.");
}
if (this.inputTimeZone == null) {
throw new IllegalStateException("Input TimeZone must be non-null.");
}
if (this.... |
3f5a10da-8166-4320-8e61-9e3240e1c54f | 9 | protected void paintComponent(Graphics g) {
super.paintComponent(g);
g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
int w = getWidth();
int h = getHeight();
// y-axis
g2.draw(new Line2D.Double(PAD, PAD, PAD, h - PAD));
// x-axis
g2.draw(ne... |
f2062de8-f476-4ab7-b4e6-9c42821f25aa | 2 | public void setMovingRight(boolean isMovingRight) {
this.isMovingRight = isMovingRight;
this.isMovingLeft = isMovingRight ? !isMovingRight : this.isMovingLeft;
this.xSpeed = !isMovingRight ? 0 : this.xSpeed;
} |
a0cb0eea-854c-4bb7-80f7-d1a3b5b93190 | 1 | public JSONObject getJSONObject(String key) throws JSONException {
Object object = this.get(key);
if (object instanceof JSONObject) {
return (JSONObject)object;
}
throw new JSONException("JSONObject[" + quote(key) +
"] is not a JSONObject.");
} |
77c21b18-ea3b-4451-b4fb-cf014110b2ec | 2 | public int getTotalnumberByPID(Statement statement,String PID)//根据PID获取车位总数
{
int result = -1;
sql = "select totalnumber from Park where PID = '" + PID +"'";
try
{
ResultSet rs = statement.executeQuery(sql);
while (rs.next()) {
result = rs.getInt("totalnumber");
}
}
catch (SQLException e)
... |
6766b13f-4e93-41be-b2ba-b804425b50b1 | 3 | public void teaTime(Command command)
{
if(!command.hasSecondWord()) {
// if there is no second word, we don't know where to go...
System.out.println("Wat drinken?");
return;
}
if(command.getSecondWord().equals("thee"))
{
if(pla... |
2df6cdd5-3aef-49fe-9223-d07170853a45 | 6 | private void createLevels() throws SlickException {
//level 1
for(int i=0; i<15; i++){
Entity enemy = new Entity("enemy");
ImageRenderComponent temp = new ImageRenderComponent("EnemyRender", new Image("res/sprites/enemies/enemy.png"));
enemy.AddComponent(temp);
enemy.setRadius(temp.getRadius());
e... |
7c84210c-bcf4-47bc-a5b9-1242167a69c1 | 5 | public String buildCommand(){
StringBuffer vmArgsOneLine = new StringBuffer();
for (String arg : vmArgs) {
// if it's the agent argument : we ignore it otherwise the
// address of the old application and the new one will be in conflict
if (!arg.contains("-agentlib")) ... |
a62ec9a2-da62-4389-bd18-7aeb2f24e786 | 4 | public static boolean isBlank(String string) {
if (string == null || string.length() == 0)
return true;
int l = string.length();
for (int i = 0; i < l; i++) {
if (!StringUtil.isWhitespace(string.codePointAt(i)))
return false;
}
return true... |
51651c26-735b-4485-9cad-da5957c42a55 | 6 | private static String clearSpaceWithChar(String s) {
s = s.trim();
int count = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == ' ') {
if (s.charAt(i - 1) == ' ') {
count++;
}
}
}
int charLen = s.length() - count;
char[] temp = new char[charLen];... |
d7cd9d5d-766b-4f20-9080-0b37a6f05658 | 4 | @Override
public int hashCode() {
int result = idUser;
result = 31 * result + (passWord != null ? passWord.hashCode() : 0);
result = 31 * result + (email != null ? email.hashCode() : 0);
result = 31 * result + (avatar != null ? avatar.hashCode() : 0);
result = 31 * result + (... |
782b3310-405d-4808-bf26-d087e5982b91 | 6 | @Override
public boolean checkGrammarTree(GrammarTree grammarTree,
SyntaxAnalyser syntaxAnalyser) throws GrammarCheckException {
GrammarTree tree = grammarTree.getSubNode(0);
// there are tree words need to be handled , at least
if (tree == null || tree.getSiblingAmount() < 3)
this.throwExceptionAndAddErro... |
d5df786b-a3dd-4859-ae2c-f118b59cd4bd | 7 | public static ArrayList<String> wordBreak(String s, Set<String> dict) {
ArrayList<String> results = new ArrayList<String>();
StringBuilder re = new StringBuilder();
ArrayList<ArrayList<Integer>> dp = new ArrayList<ArrayList<Integer>>();
for (int i = 0; i < s.length() + 1; i++) {
dp.add(new ArrayList<Integer>... |
d6529242-3060-4c0c-91b4-110ca5a2b500 | 0 | @RequestMapping(method = RequestMethod.POST, value = "")
public Step createStep(@RequestBody StepCreateRequest request) {
Integer stepId = stepsService.createStep(request.getTaskId(), request.getStepName()).getId();
return stepsService.getById(stepId);
} |
43b324fc-861d-44e7-8268-c9de9f91a83f | 0 | public void setUsuarioidUsuario(Usuario usuarioidUsuario) {
this.usuarioidUsuario = usuarioidUsuario;
} |
bd9c0562-2a29-45f4-b354-3b83c6b80364 | 2 | public static int countLines(String file) {
try {
BufferedReader reader;
reader = new BufferedReader(new FileReader(file));
int lines = 0;
while (reader.readLine() != null)
lines++;
reader.close();
return lines;
} catch (Exception e) {
return -1;
}
} |
a93bf45f-27a9-428d-8c1d-f198ce0ab1cf | 8 | private int numWallsAround(Location loc)
{
Location north = loc.add(0, -1);
Location east = loc.add(1, 0);
Location south = loc.add(0, 1);
Location west = loc.add(-1, 0);
int yes = 0;
if (north.getY() >= 0 && map[north.getX()][north.getY()] == nonWall)
yes++;
if (east.getX() < xSize && map[east.getX(... |
70cde5f5-4a59-4b29-9db1-10bbc319e22b | 5 | public static void Map(CommandSender sender, String mapId, String scale) {
Player player = (Player) sender;
short map = Short.parseShort(mapId);
MapView mapView = player.getServer().getMap(map);
if (scale == "0") {
mapView.setScale(Scale.CLOSEST);
} else if (scale == "1") {
mapView.setScale(Scale.CLOSE)... |
92a8703b-13f9-454f-9fbf-f79d49713ee3 | 9 | @SuppressWarnings("unchecked")
/**
* Returns the results of calling the specified method from the specified
* class using the specified parameters.
* @param c Class to call the method on.
* @param method Name of the method.
* @param paramTypes Data types of the parameters being passed to the method.
* @param par... |
35f6ed88-0978-47a9-9e8d-89dd646accef | 1 | public void applyDamage(double damage) {
this.health -= damage;
if(this.health < 0)
this.setHealth(0);
} |
332efb7a-2300-4b7f-bb54-f45e9571a9bc | 8 | public void onKeyUp(KeyEvent e) {
int keyCode = e.getKeyCode();
switch (keyCode) {
case KeyEvent.VK_W :
dy = 0;
break;
case KeyEvent.VK_UP :
dy = 0;
break;
case KeyEvent.VK_S :
dy = 0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.