id
stringlengths
36
36
text
stringlengths
1
1.25M
e54bff2a-ddb6-4346-bb3a-10e29cbe5a8b
public Session getSession() { return this.sessionFactory.getCurrentSession(); }
89007fa4-32c0-485d-8c77-6d3603d5d066
@SuppressWarnings("unchecked") public T findById(PK id) { return (T) getSession().get(clazz, id); }
417e64dc-9b29-41ac-afb4-39dd71e345b2
@SuppressWarnings("unchecked") public T findByProperty(String propertyName,Object value) { Criteria c = getSession().createCriteria(clazz); c.add(Restrictions.eq(propertyName, value)); return (T) c.uniqueResult(); }
c3ce7795-9b1f-43a8-bf8d-11595dce1da6
@SuppressWarnings("unchecked") public List<T> findListByProperty(String propertyName,Object value) { Criteria c = getSession().createCriteria(clazz); c.add(Restrictions.eq(propertyName, value)); return c.list(); }
7d079e6a-2e7f-4cbe-a8d3-ab42f88e4b5e
public void del(T t) { getSession().delete(t); }
add43a71-9e47-4538-bc50-929a8a9a21ca
public void del(PK id) { getSession().delete(findById(id)); }
ad89625d-920f-4ad8-9478-5a5738b73e47
@SuppressWarnings("unchecked") public List<T> findAll() { Criteria c = getSession().createCriteria(clazz); return c.list(); }
43a24c46-1a94-4499-898f-846beb2cc6c8
public void save(T t) { getSession().saveOrUpdate(t); }
0b522641-638c-416b-85ae-57bcf4358247
public User findById(int userId) { return userDao.findById(userId); }
4f7ccb25-585d-4d4e-af31-3cc60ccf8db3
public void save(User user) { user.setEnable(true); userDao.save(user); }
5c7fbe9b-5c59-4da7-82b3-1df28a6a7349
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.prin...
78ca4e30-fc71-408e-896e-b73bf3f7aec8
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"); out.println("<HTML>"); out.pri...
f7b83631-be2c-4444-a9b9-1be65f6da864
public String home(Model model) { model.addAttribute("msg", "Hello,MVC!"); return "home"; }
c4b7d153-8012-4877-8eb9-3e2c53d17fc3
@RequestMapping public ModelAndView index() { ModelAndView mav = new ModelAndView(); mav.setViewName("home"); mav.addObject("msg", "ModelAndView"); return mav; }
c7faa5e5-a14d-411a-a3d9-48ac74c32d14
@Id @GeneratedValue(strategy=GenerationType.IDENTITY) public Integer getId() { return id; }
d92a0283-0605-4542-9e63-bea8f0166171
public void setId(Integer id) { this.id = id; }
a2fd9a0d-2c9c-41ab-948a-fdcbf8e169e6
public String getUsername() { return username; }
bc256fbf-2d7f-4d41-8f3b-371f905aaf02
public void setUsername(String username) { this.username = username; }
346191af-0414-4774-b7b3-131aae94aceb
public String getPassword() { return password; }
045c7eea-3d93-41d2-a912-b51cd0e0644c
public void setPassword(String password) { this.password = password; }
9ed2f05d-e4e9-4d03-985a-668df010e3d3
public Boolean getEnable() { return enable; }
4fe1be44-4264-46ca-932e-ea688084eee0
public void setEnable(Boolean enable) { this.enable = enable; }
0c345bb8-3cde-43bb-855e-cd5cecdc6351
public CompactByteArray() { this((byte)0); }
a680ed3a-f706-4414-ab9b-e74c6d21d8ec
public CompactByteArray(byte defaultValue) { int i; values = new byte[UNICODECOUNT]; indices = new char[INDEXCOUNT]; hashes = new int[INDEXCOUNT]; for (i = 0; i < UNICODECOUNT; ++i) { values[i] = defaultValue; } for (i = 0; i < INDEXCOUNT; ++i) { indices[i] = (char)(i<<BLOCKSHI...
cfa5aa48-8e05-438c-af20-fc4b7307fdf0
public CompactByteArray(char indexArray[], byte newValues[]) { int i; if (indexArray.length != INDEXCOUNT) throw new IllegalArgumentException("Index out of bounds."); for (i = 0; i < INDEXCOUNT; ++i) { char index = indexArray[i]; if ((index < 0) || (index >= new...
d9981c39-8e33-4921-8e3c-d182ce4272c8
public CompactByteArray(String indexArray, String valueArray) { this(RLEStringToCharArray(indexArray), RLEStringToByteArray(valueArray)); }
17542a29-436f-4b0c-9635-f6ff8bfe0425
static public final char[] RLEStringToCharArray(String s) { int length = (((int) s.charAt(0)) << 16) | ((int) s.charAt(1)); char[] array = new char[length]; int ai = 0; for (int i=2; i<s.length(); ++i) { char c = s.charAt(i); if (c == ESCAPE) { c = s.charAt(++i); if (c == ESC...
808dda88-c5c1-4db6-8ff3-6332c6b425b3
static public final byte[] RLEStringToByteArray(String s) { int length = (((int) s.charAt(0)) << 16) | ((int) s.charAt(1)); byte[] array = new byte[length]; boolean nextChar = true; char c = 0; int node = 0; int runLength = 0; int i = 2; for (int ai=0; ai<length; ) { // This part o...
4080c2a4-7b10-4735-8f66-c2a3b8e05303
public byte elementAt(char index) { return (values[(indices[index >> BLOCKSHIFT] & 0xFFFF) + (index & BLOCKMASK)]); }
b360d2bf-ab90-435f-9698-f12731727b25
public void setElementAt(char index, byte value) { if (isCompact) expand(); values[(int)index] = value; touchBlock(index >> BLOCKSHIFT, value); }
9df41735-923c-48fb-9312-f3a1cfd9759a
public void setElementAt(char start, char end, byte value) { int i; if (isCompact) { expand(); } for (i = start; i <= end; ++i) { values[i] = value; touchBlock(i >> BLOCKSHIFT, value); } }
93297a4c-2857-4a9d-b2ac-8d4bbafe9eea
public void compact() { compact(false); }
1195ba28-54b1-4158-b7c2-f6cdcdb61a36
public void compact(boolean exhaustive) { if (!isCompact) { int limitCompacted = 0; int iBlockStart = 0; char iUntouched = 0xFFFF; for (int i = 0; i < indices.length; ++i, iBlockStart += BLOCKCOUNT) { indices[i] = 0xFFFF; boolean touched = blockTouched(i); if (!tou...
f555b368-214b-4d97-8b03-71ff2acb9f8d
final static boolean arrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int len) { int sourceEnd = sourceStart + len; int delta = targetStart - sourceStart; for (int i = sourceStart; i < sou...
7c592b3f-ba11-4f9e-a3d8-a8c1654ffe86
private final void touchBlock(int i, int value) { hashes[i] = (hashes[i] + (value<<1)) | 1; }
9da4cb04-0db8-40cd-9f42-7f7781bd106e
private final boolean blockTouched(int i) { return hashes[i] != 0; }
00c46a91-26d2-4cbb-b6c5-3e63bdae789a
public char[] getIndexArray() { return indices; }
676cfce2-28c0-47d4-b8fb-894699cd589e
public byte[] getValueArray() { return values; }
696a8c3e-949d-4819-a5f9-9653ad8b55a3
public Object clone() { try { CompactByteArray other = (CompactByteArray) super.clone(); other.values = (byte[])values.clone(); other.indices = (char[])indices.clone(); if (hashes != null) other.hashes = (int[])hashes.clone(); return other; } catch (CloneNotSupportedException e) ...
dd40dfd1-b045-46d1-9b6b-92d3746d2ec2
public boolean equals(Object obj) { if (obj == null) return false; if (this == obj) // quick check return true; if (getClass() != obj.getClass()) // same class? return false; CompactByteArray other = (CompactByteArray) obj; for (int i = 0; i < UNICODECOUNT; i...
2339a5b0-97b9-4b3f-b880-7357af302756
public int hashCode() { int result = 0; int increment = Math.min(3, values.length/16); for (int i = 0; i < values.length; i+= increment) { result = result * 37 + values[i]; } return result; }
53dc6305-dd3f-4bd7-a83a-970a7add78f7
private void expand() { int i; if (isCompact) { byte[] tempArray; hashes = new int[INDEXCOUNT]; tempArray = new byte[UNICODECOUNT]; for (i = 0; i < UNICODECOUNT; ++i) { byte value = elementAt((char)i); tempArray[i] = value; touchBlock(i >> BLOCKSHIFT, value); ...
384a1826-b3fc-4a61-8cee-4522edd10a9e
public SupplementaryCharacterData(int[] table) { dataTable = table; }
fb16c101-daf9-4936-bd80-6dc81be865bd
public int getValue(int index) { // Index should be a valid supplementary character. assert index >= Character.MIN_SUPPLEMENTARY_CODE_POINT && index <= Character.MAX_CODE_POINT : "Invalid code point:" + Integer.toHexString(index); int i = 0; int j = dataTable.length - 1; int k; ...
67b0d28d-84f7-4057-8bc8-ee97e87c1513
public int[] getArray() { return dataTable; }
c6c3d601-228b-41e3-b3b0-bb51a712b393
static long getLong(byte[] buf, int offset) { long num = buf[offset]&0xFF; for (int i = 1; i < 8; i++) { num = num<<8 | (buf[offset+i]&0xFF); } return num; }
1b9ea019-30a9-4a0c-994e-f38f6dcc65d8
static int getInt(byte[] buf, int offset) { int num = buf[offset]&0xFF; for (int i = 1; i < 4; i++) { num = num<<8 | (buf[offset+i]&0xFF); } return num; }
2f50aab5-931d-499c-a5a1-0775568f0d22
static short getShort(byte[] buf, int offset) { short num = (short)(buf[offset]&0xFF); num = (short)(num<<8 | (buf[offset+1]&0xFF)); return num; }
bbcbb5fe-8b80-4800-a60d-2c2aa765e422
public RuleBasedBreakIterator(String datafile) throws IOException, MissingResourceException { readTables(datafile); }
a5b0ed60-d4cf-4999-9d55-9ecdbc612ced
protected void readTables(String datafile) throws IOException, MissingResourceException { byte[] buffer = readFile(datafile); /* Read header_info. */ int stateTableLength = OurBreakIterator.getInt(buffer, 0); int backwardsStateTableLength = OurBreakIterator.getInt(buffer, 4); int endStatesLength...
81d6def9-728c-4d4e-8dd1-2fc1b6e948ea
protected byte[] readFile(final String datafile) throws IOException, MissingResourceException { BufferedInputStream is; try { is = (BufferedInputStream)AccessController.doPrivileged( new PrivilegedExceptionAction() { public Object run() throws Exception { return new BufferedInpu...
c47b2701-1539-4462-8579-ad0149b980af
public Object run() throws Exception { return new BufferedInputStream(getClass().getResourceAsStream("/sun/text/resources/" + datafile)); }
f729ab63-4762-4f05-803f-42025ca5448e
byte[] getAdditionalData() { return additionalData; }
6a2241e7-dfca-4217-bbd2-ad6335c6104e
void setAdditionalData(byte[] b) { additionalData = b; }
2df80c3b-4d4e-42eb-9d1a-1be6e266f429
public Object clone() { RuleBasedBreakIterator result = (RuleBasedBreakIterator) super.clone(); if (text != null) { result.text = (CharacterIterator) text.clone(); } return result; }
72e74d61-7e68-49ad-bdb4-8d63aa48b331
public boolean equals(Object that) { try { if (that == null) { return false; } RuleBasedBreakIterator other = (RuleBasedBreakIterator) that; if (checksum != other.checksum) { return false; } if (text == null) { return other.text == null; } else { ...
e95755d4-bf07-4c49-831c-a0118c12d5c7
public String toString() { StringBuffer sb = new StringBuffer(); sb.append('['); sb.append("checksum=0x" + Long.toHexString(checksum)); sb.append(']'); return sb.toString(); }
a04b20c1-09e7-4732-a336-95e20f771c6b
public int hashCode() { return (int)checksum; }
84a4832b-33c7-48ec-8bb6-f2d5d3c89e9a
public int first() { CharacterIterator t = getText(); t.first(); return t.getIndex(); }
624cf48d-a002-4aa5-a2a6-808f2305352b
public int last() { CharacterIterator t = getText(); // I'm not sure why, but t.last() returns the offset of the last character, // rather than the past-the-end offset t.setIndex(t.getEndIndex()); return t.getIndex(); }
2aec29ab-1474-4a73-bc4e-1770e94a2661
public int next(int n) { int result = current(); while (n > 0) { result = handleNext(); --n; } while (n < 0) { result = previous(); ++n; } return result; }
883cf4a2-e5ab-4ed4-85ed-e352e4488521
public int next() { return handleNext(); }
02ae2b96-ca3a-442d-b082-25507d20c3e9
public int previous() { // if we're already sitting at the beginning of the text, return DONE CharacterIterator text = getText(); if (current() == text.getBeginIndex()) { return BreakIterator.DONE; } // set things up. handlePrevious() will back us up to some valid // break position before...
533b6f2c-f02f-45a3-97e9-a0e7cb248de6
private int getPrevious() { char c2 = text.previous(); if (Character.isLowSurrogate(c2) && text.getIndex() > text.getBeginIndex()) { char c1 = text.previous(); if (Character.isHighSurrogate(c1)) { return Character.toCodePoint(c1, c2); } else { text.next(); } }...
695de343-943f-46f2-9617-a8fe5d1c7f22
int getCurrent() { char c1 = text.current(); if (Character.isHighSurrogate(c1) && text.getIndex() < text.getEndIndex()) { char c2 = text.next(); text.previous(); if (Character.isLowSurrogate(c2)) { return Character.toCodePoint(c1, c2); } } return (int)c1; }
9bdfce4c-6cab-487c-abc3-3b8f2e4aef2c
private int getCurrentCodePointCount() { char c1 = text.current(); if (Character.isHighSurrogate(c1) && text.getIndex() < text.getEndIndex()) { char c2 = text.next(); text.previous(); if (Character.isLowSurrogate(c2)) { return 2; } } return 1; }
672289dd-6631-478e-b59e-084f8a14520a
int getNext() { int index = text.getIndex(); int endIndex = text.getEndIndex(); if (index == endIndex || (index = index + getCurrentCodePointCount()) >= endIndex) { return CharacterIterator.DONE; } text.setIndex(index); return getCurrent(); }
254bbeb8-f04a-4f07-8c7c-20235eb5d4c3
private int getNextIndex() { int index = text.getIndex() + getCurrentCodePointCount(); int endIndex = text.getEndIndex(); if (index > endIndex) { return endIndex; } else { return index; } }
85b06c76-69ee-40fa-abff-29a95ab63785
protected static final void checkOffset(int offset, CharacterIterator text) { if (offset < text.getBeginIndex() || offset > text.getEndIndex()) { throw new IllegalArgumentException("offset out of bounds"); } }
91bce629-d533-468b-a32a-f4e70f958908
public int following(int offset) { CharacterIterator text = getText(); checkOffset(offset, text); // Set our internal iteration position (temporarily) // to the position passed in. If this is the _beginning_ position, // then we can just use next() to get our return value text.setIndex(offset)...
05c59c32-f0ff-4d53-b554-6184af5594c5
public int preceding(int offset) { // if we start by updating the current iteration position to the // position specified by the caller, we can just use previous() // to carry out this operation CharacterIterator text = getText(); checkOffset(offset, text); text.setIndex(offset); return prev...
39e76c6e-05fd-4e15-aa60-f1e36ca6a919
public boolean isBoundary(int offset) { CharacterIterator text = getText(); checkOffset(offset, text); if (offset == text.getBeginIndex()) { return true; } // to check whether this is a boundary, we can use following() on the // position before the specified one and return true if the pos...
cf535576-b11c-4ab1-8ab9-bb69c03e7e43
public int current() { return getText().getIndex(); }
84d2138b-fd69-46c2-87cc-8726cd9b5137
public CharacterIterator getText() { // The iterator is initialized pointing to no text at all, so if this // function is called while we're in that state, we have to fudge an // iterator to return. if (text == null) { text = new StringCharacterIterator(""); } return text; }
f0a9c5d2-f6d3-49b8-9ba5-0c26a4234aae
public void setText(CharacterIterator newText) { // Test iterator to see if we need to wrap it in a SafeCharIterator. // The correct behavior for CharacterIterators is to allow the // position to be set to the endpoint of the iterator. Many // CharacterIterators do not uphold this, so this is a workarou...
d6f07228-89a5-4dfe-a11f-4b1929002719
protected int handleNext() { // if we're already at the end of the text, return DONE. CharacterIterator text = getText(); if (text.getIndex() == text.getEndIndex()) { return BreakIterator.DONE; } // no matter what, we always advance at least one character forward int result = getNextIndex...
7f265ad3-7b5d-4aa6-8a5b-0146ed1bbbac
protected int handlePrevious() { CharacterIterator text = getText(); int state = START_STATE; int category = 0; int lastCategory = 0; int c = getCurrent(); // loop until we reach the beginning of the text or transition to state 0 while (c != CharacterIterator.DONE && state != STOP_STATE) { ...
eeabbd67-ded6-4f9c-82b4-fe9e19b69d67
protected int lookupCategory(int c) { if (c < Character.MIN_SUPPLEMENTARY_CODE_POINT) { return charCategoryTable.elementAt((char)c); } else { return supplementaryCharCategoryTable.getValue(c); } }
f08684e1-12dc-4ef7-9dc3-961b0b86f667
protected int lookupState(int state, int category) { return stateTable[state * numCategories + category]; }
e4512f2e-df40-419c-882a-538fc72b216c
protected int lookupBackwardState(int state, int category) { return backwardsStateTable[state * numCategories + category]; }
1a31eb61-77e1-4dea-9133-74c365cecc5b
SafeCharIterator(CharacterIterator base) { this.base = base; this.rangeStart = base.getBeginIndex(); this.rangeLimit = base.getEndIndex(); this.currentIndex = base.getIndex(); }
61b6ee21-d251-4b09-8616-0f8198984953
public char first() { return setIndex(rangeStart); }
0253f14d-8dfc-4e3f-90f6-608893b58b4b
public char last() { return setIndex(rangeLimit - 1); }
751fd5cd-0ff2-463a-8ecb-2d58dcfa7f60
public char current() { if (currentIndex < rangeStart || currentIndex >= rangeLimit) { return DONE; } else { return base.setIndex(currentIndex); } }
2e1091d9-cbb8-4394-9a56-76956db06473
public char next() { currentIndex++; if (currentIndex >= rangeLimit) { currentIndex = rangeLimit; return DONE; } else { return base.setIndex(currentIndex); } }
1c176c85-6ddc-4aab-af6a-045841ef4581
public char previous() { currentIndex--; if (currentIndex < rangeStart) { currentIndex = rangeStart; return DONE; } else { return base.setIndex(currentIndex); } }
d89f9cd1-151a-4b17-83eb-127124fe4705
public char setIndex(int i) { if (i < rangeStart || i > rangeLimit) { throw new IllegalArgumentException("Invalid position"); } currentIndex = i; return current(); }
29f6481e-a6c4-4d18-a590-7350c622f734
public int getBeginIndex() { return rangeStart; }
834c24ff-cc2c-4a35-90f4-9c8adf6b6bc9
public int getEndIndex() { return rangeLimit; }
eab617f5-5e05-4334-976c-06b29205b70d
public int getIndex() { return currentIndex; }
3bfce193-3629-45a8-8385-06f507f4b43d
public Object clone() { SafeCharIterator copy = null; try { copy = (SafeCharIterator) super.clone(); } catch(CloneNotSupportedException e) { throw new Error("Clone not supported: " + e); } CharacterIterator copyOfBase = (CharacterIterator) base.clone(); copy.b...
ac5273a8-5474-4446-a590-1ddc521e48aa
public DictionaryBasedBreakIterator(String dataFile, String dictionaryFile) throws IOException { super(dataFile); byte[] tmp = super.getAdditionalData(); if (tmp != null) { prepareCategoryFlags(tmp); super.setAdditionalData(null); } dictionary = new BreakDictionary(new BufferedInpu...
d43a80d1-0537-4f47-b011-f5b1381e5b21
private void prepareCategoryFlags(byte[] data) { categoryFlags = new boolean[data.length]; for (int i = 0; i < data.length; i++) { categoryFlags[i] = (data[i] == (byte)1) ? true : false; } }
6068218b-f4aa-48b9-969d-62aeb982389e
public void setText(CharacterIterator newText) { super.setText(newText); cachedBreakPositions = null; dictionaryCharCount = 0; positionInCache = 0; }
ee82d910-53ee-4b42-99fc-0999b70bc717
public int first() { cachedBreakPositions = null; dictionaryCharCount = 0; positionInCache = 0; return super.first(); }
6fcb71da-bb5f-4ffe-8fb4-8dfd80757cb7
public int last() { cachedBreakPositions = null; dictionaryCharCount = 0; positionInCache = 0; return super.last(); }
27c46527-23a0-4b04-85fe-f39bb2bcea05
public int previous() { CharacterIterator text = getText(); // if we have cached break positions and we're still in the range // covered by them, just move one step backward in the cache if (cachedBreakPositions != null && positionInCache > 0) { --positionInCache; text.setIndex(cachedBreakP...
5ee06d04-13b0-4f9f-b0aa-d168f9cb72a3
public int preceding(int offset) { CharacterIterator text = getText(); checkOffset(offset, text); // if we have no cached break positions, or "offset" is outside the // range covered by the cache, we can just call the inherited routine // (which will eventually call other routines in this class tha...
a58aa49f-34e7-49bb-a47d-794b09ac2152
public int following(int offset) { CharacterIterator text = getText(); checkOffset(offset, text); // if we have no cached break positions, or if "offset" is outside the // range covered by the cache, then dump the cache and call our // inherited following() method. This will call other methods in t...
4f28a01c-ee45-4602-b87e-faa8b4d63c8b
protected int handleNext() { CharacterIterator text = getText(); // if there are no cached break positions, or if we've just moved // off the end of the range covered by the cache, we have to dump // and possibly regenerate the cache if (cachedBreakPositions == null || positionInCache == ca...