method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
26cf47e5-50ee-40be-b77d-a478c92edcf4 | 3 | public static JMenuItem mkMenuItem(ResourceBundle b,
String menu, String name) {
String miLabel;
try { miLabel = b.getString(menu + "." + name + ".label"); }
catch (MissingResourceException e) { miLabel=name; }
String key = null;
try { key = b.getString(menu + "." + name + ".key"); }
catch (MissingResou... |
b8fc6ec8-5ef1-4be7-83af-713b90abc805 | 7 | public void run() {
int nEdgesATime = 1000000;
long createdEdges = 0;
Random r = new Random(System.currentTimeMillis() + this.hashCode());
double cumA = pA;
double cumB = cumA + pB;
double cumC = cumB + pC;
double cumD = 1.0;
... |
08856760-48c7-4db1-a876-63f3f55e3d97 | 1 | public byte[] encodeInvoke(int id, Object data) throws EncodingException, NotImplementedException
{
List<Byte> result = new ArrayList<Byte>();
result.add((byte)0x00); // version
result.add((byte)0x05); // type?
writeIntAMF0(result, id); // invoke ID
result.add((byte)0x05); // ???
result.add((byte)0x11); ... |
e51873b4-fca2-473e-ae66-40b83e3725a5 | 9 | public int canCompleteCircuit(int[] gas, int[] cost) {
if (gas == null || gas.length==0 || cost==null || cost.length==0){
return 0;
}
else if (gas.length==1){
return gas[0]>=cost[0]?0:-1;
}
Status status = new Status(0, 0);
int carry = 0;
f... |
0ea3eeed-fc88-4f1e-add3-33fa3a35ef21 | 1 | protected void createCommands() {
commands = new HashMap<>();
commands.put(TokenType.INCREMENT_POINTER, ArrayMemory::incrementPointer);
commands.put(TokenType.DECREMENT_POINTER, ArrayMemory::decrementPointer);
commands.put(TokenType.INCREMENT, ArrayMemory::increment);
commands.pu... |
012c586d-a37b-4ff5-994b-e49c158df862 | 6 | @SuppressWarnings("resource")
public void searchEngineMenu2(DataSource ds) {
System.out
.println("Enter doctor info (employee no or name), start date (DD/MM/YYYY), end date (DD/MM/YYYY): ");
System.out
.println("eg. 1, 01/01/2013, 31/12/2014 or eg. yuri, 01/01/2013, 31/12/2014");
Scanner s = new Scanner(... |
679d50f9-108f-4699-b551-090ca3dfbe27 | 7 | public static void main(String[] args) {
Map<Integer,Game> knownGames = new HashMap<Integer,Game>();
addGames(knownGames, getStartingGames());
System.out.println("Number of starting boards: " + knownGames.size());
for(int iteration=0; iteration<20; iteration++) {
System.out.println("Iteration " + iterati... |
183c698d-0443-4c7c-bc0b-230a9091522d | 1 | public void configureAction(Map<String, Object> config) {
if (config == null) {
this.task = null;
this.gruntFile = null;
this.page = null;
} else {
this.task = (String) config.get(Activator.KEY_TASK);
this.gruntFile = (IFile) config.get(Activator.KEY_FILE);
this.page = (IWorkbenchPage) config.get(... |
0ea2e83c-5f8c-47ff-a385-55afc76082d9 | 8 | public static void println(String mesg, int font, int x, int y, byte r, byte g, byte b, Buffer inBuffer)
{
byte [] outData = (byte[]) inBuffer.getData();
RGBFormat vfIn = (RGBFormat) inBuffer.getFormat();
Dimension sizeIn = vfIn.getSize();
int pixStrideIn = vfIn.getPixelStride();
... |
a297a712-433b-4c8d-b97b-f8dcd5c4e50c | 7 | private JSONWriter append(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
... |
8cb68d96-47a0-489b-8919-b1aa79da34da | 0 | @Override
public IRemoteClientCall getRemoteClientCall() {
return remoteClientCall;
} |
6d3aeda2-7962-42c7-b449-15c7472ef960 | 2 | public void testPropertyAddYear() {
YearMonth test = new YearMonth(1972, 6);
YearMonth copy = test.year().addToCopy(9);
check(test, 1972, 6);
check(copy, 1981, 6);
copy = test.year().addToCopy(0);
check(copy, 1972, 6);
copy = test.year().addToCop... |
06944385-997d-4097-b2dc-58e3b04039d0 | 0 | private MenuConstants() {
} |
eaaf0d2c-0ccf-4e2e-9dcc-5c0033ad55e1 | 6 | @Override
public void init(){
errorMsg ="";
name = new TextBox("Enter Username", 300, 360);
name.setFocus(true);
name.setMaxChars(12);
name.addKeyListener(new KeyListener(){
public void KeyTyped(int keyCode, char keyChar) {
if(keyCode == Keys.VK_EN... |
27701486-f297-4744-97c6-b97f6bc673c5 | 0 | @Test
public void EnsureLeftMostWildCardRankIsUsedWhenPatternHasTwoWildCards() {
assertEquals(2, patternTwoWildCards.getWildCardRank());
} |
257e9f28-bf70-4471-aaeb-7279142e4106 | 4 | private boolean isOperator(char s) {
if(s=='+' || s=='-' || s=='*' || s=='/') {
return true;
}
return false;
} |
8c51d028-3ef7-4ef5-a261-d8413ba699f0 | 3 | public static void init() {
for (int i = 0; i < MAX_CAD; i++)
for (int j = 0; j < MAX_PAT; j++)
if (i == 0)
dp[i][j] = BigInteger.ONE;
else
dp[i][j] = BigInteger.ZERO;
} |
6662ccd8-6a33-4c29-abae-c175562abd15 | 9 | @Override
public long read(CharBuffer target) throws IOException {
long totalRead = 0;
while (target.remainingSpace() > 0) {
if (buffer.remainingData() == 0) {
long read = bytes.read(buffer);
if (read == 0)
break;
else if (read == -1) {
closed = true;
break;
}
}
if (buffer.r... |
95074b21-6d64-4846-b822-5415f1b7750b | 3 | public static Object getField(Object o, String fieldName) throws SecurityException, NoSuchFieldException, IllegalArgumentException, IllegalAccessException{
Field field;
try{
field = o.getClass().getField(fieldName);
}catch(NoSuchFieldException e){
try{
field = o.getClass().getDeclaredField(fieldName);
... |
c50755e2-e6d5-43f0-af6d-8cbea90b46b9 | 4 | @Override
public OggPacket write() {
// Serialise the comments
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
// Pad for the header (size isn't known yet, so can't fully write)
byte[] headerPadding = new byte[getHeaderSize()];
baos.write(h... |
0c3e2073-065a-4bb7-8b95-c0bf86675530 | 7 | protected double kernelHelper2(int n, char[] s, int endIndexS, char[] t,
int endIndexT) {
//recursion ends if one of the indices in both strings is <0
if (endIndexS <0 || endIndexT <0) {
return getReturnValue(n);
}
int adr = 0;
if (m_useRecursionCache) {
adr=m_multX*n+m_multY*endI... |
ed8fb028-48e8-499c-ba58-8f55850fca2a | 3 | public synchronized void addZone(LinkedList<Theater> theaters, int zone){
boolean found = false;
for(LinkedList<Theater> list : this.theaters)
if(list.getFirst().getZone() == zone)
found = true;
if(!found)
this.theaters.add(theaters);
} |
010b4c4f-d64c-4531-be77-054e53c9d6ec | 9 | public void saveResource(String resourcePath, boolean replace) {
// Copied wholesale from JavaPlugin
if (resourcePath == null || resourcePath.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
resourcePath = resourcePath.replace('\\'... |
b4cc6a74-03ff-4582-83a1-9e8499238de1 | 0 | protected void onJoin(String channel, String sender, String login, String hostname) {} |
9c1505f8-10b7-4411-93fe-f8a55c04c942 | 0 | @RequestMapping(value = "/employee/skills/{employeeId}", method = RequestMethod.GET)
@ResponseBody
public String getEmployeeSkills(@PathVariable String employeeId)
throws JsonGenerationException, JsonMappingException, IOException {
ObjectMapper objectMapper = new ObjectMapper();
ObjectNode objectNode = objectM... |
4c74f40a-398c-43aa-8eea-f88dcf7e0152 | 4 | public void setDecorationBackgroundColor(Color decorationBackgroundColor) {
this.decorationBackgroundColor = decorationBackgroundColor;
if (days != null) {
for (int i = 0; i < 7; i++) {
days[i].setBackground(decorationBackgroundColor);
}
}
if (we... |
2a27b7cc-351c-4b54-9e16-8eb032c3205d | 2 | private void generateClause(ObjectStack oStack, Selector sel, StatementPrototype sp, Boolean sorted) throws SQLException
{
if (oStack.getActualRepresentation().isArray())
{
if (sorted == null)
{
sorted = true;
}
generateArrayQuery(sel, sp, oStack, sorted);
}
else
{
generateNonArrayQuery(se... |
307f8a4b-4645-4ca9-9951-812b060cae26 | 0 | public int GetTicks()
{
return ticks;
} |
b0fcef4c-ee71-4441-a391-017b19026fe2 | 3 | public boolean canModerate() {
for( String s : roles ) {
if( s.equals(UserRole.ADMIN.getTag()) ) {
return true;
}
if( s.equals(UserRole.MODERATOR.getTag()) ) {
return true;
}
}
return false;
} |
332ee0fa-5a4d-48cf-9d23-c406cc4f6bd3 | 1 | public void FermerConnection(Socket socket) {
synchronized (outputStreams) {
System.out.println("This is the end..." + socket);
outputStreams.remove(socket);
try {
socket.close();
} catch (IOException ioe) {
System.out.println("Erreur de fermeture" + socket);
ioe.printStackTrace();
}
}
} |
9643a29c-6999-4cf6-8c2a-b3e3a554f4eb | 7 | @Override
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException
{
// scale + dimension
int alphabetWidth = 650;
int pad = 50;
float scale = (float) (WIDTH - 2 * pad) / alphabetWidth;
//getMouse Input
mouseRect.x = Mouse.getX();
mouseRect.y = (int)(HE... |
83fbc7aa-ed12-41dc-a24b-993ca16faa42 | 1 | public void setDefaultPrintElementConfiguration (Font defaultFont) {
printElements = new ArrayList<PrintElementSetup>();
for (int i = 0; i < PARA_COUNT; i++) {
printElements.add(new PrintElementSetup (defaultFont, new Point (0,0), 400, Color.black));
}
Font lFont = printElements.get(FONT_GROUP_NUMBE... |
9e6f0259-02d4-48e3-a655-a3d52be2ff8f | 0 | public void Disconnect() throws Exception {
conn.disconnect();
} |
648e8112-02dd-48a4-8104-fbfd4852bdb1 | 0 | public void setFunSueldo(Integer funSueldo) {
this.funSueldo = funSueldo;
} |
fc3327e2-343b-4e12-bf5e-540878e091f9 | 3 | public static int[] sort(int[] list){
if(list == null || list.length == 0){
return list;
} else{
try{
Semaphore semaphore = new Semaphore(1);
ThreadCounter tc = new ThreadCounter(semaphore);
(new Thread((new QuickSortSortTask(tc, list, 0, list.length-1)))).run();
/*
* The semaphore will c... |
14f8b3ba-bc90-4f76-8dc6-e35dde7f1509 | 4 | static void entrance(){
int max=37197;
aux[max]=true;
aux[max-1]=true;
for(int i=max-2;i>=0;--i){
if(!aux[i+1]){
aux[i]=true;
continue;
}
int nextMonthDay=(int)nextMonthDay(i);
if(nextMonthDay>0 && nextMonthD... |
ebbc274b-52fb-4515-a8d2-8a04eb8f434b | 7 | private Node ceilingNode( K key ) {
if( key == null ) {
return null;
}
Node node = mRoot;
Node eqRet = null;
Node gtRet = null;
IntervalComparator<? super K> comp = mComp;
while( node != null ) {
int c = comp.compareMins( key, node.mKey ... |
17c41ea2-e88c-4195-a7fa-581c9f2ecf89 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == text) {
input = text.getText();
if (input.contains("/") || input.contains("\\")) {
// Slashes in the input would indicate that the user inputted a fraction
if (Math.abs(answer - TypeManager.convertFractiontoDecimal(input))... |
16172bb4-42e3-4585-abdf-3d454cbcae1e | 0 | public BuildingBlockSimulateAction(Automaton automaton,
Environment environment) {
super(automaton, environment);
putValue(NAME, "Step by BuildingBlock");
putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_B,
MAIN_MENU_MASK));
this.automaton = automaton;
this.environment = environment;
} |
76c401e2-8ce5-417a-b1db-4f73a9751a99 | 0 | public ConvertFSAToREAction(AutomatonEnvironment environment) {
super("Convert FA to RE", null);
this.environment = environment;
} |
a4849474-7947-4f31-b4a9-00ff6ff0149e | 5 | Class83(OpenGlToolkit var_ha_Sub2) {
((Class83) this).aClass258_Sub1_1440 = null;
((Class83) this).aClass258_Sub3Array1448 = null;
((Class83) this).aBoolean1442 = ((OpenGlToolkit) var_ha_Sub2).aBoolean7831;
Class348_Sub37.method3030(8, var_ha_Sub2);
if (((Class83) this).aBoolean1442) {
byte[] is = Class50_Sub... |
6e543991-8bce-4d96-a358-1cc5139baa35 | 8 | private static void retrieveFiles(OutputStream out, InputStream in, int page) throws IOException, RuntimeException{
System.out.println("Contacting Server...");
// (view files req c->s) [header | page (4)]
// (initial response) [header | num files to expect | total num (4)]
// (list of available clients s->c) [h... |
ef127464-b586-4f49-882a-0f9c1aea8a0f | 6 | public static void main(String ... args) throws IOException
{
Options options = getOptions();
CommandLine cmd = CliUtil.parse("Abstract Factory : Basic File Writing App",options,args);
if(cmd == null)
return;
String factoryName = null;
String fileName = null;
if(cmd.hasOption("factory"... |
054f040f-c5ca-48f7-ac34-8a53ad566468 | 1 | public void updateBoard(int[][] state) {
for(Hex h: hexList) {
h.setValue(state[h.getI()][h.getJ()]);
}
repaint();
} |
73c34253-181f-453d-bffb-50a2ee3e35e9 | 3 | @Override
public RoleSchool deserialize(JsonElement je, Type typeOfT, JsonDeserializationContext jdc) throws JsonParseException {
JsonObject jsonObject = je.getAsJsonObject();
String type = jsonObject.get("roleName").getAsString();
long id = Long.parseLong(jsonObject.get("id").getAsString())... |
62cbe0b8-4541-46c5-8cfa-ac6a789bd4fb | 0 | public Component getComponentAfter(Container container, Component component) {
return cycle(component, 1);
} |
b8078a94-ba8d-4b53-b46a-36625c961497 | 8 | public void parsePast(ArrayList<Section> prior) {
try {
BufferedReader input = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/historical.csv"));
String line = null;
while( (line = input.readLine()) != null) {
String[] tokens = line.split(",", 15);
if(token... |
1f8ff4a2-07fc-400d-87b3-19fe3137f49a | 6 | public static void main(String [] args) throws IOException
{
Scanner fileScan = new Scanner(new FileInputStream("dictionary.txt"));
String st;
StringBuilder sb;
DictInterface D = new DLB();
// Change MyDictionary() above to DLB() to test your DLB
while (fileScan.hasNext())
{
st = fileScan.ne... |
342ed123-3cf3-4ea6-9f78-32de267f4d61 | 6 | public static void main(String[] args) throws UnknownHostException,
IOException {
if (args.length < 2) {
System.err.println("Usage: java ChatClient machine port");
}
String host = args[0];
int port = Integer.parseInt(args[1]);
Socket s = new Socket(host, port);
ChatClientReader ccr = new ChatClientR... |
dbcbf2a0-ed16-484c-944d-58b144ae95c7 | 2 | int cdsBaseNumberOfExonInTx(int pos) {
List<Exon> exons = transcript.sortedStrand();
for (Exon eint : exons) {
if (eint.intersects(pos)) {
int cdsBaseNumber = this.transcript.baseNumberCds(pos, usePrevBaseIntron);
return cdsBaseNumber + HGVSOFFSET;
... |
4970022a-f9bb-49d9-9d21-bfcc754ce206 | 6 | @Override
public Collection<InvalidProperty> process(Map<String,String> props) {
List<InvalidProperty> rv = new ArrayList<InvalidProperty>();
final String role =
props.get(DeployerConstants.SETTINGS_ROLE);
final String env_variables =
props.get(DeployerConstants.SET... |
27d670d9-5a9f-47b7-80c7-3e417d564f61 | 9 | private void doSave() {
myFile = doRead();
if (myFile == null){
return;
}
String name = myFile.getName();
showMessage("compressing " + name);
String newName = JOptionPane.showInputDialog(this,
"Name of compressed file", name + HUFF_SUFF... |
de496f38-f501-48e5-b111-624b0a0b41bb | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, NamingException {
response.setContentType("text/html;charset=UTF-8");
if (request.getParameter("opcao") != null) {
if ("sala.listar".equalsIgnore... |
cc74af6b-9999-4325-a3ad-56d593daf8ac | 2 | public Icon getIcon(IconType iconType) {
for (Icon i : icons) {
if (i.getType().equals(iconType)) {
return i;
}
}
return null;
} |
df506e06-77c2-40f3-9c85-c6b6ad41a669 | 0 | @Override
//this is required to print the user friendly information about the Employee
public String toString() {
return "[id=" + this.id + ", name=" + this.name + ", age=" + this.age + ", salary=" +
this.salary + "]";
} |
bab2387e-a450-4879-8861-402bfa854dde | 6 | public void removePriceStep(double startPrice, double endPrice) throws RemoteException {
// trimming to 2 decimal points
startPrice = round(startPrice);
endPrice = round(endPrice);
// Checking for positive arguments
if (startPrice < 0 || endPrice < 0) throw new PriceStepNegativeArgumentException();
Pr... |
ab5c367a-1387-4b96-9d0d-244bc5fcef56 | 2 | int writeLength(byte[] data, int index, int len){
int i=countLength(len)-1;
if(i==0){
data[index++]=(byte)len;
return index;
}
data[index++]=(byte)(0x80|i);
int j=index+i;
while(i>0){
data[index+i-1]=(byte)(len&0xff);
len>>>=8;
i--;
}
return j;
} |
3a8b52d3-b037-4df5-8475-b79625554d8c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ObjectChunk other = (ObjectChunk) obj;
if (fieldName == null) {
if (other.fieldName != null)
return false;
} else if (!fieldName.equals(... |
23294589-6569-475f-8fd9-d4bcbf9ee23b | 6 | void setExampleWidgetBackground () {
if (colorAndFontTable == null) return; // user cannot change color/font on this tab
Control [] controls = getExampleControls ();
if (!instance.startup) {
for (int i = 0; i < controls.length; i++) {
controls[i].setBackground (backgroundColor);
}
}
// Set the backg... |
41c5bf89-8281-4943-a9a4-615437ea3c8f | 5 | public static void shellSort(Comparable[] array) {
int h = 1;
while(h < array.length / 3) {
h = h * 3 + 1; //1, 4, 13 and so on.
}
while(h > 0) {
for(int i = h; i < array.length; i++) {
for (int j = i; j >= h && array[j].compareTo(array[j - 1]) <... |
70ed4727-e7ff-45ac-8fc5-c0054266adb8 | 4 | private static void startLocal() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException e) {
} catch (ClassNotFoundException e) {
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
new SAVFrame().setVisible(true);
... |
7ea21ddf-f9d4-4d1f-8c68-6a7c50e5f746 | 8 | public List<AddressModel> GetAddressList(int startIndex, int endIndex){
//Init model
List<AddressModel> model = new ArrayList<AddressModel>();
//Get Data
Connection conn = null;
PreparedStatement st = null;
ResultSet rs = null;
try {
// ConnectionManager.GetComboPooledDataSource() is an ins... |
a10482e4-5dc5-4fe9-be3f-13fd0ccaa422 | 0 | FrameNewFile(){
super("New...");
initialize();
} |
29e82ca5-318b-4dea-a56f-fb5d3beaa770 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ShipVia)) {
return false;
}
ShipVia other = (ShipVia) obj;
if (shipperId == null) {
if (other.shipperId != null) {
return false;
}
} else if (!shi... |
260761cb-c873-46dd-9f3e-9f208396e5e8 | 4 | public void setValue(String node, String value) {
boolean flag = false;
this.pattern = Pattern
.compile("^<node=\"([-_a-zA-Z,._\\/0-9]{1,})\">([-a-zA-Z,._\\/0-9\\s]{1,})<\\/node>");
String tmp = "";
String line = "";
for (int i = 0; i < this.getConfigFileLines().size(); i++) {
line = this.getConfigFile... |
826383ea-12f7-44e4-83c8-e4b6230ce489 | 7 | public StarArray generate() {
Trace.message("1. God #" + Math.abs(Galaxy.getGenerator().nextInt())
+ " made heaven & earth ");
int count = Galaxy.getGenerator().nextInt(2000)+200;
StarArray stars = new StarArray();
for (int i = 0; i < count; i++) {
Star cur... |
acb5fa54-2fda-4f64-9c29-433f7fb24045 | 9 | public void fast() {
int scrollMove = num > 0 ? Move.DOWN: Move.UP;
if (num < 0)
num = -num;
if (num == 0 && withMove != 0)
seqEflButtonNoDelay(withMove, initialButtonMetric);
if(num > 0)
seqEflButtonNoDelay(scrollMove | (num == 1 ? withMove : 0), initialButtonMetric);
for (int i=1; i<num; i++)... |
3ee00afc-aea5-49b4-ab86-f3045b667504 | 4 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || obj.getClass() != ConvertiblePair.class) {
return false;
}
ConvertiblePair other = (ConvertiblePair) obj;
return this.sourceType.equals(other.sourceType) && this.targetType.equals(other.targetType);
} |
8850d3cf-3198-4b98-8385-bc74cdb0d886 | 3 | @Override
public void delete(Titre obj) {
PreparedStatement pst = null;
try {
pst = this.connect().prepareStatement("DELETE FROM Titre where id=?;");
pst.setInt(1, obj.getId());
pst.executeUpdate();
System.out.println("suppression... |
4eddd3e6-3594-46d1-bbce-bcdaf7c7b097 | 5 | public static Double getMedian(Dataset instances, Integer index) {
ArrayList<Double> list = new ArrayList<Double>();
for (Instance instance: instances) {
list.add(instance.get(index));
}
Collections.sort(list);
Double median = list.get(list.size() / 2);
if ((m... |
fcf13575-449e-4c08-a16b-8a1c034f5d59 | 8 | private void generateCapsule(Writer writer, File biancaPath) throws IOException {
LOG.fine(" Generate capsule.c");
String header = loadFile(biancaPath.getAbsolutePath() + "/stubs/capsule.c");
// Génération des fonctions pour chaque évenements
StringBuilder functions = new StringBuilder();
for (String eve... |
4c2b5b79-3809-43ca-859c-52362eec6d7a | 5 | public void setMoodleGroupField(String nodeName, String content) {
if (nodeName.equals("id")) setId(Long.parseLong(content.trim()));
if (nodeName.equals("name")) setName(content);
if (nodeName.equals("courseid")) setCourseId(Long.parseLong(content.trim()));
if (nodeName.equals("descripti... |
bfbf09c0-9cff-46d9-9809-2ce6910937c7 | 6 | @Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
FuzzySet other = (FuzzySet) obj;
if(name == null) {
if(other.name != null)
return false;
} else if(!name.equals(other.name))
return fals... |
b4ada800-410e-4c84-8152-5c16ba587792 | 8 | private String talkAboutUser(String input)
{
String talkAbout = "";
if (getChatCount() == 4)
{
talkAbout = "Why did you parents name you " + myUser.getUserName() + "?";
}
if (getChatCount() == 9)
{
if (myUser.getGirlsKissed() == 0)
{
talkAbout = "You haven't kissed any girls? Why ... |
5f60a68a-0a26-4fd8-9ff0-ff6f3ac9732e | 1 | public void deleteSchedule(int id)
{
try
{
PreparedStatement ps = con.prepareStatement( "DELETE FROM schedule WHERE id=?" );
ps.setInt( 1, id );
ps.executeUpdate();
ps.close();
}
catch( SQLException e )
{
e.printStackTrace();
}
} |
01cc91b4-8927-400c-88f4-7ba316b71bb8 | 4 | private void writeInternal (Object object) throws YamlException {
try {
if (!started) {
emitter.emit(Event.STREAM_START);
started = true;
}
emitter.emit(new DocumentStartEvent(config.writeConfig.explicitFirstDocument, null, null));
isRoot = true;
writeValue(object, config.writeConfig.writeRootT... |
fc46f851-18da-441d-9911-780ac8f00a35 | 3 | @Override
public int getVendidosEvento(Evento evento) {
try {
conn = ConnectionFactory.getConnection();
String sql = "SELECT COUNT(ingresso.id) AS vendidos "
+ "FROM ingresso "
+ "JOIN secao ON ingresso.idsecao = secao.id "
... |
7e284407-ad61-45db-be45-b6fa9ff01d7c | 2 | public double[] columnRanges(){
double[] ranges = new double[this.numberOfRows];
for(int i=0; i<this.numberOfColumns; i++){
double[] hold = new double[this.numberOfRows];
for(int j=0; j<this.numberOfRows; j++){
hold[i] = this.matrix[j][i];
... |
8c6bbc91-800e-40aa-8b45-71b63f91d64d | 8 | private void load() {
if (f.exists()) {
try {
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(f);
List<Element> l = doc.getRootElement().getChildren("card");
for (Element element : l) {
String id = element.getChildText("id");
String type = element.getChildText("type... |
ce9a0dfd-1784-478f-a7f3-4c7cfd30f8f3 | 6 | public static int[] twoSumWithHash(int[] numbers, int target) {
int[] index = new int[2];
// save target - val to a hashtable
HashMap<Integer, ArrayList<Integer>> hash = new HashMap<>();
for (int i = 0; i < numbers.length; ++i) {
if (!hash.containsKey(target - numbers[i])) {
... |
d2aea6f8-d475-44f6-be49-6825c13e79d9 | 3 | @Override
public int[] getBiomeData(int px, int pz, int sx, int sz)
{
int px2 = px >> 1;
int pz2 = pz >> 1;
int sx2 = (sx >> 1) + 3;
int sz2 = (sz >> 1) + 3;
int[] data2 = base.getBiomeData(px2, pz2, sx2, sz2);
int[] data = ArrayCache.newInt(sx2 * 2 * sz2 * 2);
... |
7a00e547-c1d0-4289-9436-03fc6bd90ff4 | 4 | protected Matrix slice(final int r0, final int c0, final int r1, final int c1, final Matrix res) {
map(new MatrixMapper() {
@Override
public void map(int row, int col, float value) {
if (row >= r0 && row < r1 && col >= c0 && col < c1) {
res.set(row - r... |
d2943c33-a362-4f64-917e-68c6e18abd3c | 4 | @Override
public void paintComponent(Graphics g){
synchronized(lock_critter){
synchronized(lock_food){/////////////////////////////////////////////nested lock
if(display_views == true){
paintViews(g);
}
Iterator<Critter> iter = play_pen.listIterator();
while(iter.hasNext()){
... |
3ae622c0-1e26-4db5-b41f-d17b4906e13a | 8 | @Override
public void map(Object key, Text value, Context context) throws IOException, InterruptedException {
// 讀取一列轉換為欄位陣列
String[] columnValue = readRow(value, VERTICALBAR);
// 建立Key <primaryKey, tableIndex, joinCondition>
outputKey = new DoubleTextPair(new IntWritable(Integer.parseInt(columnValue[0])), n... |
02e86649-2a18-4c65-9fba-ebb5fcea4db9 | 0 | private static String[] initializeHostNames() {
String[] hostNames = new String[4];
hostNames[0] = "pi.cs.oswego.edu";
hostNames[1] = "rho.cs.oswego.edu";
hostNames[2] = "wolf.cs.oswego.edu";
hostNames[3] = "lambda.cs.oswego.edu";
return hostNames;
} |
d242a007-2007-4697-819d-6b807f761fce | 5 | public void Solve() {
List<Long> primes = Euler.GetLongPrimesList((int) (Math.sqrt(_max) * 1.3));
double minimumValue = Double.MAX_VALUE;
long nResult = 0;
for (int i = 0; i < primes.size(); i++) {
long firstPrime = primes.get(i);
for (int j = i + 1; j < primes.s... |
469a60dd-54e7-460c-b3f2-f140bb9963b0 | 1 | public synchronized void deleteWayFromRelations(String key, WayOsm w){
for (RelationOsm relation : totalRelations.get(key).keySet())
relation.removeMember(totalWays.get(key).get(w));
} |
377116a5-68fc-42d8-9d24-21f6026b60f6 | 9 | @Override
public boolean equals(Object obj) {
if (super.equals(obj) && obj instanceof ComplexDTO) {
ComplexDTO that = (ComplexDTO) obj;
return eq(this.object, that.object)
&& arrayEq(this.objectArray, that.objectArray)
&& arrayEq(this.simpleDtoArray, that.simpleDtoArray)
&& eq(this.objectList, t... |
61271d3c-bb98-4e57-9f69-68277c0c6f92 | 6 | public static String keyPressed(int i, String string){
if(keyState[ANYKEY] && !prevKeyState[ANYKEY]){
String s = KeyEvent.getKeyText(keyCode);
if(s.length() == 1)
string +=s;
if(keyCode == KeyEvent.VK_BACK_SPACE && string.length() > 0){
String s2 = string.substring(0, string.length()-1);
string ... |
0fc90631-0d11-4e82-93cb-df9ce104b0c6 | 3 | public static String checkPosition(String username, String pass){
Employee bean = new Employee();
bean.setUsername(username);
bean = (Employee)DatabaseProcess.getRow(bean);
//if username cannot be found in the database
if(bean == null){
return "not found";
}
if(bean.getUsername().equals(username... |
49eb2b64-a6ff-48c5-8096-071c1d79c29c | 7 | public List<Coin> substract(int value){
int restOfValue = value;
List<Coin> consumedCoin = new LinkedList<Coin>();
while(restOfValue != 0){
LinkedList<Coin> coin100List = (LinkedList<Coin>) this.coinGroup.get(Coin100JPY.class.getName());
LinkedList<Coin> coin50List = (LinkedList<Coin>) this.coinGroup.get(Co... |
a8390ecd-49da-4966-aa26-02ee6a195eb7 | 1 | public void visit_fmul(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
52424924-0622-4259-8177-5d57eed0b569 | 9 | public static final void nbest_sign(final float[] in,
final int offset,
final float[] codebook,
final int len,
final int entries,
... |
6bb0cf10-9c10-454e-864b-5aec7e0befa5 | 4 | public static void UpperCity(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement stmnt = c... |
db891656-cb40-4ca8-bce6-cab56ff8ade8 | 8 | private boolean transmit(DATAPacket dtg) {
FileOutputStream fos = null;
try {
int i = 1;
File fi = new File(directory_name); //Création de la Zone de dépot si elle n'existe pas
if (!fi.isDirectory()) {
fi.mkdir();
}
File fichier... |
b48685a0-09f7-45d8-b338-33169ba59cfe | 2 | public void Imprimir()
{ if (VaciaLista())
{
System.out.println( "vacia" +Nombre);
}
//fin del primer if
else
{
System.out.print( "La " + Nombre +" es: ");
NodosProcesos Actual = PrimerNodo;
while (Actual.siguiente != PrimerNodo)
{
System.out.print (Actual.datos + " ");
... |
217e0b3a-9ec6-46aa-a319-24c919819bc8 | 6 | public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java Yylex <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
Yylex scanner = null;
try {
scanner = new Yylex( new java.io.FileReader(argv[i]) );
while ( ... |
b352b14d-e576-41c0-8de7-6ce262d63d63 | 9 | public static void main(String[] args) {
String helloWorld = "Hello World!";
char[] helloWorldArray = helloWorld.toCharArray();
for (char c : helloWorldArray) {
switch (c) {
case 'H':
System.out.println("Character H");
break;
case 'e':
System.out.println("Character e");
break;
case 'l'... |
d617e485-110d-405b-ab8a-9560461415eb | 7 | public List<String> dfs(List<String> result, String s, int index, String one){
if(index == 4 && !isValid(s)) return result;
else if(index == 4){
result.add(one + "." + s);
return result;
}
for(int i=1; i<=3 && i<s.length(); i++){
String input ... |
b7cb5695-c561-44c0-a65c-c6818b4ba0b7 | 0 | public void setDateCreated(String dateCreated) {this.dateCreated = dateCreated;} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.