method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a37998b6-d42b-4d1d-91f9-a4562dd508c7 | 8 | public int code(byte[] buf, int off, int len) {
int end = off + len - 16;
int i;
for (i = off; i <= end; i += 16) {
int instrTemplate = buf[i] & 0x1F;
int mask = BRANCH_TABLE[instrTemplate];
for (int slot = 0, bitPos = 5; slot < 3; ++slot, bitPos += 41) {
... |
6f40fbf6-8f22-4943-94e1-1b6e94fdb518 | 7 | private synchronized void manageWishes()
{
IMarketCommunicator buyer = null;
boolean any = false;
ArrayList<Item> newsWishes = new ArrayList<Item>();
for (int i = 0; i < wishes.size(); ++i)
{
Item wish = wishes.get(i);
newsWishes.add(wish);
... |
42d84ff7-0416-44fd-a161-ec2cb7807839 | 1 | public synchronized void editar(int i)
{
try
{
new PesquisaView(this, list.get(i));
}
catch (Exception e)
{
e.printStackTrace();
}
} |
5fcc0f15-58e0-493b-8f14-736e70942e74 | 6 | @Override
public IOAdapter createAdapter(final URL url) {
return new IOAdapter() {
SocketChannel socketChannel;
ByteBuffer byteBuffer = ByteBuffer.allocate(2048);
@Override
public void open() throws IOException {
socketChannel = SocketChannel.... |
53dba631-d081-48a9-85d5-bfa131c266c7 | 7 | @Override
public void keyPressed(final KeyEvent the_event)
{
if (!my_board.gameIsOver() && !my_paused.isPaused())
{
final String key = KeyEvent.getKeyText(the_event.getKeyCode());
if ("A".equals(key))
{
my_board.moveLeft();
}
else if ("D".equ... |
de9af53c-4d72-4924-8ba4-305d86d451c0 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String version = this.plugin.getDescription().getVersion();
if (title.split("version").length == 2) {
final String remoteVersion = title.split("version")[1].split(" ")[0]; /... |
b640f38f-8f75-49ab-8a80-6b3d2a1550ee | 1 | public static void main(String[] args) {
//System.out.println(new AnimeSearch().searchById(2167));
PeopleSearchResults searchResults = new PeopleSearch().searchByQuery("asdfasdf");
if (searchResults.searchResults == null) {
System.out.println("none found");
}
} |
c1bf34f3-47da-415c-bf47-5b70c37dac9b | 6 | private void doMarketCommand(Command command) throws RemoteException,
MalformedURLException, marketplace.exception.RejectedException,
RejectedException {
CommandName inputCommand = command.getCommandName();
String userOrItemName = command.getUserOrItemName();
Float amount = command.getAmount();
String sel... |
71d02ecb-4031-4ce5-8faa-6520c76d9f28 | 2 | public void serverModify(Connection connection, String local_path,
java.sql.Timestamp time_stamp) {
try {
Statement stmt = connection.createStatement();
if (inServerDB(connection, local_path))// already exists so should
// update
{
PreparedStatement ps = connection
.prepareStateme... |
96c855ee-aa4f-45d7-9e2a-be0c6750ebf0 | 4 | public static void main(final String[] args)
{
System.out.println("Running for " + TimeUnit.MILLISECONDS.toSeconds(Config.RUNTIME) + " seconds...\n");
// Start Inazuma-Storage client
final CountDownLatch latch = InazumaStorageClient.start();
// Configure thread pool
final ScheduledExecutorService threadPoo... |
6d4b50c9-d4ff-4bfb-a2dd-d571ac5aca6a | 3 | public static boolean connection() {
Socket socket=null;
boolean reachable=false;
//Poizkusi poslati paket do strežnika. Če se strežnik odzove,
//Potem ima program internetno povezavo, drugače pa ne
try {
socket=new Socket(Main.ip, 80);
reachable=true;
... |
35798203-b996-4b99-9c08-85623a43e39c | 6 | static void Merge(int[] A, int p, int q, int r) {
//Allocate dynamic memory for L and R within merge.
int ls = q-p+1;
int rs = r-q;
int[] L = new int[ls];
int[] R = new int[rs];
//Copy A[p...q] into L[0...ls-1]; A[q+1,r] into R[0...rs-1]
for(int i=p;... |
cb2d935e-b7cd-4dae-939c-73000c21dc29 | 5 | public void writeSimpleAdjacenclyListOfNodeSet(Set<Integer> nodes, String set, String output, boolean weighted){
StreamedLinkSet SLS = new StreamedLinkSet(set);
SLS.initTreeTraversal();
LinkSetNode N;
try
{
BufferedWriter out = new BufferedWriter(new FileWriter(output... |
ff2f58fe-ef5f-40d2-ba81-33217572ac50 | 5 | private void mergeIndirect(T[] a, int[] perm, int[] aux,
int lo, int mid, int hi)
{
// i and j is used to point to the currently processing element in the
// first and 2nd half respectively
int i = lo, j = mid + 1;
// Copy perm[lo..hi] to aux[lo..hi].
for (int k = lo; k <= hi; k++)
aux[k] = perm[k];
... |
411df3af-8b29-4aa0-af50-6e1946b5f3b8 | 5 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
JSONObject jb = new JSONObject();
String userId = request.getParameter("userId");
// String eventName = new String(
// request.getParameter("eventName").getB... |
fc194671-1b6a-4716-be31-93ed394b7077 | 3 | public InstructionScreen(){
Sounds backgroundMusic = new Sounds();
backgroundMusic.music();
// build the primary JFrame
buildFrame();
// Build the main panel
buildMainPanel();
// add the main panel to the Frame
add(mainPanel);
... |
e13103de-f022-4309-8db8-ee8ebdd73a70 | 4 | private Polygon readPolygon(StringTokenizer tokenizer) {
List<Vertex> verticies = new java.util.ArrayList<Vertex>();
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
String vertex_tokens[] = token.split("/");
ObjVertex geo, tex, norm;
... |
7738ef07-7985-4b81-b971-d8e4fb9e8e1b | 9 | /* */ public void process(InputStream is, OutputStream os)
/* */ {
/* 75 */ this.os = os;
/* */ try {
/* 77 */ Document document = builder.parse(is);
/* 78 */ Msg4Head head = new Msg4Head();
/* 79 */ head.read(document);
/* 80 */ String type = head.getMsgType();
/* ... |
842381fd-4aa4-4d5b-9c1f-0a7725d86f64 | 4 | private void processFileRequest(Sim_event ev) {
if (ev == null) {
return;
}
Object[] data = (Object[]) ev.get_data();
if (data == null) {
return;
}
String filename = (String) data[0]; // get file name
int req_source = ((Integer) data[1]).i... |
cd45563a-4f14-40dd-869e-75f7561235e0 | 2 | private void closeConnection(Connection connection) {
if (connection == null) return;
try {
connection.close();
} catch (SQLException e) {}
} |
e0546179-2f3d-4712-bc28-f1f626e2df5e | 7 | public void act(JManBoard board) {
int newx = getX();
int newy = getY();
if (!hasActed()) {
int prob = JManApp.rand(0,11);
if (prob == 0) {
newx = getX() + 1;
newy = getY();
}
if (prob == 1... |
79730489-9223-49cc-83bb-4f08b00278d3 | 4 | @Override
public Position getCurrentPosition() {
WirelessMonitor wm = WirelessMontiorFactory.getInstance();
StringBuilder sb = new StringBuilder(ENDPOINT);
for (AccessPoint ap : wm.list()) {
try {
sb.append(String.format("&wifi=mac:%s|ssid:%s|ss:%d", ap.getMAC(),
URLEncoder.encode(ap.getSSID(), "UTF-... |
6e5facac-4aea-4246-8658-8a0b4f0eda1c | 8 | private static boolean sumsToEigtyNine(int i) {
if (i == 1) return false;
if (i == 89) return true;
if (i < 1000) {
if (one.contains(i)) return false;
if (eightyNine.contains(i)) return true;
}
int sum = 0;
for (char c : (i + "").... |
34f0902a-5f78-4817-9883-559f07760e15 | 3 | public IllegalOrphanException(List<String> messages) {
super((messages != null && messages.size() > 0 ? messages.get(0) : null));
if (messages == null) {
this.messages = new ArrayList<String>();
}
else {
this.messages = messages;
}
} |
9043775e-69f6-42e9-9044-9e32c4a227bc | 7 | public int evalRPN(String[] tokens) {
if (tokens.length == 0) {
return 0;
}
Stack<Integer> stack = new Stack<Integer>();
for (String token : tokens) {
try {
int i = Integer.valueOf(token);
stack.push(i);
} catch (NumberFormatException e) {
int a = stack.pop();
int b = stack.pop();
i... |
a4fd2e08-ac61-43da-8fc5-d37016738bfc | 7 | public static void loopMusic()
{
if(BATTLE_TYPE.equals("WILD"))
{
if(!Mechanics.isLegendary(enemy[0]))
wildMusic.loop();
else
fatefulMusic.loop();
}
else if(BATTLE_TYPE.equals("TRAINER"))
{
if(b1.trainer.type==Trainer.TrainerType.JAVA)
javaMusic.loop();
else
train... |
d3055552-35d5-4061-9265-9918dc4c123b | 5 | public static int[] breakIntoDigits(long number) {
// Symmetric positive value is out of range => - Long.MIN_VALUE == Long.MIN_VALUE !!
if (number == Long.MIN_VALUE) { // -9223372036854775808, just return its representation.
return new int[] { -9, -2, -2, -3, -3, -7, -2, -0, -3, -6, -8, -5,... |
4250fa2b-9734-46fe-9a8b-8a37c53f7415 | 0 | @Override
public int fight() {
return super.fight();
} |
479580a1-f963-4ce2-ba85-d99762164868 | 3 | public ResultSet browsePatientHistory(String nic) throws SQLException{
try{
databaseConnector=myConnector.getConnection();
stmnt=(Statement) databaseConnector.createStatement();
SQLQuery="SELECT * FROM familydoctor.patienthistory WHERE NIC="+nic;
dataSet=stmnt.e... |
b7846dc5-9205-4e71-af70-06672181f8bc | 0 | @Override
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean hasFocus,
int row,
int column
) {
return this;
} |
b1dfdf66-0a4e-4870-b0be-6e77367cb4a5 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((newLine == null) ? 0 : newLine.hashCode());
result = prime * result + ((oldLine == null) ? 0 : oldLine.hashCode());
result = prime * result + ((tag == null) ? 0 : tag.hashCode(... |
e8d539e0-dcf7-4387-a7af-8d22e55876f9 | 1 | private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked
this.jPanel2.setVisible(false);
this.jPanel3.setVisible(false);
if (this.jPanel1.isVisible())
this.jPanel1.setVisible(false);
else
{
this.jPanel1.setVi... |
97a61d8a-7f9c-41a9-9c3e-af53d1a71078 | 7 | private void calculateSingleArrayGradient
(Color[] loColors, Color[] hiColors, float Imin) {
//set the flag so we know later it is a non-simple lookup
isSimpleLookup = true;
int gradientsTot = 1; //the eventual size of the single array
// These are fixed point 8.16 (start ... |
f91ca1f5-031a-457a-9acf-200c74868fca | 5 | private Node<E> insert(Node<E> node, E value) {
Node<E> result = new Node<E>(node);
int compare = result.value.compareTo(value);
if (compare == 0) return result;
if (compare > 0) {
if (result.left != null) {
result.left = insert(result.left, value);
} else {
result.left = new Node<E>(value);
s... |
ff2db82a-52f4-41de-9726-3fcd8e7e4b0f | 8 | private Element updateProduct(HttpServletRequest request, Element elResult) {
HttpSession session = request.getSession(true);
Element elResponse = new Element ("response");
if (!verifySession(request)) {
elResponse.setAttribute("success", "-1");
elResult.addContent(elResponse);
return elResult;
}... |
25e643cc-3409-4d14-b155-4fb377e7ccef | 5 | ImageRegistry(){
imageHash = new HashMap<>();
try
{
String path = "Data//Images//";
String files;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
List<String> tlist = new ArrayList<>();
for (int i = 0; i ... |
cb32d0af-9d1f-42bf-87a7-45a02f577b94 | 9 | private String readFileAsString(String filename) throws Exception {
StringBuilder source = new StringBuilder();
FileInputStream in = new FileInputStream(filename);
Exception exception = null;
BufferedReader reader;
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
Exception inne... |
4430a244-3d88-4dea-bc14-64f332fe1b54 | 0 | public String getFunctionName() {
return functionName;
} |
25cc6a2c-ea2c-4b51-8c8e-a704ad749416 | 2 | private static int search2(Cards[] hands, Cards board, int numhands, int[] wins, int[] ties, Cards remaining) {
int total = 0;
for (int i = 0; i < remaining.size() - 1; i++) {
Card card1 = remaining.get(i);
board.add(card1);
for (int j = i + 1; j < remaining.size(); j... |
678640f3-2260-4694-8c4b-8fa83cb2fb4a | 2 | public void play() {
try {
Clip clip = AudioSystem.getClip();
clip.open(stream);
clip.start();
} catch (LineUnavailableException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
... |
5d2b6b9c-2c1d-4625-b3ac-6052a30288b6 | 1 | public void onTick() {
resultant = getResultant();
acceleration = Vector.multiply(resultant,1D/mass);
try {
velocity = Vector.add(velocity,Vector.multiply(acceleration, 0.05));
displacement = Vector.add(displacement, Vector.add(Vector.multiply(velocity, 0.05), Vector.multiply(acceleration, -0.5*Math.pow(0.0... |
07a26e53-64d8-4c9d-b7f4-e163a58cf8b8 | 5 | public EntityDefinition getChildDefinition() {
int childId = -1;
if (varBitId != -1) {
VarBit varBit = VarBit.cache[varBitId];
int configId = varBit.configId;
int lsb = varBit.leastSignificantBit;
int msb = varBit.mostSignificantBit;
int bit = Client.BITFIELD_MAX_VALUE[msb - lsb];
childId = client... |
80bc754f-123e-4358-9108-42182e6e5ef2 | 8 | @Override
public String write(DataOutputStream out, PassthroughConnection ptc, KillableThread thread, boolean serverToClient) {
while(true) {
try {
out.writeShort(value.length());
} catch ( SocketTimeoutException toe ) {
if(timedOut(thread)) {
continue;
}
return null;
} catch (IOExcept... |
bd85ce4a-77a5-4486-9d4a-aba0bf6ba023 | 5 | public HashMap<String, ArrayList<String>> getTxtContent(File file){
ArrayList<String> fileList=getAllFile.getTxts(file);
HashMap<String, ArrayList<String>> hashMap=new HashMap<String, ArrayList<String>>();
String line=null;
for (String path: fileList) {
ArrayList<String> txtList=new ArrayList<String>();
t... |
700a3f78-a884-4be9-bfe6-010fd138d87d | 9 | private boolean checkNewName(String name) {
int length = name.length();
boolean ok = (length>=5 && length<=10);
if (ok)
for (int i=0; i<length; i++) {
int ci = (int)name.charAt(i);
boolean thisOk = ((ci>=48 && ci<=57) ||
(ci>=65 && ci<=90) ||
(ci>=97 && ci<=122));
//String extra = (thi... |
c661f3a6-465e-4f91-9a71-ba36b8661031 | 1 | public VideoSection getVideoSection()
{
setInfoFromGUI();
if (toCut)
{
return this.videoSection;
}
return null;
} |
ec57fcf0-0ada-487e-a7cf-f2c30c6cca49 | 5 | public OvhApi(final String root, final String AK, final String AS, final String CK)
{
this.root = root;
this.AK = AK;
this.AS = AS;
this.CK = CK;
try
{
URL url = new URL(this.root + "/auth/time");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
... |
2e7759be-ff96-4c28-aad9-97b3a7a88505 | 8 | public boolean SetImage(String imagePath) {
if (null == imagePath) {
JOptionPane.showMessageDialog(this, "Image Path is Bad! Set In Config!", "Error", JOptionPane.ERROR_MESSAGE);
return false;
}
if (3 > imagePath.length()) {
JOptionPane.showM... |
6939eb64-5efc-4647-8704-dce4749f10d6 | 2 | public int NumberCorrect()
{
int result = 0;
for(QuizResultRow rr : ResultRows)
{
if(rr.isCorrect)
{
result += 1;
}
}
return result;
} |
4ebdfde9-07ab-462e-99ff-b1b643819432 | 7 | public boolean lookup(Plugin[] plugins) throws IOException, InvalidConfigurationException{
String data = "";
String response;
// we have to clear the lists first
supported.clear();
needUpdate.clear();
unsupported.clear();
for(int i = 0; i < plugins.length; i++){
String version = plugins[i].getDescripti... |
15f2946e-82d8-4edf-82e8-4ea80cd9f88e | 8 | private void mergeUsuario(String multicastGroup, Boolean novoUsuario) throws UnknownHostException, IOException, RemoteException, XPathExpressionException {
InetAddress group = InetAddress.getByName(multicastGroup);
try (MulticastSocket mSckt = new MulticastSocket();) { //usuario "escuta" na mesma porta ... |
661e63c2-c0ca-4a01-98d8-dd607f2652a0 | 8 | public void Traslacion(int tx, int ty, int tz){
if(tx != 0){
for(int f = 0; f < pD.CoordenadasCasa.length; f++){
if(pD.CoordenadasCasa[f][2] == -300){
pD.CoordenadasCasa[f][0] += tx/2;
}else{
pD.CoordenadasCas... |
3190b71f-4eea-4633-990a-9948d8aba987 | 2 | private boolean jj_3_56() {
if (jj_scan_token(COMMA)) return true;
if (jj_3R_73()) return true;
return false;
} |
0a4369cf-14c8-4936-985c-6223f494a94b | 5 | public boolean containsKey(String var) {
for (String line : this.lines) {
if (line.trim().length() == 0) {
continue;
}
if (line.charAt(0) == '#') {
continue;
}
if (line.contains("=")) {
int delimPositio... |
34ea1b56-ea95-45be-b428-2528c879ef50 | 7 | public void p_All_fields_error_messages(
LinkedHashMap<String, LinkedHashMap<String, String>> credentials) {
autoutil.openBrowser(dataSheet(credentials,"url","url"));
autoutil.waitTime(8000);
autoutil.clickButton(dataSheet(credentials,"button","sign"),propFile("link"));
autoutil.waitTime(3000);
for(Entry... |
f2cc30bd-39f5-4300-b851-2286aca17cb3 | 4 | private void findit(ListNode current, int n){
if(current == null){
count = 0;
return;
}
findit(current.next,n);
count++;
if(count == n){
if(current == head)
result = head.next;
}
if(count == n+1){
cur... |
d1e5cf81-181a-40ef-86cd-7abb57e7123b | 1 | public void setYVal(Double[] newYVal) {
if (newYVal == null) {
this.yVal = new Double[0];
} else {
this.yVal = Arrays.copyOf(newYVal, newYVal.length);
}
} |
a483c65b-a141-48fd-ba49-38ddadaa20fb | 8 | @Override
public Document next() {
Document doc = new Document();
StringBuffer sb = new StringBuffer();
try {
String line;
Pattern docno_tag = Pattern.compile("<DOCNO>\\s*(\\S+)\\s*<");
boolean in_doc = false;
while (true) {
line = rdr.readLine();
if (line == null) {
at_eof = true;
... |
dff115b3-934b-43f7-8f66-0f0ca048accf | 9 | private void skipDeletedSuccessors(Node<E> x) {
whileActive:
do {
Node<E> next = x.next;
// assert next != null;
// assert x != NEXT_TERMINATOR;
// assert x != PREV_TERMINATOR;
Node<E> p = next;
findActive:
for (;;) {
... |
54cc35f4-53f7-4c0c-baec-0600f3922c01 | 9 | public static void main(String[] args) {
// create model and view
IView view = new View();
IModel model = new Model(view);
// register the model on the view
view.registerModel(model);
// create a controller and register him on the view
Controller ctrl;
try {
ctrl = new Controller(model, view);
... |
931921a1-2614-4b00-ac7c-01e46e245bce | 2 | public int getWhiteCount() {
int whiteCount = 0;
for (int i = 0; i < AnswerCombination.SIZE; i++) {
if (this.get(i).getColor().getRealName() == "WHITE") {
whiteCount++;
}
}
return whiteCount;
} |
3ea99506-000a-4c49-94ef-35df25766cd2 | 1 | @Override
public void itemStateChanged(ItemEvent e) {
//check checkbox and set visibility
if (e.getStateChange() == ItemEvent.DESELECTED){
_view.edt_ID.setVisible(true);
} else {
_view.edt_ID.setVisible(false);
_view.edt_ID.setText(... |
72238b03-3805-431d-9513-30a5f50d98ae | 8 | public Picture load(int id) {
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
Picture picture = null;
try {
conn = DbConnection.getConnection();
stmt = conn.prepareStatement(LOAD_PICTURE_STMT);
stmt.setInt(1, id);
rs = stmt.executeQuery();
if (rs.next()) {
... |
ca3bf8b0-4a82-4bfa-b78b-b406f758fddb | 6 | * </ul>
*
* @since 3.2
*/
public void setSortColumn (CTableColumn column) {
checkWidget ();
if (column != null && column.isDisposed ()) SWT.error (SWT.ERROR_INVALID_ARGUMENT);
if (column == sortColumn) return;
if (sortColumn != null && !sortColumn.isDisposed ()) {
sortColumn.setSortDirection (SWT.NONE);
}
s... |
2d840199-a303-4719-848d-543573835d6f | 4 | public boolean equals(Employee worker)
{
if(this.getFirstName().equalsIgnoreCase(worker.getFirstName()) &&
this.getLastName().equalsIgnoreCase(worker.getLastName()) &&
this.getPayRate() == worker.getPayRate() &&
this.getHours() == worker.getHours())
return true;
else
return false;
} |
97093316-a73b-4fb6-b8d9-36a739f4c799 | 2 | public static boolean city(String city){
if(city.matches("[a-zA-Z]+(\\s[A-Z][a-z]+(\\.)?)*")&&city.length()<30)
return true;
return false;
} |
b0a4a445-4117-4629-88be-38b946ce60bc | 5 | private void replaceWires(List<List<Gate>> layersOfGates,int numberOfInputs,
int startOutputWire) {
for (List<Gate> list: layersOfGates) {
for (Gate g: list) {
int leftIndex = g.getLeftWireIndex();
int rightIndex = g.getRightWireIndex();
int outputWireIndex = g.getOutputWireIndex();
if (outputWi... |
d3da36e6-cf20-4d70-8c9d-0f1090e4a635 | 6 | public static ControlFrame selectNextStrategy(ControlFrame frame) {
{ Keyword strategy = null;
if (frame.currentStrategy != null) {
strategy = frame.currentStrategy;
}
else if (frame.state == Logic.KWD_PARALLEL_STRATEGIES) {
strategy = Logic.KWD_SELECT_PARALLEL_THREAD;
}
... |
a4fee8ce-cff3-4636-937f-fb8a88443938 | 8 | public static void loadLwjgl() throws IOException {
String path = "/" + System.mapLibraryName("lwjgl");
if (!path.startsWith("/")) {
throw new IllegalArgumentException("The path to be absolute (start with '/').");
}
String[] parts = path.split("/");
String filename ... |
ee412217-155f-40a9-af3a-fa28a7cbc979 | 8 | final Class39_Sub2 method1169(boolean flag, boolean flag1) {
int j = anInt2161;
int i = anInt2197;
if (flag1) {
i = anInt2177;
j = anInt2157;
}
if (!flag) {
readValue(13, null);
}
if (i == -1) {
return null;
... |
b2cb9e04-bbdf-4b5d-b493-86c808f5d86e | 5 | public List<TreeNode> generateTreesDP(int n, Map<Integer, List<TreeNode>> DP) {
ArrayList<TreeNode> res = new ArrayList<TreeNode>();
if(n == 0) {
res.add(null);
return res;
}
if(DP.containsKey(n)) return DP.get(n);
for(int i = 1; i <= n; ++i){
List<TreeNode> ls = generateTreesDP(i-1, DP);
List<Tr... |
0617a490-5dc6-4b22-b2b8-d88802df3fb1 | 6 | public static boolean slotsNextP(AllPurposeIterator self) {
{ Slot slot = null;
for (;;) {
loop001 : for (;;) {
{
slot = ((Slot)(self.iteratorConsList.value));
if (!(slot != null)) {
break loop001;
}
}
self.iteratorConsL... |
9bb8d353-560b-440a-8643-d8662ae5b020 | 9 | public static String packOptionsToString(Hashtable ohash, boolean hideEmptyStringOpts)
throws ClassCastException
{
if ((ohash == null) || ohash.size() == 0)
return "-";
StringBuffer sb = new StringBuffer();
boolean hadAny = false;
for (Enumeration e = ohash.keys(); e.hasMoreElements(); )
{
SOCGameO... |
fc74aa3b-7625-46f7-8f6e-3e291700856a | 9 | public void showBankDeposit(CommandSender player, String bank, String name, double amount) {
if (!iConomy.hasAccount(name)) {
Messaging.send(this.Template.color("error.bank.account.none"));
return;
}
Bank Bank = null;
Account Account = iConomy.getAccount(name);
BankAccount accou... |
2118a095-e1c0-48fa-9c99-48df30f1b3c4 | 9 | public boolean isMatch(String s, String p) {
int is=0,ip=0;
boolean star=false;
int starpos=-1,smark=-1;
while(is<s.length()){
if(ip>=p.length()){
if(is<=s.length()-1)
return false;
else
break;
}
if... |
33cb1b2d-79ed-4664-a861-7820f10e6118 | 0 | public void setImagen(String imagen) {
this.imagen = imagen;
} |
902e27d5-2b3c-482b-8286-b451c7f3f09d | 5 | public boolean edit( int X, int Y ){
boolean flag = super.edit(X,Y);
if( !flag ){
X -= LabyrinthDrawer.MARGIN;
Y -= LabyrinthDrawer.MARGIN;
int x = X/LabyrinthDrawer.CELL_SIZE;
int y = Y/LabyrinthDrawer.CELL_SIZE;
if( 0<=x && x<LabyrinthDrawer.DIMENSION && 0<=y && y<LabyrinthDrawer... |
e0dd946f-90c5-4fd7-a01f-97d285ca5104 | 1 | public String findVdc(String orgLink, String vdcName) throws Exception
{
String response = doGet(orgLink);
String element = findElement(response, Constants.LINK, Constants.VDC_LINK, vdcName);
if( element == null){
throw new Exception("No VDC found that matches the given name: " + vdcName);
}
return ... |
5be6fb7a-932f-4f5a-86c2-ef4fd8f3ef1b | 2 | public static float pedirSalodInicialCuenta() throws SaldoInicialInsuficienteException{
float inicial=0;
try{
System.out.print("Saldo inicial => ");
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
inicial=Float.parseFloat(stdin.readLine());
}catch(Exception e){
System.out.pr... |
d1535ad2-8b44-4685-82a4-37dca54ae479 | 2 | public void count(Object obj) {
Class<?> type = obj.getClass();
if (!baseType.isAssignableFrom(type))
throw new RuntimeException(obj + " incorrect type: " + type
+ ", should be type or subtype of " + baseType);
countClass(type);
} |
ac6dac00-4c30-412d-a2d0-63e758f14236 | 4 | public void insertTab(AbstractTab tab) {
int index;
String tip ;
String title = tab.getTabName();
if (tab instanceof ServerTab) {
index = getTabCount();
tip = "Server " + title;
} else {
ServerTab s = tab.getServerTab();
index = in... |
fdb491bc-e4b2-4424-b608-094adc0b6836 | 6 | private void setupDisplay() {
try {
DisplayMode[] modes = Display.getAvailableDisplayModes();
for(int i = 0; i < modes.length; i++){
if(modes[i].getWidth() == Globals.screenWidth && modes[i].getHeight() == Globals.screenHeight && modes[i].isFullscreenCapable())
Display.setDisplayMode(modes[i]);
}
... |
b81d1066-8232-40ba-986e-d83a5c5c5caf | 5 | private void otherChar() {
int tempChar = nextChar; // for data integrity purposes.
switch(tempChar){
case -1: // end of file
tempToken = new Token("eof",charPos, lineNum);
tokenFoundFlag = true;
break;
case 32: // whiteSpace, ignore
whiteSpaceFlag = true;
exitSMFlag = true;
break; ... |
4c1f0946-753b-4eb1-a16e-2d677a22859c | 5 | private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0);
return 8;
}
switch(curChar)
{
case 78:
... |
ebd533da-4d15-45ef-8a53-fbc787890e63 | 3 | public static void SSHome() throws IOException{
int timeblock = 5;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (timeblock > 0){
System.out.println("What would you like to do right now?");
System.out.println("1. Go workout at the Gym");
System.out.println(... |
31222f9a-6045-4ff1-b8bc-dc8f2b9d2014 | 0 | public int getNumberOfImages()
{
return numberOfImages;
} |
91c1d048-a5c6-4d62-a060-bce9d047e2a1 | 6 | public void loadClassesMetadata (final Class<?>... clzs) throws ClassNotFoundException {
if (clzs == null || clzs.length == 0) return;
for (Class<?> clz : clzs) {
String clzName = clz.getCanonicalName();
if (classMetadataCache.containsKey(clzName)) continue;
ClassMetadata classMetadata = new ClassMe... |
5a05e278-158d-4978-ae13-152bf9d5237c | 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... |
b54140c9-3dd8-4684-a439-245c22234474 | 8 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!super.equals(obj)) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ObjectProperty<?> other = (ObjectProperty<?>) obj... |
1d44f26a-2cf0-48f8-84c0-819e62d759f5 | 8 | private void init() {
if (Double.compare(getSkinnable().getPrefWidth(), 0.0) <= 0 || Double.compare(getSkinnable().getPrefHeight(), 0.0) <= 0 ||
getSkinnable().getWidth() <= 0 || getSkinnable().getHeight() <= 0) {
getSkinnable().setPrefSize(PREFERRED_SIZE, PREFERRED_SIZE);
}
... |
7e90bb44-cbe6-47f0-bcaa-670713d12275 | 0 | private <E extends Signable> E sign(E signable) {
signable.sign(apiKey);
return signable;
} |
6dcad5ce-7111-4378-8c49-0766b1a2cf5f | 8 | public void paintGridMirrors(int w, int h, Graphics2D g2d) {
if (type == DBC_ID || type == RBC_ID)
return;
if (mirrorBoxes == null)
return;
int dx, dy, x0, y0, x1, y1, x2, y2, lx, ly;
synchronized (mirrorBoxes) {
for (Rectangle rect : mirrorBoxes) {
x0 = (int) x;
y0 = (int) y;
lx = (int) ... |
e075a689-3ece-4b5f-96af-05ce662ed035 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
JsonInteger other = (JsonInteger) obj;
if (other.hasComments() ^ hasComments())
return false;
if (value != other.value)
return fals... |
1db9d8a3-c1c2-47ea-90a8-68565d8c92ad | 0 | @Override
public Object clone() throws CloneNotSupportedException {
AnObject o = (AnObject) super.clone();
// o.internalObject = new Object();
return o;
} |
2db66cd1-f1c6-4791-a25e-06e4877b384d | 8 | Vector<Integer> getNeighboringIndexes(int index) {
Vector<Integer> result = new Vector<Integer>(6);
int row = getRow(index);
int col = getColumn(index);
int offset = getOffset(row);
if (row < numRows - 1) {
if (col + offset > 0) {
result.add(getIndex(r... |
77d02de8-c7c3-421a-b2e5-493a91d5c98b | 9 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
d: do {
line = br.readLine();
if (line == null || line.length() == 0)
break d;
int times = Integer.parseIn... |
688aeff4-03ae-431b-a293-7a5df718df41 | 3 | private int trouverIdDernierClient(){
if(this.plagesHoraire != null){
int maxId = -1;
for(PlageHoraire ph : this.plagesHoraire){
int id = ph.trouverIdDernierClient();
if(id > maxId){
maxId = id;
}
}
return maxId;
}
else{
return -1;
}
} |
0d6d835b-76a6-4341-858b-273cd366d4d3 | 1 | public static int[] ToIntArray(Integer[] data)
{
int[] result = new int[data.length];
for(int i = 0; i < data.length; i++)
result[i] = data[i].intValue();
return result;
} |
1889be0c-36fb-4846-9d34-5630d04e7e3d | 9 | private Connection createNewConnection()
{
Connection myconn = null;
try
{
try
{
Class<?> myclass = Class.forName(dbClassNm);
if (myclass == null)
{
CDbError.logError(errfile, false, "Class loader did not return a class for " + db... |
83e66aa6-b8ae-4307-8e60-18a431b4bbfe | 1 | public void printStackTrace(Exception exception) {
exception.printStackTrace();
if (writeToFile) {
checkLogFile();
exception.printStackTrace(printWriter);
printWriter.flush();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.