method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f111d157-fe41-4aa0-b2f0-36a8740b2850 | 5 | private static ArrayList<Position> getPossiblePositions(int index, ArrayList<ArrayList<Piece>> pieces)
{
ArrayList<Position> pos = new ArrayList<Position>();
for(int i = 0; i < 8; i++)
{
Piece cPiece = pieces.get(index).get(i);
if(cPiece != null)
{
for(int x = 0; x <= placementGrid.getHeight()-cPiec... |
b07fb49d-8b15-4b26-8412-3c8fcb8afe80 | 7 | @Override
public Object take(int forThreadId) throws InterruptedException
{
if (isInTerminalPhase(forThreadId))
{
return terminalPhaseTake(forThreadId);
}
while (routerQueueHasData(forThreadId))
{
Object nameValues = takeFromRouter(forThreadId);
... |
86147c8b-d6f7-4e8d-9ab0-21bb7d5a6c84 | 8 | public void SaveMarkers() { // saves a marker-file and generates a new set of marker list from it
try {
System.out.println("Saving marker file: "+markerOutfilename);
FileOutputStream os=new FileOutputStream(markerOutfilename);
if (AppendVersionNumber) // to advance the number
{
markerInfilename ... |
a70f531c-2aa3-4611-8463-ee1eecae0629 | 9 | private void addAttribute(String name, Attributes atts) {
if (currentAttributeMap == null)
return;
String type = atts.getValue("type");
if (type == null) //This can happen if the type is defined inline within the attribute
{
pendingAttributeWithInlineType = name;
return;
}
Variable attr = ... |
b3624a89-9264-4fed-ae9f-91eac0377924 | 3 | public void visitClassType(final String name) {
if ("java/lang/Object".equals(name)) {
// Map<java.lang.Object,java.util.List>
// or
// abstract public V get(Object key); (seen in Dictionary.class)
// should have Object
// but java.lang.String extends java.lang.Object is unnecessary
boolean needObje... |
85c5202a-f464-4fc3-aaf0-07973230e6d6 | 2 | public int[] getBinaryArray(){
if(!this.inputSet)throw new IllegalArgumentException("No input has been entered");
if(!this.trueDtoA){
System.out.println("Class - DtoA; method - getBinaryInput");
System.out.println("This instance of DtoA is not a true simulation of an DAC");
... |
0ce6c098-b9b5-4f8f-8686-ca8726edb36b | 1 | protected static User getInstance() {
if (instance == null) {
new User();
}
return instance;
} |
d35022c3-d859-4761-9911-411e0660413f | 0 | public void setVue(VuePraticiens vue) {
this.vue = vue;
} |
4ae6503a-1366-490b-9a01-b37f8e535a66 | 3 | private static Method getMethod(Class<?> cl, String method) {
for(Method m : cl.getMethods()) {
if(m.getName().equals(method)) {
return m;
}
}
return null;
} |
9f22a374-1f4e-4c72-bd44-c461bfc37162 | 5 | public static Style loadStyle(BufferedReader reader) {
try {
String line = reader.readLine();
String[] temp = line.split(";");
Style style = new Style(Float.parseFloat(temp[0]));
for(int x = 1; x<temp.length; x++) {
style.boxFrame.add(Float.parseFloat(temp[x]));
}
while((line = reader.readLine()... |
56893327-87f2-459b-9710-dec9b22c462d | 5 | public void testArchitecture() throws IOException{
//rotate bin
archError=0;
for(int k=0; k<binNo; k++){
testBin=bins[k];
//System.out.print("Testing bin: "+k+"\n");
propagateBackNNA(testBin);
}
String s="";
for(int l=0; l < hiddenLayersNo; l++) s+=hiddenLayers[l]+" ";
System.out.print("Validate... |
8f56c6e5-01a5-47c2-b911-b173f12cffae | 9 | @Override
public void handle(
final HttpRequest request,
final HttpResponse response,
final HttpContext context) throws HttpException, IOException {
//System.out.println("request received");
String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGL... |
6934423b-5592-4e09-b5da-f8e58208c559 | 0 | public MessageThread(BufferedReader reader, JTextArea textArea) {
this.reader = reader;
this.textArea = textArea;
} |
4475e553-542a-41e6-ab59-b3c606800af9 | 4 | public static void main(String[] args) {
// Add Window Listener
frame.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
String[] gameModes = { "Kirby", "Mario" };
String gameSelect = (String) JOptionPane.showInputDialog(null,
... |
46c08ecd-faac-420b-b903-4c20a8d483f6 | 0 | public JTextField getThetaTextField() {
return thetaTextField;
} |
381afce0-4169-4cfc-85c2-80fe1713cb9c | 2 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((ip == null) ? 0 : ip.hashCode());
result = prime * result + port;
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
} |
62a11b9c-ce9b-4638-87cb-2d9870a03a7d | 6 | float[][] GeneratePerlinNoise(float[][] baseNoise, int octaveCount) {
int width = baseNoise.length;
int height = baseNoise[0].length;
float[][][] smoothNoise = new float[octaveCount][][]; // an array of 2D
// arrays
// containing
float persistance = 0.5f;
// generate smooth ... |
f00c46f0-00d2-498a-950d-fb3da7142efe | 1 | public static boolean transform(InstructionContainer ic,
StructuredBlock last) {
return (createLocalPrePostInc(ic, last) || createPostInc(ic, last));
} |
f9718637-3114-4322-ae12-db4b3a7b84a8 | 9 | public String getNanCols(){
String ret;
StringBuilder sb = new StringBuilder();
int cnt = 0;
int i,j,para;
ret = "|----------------All NaN Features-----------------|\n";
for(i=0;i<max_y;i++){
para = 0;
for(j=0;j<max_x;j++){
if(ParaArray.isNaN(a[i][j]))
para++;
}
if(para == max_x){
s... |
eedd0b99-f281-434c-bccb-57aa17e1ddf2 | 7 | public static int lookBack(FlaggableCharacterString target, int start, int count, Condition condition) {
int index = start;
while(0 <= index && index < target.size() && !condition.applies(target.get(index))) {
index--;
}
while(count > 0 && index > 0) {
index--;
if(index < 0){
break;
} els... |
db22eaac-49c6-4328-afc3-0ceac299e149 | 5 | private void setCommand(Info info) {
Angle = 0;
FindNextTank(info);
int angle = RotateToKill(info);
int distance = Distance(info);
if (angle > info.getDirection()) {
Angle = angle - info.getDirection();
if (distance > 200) {
type = 1;
... |
927eea6c-5051-4860-adb9-8c5975ed4aaa | 8 | public Point2D.Double nextPosition() {
assert n % 2 == 1;
final int halfN = (n - 1) / 2;
final Point2D.Double result = new Point2D.Double(x, y);
i++;
if (seg == 'A') {
x++;
if (x > halfN) {
seg = 'B';
x = halfN;
y = -halfN + 1;
}
} else if (seg == 'B') {
y++;
if (y > halfN) {
... |
be83d907-d082-47b7-ab7d-144a922adcfb | 9 | private static void updatePacks() {
for(int i = 0; i < packPanels.size(); i++) {
if(selectedPack == i) {
ModPack pack = ModPack.getPack(getIndex());
if(pack != null) {
String mods = "";
if(pack.getMods() != null) {
mods += "<p>This pack contains the following mods by default:</p><ul>";
... |
321a7a37-3cf5-4889-b88b-581c3bd2ad6e | 2 | @FXML
public void action(ActionEvent event) {
if(event.getSource().equals(buttonOk)) {
Core.getIntance().close();
Model.getIntance().newGame(EGameMode.offline, ((EGame) choiceBoxGame.getValue()).getGameSize(), ((EGame) choiceBoxGame.getValue()).getWinLength());
}
if(... |
5182731f-e51c-4f36-99b8-75621f622b2a | 0 | public void setAnturium(int anturium) {
this.anturium = anturium;
} |
0674545d-60f7-4d8a-a643-7dacad3f302f | 1 | private void save( )
{
try
{
SwingUtilities.invokeAndWait(
new Runnable()
{
public void run( )
{
mainFrame.saveAudioVectors(fica.getICVectors(), "Analysed Collection");
}
});
}
catch( Exception exc )
{
FastICAApp.exceptionDialog(exc);
}
} |
1ffc7cac-ebf7-4b75-8082-cbd174374ecd | 7 | public int escapeTranslate(String escapeString, StringBuffer buf, int i)
{
if (escapeString.endsWith("z") || escapeString.endsWith("Z"))
{
buf.delete(i, i + escapeString.length() + 2);
final int code = Util.s0_int(escapeString.substring(0, escapeString.length() - 1));
if (code < 20)
{
setModeAndExe... |
6b0ff3b8-1c33-4edc-ad71-955c1968d6e0 | 1 | @Override
public String toString() {
if (isKeyword()) {
return PACKAGE_SEPARATOR + getSymbolNamePrecise();
} else {
return getSymbolNamePrecise();
}
} |
1b6b0fa8-0fd5-4bd0-9217-e2c7aa99f163 | 7 | public static void drawDottedLine(Graphics g, int fromX, int fromY, int toX, int toY) {
int dx = toX - fromX;
int dy = toY - fromY;
if(dx == 0 && dy == 0) {
return;
}
boolean swapped = false;
if(Math.abs(dx) < Math.abs(dy)) {
int temp = fromX; fromX = fromY; fromY = temp;
temp = toX; toX = toY; toY... |
31fd8379-175b-424c-a0a2-d9da6dbf660c | 6 | private static String findLarge(String s){
int n = countOnes(s);
char[] newString=s.toCharArray();
int index = s.length()-1;
while(n<k && index>=0){
if(newString[index]=='0'){
long temp = Long.parseLong(new String(newString), 2);
temp-= 1 << s.length()-1-index;
newString = Long.toBinaryString(tem... |
cfe6f547-6d45-481e-a239-acd05216c792 | 8 | @Override
public IFunction bindFunction(final Object target, final String name )
throws CannotBindFunctionException {
// check arguments
if( (target == null) || (name == null) || (name.length() < 0) )
throw new CannotBindFunctionException("Cannot bind the method call to a function on " + target.getClass(... |
2a1e2b1b-47cd-4e5b-a4cd-2509bcd8317f | 2 | public static void moverCanal() {
int canal = -1;
int subCanal = -1;
String position = frame.getSelectedNodePosition();
try{
position = position.substring(1);
String[] numeros = position.split(":");
canal = Integer.parseInt(numeros[0]);
if (numeros.length > 1){
int numClientes = canales.get(cana... |
27ca703f-1df5-4596-8c64-87b973d148c5 | 0 | public String getOld() {
return old;
} |
3ab96462-3fd1-4831-adab-5cc33ba201c5 | 9 | public RandomDispatcher(File backgroundPath, File targetPath, boolean isOnce) {
// Initialize backgroundImageList
List<File> backgroundImageList = new ArrayList<File>();
for(File i: backgroundPath.listFiles(new ExtensionFilter()))
backgroundImageList.add(i);
if(0 >= backgroundImageList.size())
thro... |
b7675d05-f440-478c-8406-1a8c62df534e | 2 | public boolean productSearch (String nomeProduto) {
for(Product p : this.products) {
if (p.getName().equals(nomeProduto)) {
return true;
}
}
return false;
} |
e93b6928-c375-44ad-b382-9355defa34e4 | 2 | private static String hexToString(byte[] bytes) {
StringBuffer buff = new StringBuffer();
for (int i=0; i<bytes.length; i++) {
int val = bytes[i];
val = val & 0xff; // remove higher bits, sign
if (val<16) buff.append('0'); // leading 0
buff.append(Integer.toString(val, 16));
}
return buff.toString(... |
bf21f353-25d8-48ba-aba3-892f74540054 | 3 | @Override
void run() {
roadDistance = 0;
time = System.nanoTime();
//Tomamos un punto al azar del arreglo y desde ahí construimos nuestro camino.
GeoRef actual = geoRefs.remove(new Random().nextInt(geoRefs.size()));
conjunct.add(actual);
double minimum;
Geo... |
ade5fbc6-2cf6-409b-9323-f440e41fe5d0 | 7 | private static void loadTable () {
try{
String readline = null;
//iteminfo storage
ArrayList<String[]> itemsInfo = new ArrayList<String[]>();
tabledata = new URL(Strings.MODDED_URL + Strings.MOD_CSV);
moddatamap = new HashMap<>();
final BufferedReader in = new BufferedReader(new InputStreamReader(ta... |
b0b3427b-230a-4ab4-85dc-31be6845509b | 0 | public void setEndTime (String eT)
{
endTime = eT;
} |
dc08301d-018b-4b60-a1af-a5c5e98804a9 | 3 | public static void checkFltParam(SessionRequestContent request, Criteria criteria, String reqName, String critName){
String param = (String) request.getParameter(reqName);
if (param != null && !param.isEmpty()) {
Float currParam = Float.parseFloat(param);
if (currParam > 0) {
... |
72d8866c-f9e1-4b91-a142-cc4d6c066edd | 3 | public char skipTo(char to) throws JSONException {
char c;
try {
long startIndex = this.index;
long startCharacter = this.character;
long startLine = this.line;
this.reader.mark(1000000);
do {
c = this.next();
if... |
63d40631-6531-46e7-ab31-93ffaab75887 | 1 | @SuppressWarnings("unchecked")
public static <T> T instantiateModelOrService(Class<T> clazz) {
T product = (T) modelsAndServices.get(clazz);
if (product == null) {
product = injectAndInitialize((T) instanceSupplier.apply(clazz));
modelsAndServices.putIfAbsent(clazz, product);... |
cd98fc72-68d2-4085-a108-d5d30d87a15c | 8 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 175
// setlimit, line 176
v_1 = limit - cursor;
// tomark, line 176
if (cursor < I_pV) {
return false;
}
cursor = I_pV;
v_2 = limit_backward;
limit_backward = cursor;
cursor = limit - v_1;
... |
b70ff108-8804-4f60-8a7a-ff5ff2cd3fb4 | 6 | public static void main(String[] args) {
int[] a={0,1,2,3,4,5,6,7,8,9};
System.out.println(Arrays.toString(a));
for(int k=1;k<1000000;k++){
int p1=a.length-2;
while((p1>=0)&&!(a[p1]<a[p1+1]))
p1--;
int p2=p1+1;
int minp2=a[p2];
for(int i=p1+1;i<a.length;i++){
if((a[p1]<a[i])&&(a[i]<minp2)){... |
2a243fbe-ce42-452f-85da-91320741b9df | 1 | public void visit_goto(final Instruction inst) {
if (longBranch) {
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
} else {
addOpcode(Opcode.opc_goto);
addBranch((Label) inst.operand());
}
stackHeight += 0;
} |
62930085-eac5-4d04-a0fa-0eec2d9ea2ff | 7 | public static LocationImpl parse(String text) throws IllegalArgumentException {
if (text == null || text.length() == 0) {
return null;
}
// Do we have a description?
String description;
int uriStart = text.lastIndexOf(" - "); // lastIndexOf to allow the separator to ... |
3f041f8d-0222-4620-aff1-2c8c29de049d | 4 | @Override
public void ejecutar(Stack<Valor> st, MemoriaDatos md, Cp cp)
throws Exception {
if (st.size() < 2)
throw new Exception("O: faltan operandos");
Valor op1 = st.pop();
Valor op2 = st.pop();
if (op1 instanceof Booleano && op2 instanceof Booleano) {
st.push(new Booleano(((boolean) op1.getValo... |
cad29b6a-3191-41c0-96ee-90e98952eed5 | 1 | public void modificarProducto(Producto p){
try {
Statement comando=connection.createStatement();
comando.executeUpdate("UPDATE Productos SET "
+ "Nombre='"+p.getNombre()+"',"
+ "Ref='"+p.getRef()+"',"
+ "Precio='"+Do... |
15a7c3a4-480c-4aa1-973e-fc48191a70ab | 7 | public List<String[]> readDataFile(File dataFile) throws JChunkerException {
List<String[]> dataList = new ArrayList<String[]>();
BufferedReader dataFileReader = null;
try {
dataFileReader = new BufferedReader(new InputStreamReader(new FileInputStream(dataFile), dataFileEnco... |
c0f8a4de-9340-40de-a375-e5545c57bac5 | 4 | public boolean isOnMap(int x, int y){
if (x >= 0 && x < (Standards.CHUNK_SIZE * Standards.MAP_SIZE)){
if (y >= 0 && y < (Standards.CHUNK_SIZE * Standards.MAP_SIZE)){
return true;
}
}
return false;
} |
e07169ea-1e94-42c3-8d58-52a5478ffc88 | 0 | public Process peek() // Return the process at the head.
{
return this.head;
} |
d7f1c238-441a-49fa-b961-8c11faa4e295 | 7 | public void log(int level, String message, Object... replacements) {
if (level < loggingMode)
return;
for (Object replace : replacements)
message = message.replaceFirst("\\{\\}", replace.toString());
String lvlMessage = "";
switch (level) {
case 0:
... |
117376d6-5699-4be3-86ca-aa5c5c66dd97 | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
8aba5fc7-e890-44ea-80ba-61f858ec083a | 1 | public void add(int element)
{
if (manyItems == data.length)
{ // Ensure twice as much space as we need.
ensureCapacity((manyItems + 1)*2);
}
data[manyItems] = element;
manyItems++;
} |
4a705e02-b872-4506-97b7-e7b1f30d9427 | 5 | @EventHandler
public void serverCommandEvent(ServerCommandEvent event){
if(event.getCommand().equalsIgnoreCase("stop")){
for(World world : Bukkit.getWorlds()){
if(world.equals(Bukkit.getWorlds().get(0)) || world.getName().endsWith("_nether") || world.getName().endsWith("the_end") ){
} else {
Bukkit.... |
792d1839-9b7c-413c-8b17-2f1a887286b3 | 0 | public void setName (String n)
{
name = n;
} |
423c0415-7afa-4a9a-abbf-2948509d2008 | 0 | public String getDescription() {
return description;
} |
f8574230-3e2a-4ead-b07f-9c2f02e24277 | 8 | public void saveGame() {
BufferedWriter bufferedWriter = null;
try {
File oldsave = new File("Data/profile.sav");
oldsave.delete();
File newsave = new File("Data/profile.sav");
newsave.createNewFile();
bufferedWriter = new BufferedWriter(new Fi... |
bee14b33-308f-457a-ba66-9678f0177ed6 | 0 | public String getNameF() {
return nameF;
} |
379327ac-744f-41f3-b219-94c19cc007f5 | 3 | public int next() {
if (size == 0)
return 0;
int next = current + step;
if (next < 0 || next > size)
step = 0 - step;
current = current + step;
return current;
} |
3c105b33-ce63-42b1-be4c-fb2d837a58f7 | 1 | public double getFullDuration()
{
double time = 0;
for (Edge edge : edges)
time += edge.getTravelTime();
return time;
} |
ba4068a0-add3-4ba9-bff0-57a1488d6557 | 3 | public String getTestUrl() {
String url = null;
if (testInfo != null && testInfo.isValid()) {
url = BmUrlManager.getServerUrl() + "/node/" + testInfo.getId();
if (this.testInfo.getStatus() == TestStatus.Running) {
url += "/gjtl";
}
}
re... |
8ddc1a22-16cd-4851-8750-5cb1bea2cfb1 | 3 | public Map<String, Object> toMessage() {
Map<String, Object> message = new HashMap<>();
message.put("type", getMessageName());
List<Object> fieldsNameAndValue = getFieldsNameAndValue();
for (int i = 0; i < fieldsNameAndValue.size() / 2; i++) {
String fieldName = (String) fieldsNameAndVal... |
f7a7739f-23e7-4d6b-820a-104e0f750cc2 | 2 | public int count(String str)
{
int result = 0;
str = Normalizer.normalize(str, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase();
for (String keyword : keywords)
{
if (str.contains(keyword))
++result;
}
return result;
} |
c14202e7-51f4-48a1-bb1f-1ee5e8d5d6a6 | 0 | @Override
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.applicationEventPublisher = applicationEventPublisher;
} |
f48477e7-7c3c-4011-b1c4-2b8770c885f6 | 5 | public void addConnection(PlayerMP player, Packet00Login packet) {
boolean alreadyConnected = false;
for (PlayerMP p : this.connectedPlayers) {
if (player.getUsername().equalsIgnoreCase(p.getUsername())) {
if (p.ipAddress == null) {
p.ipAddress = player.ipAddress;
}
if (p.port == -1) {
p.po... |
466d3779-abb1-4afa-ba5c-e920b24a130b | 7 | private Boolean chooseNextMove(List<Integer> distToInt, List<Integer> lightState) {
Random random = new Random();
double probability = random.nextDouble();
Boolean nextMove = false;
if (probability > epsilon) {
for (int i = 0; i < distToInt.size(); i++) {
// ... |
c789ac40-7930-44bf-80e8-35daad765875 | 4 | public void run() {
try {
// alert inside thread
System.out.println("Server: Server connected to a new client...");
// process received message
Message msg = null;
do {
msg = (Message)objectFromClient.readObject();
if(msg != null) {
parseMessage(msg);
msg = null;
}
... |
84459aeb-7a5c-469d-9f84-2ff780b98ff9 | 2 | private void setSliderBasedPosition() {
if(!mediaPlayer.isSeekable()) {
return;
}
float positionValue = (float)positionSlider.getValue() / 1000.0f;
// Avoid end of file freeze-up
if(positionValue > 0.99f) {
positionValue = 0.99f;
}
mediaPl... |
658d3084-9779-4388-9d4c-5c0d11ada406 | 6 | public static int charToInt(char ch) {
if ('0' <= ch && ch <= '9') {
return (ch - '0');
} else if ('a' <= ch && ch <= 'f') {
return (ch - 'a') + 10;
} else if ('A' <= ch && ch <= 'F') {
return (ch - 'A') + 10;
} else {
throw new NumberFormatException("not a sha-1 string");
}
} |
cd131708-e0b4-4d87-910a-054859a5f6db | 5 | public static void registration(String login) throws InterruptedException {
driver.findElement(By.xpath(reg_button)).click();
try {
Thread.sleep(500);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
driver.findElement(By.xpath(login_field)).sendKeys(logi... |
d0a5c0b7-d9da-4c23-8584-81618da38a7f | 0 | public Collection<RoomEntity> getRooms() {
return rooms;
} |
70d98b8c-dd74-4648-a0b3-702f67bff67e | 1 | public SwingWorkerFrame()
{
chooser = new JFileChooser();
chooser.setCurrentDirectory(new File("."));
textArea = new JTextArea();
add(new JScrollPane(textArea));
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
statusLine = new JLabel(" ");
add(statusLine, BorderLayout.SOUTH);
... |
e9084616-c54b-4794-8563-ac1f01d45bbc | 9 | public static double findMinDistance(Instances inst, int attrIndex) {
double min = Double.MAX_VALUE;
int numInst = inst.numInstances();
double diff;
if (numInst < 2) return min;
int begin = -1;
Instance instance = null;
do {
begin++;
if (begin < numInst)
{ instance = inst.inst... |
250ea211-336b-4b16-9f07-3e9fd65beb1b | 2 | public String getIPAddress() {
Player player = getPlayer();
if (player == null)
return null;
try {
return player.getAddress().getAddress().getHostAddress();
} catch (NullPointerException e) {
return null;
}
} |
e07310d4-2938-4c91-8402-dc05701ddcb1 | 3 | @Override
public void caseAStmtsStmt(AStmtsStmt node)
{
inAStmtsStmt(node);
if(node.getLM() != null)
{
node.getLM().apply(this);
}
if(node.getStmt() != null)
{
node.getStmt().apply(this);
}
if(node.getRM() != null)
... |
1a1584b2-8366-46f6-ac3f-c7fc951a32fd | 3 | public static void main(String[] args){
//Criando objeto e setando um valor
TipoPessoa tipo = new TipoPessoa();
tipo.setNomeTipo("Aluno");
//Fim
try{
//Iniciando DAO
TipoPessoaDAO daoTipo = new TipoPessoaDAO();
... |
018b7fe4-b408-4756-b0b4-2f18149405fa | 8 | public void run()
{
int ticks=0;
int frames=0;
long start;
long time;
long end=System.nanoTime();
long nextdraw=0;
final long NSPT=NANOSECOND/this.ticksPerSecond;
long endSecond=System.currentTimeMillis()+MILLISECOND;
long ticktime=0;
long drawtime=0;
long avgDrawTime=0;
boolean useAvgDra... |
a34562fe-f7f7-4ccd-a7ff-a1f7299c7675 | 5 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = (String) request.getSessionAttribute(JSP_PAGE);
String directionsPage = ConfigurationManager.getProperty("path.page.directions");
String toursPage = ConfigurationManager.getProperty("p... |
72248a43-3897-4980-b762-b7477f241167 | 6 | @SuppressWarnings("unchecked")
private Object delete(DatabaseUpdater updater, Object object) throws UpdateException {
if(object == null){
//No entity to delete here, so abort this step.
return object;
}
for (ExtendedField field : DaoUtils.getAllMappingsWithS... |
317f3162-e68d-4b69-bc36-87596e283ae8 | 9 | public static byte[] convert_lock_to_key(byte[] lock) {
int len = lock.length;
byte[] key = new byte[len];
for (int i = 1; i < len; i++)
key[i] = (byte) (lock[i] ^ lock[i - 1]);
key[0] = (byte) (lock[0] ^ lock[len - 1] ^ lock[len - 2] ^ 5);
for (int i = 0; i < len; i++)
key[i] = (byte) (((key[i] << 4) &... |
2f624914-aed4-47ff-91a9-4238065f664b | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 140
// [, line 141
ket = cursor;
// substring, line 141
among_var = find_among_b(a_7, 18);
if (among_var == 0)
... |
5218fbd6-9d83-4502-b449-e3635f5f3010 | 9 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getKodeKecamatan() == null) ? 0 : getKodeKecamatan().hashCode());
result = prime * result + ((getNamaKec... |
7d4f8427-44f0-4718-ba1d-cb785110b02d | 0 | public void setDeclareDate(Date declareDate) {
this.declareDate = declareDate;
} |
b7c03120-75b0-4b5d-85f2-fb29175c676d | 1 | public static void save(Map<String, Ban> bans, String path) {
File f = new File(path);
try {
FileOutputStream fileStream = new FileOutputStream(f);
ObjectOutputStream output = new ObjectOutputStream(fileStream);
output.writeObject(bans);
output.cl... |
663cd072-8e3d-4807-ab2e-585ae7d944eb | 6 | private static void handle(String login, String action) {
if( "lvlup" == action) {
String password = UserManager.getInstance().users().get(login).password();
Nogame.auth(login, password);
Lvlup.start();
} else if ("catacomb" == action) {
String password = UserMa... |
2c89c8ba-918f-4c31-803c-9188747e91c0 | 2 | public static int[] findMinMax(int[] sorted, int min, int max) {
int[] minMax = new int[2];
if (min < sorted[0]) {
minMax[0] = sorted[0];
} else {
minMax[0] = binarySearch(sorted, min, 0, sorted.length, 0);
}
if (max > sorted[sorted.length - 1]) {
minMax[1] = sorted[sorted.length - 1];
} else {
... |
bd5b9436-9bc7-44d5-b2a5-2d8fd2e92d94 | 9 | private ElementHandler computeElementHandler(String elementName) {
BlockType blockType = elementNameToBlockType.get(elementName);
if (blockType == null) {
SpanType spanType = elementNameToSpanType.get(elementName);
if (spanType != null) {
return new SpanElementHandler(spanType);
}
if (elemen... |
86f5120d-842a-4355-951b-4e55c6653841 | 6 | private boolean cmdPerms(CommandSender sender) {
sender.sendMessage(ChatColor.YELLOW + "----------------------------");
sender.sendMessage(ChatColor.YELLOW + "Armor Permissions ");
if ((sender instanceof Player)) {
Player player = (Player) sender;
if (player.hasPermission("armorpers.chainmail")) {
sende... |
49903885-8e37-4755-9a29-bb9465ffc385 | 1 | public int hash(String s) {
int length = s.length();
int r = 0;
for (int i = 0; i < length; i++) {
r = r + s.charAt(i) + 174;
}
return r * 13 % 97;
} |
b97ed489-9170-4883-a670-8f0bb6a105e6 | 4 | public Options(int adv) {
Game game = Game.getInstance();
game.clearGame();
// How many enemies ?
this.adversaireNumber = adv;
Player michel = new RealPlayer("Michel", Color.RED);
Player jean_luc = new IAPlayer("Jean-Luc", Color.BLUE);
Player patrick = new IAPlayer("Patrick", Color.GREEN);
Player ... |
5d459287-cc46-4f3f-8d37-3439306093ad | 2 | protected float validateDesire(float d) {
if(d < 0) {
d = 0;
}
if(d > 1f) {
d = 1f;
}
return d;
} |
15505c1e-8b05-4fb8-9c99-ab4afe7d0217 | 8 | public final void applyPassive(final MapleCharacter applyto, final MapleMapObject obj) {
if (makeChanceResult()) {
switch (sourceid) { // MP eater
case 2100000:
case 2200000:
case 2300000:
if (obj == null || obj.getType() != MapleMa... |
92187ede-55e9-4ae7-9d22-84f980202ccd | 3 | public Config reload() throws InvalidConfigurationException {
if (CONFIG_FILE == null) {
throw new InvalidConfigurationException(new NullPointerException());
}
if (!CONFIG_FILE.exists()) {
throw new InvalidConfigurationException(new IOException("File doesn't exist"));
... |
dd4e6ce9-b33b-48c1-a342-998827d1c2eb | 0 | @Override
public int hashCode(){
int hash = 7;
hash = 71 * hash + this.x;
hash = 71 * hash + this.y;
return hash;
} |
3f49f4f8-f8c4-40b0-99ac-835a4ba82f0d | 2 | @Override
public void init(ServletConfig config) throws ServletException {
try {
// Create a JNDI Initial context to be able to lookup the DataSource
InitialContext ctx = new InitialContext();
// Lookup the DataSource.
pool = (DataSource)ctx.lookup("java:comp/env/jdbc/mysql_... |
779e58a7-0d56-4873-9e76-5c982a1a27a3 | 8 | private void filterByState() {
genModelCopies();
stateCopies = new ArrayList();
ArrayList<Copy> auxCopies2 = new ArrayList();
if (jRadioStored.isSelected()) {
for (int i = 0; i < listCopies.size(); i++) {
if (listCopies.get(i).getState().equals(Copy.CopyState.... |
1737ff76-e21b-4601-8276-e7e5391d1934 | 8 | @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... |
93b68679-b335-4567-a078-4ee574442b98 | 2 | public void testPropertyAddMinute() {
Partial test = new Partial(TYPES, VALUES);
Partial copy = test.property(DateTimeFieldType.minuteOfHour()).addToCopy(9);
check(test, 10, 20, 30, 40);
check(copy, 10, 29, 30, 40);
copy = test.property(DateTimeFieldType.minuteOfHour()).... |
c914d092-f059-4436-8eee-1138e8ac712c | 9 | public static IHuffmanNode insertIntoTree(IHuffmanNode rootNode, LinkedList<IHuffmanWord> list) {
rootNode = rootNode == null ? new Node() : rootNode;
for (IHuffmanWord word : list) {
IHuffmanNode curNode = rootNode;
int[] code = word.getOutputWord();
int relBits = wo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.